libMesh::PointLocatorBase Class Reference
#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 =0 |
| bool | initialized () const |
| virtual void | enable_out_of_mesh_mode (void)=0 |
| virtual void | disable_out_of_mesh_mode (void)=0 |
Static Public Member Functions | |
| static AutoPtr< PointLocatorBase > | build (const 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 () |
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 |
Static Protected Attributes | |
| static Counts | _counts |
| static Threads::atomic < unsigned int > | _n_objects |
| static Threads::spin_mutex | _mutex |
| static bool | _enable_print_counter = true |
Detailed Description
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 57 of file point_locator_base.h.
Member Typedef Documentation
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.
Constructor & Destructor Documentation
| 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.
00037 : 00038 _master (master), 00039 _mesh (mesh), 00040 _initialized (false) 00041 { 00042 }
| libMesh::PointLocatorBase::~PointLocatorBase | ( | ) | [virtual] |
Member Function Documentation
| AutoPtr< PointLocatorBase > libMesh::PointLocatorBase::build | ( | const 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 AutoPtr<PointLocatorBase> is returned to prevent memory leak. This way the user need not remember to delete the object.
Definition at line 56 of file point_locator_base.C.
References libMesh::err, libMeshEnums::LIST, and libMeshEnums::TREE.
Referenced by libMesh::MeshBase::point_locator(), and libMesh::MeshBase::sub_point_locator().
00059 { 00060 switch (t) 00061 { 00062 case TREE: 00063 { 00064 AutoPtr<PointLocatorBase> ap(new PointLocatorTree(mesh, 00065 master)); 00066 return ap; 00067 } 00068 00069 case LIST: 00070 { 00071 AutoPtr<PointLocatorBase> ap(new PointLocatorList(mesh, 00072 master)); 00073 return ap; 00074 } 00075 00076 default: 00077 { 00078 libMesh::err << "ERROR: Bad PointLocatorType = " << t << std::endl; 00079 libmesh_error(); 00080 } 00081 } 00082 00083 libmesh_error(); 00084 AutoPtr<PointLocatorBase> ap(NULL); 00085 return ap; 00086 }
| 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 | ( | void | ) | [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::PointLocatorList, and libMesh::PointLocatorTree.
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.
00107 { 00108 _enable_print_counter = false; 00109 return; 00110 }
| virtual void libMesh::PointLocatorBase::enable_out_of_mesh_mode | ( | void | ) | [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::PointLocatorList, and libMesh::PointLocatorTree.
Referenced by libMesh::MeshFunction::enable_out_of_mesh_mode(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), and libMesh::System::point_value().
| 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.
00101 { 00102 _enable_print_counter = true; 00103 return; 00104 }
| 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().
00048 { 00049 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG) 00050 00051 std::ostringstream oss; 00052 00053 oss << '\n' 00054 << " ---------------------------------------------------------------------------- \n" 00055 << "| Reference count information |\n" 00056 << " ---------------------------------------------------------------------------- \n"; 00057 00058 for (Counts::iterator it = _counts.begin(); 00059 it != _counts.end(); ++it) 00060 { 00061 const std::string name(it->first); 00062 const unsigned int creations = it->second.first; 00063 const unsigned int destructions = it->second.second; 00064 00065 oss << "| " << name << " reference count information:\n" 00066 << "| Creations: " << creations << '\n' 00067 << "| Destructions: " << destructions << '\n'; 00068 } 00069 00070 oss << " ---------------------------------------------------------------------------- \n"; 00071 00072 return oss.str(); 00073 00074 #else 00075 00076 return ""; 00077 00078 #endif 00079 }
| 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, and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
00164 { 00165 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00166 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00167 00168 p.first++; 00169 }
| 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, and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
00177 { 00178 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00179 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00180 00181 p.second++; 00182 }
| virtual void libMesh::PointLocatorBase::init | ( | ) | [pure virtual] |
Initializes the point locator, so that the operator() methods can be used. Pure virtual.
Implemented in libMesh::PointLocatorList, and libMesh::PointLocatorTree.
| bool libMesh::PointLocatorBase::initialized | ( | ) | const [inline] |
- Returns:
truewhen this object is properly initialized and ready for use,falseotherwise.
Definition at line 150 of file point_locator_base.h.
References _initialized.
Referenced by libMesh::PointLocatorTree::init(), and libMesh::PointLocatorList::init().
00151 { 00152 return (this->_initialized); 00153 }
| 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.
00080 { return _n_objects; }
Locates the element in which the point with global coordinates p is located. Pure virtual.
Implemented in libMesh::PointLocatorList, and libMesh::PointLocatorTree.
| 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().
00089 { 00090 if( _enable_print_counter ) out_stream << ReferenceCounter::get_info(); 00091 }
Member Data Documentation
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 142 of file point_locator_base.h.
Referenced by libMesh::PointLocatorTree::init(), libMesh::PointLocatorList::init(), initialized(), libMesh::PointLocatorTree::operator()(), and libMesh::PointLocatorList::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 132 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 137 of file point_locator_base.h.
Referenced by libMesh::PointLocatorTree::enable_out_of_mesh_mode(), libMesh::PointLocatorTree::init(), libMesh::PointLocatorList::init(), and libMesh::PointLocatorTree::operator()().
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().
The documentation for this class was generated from the following files:
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:34 UTC
Hosted By: