Skip to content

feat: Add meshing tools and stats #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

mlemayTTE
Copy link
Contributor

@mlemayTTE mlemayTTE commented Apr 16, 2025

This PR adds new meshing tools and stats.

Tools include:

  • a filter to merge colocated points
  • a filter to split each cell of a mesh by the center of the edges

Stats tools include:

  • a filter to compute mesh cell type statistics

@mlemayTTE mlemayTTE changed the title feature: Add meshing tools and stats feat: Add meshing tools and stats Apr 18, 2025
@mlemayTTE mlemayTTE marked this pull request as ready for review April 24, 2025 14:24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this script redundant with the already existing methods in vtk to remove colocated points such as vtkCleanPolyData, vtkCleanUnstructuredGrid or vtkMergePoints ?

self._transferCellArrays( output )
return 1

def _get_cell_counts( self: Self ) -> tuple[ int, int, int, int, int ]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the class CellTypeCounts here ?

def to_vtk_id_list( data ) -> vtkIdList:

# TODO: copy from vtkUtils
def getAttributesFromDataSet( object: vtkDataSet, onPoints: bool ) -> dict[ str, int ]:
Copy link
Contributor

@alexbenedicto alexbenedicto May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAttributesFromDataSet is ambiguous to me, can we use getArraysFromDataSet ?

return bounds


def createSingleCellMesh( cellType: int, ptsCoord: npt.NDArray[ np.float64 ] ) -> vtkUnstructuredGrid:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have a check for the ordering of the nodes when creating the cell ? If not, need a warning that the cell can be degenerated if invalid node ordering

return mesh


def createMultiCellMesh( cellTypes: list[ int ],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question for check of nodes ordering with multiple cells

)

# update sys.path to load all GEOS Python Package dependencies
geos_pv_path: Path = Path( __file__ ).parent.parent.parent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understood what was decided regarding paths in the code, can we still use this for ParaView filters ?

)

# update sys.path to load all GEOS Python Package dependencies
geos_pv_path: Path = Path( __file__ ).parent.parent.parent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark for paths

Comment on lines +79 to +84
except AssertionError as e:
print(f"Mesh split failed due to: {e}")
return 0
except Exception as e:
print(f"Mesh split failed due to: {e}")
return 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except (AssertionError, Exception) as e:
    print(f"Mesh split failed due to: {e}")
    return 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants