Strategy base class for clipping operations for specific geometry instances, for use by MeshClipper.
More...
|
| enum class | LabelType : char { LABEL_IN = 0
, LABEL_ON = 1
, LABEL_OUT = 2
} |
| | A type to denote whether something is inside, on or outside the boundary of a geometry. More...
|
| |
| using | BoundingBox3DType = axom::primal::BoundingBox< double, 3 > |
| |
| using | Cone3DType = axom::primal::Cone< double, 3 > |
| |
| using | HexahedronType = axom::primal::Hexahedron< double, 3 > |
| |
| using | OctahedronType = axom::primal::Octahedron< double, 3 > |
| |
| using | Plane3DType = axom::primal::Plane< double, 3 > |
| |
| using | Point3DType = axom::primal::Point< double, 3 > |
| |
| using | Ray3DType = axom::primal::Ray< double, 3 > |
| |
| using | Segment3DType = axom::primal::Segment< double, 3 > |
| |
| using | SphereType = axom::primal::Sphere< double, 3 > |
| |
| using | TetrahedronType = axom::primal::Tetrahedron< double, 3 > |
| |
| using | Triangle3DType = axom::primal::Triangle< double, 3 > |
| |
| using | Vector3DType = axom::primal::Vector< double, 3 > |
| |
| using | BoundingBox2DType = axom::primal::BoundingBox< double, 2 > |
| |
| using | Point2DType = axom::primal::Point< double, 2 > |
| |
| using | CircleType = axom::primal::Sphere< double, 2 > |
| |
| using | Plane2DType = axom::primal::Plane< double, 2 > |
| |
| using | Ray2DType = axom::primal::Ray< double, 2 > |
| |
| using | Segment2DType = axom::primal::Segment< double, 2 > |
| |
|
| conduit::Node | m_info |
| | Information on the geometry. More...
|
| |
| numerics::Matrix< double > | m_extTrans |
| | External transformation due to the GeometryOperator. More...
|
| |
| virtual const axom::primal::BoundingBox< double, 2 > & | getBoundingBox2D () const |
| | Get the 2D axis-aligned bounding box for the geometry, if it's applicable and available. More...
|
| |
| virtual const axom::primal::BoundingBox< double, 3 > & | getBoundingBox3D () const |
| | Get the 3D axis-aligned bounding box for the geometry, if it's applicable and available. More...
|
| |
| virtual bool | labelCellsInOut (quest::experimental::ShapeMesh &shapeMesh, axom::Array< LabelType > &cellLabels) |
| | Label each cell in the mesh as inside, outside or both/undetermined, if possible. More...
|
| |
| virtual bool | labelTetsInOut (quest::experimental::ShapeMesh &shapeMesh, axom::ArrayView< const axom::IndexType > cellIds, axom::Array< LabelType > &tetLabels) |
| | Label each tetrahedron in the given cells, as inside, outside or both/undetermined, if possible. More...
|
| |
| virtual bool | specializedClipCells (quest::experimental::ShapeMesh &shapeMesh, axom::ArrayView< double > ovlap, conduit::Node &statistics) |
| | Clip with a fast geometry-specialized method if possible. More...
|
| |
| virtual bool | specializedClipCells (quest::experimental::ShapeMesh &shapeMesh, axom::ArrayView< double > ovlap, const axom::ArrayView< IndexType > &cellIds, conduit::Node &statistics) |
| | Clip with a fast geometry-specialized method if possible. More...
|
| |
| virtual bool | specializedClipTets (quest::experimental::ShapeMesh &shapeMesh, axom::ArrayView< double > ovlap, const axom::ArrayView< IndexType > &tetIds, conduit::Node &statistics) |
| |
| virtual bool | getGeometryAsTets (quest::experimental::ShapeMesh &shapeMesh, axom::Array< TetrahedronType > &tets) |
| | Get the geometry as discrete tetrahedra, or return false. More...
|
| |
| virtual bool | getGeometryAsOcts (quest::experimental::ShapeMesh &shapeMesh, axom::Array< OctahedronType > &octs) |
| | Get the geometry as discrete octahedra, or return false. More...
|
| |
Strategy base class for clipping operations for specific geometry instances, for use by MeshClipper.
Key methods to implement: (Some combination of these is required.)
getBoundingBox2D or getBoundingBox3D: Axis-aligned bounding box for the geometry.
labelCellsInOut: Label the cells in a mesh as inside, outside or on the shape boundary. If a cell cannot be determined, you can conservatively label it as on the boundary.
labelTetsInOut: Label the tets in a mesh as inside, outside or on the shape boundary. The tets come from decomposing the hexahedral mesh cells. If a tet cannot be determined, you can conservatively label it as on the boundary.
getShapesAsTets: Build an array of tetrahedra to approximate the shape.
getShapesAsOcts: Build an array of octahedra to approximate the shape.
specializedClipCells: Use a fast clipping algorithm (if one is available) to clip the cells in a mesh. Implementation should use special knowledge of the geometry. One version of this method clips all cells in the mesh, one clips only cells in a provided index list and one only clips the tetrahedra (which come from decomposing the mesh cells) in a provided index list. The last two work in conjunction with labelCellsInOut and labelTetsInOut.
Every method should return true if it fulfilled the request, or false if it was a no-op.
Subclasses of MeshClipperStrategy must implement either
- a
specializedClipCells or specializedClipTets method or
- one of the
getShapesAs...() methods. The former is prefered if the use of geometry-specific information can make it faster. labelCellsInOut and labelTetsInOut are optional but if provided, they can improve performance by limiting the slower clipping steps to a smaller subset. getBoundingBox2D or getBoundingBox3D can also improve performance by reducing computation.
Label each cell in the mesh as inside, outside or both/undetermined, if possible.
- Parameters
-
| [in] | shapeMesh | Mesh to shape into. |
| [out] | labels | Output |
The cell labels should be set to
labelIn if the cell is completely inside the shape,
labelOut if the cell is completely outside, and
labelOn if the cell is both inside and outside (or cannot be easily determined).
The output labels are used in optimizing the clipping algorithm. Subclasses should implement this if it's cost-effective, and skip if it's not. It's safe to label cells as on the boundary if it can't be efficiently determined as inside or outside.
Degenerate cells have zero volume and should be labeled outside for best clipping performance.
- Returns
- Whether the operation was done. (A false means not done.)
If implementation returns true, it should ensure these post-conditions hold:
- Postcondition
- labels.size() == shapeMesh.getCellCount()
-
labels.getAllocatorID() == shapeMesh.getAllocatorId()
References AXOM_UNUSED_VAR.
Label each tetrahedron in the given cells, as inside, outside or both/undetermined, if possible.
- Parameters
-
| [in] | shapeMesh | Blueprint mesh to shape into. |
| [in] | cellIds | Indices of cells whose constituent tets should be labeled. |
| [out] | tetLabels | Output |
See also comments in labelCellsInOut().
Indices [i*NUM_TETS_PER_HEX, (i+1)*NUM_TETS_PER_HEX) in tetLabels correspond to parent cell index c = cellIds[i].
The NUM_TETS_PER_HEX tets in cell c have indices [c*NUM_TETS_PER_HEX, (c+1)*NUM_TETS_PER_HEX). in shapeMesh.getCellsAsTets().
Degenerate tets have zero volume and MUST be labeled outside. Further computation can fail if degenerate tets are seen.
If implementation returns true, it should ensure these post-conditions hold:
- Postcondition
- tetLabels.size() == NUM_TETS_PER_HEX * cellIds.size()
-
labels.getAllocatorID() == shapeMesh.getAllocatorId()
-
tetLabels should have NUM_TETS_PER_HEX labels for each index in cellIds.
References AXOM_UNUSED_VAR.
Clip with a fast geometry-specialized method if possible.
- Parameters
-
| [in] | shapeMesh | Blueprint mesh to shape into. |
| [out] | ovlap | Shape overlap volume of each cell in the shapeMesh. It's initialized to zeros. |
| [out] | statistics | Optional statistics to record consisting of child nodes with integer values. |
The default implementation has no specialized method, so it's a no-op and returns false.
If this method returns false, then exactly one of the getShapesAs...() methods must be provided.
- Returns
- True if clipping was done and false if a no-op.
This method need not be implemented if labelCellsInOut() returns true.
Setting the statistics is not required except for getting accurate statistics.
If implementation returns true, it should ensure these post-conditions hold:
- Postcondition
- ovlap.size() == shapeMesh.getCellCount()
-
ovlap.getAllocatorID() == shapeMesh.getAllocatorId()
References AXOM_UNUSED_VAR.
Clip with a fast geometry-specialized method if possible.
- Parameters
-
| [in] | shapeMesh | Blueprint mesh to shape into. |
| [out] | ovlap | Shape overlap volume of each cell in shapeMesh, initialized to the cell volumes for cell inside the shape and zero for other cells. |
| [in] | cellIds | Limit computation to these cell ids. |
| [out] | statistics | Optional statistics to record consisting of child nodes with integer values. |
The default implementation has no specialized method, so it's a no-op and returns false.
If this method returns false, then exactly one of getGeometryAsTets() or getGeometryAsOcts() methods must be provided so that MeshClipper can use the general clipping methods.
- Returns
- True if clipping was done and false if a no-op.
This method need not be implemented if labelCellsInOut() returns false.
Setting the statistics is not required except for getting accurate statistics.
- Precondition
ovlap is pre-initialized for the implementation to add or subtract partial volumes to individual cells.
If implementation returns true, it should ensure these post-conditions hold:
- Postcondition
- ovlap.size() == shapeMesh.getCellCount()
-
ovlap.getAllocatorID() == shapeMesh.getAllocatorId()
References AXOM_UNUSED_VAR.
Get the geometry as discrete tetrahedra, or return false.
- Parameters
-
| [in] | shapeMesh | Blueprint mesh to shape into. |
| [out] | tets | Array of non-degenerate tetrahedra filling the space of the shape, fully transformed. |
Subclasses implementing this routine should snap to zero any output vertex coordinate that is close to zero.
Degenerate tets are allowed, but they may cause a reduction in clipping performance, so it's best to omit them from tets.
- Returns
- Whether the shape can be represented as tetrahedra.
If implementation returns true, it should ensure these post-conditions hold:
- Postcondition
- tets.getAllocatorID() == shapeMesh.getAllocatorId()
References AXOM_UNUSED_VAR.
Get the geometry as discrete octahedra, or return false.
- Parameters
-
| [in] | shapeMesh | Blueprint mesh to shape into. |
| [out] | octs | Array of non-degenerate octahedra filling the space of the shape, fully transformed. |
Subclasses implementing this routine should snap to zero any output vertex coordinate that is close to zero.
Degenerate octs are allowed, but they may cause a reduction in clipping performance, so it's best to omit them from octs.
- Returns
- Whether the shape can be represented as octahedra.
If implementation returns true, it should ensure these post-conditions hold:
- Postcondition
- octs.getAllocatorID() == shapeMesh.getAllocatorId()
References AXOM_UNUSED_VAR.
| conduit::Node axom::quest::experimental::MeshClipperStrategy::m_info |
|
protected |
Information on the geometry.
This is initially set to a deep copy of the source klee::Geometry hierarchy data. Subclasses may use and change this data as needed.
This information should be sufficient for the subclass to implement the required and optional virtual methods. But it's up to the subclass to define the requirements, validate the data, fail fast if the data is invalid and document the requirements.