$extrastylesheet
#include <tree.h>

Public Member Functions | |
| Tree (const MeshBase &m, unsigned int target_bin_size, Trees::BuildType bt=Trees::NODES) | |
| Tree (const Tree< N > &other_tree) | |
| ~Tree () | |
| void | print_nodes (std::ostream &my_out=libMesh::out) const |
| void | print_elements (std::ostream &my_out=libMesh::out) const |
| unsigned int | n_active_bins () const |
| const Elem * | find_element (const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=NULL, Real relative_tol=TOLERANCE) const |
| const Elem * | operator() (const Point &p, const std::set< subdomain_id_type > *allowed_subdomains=NULL, Real relative_tol=TOLERANCE) const |
Static Public Member Functions | |
| 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 | |
| void | increment_constructor_count (const std::string &name) |
| void | increment_destructor_count (const std::string &name) |
Protected Attributes | |
| const MeshBase & | mesh |
Static Protected Attributes | |
| static Counts | _counts |
| static Threads::atomic < unsigned int > | _n_objects |
| static Threads::spin_mutex | _mutex |
| static bool | _enable_print_counter = true |
Private Attributes | |
| TreeNode< N > | root |
| const Trees::BuildType | build_type |
This class defines a tree that may be used for fast point location in space.
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::Tree< N >::Tree | ( | const MeshBase & | m, |
| unsigned int | target_bin_size, | ||
| Trees::BuildType | bt = Trees::NODES |
||
| ) |
Constructor. Requires a mesh and the target bin size. Optionally takes the build method.
Definition at line 37 of file tree.C.
References libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::MeshTools::bounding_box(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::Tree< N >::build_type, libMesh::Trees::ELEMENTS, end, libMesh::libmesh_assert(), libMesh::Trees::LOCAL_ELEMENTS, libMesh::TreeBase::mesh, libMesh::Trees::NODES, libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), and libMesh::Tree< N >::root.
: TreeBase(m), root(m,target_bin_size), build_type(bt) { // Set the root node bounding box equal to the bounding // box for the entire domain. root.set_bounding_box (MeshTools::bounding_box(mesh)); if (build_type == Trees::NODES) { // Add all the nodes to the root node. It will // automagically build the tree for us. MeshBase::const_node_iterator it = mesh.nodes_begin(); const MeshBase::const_node_iterator end = mesh.nodes_end(); for (; it != end; ++it) { #ifndef NDEBUG bool node_was_inserted = #endif root.insert (*it); libmesh_assert(node_was_inserted); } // Now the tree contains the nodes. // However, we want element pointers, so here we // convert between the two. std::vector<std::vector<const Elem*> > nodes_to_elem; MeshTools::build_nodes_to_elem_map (mesh, nodes_to_elem); root.transform_nodes_to_elements (nodes_to_elem); } else if (build_type == Trees::ELEMENTS) { // Add all active elements to the root node. It will // automatically build the tree for us. MeshBase::const_element_iterator it = mesh.active_elements_begin(); const MeshBase::const_element_iterator end = mesh.active_elements_end(); for (; it != end; ++it) { #ifndef NDEBUG bool elem_was_inserted = #endif root.insert (*it); libmesh_assert(elem_was_inserted); } } else if (build_type == Trees::LOCAL_ELEMENTS) { // Add all active, local elements to the root node. It will // automatically build the tree for us. MeshBase::const_element_iterator it = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end = mesh.active_local_elements_end(); for (; it != end; ++it) { #ifndef NDEBUG bool elem_was_inserted = #endif root.insert (*it); libmesh_assert(elem_was_inserted); } } else libmesh_error_msg("Unknown build_type = " << build_type); }
| libMesh::Tree< N >::Tree | ( | const Tree< N > & | other_tree | ) |
Copy-constructor. Not currently implemented.
Definition at line 115 of file tree.C.
: TreeBase (other_tree), root (other_tree.root), build_type (other_tree.build_type) { libmesh_not_implemented(); }
| libMesh::Tree< N >::~Tree | ( | ) | [inline] |
| 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;
}
| 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;
}
| const Elem * libMesh::Tree< N >::find_element | ( | const Point & | p, |
| const std::set< subdomain_id_type > * | allowed_subdomains = NULL, |
||
| Real | relative_tol = TOLERANCE |
||
| ) | const [virtual] |
Implements libMesh::TreeBase.
Definition at line 149 of file tree.C.
{
return root.find_element(p, allowed_subdomains, relative_tol);
}
| 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++;
}
| unsigned int libMesh::Tree< N >::n_active_bins | ( | ) | const [inline, virtual] |
Implements libMesh::TreeBase.
Definition at line 75 of file tree.h.
References libMesh::Tree< N >::root.
{ return root.n_active_bins(); }
| 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; }
| const Elem * libMesh::Tree< N >::operator() | ( | const Point & | p, |
| const std::set< subdomain_id_type > * | allowed_subdomains = NULL, |
||
| Real | relative_tol = TOLERANCE |
||
| ) | const |
Definition at line 160 of file tree.C.
{
return this->find_element(p, allowed_subdomains, relative_tol);
}
| void libMesh::Tree< N >::print_elements | ( | std::ostream & | my_out = libMesh::out | ) | const [virtual] |
Prints the nodes.
Implements libMesh::TreeBase.
Definition at line 138 of file tree.C.
{
my_out << "Printing elements...\n";
root.print_elements(my_out);
}
| 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::Tree< N >::print_nodes | ( | std::ostream & | my_out = libMesh::out | ) | const [virtual] |
Prints the nodes.
Implements libMesh::TreeBase.
Definition at line 129 of file tree.C.
{
my_out << "Printing nodes...\n";
root.print_nodes(my_out);
}
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().
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().
const Trees::BuildType libMesh::Tree< N >::build_type [private] |
How the tree is built.
Definition at line 106 of file tree.h.
Referenced by libMesh::Tree< N >::Tree().
const MeshBase& libMesh::TreeBase::mesh [protected, inherited] |
Constant reference to a mesh. Declared at construction.
Definition at line 107 of file tree_base.h.
Referenced by libMesh::Tree< N >::Tree().
TreeNode<N> libMesh::Tree< N >::root [private] |
The tree root.
Definition at line 101 of file tree.h.
Referenced by libMesh::Tree< N >::n_active_bins(), and libMesh::Tree< N >::Tree().