ogstools.mesh.utils module#

ogstools.mesh.utils.node_reordering(mesh, method=1, log=True)[source]#

Reorders mesh nodes to make a mesh compatible with OGS6.

Parameters:
  • mesh (UnstructuredGrid) – mesh whose nodes are to be reordered.

  • method (int) –

    0: Reversing order of nodes for all elements.

    1: Reversing order of nodes unless it’s perceived correct by OGS6

    standards. This is the default selection.

    2: Fixing node ordering issues between VTK and OGS6 (only applies

    to prism-elements).

    3: Re-ordering of mesh node vector such that all base nodes are

    sorted before all nonlinear nodes.

  • log (bool) – If False, silence the NodeReordering tool’s own log output.

Return type:

UnstructuredGrid

ogstools.mesh.utils.to_linear(mesh)[source]#

Convert to a linear mesh.

Return type:

UnstructuredGrid

ogstools.mesh.utils.to_quadratic(mesh)[source]#

Convert to a quadratic mesh.

Return type:

UnstructuredGrid

ogstools.mesh.utils.validate(mesh, strict=False)[source]#

Check conformity of mesh with OGS.

Parameters:
  • mesh (UnstructuredGrid | Path | str) – pyvista mesh or path to the mesh file.

  • strict (bool) – If True, raise a UserWarning if checkMesh returns an error.

Return type:

bool

ogstools.mesh.utils.check_datatypes(mesh, strict=False, meshname='')[source]#
Return type:

bool

ogstools.mesh.utils.reindex_material_ids(mesh)[source]#
Return type:

None

ogstools.mesh.utils.remove_data(mesh, datanames)[source]#
Return type:

None

ogstools.mesh.utils.axis_ids_2D(mesh)[source]#

Return the two axes, in which the mesh (predominantly) lives in.

Return type:

tuple[int, int]

ogstools.mesh.utils.reshape_obs_points(points, mesh=None)[source]#
Return type:

ndarray

ogstools.mesh.utils.ordered_cell_ids(edges)[source]#
Return type:

list[int]

ogstools.mesh.utils.unique_cell_types(mesh)[source]#

Returns the unique cell types of the mesh

Return type:

list[CellType]

ogstools.mesh.utils.pv_set_attr(mesh, attr, value)[source]#

Set a PyVista mesh attribute.

Updates the attribute if it already exists; otherwise creates it using pyvista.set_new_attribute().

Return type:

None

ogstools.mesh.utils.angles(dataset, center=(0.0, 0.0, 0.0), normal=(0.0, 0.0, 1.0))[source]#

Compute the angles of the mesh’s points around a normal and center.

Parameters:
  • mesh – For the points of this mesh the angles are computed.

  • center (Sequence) – Center of rotation.

  • normal (Sequence) – Normal axis of rotation.

Return type:

ndarray

ogstools.mesh.utils.azimuth(dataset)[source]#

Calculate the azimuth angle with regards to the z-axis

Return type:

ndarray | None