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

Concrete class for sample based shaping. More...

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

Inheritance diagram for axom::quest::SamplingShaper:

Public Types

enum class  SamplingMethod : int { InOut , WindingNumber }
 Struct to help choose sampler method: InOut or WindingNumber. More...
 
using RuntimePolicy = axom::runtime_policy::Policy
 
using RefinementType = DiscreteShape::RefinementType
 Refinement type. More...
 

Public Member Functions

 SamplingShaper (RuntimePolicy execPolicy, int allocatorId, const klee::ShapeSet &shapeSet, sidre::MFEMSidreDataCollection *dc)
 
 ~SamplingShaper ()
 
mfem::QuadratureFunction * getShapeQFunction (const std::string &name) const
 Returns a pointer to the quadrature function associated with shape name if it exists, else nullptr. More...
 
mfem::QuadratureFunction * getMaterialQFunction (const std::string &name) const
 Returns a pointer to the quadrature function associated with material name if it exists, else nullptr. More...
 
void importInitialVolumeFractions (const std::map< std::string, mfem::GridFunction * > &initialGridFunctions)
 Import an initial set of material volume fractions before shaping. More...
 
void adjustVolumeFractions () override
 
void printRegisteredFieldNames (const std::string &initialMessage)
 
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 sampling; supplements parameters in base class
void setSamplingType (shaping::VolFracSampling vfSampling)
 
void setSamplingMethod (SamplingMethod samplingMethod)
 
void setQuadratureOrder (int quadratureOrder)
 
void setVolumeFractionOrder (int volfracOrder)
 
void setPointProjector22 (shaping::PointProjector< 2, 2 > projector)
 Registers a function to project from 2D input points to 2D query points. More...
 
void setPointProjector32 (shaping::PointProjector< 3, 2 > projector)
 Registers a function to project from 3D input points to 2D query points. More...
 
void setPointProjector23 (shaping::PointProjector< 2, 3 > projector)
 Registers a function to project from 2D input points to 3D query points. More...
 
void setPointProjector33 (shaping::PointProjector< 3, 3 > projector)
 Registers a function to project from 3D input points to 3D query points. More...
 
Functions related to the stages for a given shape
void loadShape (const klee::Shape &shape) override
 Load the shape geometry. For MFEM files, geometry is loaded into m_contours. Other formats make discrete geometry and load it into m_surface in the Shaper base class. More...
 
void prepareShapeQuery (klee::Dimensions shapeDimension, const klee::Shape &shape) override
 Initializes the spatial index for shaping. More...
 
void runShapeQuery (const klee::Shape &shape) override
 
void applyReplacementRules (const klee::Shape &shape) override
 
void finalizeShapeQuery () override
 
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_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}
 
double m_vertexWeldThreshold {DEFAULT_VERTEX_WELD_THRESHOLD}
 
bool m_verboseOutput {false}
 
MPI_Comm m_comm {MPI_COMM_SELF}
 

Detailed Description

Concrete class for sample based shaping.

Member Typedef Documentation

◆ RuntimePolicy

◆ RefinementType

Member Enumeration Documentation

◆ SamplingMethod

Struct to help choose sampler method: InOut or WindingNumber.

Enumerator
InOut 
WindingNumber 

Constructor & Destructor Documentation

◆ SamplingShaper()

axom::quest::SamplingShaper::SamplingShaper ( RuntimePolicy  execPolicy,
int  allocatorId,
const klee::ShapeSet shapeSet,
sidre::MFEMSidreDataCollection *  dc 
)
inline

◆ ~SamplingShaper()

axom::quest::SamplingShaper::~SamplingShaper ( )
inline

Member Function Documentation

◆ setSamplingType()

void axom::quest::SamplingShaper::setSamplingType ( shaping::VolFracSampling  vfSampling)
inline

◆ setSamplingMethod()

void axom::quest::SamplingShaper::setSamplingMethod ( SamplingMethod  samplingMethod)
inline

◆ setQuadratureOrder()

void axom::quest::SamplingShaper::setQuadratureOrder ( int  quadratureOrder)
inline

◆ setVolumeFractionOrder()

void axom::quest::SamplingShaper::setVolumeFractionOrder ( int  volfracOrder)
inline

◆ setPointProjector22()

void axom::quest::SamplingShaper::setPointProjector22 ( shaping::PointProjector< 2, 2 >  projector)
inline

Registers a function to project from 2D input points to 2D query points.

◆ setPointProjector32()

void axom::quest::SamplingShaper::setPointProjector32 ( shaping::PointProjector< 3, 2 >  projector)
inline

Registers a function to project from 3D input points to 2D query points.

◆ setPointProjector23()

void axom::quest::SamplingShaper::setPointProjector23 ( shaping::PointProjector< 2, 3 >  projector)
inline

Registers a function to project from 2D input points to 3D query points.

◆ setPointProjector33()

void axom::quest::SamplingShaper::setPointProjector33 ( shaping::PointProjector< 3, 3 >  projector)
inline

Registers a function to project from 3D input points to 3D query points.

◆ getShapeQFunction()

mfem::QuadratureFunction* axom::quest::SamplingShaper::getShapeQFunction ( const std::string &  name) const
inline

Returns a pointer to the quadrature function associated with shape name if it exists, else nullptr.

◆ getMaterialQFunction()

mfem::QuadratureFunction* axom::quest::SamplingShaper::getMaterialQFunction ( const std::string &  name) const
inline

Returns a pointer to the quadrature function associated with material name if it exists, else nullptr.

◆ loadShape()

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

Load the shape geometry. For MFEM files, geometry is loaded into m_contours. Other formats make discrete geometry and load it into m_surface in the Shaper base class.

Parameters
shapeThe shape to load.

Reimplemented from axom::quest::Shaper.

References axom::klee::Shape::getGeometry(), axom::klee::Shape::getName(), axom::klee::Geometry::getPath(), axom::quest::Shaper::loadShape(), axom::quest::Shaper::m_prefixPath, axom::utilities::filesystem::prefixRelativePath(), SLIC_ERROR_IF, and SLIC_INFO_ROOT.

◆ prepareShapeQuery()

◆ runShapeQuery()

◆ applyReplacementRules()

◆ finalizeShapeQuery()

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

◆ importInitialVolumeFractions()

void axom::quest::SamplingShaper::importInitialVolumeFractions ( const std::map< std::string, mfem::GridFunction * > &  initialGridFunctions)
inline

Import an initial set of material volume fractions before shaping.

Parameters
[in]initialGridFuncionsThe input data as a map from material names to grid functions

The imported grid functions are interpolated at quadrature points and registered with the supplied names as material-based quadrature fields

References axom::slic::message::Debug, axom::quest::Shaper::isVerbose(), SLIC_INFO_ROOT, SLIC_WARNING, and axom::slic::message::Warning.

◆ adjustVolumeFractions()

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

◆ printRegisteredFieldNames()

void axom::quest::SamplingShaper::printRegisteredFieldNames ( const std::string &  initialMessage)
inline

Prints out the names of the registered fields related to shapes and materials This function is intended to help with debugging

References SLIC_INFO_ROOT.

◆ 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_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_vertexWeldThreshold

double axom::quest::Shaper::m_vertexWeldThreshold {DEFAULT_VERTEX_WELD_THRESHOLD}
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: