sparseSpatialSampling.geometry.geometry_base module

Implements a common base class for geometry objects from which all other geometry objects should be derived.

class sparseSpatialSampling.geometry.geometry_base.GeometryObject(name, keep_inside, refine=False, min_refinement_level=None)[source]

Bases: ABC

Implement the base class for geometry objects from which all other geometry objects should be derived.

Parameters:
  • name (str) – Name of the geometry object.

  • keep_inside (bool) – If True, the points inside the object are kept; if False, they are masked out.

  • refine (bool) – If True, the mesh around the geometry object is refined after \(S^3\) generates the mesh.

  • min_refinement_level (int | None) – Minimum refinement level for resolving the geometry. If None and refine=True, the geometry will be resolved with the maximum refinement level present at its surface after \(S^3\) has generated the grid.

abstract property center: torch.Tensor

Return the center coordinates based on the main width of the geometry object.

Returns:

center coordinates of the geometry object.

Return type:

pt.Tensor

abstractmethod check_cell(cell_nodes, refine_geometry=False)[source]

Check if a cell is valid or invalid based on the specified settings.

Parameters:
  • cell_nodes (pt.Tensor) – Vertices of the cell to be checked.

  • refine_geometry (bool) – If False, cells are masked out while generating the grid. If True, checks whether a cell is located in the vicinity of the geometry surface to refine it subsequently. This parameter is provided by \(S^3\).

Returns:

True if the cell is invalid, False if the cell is valid.

Return type:

bool

property keep_inside

Get the keep_inside flag for the geometry object.

Returns:

True if points inside the object are kept; False if they are masked out.

Return type:

bool

abstract property main_width: float

Return the width of the main dimension of the geometry object.

Returns:

Main width of the geometry object.

Return type:

float

property min_refinement_level

Get the minimum refinement level for resolving the geometry.

Returns:

Minimum refinement level, or None if not explicitly set.

Return type:

int | None

property name

Get the name of the geometry object.

Returns:

Name of the geometry object.

Return type:

str

property refine

Get the refine flag for the geometry object.

Returns:

True if the mesh around the geometry object should be refined; False otherwise.

Return type:

bool

abstractmethod type()[source]

Return the name of the geometry object.

Returns:

Name of the geometry object.

Return type:

str