Class facilitating local discretization-related functionsThis class implements discretization-related functionality operating on data in MOAB. A member of this class caches certain data about the element it's currently operating on, but is not meant to be instantiated one-per-element, but rather one-per-search (or other operation on a collection of elements). More...
#include <ElemEvaluator.hpp>
Public Member Functions | |
ElemEvaluator (Interface *impl, EntityHandle ent=0, Tag tag=0, int tagged_ent_dim=-1) | |
Constructor. More... | |
~ElemEvaluator () | |
ErrorCode | eval (const double *params, double *result, int num_tuples=-1) const |
Evaluate cached tag at a given parametric location within the cached entity If evaluating coordinates, call set_tag(0, 0), which indicates coords instead of a tag. More... | |
ErrorCode | reverse_eval (const double *posn, double iter_tol, double inside_tol, double *params, int *is_inside=NULL) const |
Reverse-evaluate the cached entity at a given physical position. More... | |
ErrorCode | get_normal (const int ientDim, const int facet, double normal[3]) const |
Evaluate the normal to a facet of an entity. More... | |
ErrorCode | jacobian (const double *params, double *result) const |
Evaluate the jacobian of the cached entity at a given parametric location. More... | |
ErrorCode | integrate (double *result) const |
Integrate the cached tag over the cached entity. More... | |
int | inside (const double *params, const double tol) const |
Return whether a physical position is inside the cached entity to within a tolerance. More... | |
ErrorCode | find_containing_entity (Range &entities, const double *point, const double iter_tol, const double inside_tol, EntityHandle &containing_ent, double *params, unsigned int *num_evals=NULL) |
Given a list of entities, return the entity the point is in, or none This function reverse-evaluates the entities, returning the first entity containing the point. If no entity contains the point, containing_ent is returned as 0 and params are unchanged. This function returns something other than MB_SUCCESS only when queries go wrong for some reason. num_evals, if non-NULL, is always incremented for each call to reverse_eval. This function calls set_ent_handle for each entity before calling reverse_eval, so the ElemEvaluator object is changed. More... | |
ErrorCode | find_containing_entity (EntityHandle ent_set, const double *point, const double iter_tol, const double inside_tol, EntityHandle &containing_ent, double *params, unsigned int *num_evals=NULL) |
Given an entity set, return the contained entity the point is in, or none This function reverse-evaluates the entities, returning the first entity containing the point. If no entity contains the point, containing_ent is returned as 0 and params are unchanged. This function returns something other than MB_SUCCESS only when queries go wrong for some reason. num_evals, if non-NULL, is always incremented for each call to reverse_eval. This function calls set_ent_handle for each entity before calling reverse_eval, so the ElemEvaluator object is changed. More... | |
ErrorCode | set_eval_set (EntityType tp, const EvalSet &eval_set) |
Set the eval set for a given type entity. More... | |
ErrorCode | set_eval_set (const EntityHandle eh) |
Set the eval set using a given entity handle This function queries the entity type and number of vertices on the entity to decide which type of shape function to use. NOTE: this function should only be called after setting a valid MOAB instance on the evaluator. More... | |
EvalSet | get_eval_set (EntityType tp) |
Get the eval set for a given type entity. More... | |
ErrorCode | set_ent_handle (EntityHandle ent) |
Set entity handle & cache connectivty & vertex positions. More... | |
EntityHandle | get_ent_handle () const |
Get entity handle for this ElemEval. More... | |
double * | get_vert_pos () |
const EntityHandle * | get_vert_handles () const |
int | get_num_verts () const |
Tag | get_tag_handle () const |
ErrorCode | set_tag_handle (Tag tag, int tagged_ent_dim=-1) |
ErrorCode | set_tag (const char *tag_name, int tagged_ent_dim=-1) |
int | get_tagged_ent_dim () const |
ErrorCode | set_tagged_ent_dim (int dim) |
double * | get_work_space () |
Interface * | get_moab () |
Private Attributes | |
Interface * | mbImpl |
Interface. More... | |
EntityHandle | entHandle |
Entity handle being evaluated. More... | |
EntityType | entType |
Entity type. More... | |
int | entDim |
Entity dimension. More... | |
int | numVerts |
Number of vertices cached here. More... | |
const EntityHandle * | vertHandles |
Cached copy of vertex handle ptr. More... | |
CartVect | vertPos [CN::MAX_NODES_PER_ELEMENT] |
Cached copy of vertex positions. More... | |
Tag | tagHandle |
Tag being evaluated. More... | |
bool | tagCoords |
Whether tag is coordinates or something else. More... | |
int | numTuples |
Number of values in this tag. More... | |
int | taggedEntDim |
Dimension of entities from which to grab tag. More... | |
std::vector< unsigned char > | tagSpace |
Tag space. More... | |
EvalSet | evalSets [MBMAXTYPE] |
Evaluation methods for elements of various topologies. More... | |
double * | workSpace |
Work space for element-specific data. More... | |
Class facilitating local discretization-related functions
This class implements discretization-related functionality operating on data in MOAB. A member of this class caches certain data about the element it's currently operating on, but is not meant to be instantiated one-per-element, but rather one-per-search (or other operation on a collection of elements).
Actual discretization functionality is accessed through function pointers, allowing applications to specialize the implementation of specific functions while still using this class.
This class depends on MOAB functionality for gathering entity-based data; the functions it calls through function pointers depend only on POD (plain old data, or intrinsic data types). This allows the use of other packages for serving these functions, without having to modify them to get data through MOAB. This should also promote efficiency, since in many cases they will be able to read data from its native storage locations.
Definition at line 177 of file ElemEvaluator.hpp.
|
inline |
Constructor.
impl | MOAB instance |
ent | Entity handle to cache on the evaluator; if non-zero, calls set_ent_handle, which does some other stuff. |
tag | Tag to cache on the evaluator; if non-zero, calls set_tag_handle, which does some other stuff too. |
tagged_ent_dim | Dimension of entities to be tagged to cache on the evaluator |
Definition at line 422 of file ElemEvaluator.hpp.
References set_ent_handle(), and set_tag_handle().
|
inline |
Definition at line 430 of file ElemEvaluator.hpp.
References workSpace.
|
inline |
Evaluate cached tag at a given parametric location within the cached entity If evaluating coordinates, call set_tag(0, 0), which indicates coords instead of a tag.
params | Parameters at which to evaluate field |
result | Result of evaluation |
num_tuples | Size of evaluated field, in number of values |
Definition at line 569 of file ElemEvaluator.hpp.
References entDim, entHandle, entType, evalSets, MBMAXTYPE, numTuples, tagCoords, tagSpace, vertPos, and workSpace.
Referenced by moab::DataCoupler::interpolate().
|
inline |
Given an entity set, return the contained entity the point is in, or none This function reverse-evaluates the entities, returning the first entity containing the point. If no entity contains the point, containing_ent is returned as 0 and params are unchanged. This function returns something other than MB_SUCCESS only when queries go wrong for some reason. num_evals, if non-NULL, is always incremented for each call to reverse_eval. This function calls set_ent_handle for each entity before calling reverse_eval, so the ElemEvaluator object is changed.
ent_set | Entity set containing the entities to be tested |
point | Point tested, must have 3 dimensions, even for edge and face entities |
iter_tol | Tolerance for non-linear reverse evaluation |
inside_tol | Tolerance for is_inside test |
containing_ent | Entity containing the point, returned 0 if no entity |
params | Parameters of point in containing entity, unchanged if no containing entity |
num_evals | If non-NULL, incremented each time reverse_eval is called |
Definition at line 620 of file ElemEvaluator.hpp.
References entities, ErrorCode, find_containing_entity(), moab::Interface::get_entities_by_handle(), MB_SUCCESS, MBENTITYSET, mbImpl, and moab::Interface::type_from_handle().
ErrorCode moab::ElemEvaluator::find_containing_entity | ( | Range & | entities, |
const double * | point, | ||
const double | iter_tol, | ||
const double | inside_tol, | ||
EntityHandle & | containing_ent, | ||
double * | params, | ||
unsigned int * | num_evals = NULL |
||
) |
Given a list of entities, return the entity the point is in, or none This function reverse-evaluates the entities, returning the first entity containing the point. If no entity contains the point, containing_ent is returned as 0 and params are unchanged. This function returns something other than MB_SUCCESS only when queries go wrong for some reason. num_evals, if non-NULL, is always incremented for each call to reverse_eval. This function calls set_ent_handle for each entity before calling reverse_eval, so the ElemEvaluator object is changed.
entities | Entities tested |
point | Point tested, must have 3 dimensions, even for edge and face entities |
iter_tol | Tolerance for non-linear reverse evaluation |
inside_tol | Tolerance for is_inside test |
containing_ent | Entity containing the point, returned 0 if no entity |
params | Parameters of point in containing entity, unchanged if no containing entity |
num_evals | If non-NULL, incremented each time reverse_eval is called |
Definition at line 137 of file ElemEvaluator.cpp.
References entities, ErrorCode, MB_SUCCESS, reverse_eval(), and set_ent_handle().
Referenced by moab::BVHTree::bruteforce_find(), moab::AdaptiveKDTree::distance_search(), moab::BVHTree::distance_search(), find_containing_entity(), moab::AdaptiveKDTree::point_search(), and moab::BVHTree::point_search().
|
inline |
Get entity handle for this ElemEval.
Definition at line 307 of file ElemEvaluator.hpp.
References entHandle.
|
inline |
Get the eval set for a given type entity.
Definition at line 298 of file ElemEvaluator.hpp.
References evalSets.
|
inline |
|
inline |
Evaluate the normal to a facet of an entity.
Evaluate the normal of the cached entity at a given facet.
ientDim | Dimension of the facet. Should be (d-1) for d-dimensional entities |
facet | Local id of the facet w.r.t the entity |
normal | Returns the normal. |
Definition at line 590 of file ElemEvaluator.hpp.
References moab::CartVect::array(), entHandle, entType, evalSets, MBMAXTYPE, numVerts, and vertPos.
|
inline |
Definition at line 326 of file ElemEvaluator.hpp.
References numVerts.
|
inline |
Definition at line 332 of file ElemEvaluator.hpp.
References tagHandle.
|
inline |
Definition at line 354 of file ElemEvaluator.hpp.
References taggedEntDim.
|
inline |
Definition at line 320 of file ElemEvaluator.hpp.
References vertHandles.
|
inline |
Definition at line 314 of file ElemEvaluator.hpp.
References moab::CartVect::array(), and vertPos.
|
inline |
Definition at line 366 of file ElemEvaluator.hpp.
References workSpace.
|
inline |
Return whether a physical position is inside the cached entity to within a tolerance.
params | Parameters at which to query the element |
tol | Tolerance, usually 10^-6 or so |
Definition at line 637 of file ElemEvaluator.hpp.
|
inline |
Integrate the cached tag over the cached entity.
result | Result of the integration |
Definition at line 604 of file ElemEvaluator.hpp.
References moab::CartVect::array(), entDim, entHandle, entType, ErrorCode, evalSets, MB_SUCCESS, mbImpl, MBMAXTYPE, numTuples, numVerts, moab::Interface::tag_get_data(), tagCoords, taggedEntDim, tagHandle, tagSpace, vertHandles, vertPos, and workSpace.
|
inline |
Evaluate the jacobian of the cached entity at a given parametric location.
params | Parameters at which to evaluate jacobian |
result | Result of evaluation, in the form of a 3x3 matrix, stored in column-major order |
Definition at line 597 of file ElemEvaluator.hpp.
References moab::CartVect::array(), entDim, entHandle, entType, evalSets, MBMAXTYPE, numVerts, vertPos, and workSpace.
|
inline |
Reverse-evaluate the cached entity at a given physical position.
posn | Position at which to evaluate parameters |
iter_tol | Tolerance of reverse evaluation non-linear iteration, usually 10^-10 or so |
inside_tol | Tolerance of is_inside evaluation, usually 10^-6 or so |
params | Result of evaluation |
is_inside | If non-NULL, returns true of resulting parameters place the point inside the element (in most cases, within [-1]*(dim) |
Definition at line 577 of file ElemEvaluator.hpp.
References moab::CartVect::array(), entDim, entHandle, entType, moab::EvalSet::evalFcn, evalSets, moab::EvalSet::insideFcn, moab::EvalSet::jacobianFcn, MBMAXTYPE, numVerts, vertPos, and workSpace.
Referenced by find_containing_entity(), and moab::BVHTree::find_point().
|
inline |
Set entity handle & cache connectivty & vertex positions.
Definition at line 435 of file ElemEvaluator.hpp.
References moab::CartVect::array(), moab::Interface::dimension_from_handle(), entDim, entHandle, entType, ErrorCode, evalSets, moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::EvalSet::get_eval_set(), MB_SUCCESS, mbImpl, numVerts, set_tag_handle(), tagHandle, moab::Interface::type_from_handle(), vertHandles, vertPos, and workSpace.
Referenced by ElemEvaluator(), find_containing_entity(), moab::BVHTree::find_point(), and moab::DataCoupler::interpolate().
|
inline |
Set the eval set using a given entity handle This function queries the entity type and number of vertices on the entity to decide which type of shape function to use. NOTE: this function should only be called after setting a valid MOAB instance on the evaluator.
eh | Entity handle whose type and #vertices are queried |
Definition at line 642 of file ElemEvaluator.hpp.
References ErrorCode, evalSets, moab::EvalSet::get_eval_set(), mbImpl, and moab::Interface::type_from_handle().
Set the eval set for a given type entity.
tp | Entity type for which to set the eval set |
eval_set | Eval set object to use |
Definition at line 558 of file ElemEvaluator.hpp.
References entHandle, entType, ErrorCode, evalSets, moab::EvalSet::initFcn, MB_SUCCESS, numVerts, vertPos, and workSpace.
Referenced by moab::DataCoupler::DataCoupler().
|
inline |
Definition at line 507 of file ElemEvaluator.hpp.
References entDim, entHandle, ErrorCode, moab::CN::MAX_NODES_PER_ELEMENT, MB_SUCCESS, mbImpl, numTuples, numVerts, moab::Interface::tag_get_bytes(), moab::Interface::tag_get_data(), moab::Interface::tag_get_handle(), moab::Interface::tag_get_length(), tagCoords, taggedEntDim, tagHandle, tagSpace, and vertHandles.
Definition at line 465 of file ElemEvaluator.hpp.
References entDim, entHandle, ErrorCode, moab::CN::MAX_NODES_PER_ELEMENT, MB_SUCCESS, mbImpl, numTuples, numVerts, moab::Interface::tag_get_bytes(), moab::Interface::tag_get_data(), moab::Interface::tag_get_length(), tagCoords, taggedEntDim, tagHandle, tagSpace, and vertHandles.
Referenced by ElemEvaluator(), moab::DataCoupler::interpolate(), and set_ent_handle().
|
inline |
|
private |
Entity dimension.
Definition at line 388 of file ElemEvaluator.hpp.
Referenced by eval(), inside(), integrate(), jacobian(), reverse_eval(), set_ent_handle(), set_tag(), and set_tag_handle().
|
private |
Entity handle being evaluated.
Definition at line 382 of file ElemEvaluator.hpp.
Referenced by eval(), get_ent_handle(), get_normal(), integrate(), jacobian(), reverse_eval(), set_ent_handle(), set_eval_set(), set_tag(), and set_tag_handle().
|
private |
Entity type.
Definition at line 385 of file ElemEvaluator.hpp.
Referenced by eval(), get_normal(), inside(), integrate(), jacobian(), reverse_eval(), set_ent_handle(), and set_eval_set().
Evaluation methods for elements of various topologies.
Definition at line 415 of file ElemEvaluator.hpp.
Referenced by eval(), get_eval_set(), get_normal(), inside(), integrate(), jacobian(), reverse_eval(), set_ent_handle(), and set_eval_set().
|
private |
Definition at line 379 of file ElemEvaluator.hpp.
Referenced by find_containing_entity(), get_moab(), integrate(), set_ent_handle(), set_eval_set(), set_tag(), and set_tag_handle().
|
private |
Number of values in this tag.
Definition at line 406 of file ElemEvaluator.hpp.
Referenced by eval(), integrate(), set_tag(), and set_tag_handle().
|
private |
Number of vertices cached here.
Definition at line 391 of file ElemEvaluator.hpp.
Referenced by get_normal(), get_num_verts(), integrate(), jacobian(), reverse_eval(), set_ent_handle(), set_eval_set(), set_tag(), and set_tag_handle().
|
private |
Whether tag is coordinates or something else.
Definition at line 403 of file ElemEvaluator.hpp.
Referenced by eval(), integrate(), set_tag(), and set_tag_handle().
|
private |
Dimension of entities from which to grab tag.
Definition at line 409 of file ElemEvaluator.hpp.
Referenced by get_tagged_ent_dim(), integrate(), set_tag(), and set_tag_handle().
|
private |
Tag being evaluated.
Definition at line 400 of file ElemEvaluator.hpp.
Referenced by get_tag_handle(), integrate(), set_ent_handle(), set_tag(), and set_tag_handle().
|
private |
Tag space.
Definition at line 412 of file ElemEvaluator.hpp.
Referenced by eval(), integrate(), set_tag(), and set_tag_handle().
|
private |
Cached copy of vertex handle ptr.
Definition at line 394 of file ElemEvaluator.hpp.
Referenced by get_vert_handles(), integrate(), set_ent_handle(), set_tag(), and set_tag_handle().
|
private |
Cached copy of vertex positions.
Definition at line 397 of file ElemEvaluator.hpp.
Referenced by eval(), get_normal(), get_vert_pos(), integrate(), jacobian(), reverse_eval(), set_ent_handle(), and set_eval_set().
|
private |
Work space for element-specific data.
Definition at line 418 of file ElemEvaluator.hpp.
Referenced by eval(), get_work_space(), integrate(), jacobian(), reverse_eval(), set_ent_handle(), set_eval_set(), and ~ElemEvaluator().