$extrastylesheet
#include <point_locator_base.h>

Public Member Functions | |
| virtual | ~PointLocatorBase () |
| virtual void | clear ()=0 |
| virtual void | init ()=0 |
| virtual const Elem * | operator() (const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=NULL) const =0 |
| bool | initialized () const |
| virtual void | enable_out_of_mesh_mode ()=0 |
| virtual void | disable_out_of_mesh_mode ()=0 |
| virtual void | set_close_to_point_tol (Real close_to_point_tol) |
| virtual void | unset_close_to_point_tol () |
Static Public Member Functions | |
| static UniquePtr < PointLocatorBase > | build (PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=NULL) |
| static std::string | get_info () |
| static void | print_info (std::ostream &out=libMesh::out) |
| static unsigned int | n_objects () |
| static void | enable_print_counter_info () |
| static void | disable_print_counter_info () |
Public Attributes | |
| bool | _verbose |
Protected Types | |
| typedef std::map< std::string, std::pair< unsigned int, unsigned int > > | Counts |
Protected Member Functions | |
| PointLocatorBase (const MeshBase &mesh, const PointLocatorBase *master) | |
| void | increment_constructor_count (const std::string &name) |
| void | increment_destructor_count (const std::string &name) |
Protected Attributes | |
| const PointLocatorBase * | _master |
| const MeshBase & | _mesh |
| bool | _initialized |
| bool | _use_close_to_point_tol |
| Real | _close_to_point_tol |
Static Protected Attributes | |
| static Counts | _counts |
| static Threads::atomic < unsigned int > | _n_objects |
| static Threads::spin_mutex | _mutex |
| static bool | _enable_print_counter = true |
This is the base class for point locators. They locate points in space: given a mesh they return the element and local coordinates for a given point in global coordinates.
Definition at line 54 of file point_locator_base.h.
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts [protected, inherited] |
Data structure to log the information. The log is identified by the class name.
Definition at line 113 of file reference_counter.h.
| libMesh::PointLocatorBase::PointLocatorBase | ( | const MeshBase & | mesh, |
| const PointLocatorBase * | master | ||
| ) | [protected] |
Constructor. Protected so that this base class cannot be explicitly instantiated. Takes a master PointLocator that helps in saving memory.
Definition at line 36 of file point_locator_base.C.
: _verbose (false), _master (master), _mesh (mesh), _initialized (false), _use_close_to_point_tol (false), _close_to_point_tol (TOLERANCE) { }
| libMesh::PointLocatorBase::~PointLocatorBase | ( | ) | [virtual] |
| UniquePtr< PointLocatorBase > libMesh::PointLocatorBase::build | ( | PointLocatorType | t, |
| const MeshBase & | mesh, | ||
| const PointLocatorBase * | master = NULL |
||
| ) | [static] |
Builds an PointLocator for the mesh mesh. Optionally takes a master PointLocator to save memory. An UniquePtr<PointLocatorBase> is returned to prevent memory leak. This way the user need not remember to delete the object.
Definition at line 64 of file point_locator_base.C.
References libMesh::Trees::ELEMENTS, libMesh::LIST, libMesh::Trees::LOCAL_ELEMENTS, libMesh::TREE, libMesh::TREE_ELEMENTS, and libMesh::TREE_LOCAL_ELEMENTS.
Referenced by libMesh::MeshBase::point_locator(), and libMesh::MeshBase::sub_point_locator().
{
switch (t)
{
case TREE:
return UniquePtr<PointLocatorBase>(new PointLocatorTree(mesh, /*Trees::NODES,*/ master));
case TREE_ELEMENTS:
return UniquePtr<PointLocatorBase>(new PointLocatorTree(mesh, Trees::ELEMENTS, master));
case TREE_LOCAL_ELEMENTS:
return UniquePtr<PointLocatorBase>(new PointLocatorTree(mesh, Trees::LOCAL_ELEMENTS, master));
case LIST:
return UniquePtr<PointLocatorBase>(new PointLocatorList(mesh, master));
default:
libmesh_error_msg("ERROR: Bad PointLocatorType = " << t);
}
libmesh_error_msg("We'll never get here!");
return UniquePtr<PointLocatorBase>();
}
| virtual void libMesh::PointLocatorBase::clear | ( | ) | [pure virtual] |
Clears the PointLocator.
Implemented in libMesh::PointLocatorList, and libMesh::PointLocatorTree.
| virtual void libMesh::PointLocatorBase::disable_out_of_mesh_mode | ( | ) | [pure virtual] |
Disables out-of-mesh mode (default). If asked to find a point that is contained in no mesh at all, the point locator will now crash.
Implemented in libMesh::PointLocatorTree, and libMesh::PointLocatorList.
Referenced by libMesh::MeshFunction::disable_out_of_mesh_mode().
| void libMesh::ReferenceCounter::disable_print_counter_info | ( | ) | [static, inherited] |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
Referenced by libMesh::LibMeshInit::LibMeshInit().
{
_enable_print_counter = false;
return;
}
| virtual void libMesh::PointLocatorBase::enable_out_of_mesh_mode | ( | ) | [pure virtual] |
Enables out-of-mesh mode. In this mode, if asked to find a point that is contained in no mesh at all, the point locator will return a NULL pointer instead of crashing. Per default, this mode is off.
Implemented in libMesh::PointLocatorTree, and libMesh::PointLocatorList.
Referenced by libMesh::MeshFunction::enable_out_of_mesh_mode(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), and libMesh::MeshFunction::set_point_locator_tolerance().
| void libMesh::ReferenceCounter::enable_print_counter_info | ( | ) | [static, inherited] |
Methods to enable/disable the reference counter output from print_info()
Definition at line 100 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
{
_enable_print_counter = true;
return;
}
| std::string libMesh::ReferenceCounter::get_info | ( | ) | [static, inherited] |
Gets a string containing the reference information.
Definition at line 47 of file reference_counter.C.
References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().
Referenced by libMesh::ReferenceCounter::print_info().
{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
std::ostringstream oss;
oss << '\n'
<< " ---------------------------------------------------------------------------- \n"
<< "| Reference count information |\n"
<< " ---------------------------------------------------------------------------- \n";
for (Counts::iterator it = _counts.begin();
it != _counts.end(); ++it)
{
const std::string name(it->first);
const unsigned int creations = it->second.first;
const unsigned int destructions = it->second.second;
oss << "| " << name << " reference count information:\n"
<< "| Creations: " << creations << '\n'
<< "| Destructions: " << destructions << '\n';
}
oss << " ---------------------------------------------------------------------------- \n";
return oss.str();
#else
return "";
#endif
}
| void libMesh::ReferenceCounter::increment_constructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 163 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.first++;
}
| void libMesh::ReferenceCounter::increment_destructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 176 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.second++;
}
| virtual void libMesh::PointLocatorBase::init | ( | ) | [pure virtual] |
Initializes the point locator, so that the operator() methods can be used. Pure virtual.
Implemented in libMesh::PointLocatorTree, and libMesh::PointLocatorList.
| bool libMesh::PointLocatorBase::initialized | ( | ) | const |
true when this object is properly initialized and ready for use, false otherwise. Definition at line 57 of file point_locator_base.C.
References _initialized.
Referenced by libMesh::PointLocatorTree::init(), and libMesh::PointLocatorList::init().
{
return this->_initialized;
}
| static unsigned int libMesh::ReferenceCounter::n_objects | ( | ) | [inline, static, inherited] |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 79 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
Referenced by libMesh::LibMeshInit::~LibMeshInit().
{ return _n_objects; }
| virtual const Elem* libMesh::PointLocatorBase::operator() | ( | const Point & | p, |
| const std::set< subdomain_id_type > * | allowed_subdomains = NULL |
||
| ) | const [pure virtual] |
Locates the element in which the point with global coordinates p is located. Pure virtual. Optionally allows the user to restrict the subdomains searched.
Implemented in libMesh::PointLocatorTree, and libMesh::PointLocatorList.
| void libMesh::ReferenceCounter::print_info | ( | std::ostream & | out = libMesh::out | ) | [static, inherited] |
Prints the reference information, by default to libMesh::out.
Definition at line 88 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
Referenced by libMesh::LibMeshInit::~LibMeshInit().
{
if( _enable_print_counter ) out_stream << ReferenceCounter::get_info();
}
| void libMesh::PointLocatorBase::set_close_to_point_tol | ( | Real | close_to_point_tol | ) | [virtual] |
Set a tolerance to use when determining if a point is contained within the mesh.
Reimplemented in libMesh::PointLocatorList.
Definition at line 90 of file point_locator_base.C.
References _close_to_point_tol, and _use_close_to_point_tol.
Referenced by libMesh::MeshFunction::set_point_locator_tolerance().
{
_use_close_to_point_tol = true;
_close_to_point_tol = close_to_point_tol;
}
| void libMesh::PointLocatorBase::unset_close_to_point_tol | ( | ) | [virtual] |
Specify that we do not want to use a user-specified tolerance to determine if a point is contained within the mesh.
Reimplemented in libMesh::PointLocatorList.
Definition at line 97 of file point_locator_base.C.
References _close_to_point_tol, _use_close_to_point_tol, and libMesh::TOLERANCE.
Referenced by libMesh::MeshFunction::unset_point_locator_tolerance().
{
_use_close_to_point_tol = false;
_close_to_point_tol = TOLERANCE;
}
Real libMesh::PointLocatorBase::_close_to_point_tol [protected] |
The tolerance to use.
Definition at line 164 of file point_locator_base.h.
Referenced by libMesh::PointLocatorTree::operator()(), set_close_to_point_tol(), and unset_close_to_point_tol().
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts [static, protected, inherited] |
Actually holds the data.
Definition at line 118 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
bool libMesh::ReferenceCounter::_enable_print_counter = true [static, protected, inherited] |
Flag to control whether reference count information is printed when print_info is called.
Definition at line 137 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().
bool libMesh::PointLocatorBase::_initialized [protected] |
true when properly initialized, false otherwise.
Definition at line 153 of file point_locator_base.h.
Referenced by libMesh::PointLocatorTree::init(), libMesh::PointLocatorList::init(), initialized(), libMesh::PointLocatorList::operator()(), and libMesh::PointLocatorTree::operator()().
const PointLocatorBase* libMesh::PointLocatorBase::_master [protected] |
Const pointer to our master, initialized to NULL if none given. When using multiple PointLocators, one can be assigned master and be in charge of something that all can have access to.
Definition at line 143 of file point_locator_base.h.
Referenced by libMesh::PointLocatorTree::clear(), libMesh::PointLocatorList::clear(), libMesh::PointLocatorTree::init(), and libMesh::PointLocatorList::init().
const MeshBase& libMesh::PointLocatorBase::_mesh [protected] |
constant reference to the mesh in which the point is looked for.
Definition at line 148 of file point_locator_base.h.
Referenced by libMesh::PointLocatorTree::enable_out_of_mesh_mode(), libMesh::PointLocatorTree::init(), libMesh::PointLocatorList::init(), and libMesh::PointLocatorTree::perform_linear_search().
Threads::spin_mutex libMesh::ReferenceCounter::_mutex [static, protected, inherited] |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 131 of file reference_counter.h.
Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects [static, protected, inherited] |
The number of objects. Print the reference count information when the number returns to 0.
Definition at line 126 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
bool libMesh::PointLocatorBase::_use_close_to_point_tol [protected] |
true if we will use a user-specified tolerance for locating the element.
Definition at line 159 of file point_locator_base.h.
Referenced by libMesh::PointLocatorTree::operator()(), set_close_to_point_tol(), and unset_close_to_point_tol().
Boolean flag to indicate whether to print out extra info.
Definition at line 135 of file point_locator_base.h.
Referenced by libMesh::PointLocatorTree::operator()().