AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::quest::IntersectionShaper Class Reference

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/quest/IntersectionShaper.hpp>

Inheritance diagram for axom::quest::IntersectionShaper:

Public Types

using BoundingBox2D = primal::BoundingBox< double, 2 >
 
using BoundingBox3D = primal::BoundingBox< double, 3 >
 
using HexahedronType = primal::Hexahedron< double, 3 >
 
using OctahedronType = primal::Octahedron< double, 3 >
 
using PolyhedronType = primal::Polyhedron< double, 3 >
 
using Point2D = primal::Point< double, 2 >
 
using Point3D = primal::Point< double, 3 >
 
using TetrahedronType = primal::Tetrahedron< double, 3 >
 
using SegmentMesh = mint::UnstructuredMesh< mint::SINGLE_SHAPE >
 
using TetMesh = mint::UnstructuredMesh< mint::SINGLE_SHAPE >
 
using PolygonStaticType = primal::Polygon< double, 2, axom::primal::PolygonArray::Static >
 
using RuntimePolicy = axom::runtime_policy::Policy
 
using RefinementType = DiscreteShape::RefinementType
 Refinement type. More...
 

Public Member Functions

template<typename ShapeType >
void setMeshDependentData ()
 Set data that depends on mesh (but not on shapes). More...
 
template<typename ExecSpace >
void setMeshDependentDataImpl2D ()
 Set 2D mesh-dependent data, using the given ExecSpace for execution. More...
 
template<typename ExecSpace >
void setMeshDependentDataImpl3D ()
 Set 3D mesh-dependent data, using the given ExecSpace for execution. More...
 
double getRevolvedVolume () const
 Return the revolved volume that was computed during dynamic refinement. More...
 
double getApproximateRevolvedVolume () const
 Return the revolved volume for the m_surfaceMesh at m_level circle refinement. More...
 
virtual void loadShape (const klee::Shape &shape) override
 Loads the shape from file into m_surfaceMesh. More...
 
void prepareShapeQuery (klee::Dimensions shapeDimension, const klee::Shape &shape) override
 Prepares the shaping query, based on the policy member set (default is sequential) More...
 
void runShapeQuery (const klee::Shape &shape) override
 
axom::ArrayView< const double > getOverlapVolumes () const
 
axom::ArrayView< const double > getCellVolumes () const
 
double sumOverlapVolumes (bool global=true) const
 
template<typename ExecSpace , typename Summable >
Summable sumArray (const Summable *a, axom::IndexType count) const
 
void adjustVolumeFractions () override
 
std::vector< std::string > getMaterialNames () const
 
std::pair< axom::ArrayView< double >, int > getMaterial (const std::string &materialName)
 Gets the grid function and material number for a material name. More...
 
bool verifyInputMesh (std::string &whyBad) const
 Verify the input mesh is okay for this class to work with. More...
 
void setFilePath (const std::string &filePath)
 Set path of shape input file. More...
 
mint::MeshgetSurfaceMesh () const
 
bool isVerbose () const
 
virtual bool isValidFormat (const std::string &format) const
 Predicate to determine if the specified format is valid. More...
 
std::string shapeFormat (const klee::Shape &shape) const
 Returns the format type of the supplied shape. More...
 
RuntimePolicy getExecutionPolicy () const
 Returns the execution policy used by the Shaper. More...
 
double allReduceSum (double val) const
 Helper to apply a parallel sum reduction to a quantity. More...
 
double allReduceMin (double val) const
 Helper to apply a parallel min reduction to a quantity. More...
 
double allReduceMax (double val) const
 Helper to apply a parallel max reduction to a quantity. More...
 
Functions to get and set shaping parameters related to intersection; supplements parameters in base class
void setLevel (int level)
 
void setFreeMaterialName (const std::string &name)
 Set the name of the material used to account for free volume fractions. More...
 
Functions to get and set shaping parameters
void setSamplesPerKnotSpan (int nSamples)
 
void setVertexWeldThreshold (double threshold)
 
void setVerbosity (bool isVerbose)
 
void setPercentError (double percent)
 
void setRefinementType (RefinementType t)
 

Static Public Attributes

static constexpr int DEFAULT_CIRCLE_REFINEMENT_LEVEL {7}
 
static constexpr double DEFAULT_REVOLVED_VOLUME {0.}
 
static constexpr int DEFAULT_SAMPLES_PER_KNOT_SPAN {25}
 
static constexpr double MINIMUM_PERCENT_ERROR {0.}
 
static constexpr double MAXIMUM_PERCENT_ERROR {100.}
 
static constexpr double DEFAULT_VERTEX_WELD_THRESHOLD {1e-9}
 

Protected Member Functions

void loadShapeInternal (const klee::Shape &shape, double percentError, double &revolvedVolume)
 Loads the shape into m_surfaceMesh. More...
 
void applyTransforms (const klee::Shape &shape)
 Computes transforms for the shape and applies them to the surface mesh. More...
 
void applyTransforms (const numerics::Matrix< double > &transform)
 Computes transforms for the shape and applies them to the surface mesh. More...
 
numerics::Matrix< double > getTransforms (const klee::Shape &shape) const
 Get a matrix that contains the shape's concatenated transforms. More...
 
int getRank () const
 Helper function to get the rank associated with the current process. More...
 

Protected Attributes

RuntimePolicy m_execPolicy
 
int m_allocatorId
 
sidre::DataStore m_dataStore
 
const klee::ShapeSetm_shapeSet
 
std::string m_prefixPath
 Prefix path for shape file names with relative path. More...
 
axom::IndexType m_cellCount
 Number of cells in computational mesh (m_dc or m_bpGrp). More...
 
std::shared_ptr< mint::Meshm_surfaceMesh
 
int m_samplesPerKnotSpan {DEFAULT_SAMPLES_PER_KNOT_SPAN}
 
double m_percentError {MINIMUM_PERCENT_ERROR}
 
RefinementType m_refinementType {DiscreteShape::RefinementUniformSegments}
 
bool m_verboseOutput {false}
 
MPI_Comm m_comm {MPI_COMM_SELF}
 

Private functions related to the stages for a given shape

template<typename ExecSpace >
axom::ArrayView< double > getCompletelyFree ()
 Make a new grid function that contains all of the free space not occupied by existing materials. More...
 
template<typename ExecSpace >
void applyReplacementRulesImpl (const klee::Shape &shape)
 Set the volume fractions for the current shape into the grid function for the material and adjust any other material volume fraction grid functions. More...
 
void applyReplacementRules (const klee::Shape &shape) override
 Apply material replacement rules for the current shape, using the appropriate execution policy. More...
 
void finalizeShapeQuery () override
 

Member Typedef Documentation

◆ BoundingBox2D

◆ BoundingBox3D

◆ HexahedronType

◆ OctahedronType

◆ PolyhedronType

◆ Point2D

◆ Point3D

◆ TetrahedronType

◆ SegmentMesh

◆ TetMesh

◆ PolygonStaticType

◆ RuntimePolicy

◆ RefinementType

Member Function Documentation

◆ setMeshDependentData()

template<typename ShapeType >
void axom::quest::IntersectionShaper::setMeshDependentData ( )
inline

Set data that depends on mesh (but not on shapes).

References AXOM_ANNOTATE_SCOPE, axom::quest::Shaper::m_execPolicy, and SLIC_ERROR.

◆ setMeshDependentDataImpl2D()

template<typename ExecSpace >
void axom::quest::IntersectionShaper::setMeshDependentDataImpl2D ( )
inline

Set 2D mesh-dependent data, using the given ExecSpace for execution.

This method has proven to be a potential bottleneck on devices. The performance annotations will be removed once it is robustly fixed.

References axom::primal::BoundingBox< T, NDIMS >::addPoint(), AXOM_ANNOTATE_BEGIN, AXOM_ANNOTATE_END, AXOM_LAMBDA, axom::Array< T, DIM, SPACE, StoragePolicy >::fill(), axom::quest::Shaper::m_allocatorId, axom::quest::Shaper::m_cellCount, SLIC_INFO, and axom::Array< T, DIM, SPACE, StoragePolicy >::view().

◆ setMeshDependentDataImpl3D()

template<typename ExecSpace >
void axom::quest::IntersectionShaper::setMeshDependentDataImpl3D ( )
inline

Set 3D mesh-dependent data, using the given ExecSpace for execution.

This method has proven to be a potential bottleneck on devices. The performance annotations will be removed once it is robustly fixed.

References AXOM_ANNOTATE_BEGIN, AXOM_ANNOTATE_END, AXOM_LAMBDA, axom::Array< T, DIM, SPACE, StoragePolicy >::fill(), axom::quest::Shaper::m_allocatorId, axom::quest::Shaper::m_cellCount, SLIC_INFO, and axom::Array< T, DIM, SPACE, StoragePolicy >::view().

◆ setLevel()

void axom::quest::IntersectionShaper::setLevel ( int  level)
inline

◆ setFreeMaterialName()

void axom::quest::IntersectionShaper::setFreeMaterialName ( const std::string &  name)
inline

Set the name of the material used to account for free volume fractions.

Parameters
nameThe new name of the material. This name cannot contain underscores and it cannot be set once shaping has started.
Note
This should not be called once any shaping has occurred.

References axom::quest::Shaper::m_cellCount, and SLIC_ERROR.

◆ getRevolvedVolume()

double axom::quest::IntersectionShaper::getRevolvedVolume ( ) const
inline

Return the revolved volume that was computed during dynamic refinement.

Returns
The revolved volume (or zero).

◆ getApproximateRevolvedVolume()

double axom::quest::IntersectionShaper::getApproximateRevolvedVolume ( ) const
inline

Return the revolved volume for the m_surfaceMesh at m_level circle refinement.

Note
loadShape should have been called before this method.
Returns
The revolved volume (or zero).

References axom::quest::Shaper::m_surfaceMesh.

◆ loadShape()

virtual void axom::quest::IntersectionShaper::loadShape ( const klee::Shape shape)
inlineoverridevirtual

◆ getCompletelyFree()

template<typename ExecSpace >
axom::ArrayView<double> axom::quest::IntersectionShaper::getCompletelyFree ( )
inline

Make a new grid function that contains all of the free space not occupied by existing materials.

Note
We currently leave the free material in the data collection, even after the shaper has executed.
Template Parameters
ExecSpaceThe execution space where the data are computed.
Returns
The grid function that represents the amount of completely free space in each zone.

References AXOM_ANNOTATE_SCOPE, AXOM_LAMBDA, axom::ArrayView< T, DIM, SPACE >::empty(), axom::ArrayView< T, DIM, SPACE >::size(), and SLIC_ASSERT.

◆ applyReplacementRulesImpl()

template<typename ExecSpace >
void axom::quest::IntersectionShaper::applyReplacementRulesImpl ( const klee::Shape shape)
inline

Set the volume fractions for the current shape into the grid function for the material and adjust any other material volume fraction grid functions.

Template Parameters
ExecSpaceThe execution space where the data are computed.
Parameters
shapeThe shape whose volume fractions are being stored.

The replacement rules operate on the current shape's material as well as the rest of the materials since they need to be updated to sum to 1. When adding a volume fraction to a zone, the code adds the allowed amount to the zone. In most cases, this is just the computed material volume, though it can be restricted by amounts of other materials if replacing materials. Once a volume fraction has been added, a list of update materials is iterated and a corresponding amount is subtracted from them. This update list consists of "completely free", all non-shape materials, and finally the shape material itself. The shape material is added at the end in case the initial volume fraction addition exceeded 1.

The "completely free" material (CF) represents any volume fraction in the zones that has not been assigned to any material. We subtract from CF first as part of the update process so we do not have to subtract from real materials in the event that a zone is not full.

The list of update materials depends on the shape's material replacement rule.

Example: update mats |-—>

mat1 | CF mat0

add 0.4 mat1 -> | 0.4 | 0.2 | 0.4 |

mat1 CF mat0 subtract


| 0.8 | 0.2 | 0.4 | | 0.4 | (added 0.4 to mat1)


mat1 CF mat0 subtract


| 0.8 | 0.0 | 0.4 | | 0.2 | (subtracted 0.2 from CF)


mat1 CF mat0 subtract


| 0.8 | 0.0 | 0.2 | | 0.0 | (subtracted 0.2 from mat0)


References AXOM_ANNOTATE_SCOPE, AXOM_LAMBDA, axom::klee::Shape::getMaterial(), getMaterial(), getMaterialNames(), axom::klee::Shape::getMaterialsNotReplaced(), axom::klee::Shape::getMaterialsReplaced(), axom::klee::Shape::getName(), axom::quest::Shaper::m_allocatorId, SLIC_ERROR_IF, axom::sort(), and axom::Array< T, DIM, SPACE, StoragePolicy >::view().

◆ applyReplacementRules()

void axom::quest::IntersectionShaper::applyReplacementRules ( const klee::Shape shape)
inlineoverridevirtual

Apply material replacement rules for the current shape, using the appropriate execution policy.

Implements axom::quest::Shaper.

References AXOM_ANNOTATE_SCOPE, AXOM_UNUSED_VAR, and axom::quest::Shaper::m_execPolicy.

◆ finalizeShapeQuery()

void axom::quest::IntersectionShaper::finalizeShapeQuery ( )
inlineoverridevirtual

◆ prepareShapeQuery()

void axom::quest::IntersectionShaper::prepareShapeQuery ( klee::Dimensions  shapeDimension,
const klee::Shape shape 
)
inlineoverridevirtual

◆ runShapeQuery()

void axom::quest::IntersectionShaper::runShapeQuery ( const klee::Shape shape)
inlineoverridevirtual

◆ getOverlapVolumes()

axom::ArrayView<const double> axom::quest::IntersectionShaper::getOverlapVolumes ( ) const
inline

◆ getCellVolumes()

axom::ArrayView<const double> axom::quest::IntersectionShaper::getCellVolumes ( ) const
inline

◆ sumOverlapVolumes()

double axom::quest::IntersectionShaper::sumOverlapVolumes ( bool  global = true) const
inline

◆ sumArray()

template<typename ExecSpace , typename Summable >
Summable axom::quest::IntersectionShaper::sumArray ( const Summable *  a,
axom::IndexType  count 
) const
inline

References AXOM_LAMBDA.

◆ adjustVolumeFractions()

void axom::quest::IntersectionShaper::adjustVolumeFractions ( )
inlineoverridevirtual

Implements axom::quest::Shaper.

◆ getMaterialNames()

std::vector<std::string> axom::quest::IntersectionShaper::getMaterialNames ( ) const
inline

◆ getMaterial()

std::pair<axom::ArrayView<double>, int> axom::quest::IntersectionShaper::getMaterial ( const std::string &  materialName)
inline

Gets the grid function and material number for a material name.

Parameters
materialNameThe name of the material.
Returns
A pair containing the associated grid function (an element in the m_vf_grid_functions array) and material number (its index in the array).

References AXOM_LAMBDA, axom::detail::getAllocatorSpace(), axom::quest::Shaper::m_execPolicy, and SLIC_ASSERT.

◆ verifyInputMesh()

bool axom::quest::Shaper::verifyInputMesh ( std::string &  whyBad) const
inherited

Verify the input mesh is okay for this class to work with.

◆ setSamplesPerKnotSpan()

void axom::quest::Shaper::setSamplesPerKnotSpan ( int  nSamples)
inherited

◆ setVertexWeldThreshold()

void axom::quest::Shaper::setVertexWeldThreshold ( double  threshold)
inherited

◆ setVerbosity()

void axom::quest::Shaper::setVerbosity ( bool  isVerbose)
inlineinherited

◆ setPercentError()

void axom::quest::Shaper::setPercentError ( double  percent)
inherited

◆ setRefinementType()

void axom::quest::Shaper::setRefinementType ( RefinementType  t)
inherited

◆ setFilePath()

void axom::quest::Shaper::setFilePath ( const std::string &  filePath)
inherited

Set path of shape input file.

The path is used to resolve relative paths that may have been specified in the file.

◆ getSurfaceMesh()

mint::Mesh* axom::quest::Shaper::getSurfaceMesh ( ) const
inlineinherited

◆ isVerbose()

bool axom::quest::Shaper::isVerbose ( ) const
inlineinherited

◆ isValidFormat()

virtual bool axom::quest::Shaper::isValidFormat ( const std::string &  format) const
virtualinherited

Predicate to determine if the specified format is valid.

Parameters
formatA string listing the format to check

◆ shapeFormat()

std::string axom::quest::Shaper::shapeFormat ( const klee::Shape shape) const
inlineinherited

Returns the format type of the supplied shape.

References axom::klee::Geometry::getFormat(), and axom::klee::Shape::getGeometry().

◆ getExecutionPolicy()

RuntimePolicy axom::quest::Shaper::getExecutionPolicy ( ) const
inlineinherited

Returns the execution policy used by the Shaper.

References axom::quest::Shaper::m_execPolicy.

◆ allReduceSum()

double axom::quest::Shaper::allReduceSum ( double  val) const
inherited

Helper to apply a parallel sum reduction to a quantity.

Note
This is the identity function when running without MPI

◆ allReduceMin()

double axom::quest::Shaper::allReduceMin ( double  val) const
inherited

Helper to apply a parallel min reduction to a quantity.

Note
This is the identity function when running without MPI

◆ allReduceMax()

double axom::quest::Shaper::allReduceMax ( double  val) const
inherited

Helper to apply a parallel max reduction to a quantity.

Note
This is the identity function when running without MPI

◆ loadShapeInternal()

void axom::quest::Shaper::loadShapeInternal ( const klee::Shape shape,
double  percentError,
double &  revolvedVolume 
)
protectedinherited

Loads the shape into m_surfaceMesh.

Parameters
shapeThe shape.
percentErrorA percent error to use when refining the shape. If it positive then Axom will try to refine dynamically according to this error. Otherwise, it will use the segmentsPerKnotSpan value.
[out]revolvedvolumeA revolved volume for the shape, if the shape is from a C2C contour.

◆ applyTransforms() [1/2]

void axom::quest::Shaper::applyTransforms ( const klee::Shape shape)
protectedinherited

Computes transforms for the shape and applies them to the surface mesh.

Parameters
shapeThe shape.

◆ applyTransforms() [2/2]

void axom::quest::Shaper::applyTransforms ( const numerics::Matrix< double > &  transform)
protectedinherited

Computes transforms for the shape and applies them to the surface mesh.

Parameters
shapeThe shape.
transformA 4x4 matrix containing the transformation to apply.

◆ getTransforms()

numerics::Matrix<double> axom::quest::Shaper::getTransforms ( const klee::Shape shape) const
protectedinherited

Get a matrix that contains the shape's concatenated transforms.

Parameters
shapeThe shape whose transforms are being concatenated.
Returns
A 4x4 matrix that represents the transforms.

◆ getRank()

int axom::quest::Shaper::getRank ( ) const
protectedinherited

Helper function to get the rank associated with the current process.

Note
This function can be called even in non-mpi configurations

Member Data Documentation

◆ DEFAULT_CIRCLE_REFINEMENT_LEVEL

constexpr int axom::quest::IntersectionShaper::DEFAULT_CIRCLE_REFINEMENT_LEVEL {7}
staticconstexpr

◆ DEFAULT_REVOLVED_VOLUME

constexpr double axom::quest::IntersectionShaper::DEFAULT_REVOLVED_VOLUME {0.}
staticconstexpr

◆ DEFAULT_SAMPLES_PER_KNOT_SPAN

constexpr int axom::quest::Shaper::DEFAULT_SAMPLES_PER_KNOT_SPAN {25}
staticconstexprinherited

◆ MINIMUM_PERCENT_ERROR

constexpr double axom::quest::Shaper::MINIMUM_PERCENT_ERROR {0.}
staticconstexprinherited

◆ MAXIMUM_PERCENT_ERROR

constexpr double axom::quest::Shaper::MAXIMUM_PERCENT_ERROR {100.}
staticconstexprinherited

◆ DEFAULT_VERTEX_WELD_THRESHOLD

constexpr double axom::quest::Shaper::DEFAULT_VERTEX_WELD_THRESHOLD {1e-9}
staticconstexprinherited

◆ m_execPolicy

RuntimePolicy axom::quest::Shaper::m_execPolicy
protectedinherited

◆ m_allocatorId

int axom::quest::Shaper::m_allocatorId
protectedinherited

◆ m_dataStore

sidre::DataStore axom::quest::Shaper::m_dataStore
protectedinherited

◆ m_shapeSet

const klee::ShapeSet& axom::quest::Shaper::m_shapeSet
protectedinherited

◆ m_prefixPath

std::string axom::quest::Shaper::m_prefixPath
protectedinherited

Prefix path for shape file names with relative path.

◆ m_cellCount

axom::IndexType axom::quest::Shaper::m_cellCount
protectedinherited

Number of cells in computational mesh (m_dc or m_bpGrp).

◆ m_surfaceMesh

std::shared_ptr<mint::Mesh> axom::quest::Shaper::m_surfaceMesh
protectedinherited

◆ m_samplesPerKnotSpan

int axom::quest::Shaper::m_samplesPerKnotSpan {DEFAULT_SAMPLES_PER_KNOT_SPAN}
protectedinherited

◆ m_percentError

double axom::quest::Shaper::m_percentError {MINIMUM_PERCENT_ERROR}
protectedinherited

◆ m_refinementType

RefinementType axom::quest::Shaper::m_refinementType {DiscreteShape::RefinementUniformSegments}
protectedinherited

◆ m_verboseOutput

bool axom::quest::Shaper::m_verboseOutput {false}
protectedinherited

◆ m_comm

MPI_Comm axom::quest::Shaper::m_comm {MPI_COMM_SELF}
protectedinherited

The documentation for this class was generated from the following file: