Tool to facilitate spatial location of a point in a mesh. More...
#include <SpatialLocator.hpp>
Public Member Functions | |
SpatialLocator (Interface *impl, Range &elems, Tree *tree=NULL, ElemEvaluator *eval=NULL) | |
virtual | ~SpatialLocator () |
ErrorCode | add_elems (Range &elems) |
BoundBox & | local_box () |
const BoundBox & | local_box () const |
ErrorCode | locate_points (Range &vertices, EntityHandle *ents, double *params, int *is_inside=NULL, const double rel_iter_tol=1.0e-10, const double abs_iter_tol=1.0e-10, const double inside_tol=1.0e-6) |
ErrorCode | locate_points (const double *pos, int num_points, EntityHandle *ents, double *params, int *is_inside=NULL, const double rel_iter_tol=1.0e-10, const double abs_iter_tol=1.0e-10, const double inside_tol=1.0e-6) |
ErrorCode | locate_points (Range &ents, const double rel_iter_tol=1.0e-10, const double abs_iter_tol=1.0e-10, const double inside_tol=1.0e-6) |
ErrorCode | locate_points (const double *pos, int num_points, const double rel_iter_tol=1.0e-10, const double abs_iter_tol=1.0e-10, const double inside_tol=1.0e-6) |
int | local_num_located () |
int | remote_num_located () |
Interface * | moab () |
Return the MOAB interface associated with this locator. More... | |
ErrorCode | locate_point (const double *pos, EntityHandle &ent, double *params, int *is_inside=NULL, const double rel_iter_tol=1.0e-10, const double abs_iter_tol=1.0e-10, const double inside_tol=1.0e-6) |
Tree * | get_tree () |
TupleList & | loc_table () |
const TupleList & | loc_table () const |
TupleList & | par_loc_table () |
const TupleList & | par_loc_table () const |
ElemEvaluator * | elem_eval () |
const ElemEvaluator * | elem_eval () const |
void | elem_eval (ElemEvaluator *eval) |
SpatialLocatorTimes & | sl_times () |
Get spatial locator times object. More... | |
const SpatialLocatorTimes & | sl_times () const |
Get spatial locator times object. More... | |
Private Member Functions | |
void | create_tree () |
Private Attributes | |
Interface * | mbImpl |
Range | myElems |
int | myDim |
Tree * | myTree |
ElemEvaluator * | elemEval |
bool | iCreatedTree |
TupleList | locTable |
TupleList | parLocTable |
BoundBox | localBox |
BoundBox | globalBox |
CartVect | regDeltaXYZ |
int | regNums [3] |
std::map< int, BoundBox > | srcProcBoxes |
SpatialLocatorTimes | myTimes |
CpuTimer | myTimer |
bool | timerInitialized |
Tool to facilitate spatial location of a point in a mesh.
SpatialLocator facilitates searching for points in or performing ray traces on collections of mesh entities in 2D or 3D. This searching is facilitated by a tree-based decomposition of the mesh. Various types of trees are implemented in MOAB and can be used by this tool, but by default it uses AdaptiveKDTree (see child classes of Tree for which others are available). Parallel and serial searching are both supported.
SpatialLocator can either cache the search results for points or pass back this information in arguments. Cached information is kept in locTable, indexed in the same order as search points passed in. This information consists of the entity handle containing the point and the parametric coordinates inside that element. Information about the points searched, e.g. the entities from which those points are derived, can be stored in the calling application if desired.
In parallel, there is a separation between the proc deciding which points to search for (the "target" proc), and the proc locating the point in its local mesh (the "source" proc). On the source proc, location information is cached in locTable, as in the serial case. By default, this location information (handle and parametric coords) is not returned to the target proc, since it would be of no use there. Instead, the rank of the source proc locating the point, and the index of that location info in the source proc's locTable, is returned; this information is stored on the target proc in this class's parLocTable variable. Again, information about the points searched should be stored in the calling application, if desired.
This class uses the ElemEvaluator class for specification and evaluation of basis functions (used for computing parametric coords within an entity). See documentation and examples for that class for usage information.
Definition at line 56 of file SpatialLocator.hpp.
moab::SpatialLocator::SpatialLocator | ( | Interface * | impl, |
Range & | elems, | ||
Tree * | tree = NULL , |
||
ElemEvaluator * | eval = NULL |
||
) |
Definition at line 18 of file SpatialLocator.cpp.
References moab::Tree::build_tree(), create_tree(), moab::Interface::dimension_from_handle(), moab::Range::empty(), ErrorCode, moab::Tree::get_bounding_box(), localBox, MB_SUCCESS, mbImpl, myDim, myElems, myTree, moab::Range::rbegin(), and regNums.
|
inlinevirtual |
Definition at line 346 of file SpatialLocator.hpp.
References iCreatedTree, and myTree.
Definition at line 51 of file SpatialLocator.cpp.
References moab::Range::begin(), moab::Tree::build_tree(), moab::Interface::dimension_from_handle(), moab::Range::empty(), ErrorCode, mbImpl, myDim, myElems, myTree, and moab::Range::rbegin().
|
private |
Create a tree Tree type depends on what's in myElems: if empty or all vertices, creates a kdtree, otherwise creates a BVHTree.
Definition at line 37 of file SpatialLocator.cpp.
References moab::Range::empty(), iCreatedTree, mbImpl, MBVERTEX, myElems, myTree, moab::Range::rbegin(), and moab::Interface::type_from_handle().
Referenced by SpatialLocator().
|
inline |
Definition at line 208 of file SpatialLocator.hpp.
References elemEval.
Referenced by moab::DataCoupler::DataCoupler(), moab::DataCoupler::interpolate(), and moab::DataCoupler::~DataCoupler().
|
inline |
Definition at line 214 of file SpatialLocator.hpp.
References elemEval.
|
inline |
Definition at line 220 of file SpatialLocator.hpp.
References elemEval, myTree, and moab::Tree::set_eval().
|
inline |
Definition at line 174 of file SpatialLocator.hpp.
References myTree.
Referenced by DeformMeshRemap::execute().
|
inline |
Definition at line 181 of file SpatialLocator.hpp.
References locTable.
Referenced by moab::DataCoupler::interpolate().
|
inline |
Definition at line 188 of file SpatialLocator.hpp.
References locTable.
|
inline |
|
inline |
Definition at line 75 of file SpatialLocator.hpp.
References localBox.
int moab::SpatialLocator::local_num_located | ( | ) |
Definition at line 499 of file SpatialLocator.cpp.
References moab::TupleList::get_n(), locTable, nl, and moab::TupleList::vul_rd.
Referenced by DeformMeshRemap::execute().
|
inline |
Definition at line 351 of file SpatialLocator.hpp.
References locate_points().
Referenced by main().
ErrorCode moab::SpatialLocator::locate_points | ( | const double * | pos, |
int | num_points, | ||
const double | rel_iter_tol = 1.0e-10 , |
||
const double | abs_iter_tol = 1.0e-10 , |
||
const double | inside_tol = 1.0e-6 |
||
) |
Definition at line 382 of file SpatialLocator.cpp.
References moab::TupleList::enableWriteAccess(), ErrorCode, moab::TupleList::initialize(), locate_points(), locTable, MB_SUCCESS, myTimer, myTimes, moab::TupleList::set_n(), moab::SpatialLocatorTimes::slTimes, moab::SpatialLocatorTimes::SRC_SEARCH, moab::CpuTimer::time_elapsed(), timerInitialized, moab::TupleList::vi_wr, moab::TupleList::vr_wr, and moab::TupleList::vul_wr.
ErrorCode moab::SpatialLocator::locate_points | ( | const double * | pos, |
int | num_points, | ||
EntityHandle * | ents, | ||
double * | params, | ||
int * | is_inside = NULL , |
||
const double | rel_iter_tol = 1.0e-10 , |
||
const double | abs_iter_tol = 1.0e-10 , |
||
const double | inside_tol = 1.0e-6 |
||
) |
Definition at line 440 of file SpatialLocator.cpp.
References moab::debug, elemEval, ErrorCode, moab::Tree::get_eval(), MB_SUCCESS, myTimer, myTimes, myTree, moab::Tree::point_search(), moab::Tree::set_eval(), moab::SpatialLocatorTimes::slTimes, moab::SpatialLocatorTimes::SRC_SEARCH, moab::CpuTimer::time_elapsed(), and timerInitialized.
ErrorCode moab::SpatialLocator::locate_points | ( | Range & | ents, |
const double | rel_iter_tol = 1.0e-10 , |
||
const double | abs_iter_tol = 1.0e-10 , |
||
const double | inside_tol = 1.0e-6 |
||
) |
Definition at line 356 of file SpatialLocator.cpp.
References moab::Range::empty(), ErrorCode, moab::Interface::get_coords(), locate_points(), MB_SUCCESS, mbImpl, MBVERTEX, myTimer, myTimes, moab::Range::rbegin(), moab::Range::size(), moab::SpatialLocatorTimes::slTimes, moab::SpatialLocatorTimes::SRC_SEARCH, moab::CpuTimer::time_elapsed(), timerInitialized, and moab::Interface::type_from_handle().
ErrorCode moab::SpatialLocator::locate_points | ( | Range & | vertices, |
EntityHandle * | ents, | ||
double * | params, | ||
int * | is_inside = NULL , |
||
const double | rel_iter_tol = 1.0e-10 , |
||
const double | abs_iter_tol = 1.0e-10 , |
||
const double | inside_tol = 1.0e-6 |
||
) |
Definition at line 412 of file SpatialLocator.cpp.
References moab::Range::empty(), ErrorCode, moab::Interface::get_coords(), MB_SUCCESS, mbImpl, MBVERTEX, myTimer, myTimes, moab::Range::rbegin(), moab::Range::size(), moab::SpatialLocatorTimes::slTimes, moab::SpatialLocatorTimes::SRC_SEARCH, moab::CpuTimer::time_elapsed(), timerInitialized, and moab::Interface::type_from_handle().
Referenced by locate_point(), locate_points(), and moab::DataCoupler::locate_points().
|
inline |
Return the MOAB interface associated with this locator.
Definition at line 159 of file SpatialLocator.hpp.
References mbImpl.
|
inline |
Definition at line 195 of file SpatialLocator.hpp.
References parLocTable.
Referenced by moab::DataCoupler::interpolate().
|
inline |
Definition at line 202 of file SpatialLocator.hpp.
References parLocTable.
int moab::SpatialLocator::remote_num_located | ( | ) |
Definition at line 521 of file SpatialLocator.cpp.
References moab::TupleList::get_n(), parLocTable, and moab::TupleList::vi_rd.
|
inline |
Get spatial locator times object.
Definition at line 227 of file SpatialLocator.hpp.
References myTimes.
|
inline |
Get spatial locator times object.
Definition at line 233 of file SpatialLocator.hpp.
References myTimes.
|
private |
Definition at line 285 of file SpatialLocator.hpp.
Referenced by elem_eval(), and locate_points().
|
private |
Definition at line 318 of file SpatialLocator.hpp.
|
private |
Definition at line 288 of file SpatialLocator.hpp.
Referenced by create_tree(), and ~SpatialLocator().
|
private |
Definition at line 314 of file SpatialLocator.hpp.
Referenced by local_box(), and SpatialLocator().
|
private |
Definition at line 297 of file SpatialLocator.hpp.
Referenced by loc_table(), local_num_located(), and locate_points().
|
private |
Definition at line 273 of file SpatialLocator.hpp.
Referenced by add_elems(), create_tree(), locate_points(), moab(), and SpatialLocator().
|
private |
Definition at line 279 of file SpatialLocator.hpp.
Referenced by add_elems(), and SpatialLocator().
|
private |
Definition at line 276 of file SpatialLocator.hpp.
Referenced by add_elems(), create_tree(), and SpatialLocator().
|
private |
Definition at line 339 of file SpatialLocator.hpp.
Referenced by locate_points().
|
private |
Definition at line 335 of file SpatialLocator.hpp.
Referenced by locate_points(), and sl_times().
|
private |
Definition at line 282 of file SpatialLocator.hpp.
Referenced by add_elems(), create_tree(), elem_eval(), get_tree(), locate_points(), SpatialLocator(), and ~SpatialLocator().
|
private |
Definition at line 310 of file SpatialLocator.hpp.
Referenced by par_loc_table(), and remote_num_located().
|
private |
Definition at line 322 of file SpatialLocator.hpp.
|
private |
Definition at line 326 of file SpatialLocator.hpp.
Referenced by SpatialLocator().
|
private |
Definition at line 331 of file SpatialLocator.hpp.
|
private |
Definition at line 343 of file SpatialLocator.hpp.
Referenced by locate_points().