ogstools.mesh.create.region module#

class ogstools.mesh.create.region.RegionSet[source]#

Bases: object

A class representing a set of regions composed of subsets, each identified by MaterialID.

The RegionSet class represents a collection of regions, where each region is composed of subsets. Each subset within a region is uniquely identified by “MaterialID”.

__init__(input)[source]#
box_boundaries()[source]#

Retrieve the boundaries of the mesh in local coordinate system (u, v, w).

This function extracts the boundaries of the mesh along the u, v, and w directions of the local coordinate system. The u-axis corresponds to the x-coordinate, the v-axis corresponds to the y-coordinate, and the w-axis corresponds to the z-coordinate.

Returns:

A tuple (u_min, u_max, v_min, v_max, w_min, w_max) representing the boundaries of the mesh in the local coordinate system.

Return type:

tuple[UnstructuredGrid, …]

notes:
example:

mesh = … u_min, u_max, v_min, v_max, w_min, w_max = mesh.box_boundaries()

ogstools.mesh.create.region.to_boundary(surface_mesh, filter_condition)[source]#

Extract cells from a surface mesh that meet a filter condition for normals.

This function takes a surface mesh represented by a pv.PolyData object and extracts cells that match a specified filter condition based on the normals of the mesh.

Parameters:
  • surface_mesh (PolyData) – The input surface mesh.

  • filter_condition (Callable[[ndarray], ndarray]) – A callable filter condition that takes an array of normals as input and returns an array indicating whether the condition is met.

Returns:

A mesh containing only the cells that meet the filter condition.

Return type:

UnstructuredGrid

example:

surface_mesh = … specific_cells = to_boundary(surface_mesh, lambda normals: [n[2] > 0.5 for n in normals])