#include <location_maps.h>
void init (MeshBase &)
void clear ()
void insert (T &)
bool empty () const
T * find (const Point &, const Real tol=TOLERANCE)
Point point_of (const T &) const
template<> Point point_of (const Elem &elem) const
unsigned int key (const Point &)
void fill (MeshBase &)
template<> void fill (MeshBase &mesh)
typedef std::unordered_multimap< unsigned int, T * > map_type
typedef std::tr1::unordered_multimap< unsigned int, T * > map_type
typedef std::hash_multimap< unsigned int, T * > map_type
typedef std::hash_multimap< unsigned int, T * > map_type
typedef __gnu_cxx::hash_multimap< unsigned int, T * > map_type
typedef std::multimap< unsigned int, T * > map_type
typedef std::multimap< unsigned int, T * > map_type
map_type _map
std::vector< Real > _lower_bound
std::vector< Real > _upper_bound
Definition at line 59 of file location_maps.h.
Definition at line 62 of file location_maps.h.
Definition at line 78 of file location_maps.h.
Definition at line 75 of file location_maps.h.
Definition at line 71 of file location_maps.h.
Definition at line 69 of file location_maps.h.
Definition at line 66 of file location_maps.h.
Definition at line 64 of file location_maps.h.
Definition at line 83 of file location_maps.h.
Referenced by MeshRefinement::clear().
{ _map.clear(); }
Definition at line 87 of file location_maps.h.
Referenced by MeshTools::correct_node_proc_ids(), MeshCommunication::make_nodes_parallel_consistent(), and Parallel::sync_dofobject_data_by_xyz().
{ return _map.empty(); }
Definition at line 215 of file location_maps.C.
References MeshBase::active_elements_begin(), and MeshBase::active_elements_end().
{
// Populate the elem map
MeshBase::element_iterator it = mesh.active_elements_begin(),
end = mesh.active_elements_end();
for (; it != end; ++it)
this->insert(**it);
}
Definition at line 128 of file location_maps.C.
References TypeVector< T >::absolute_fuzzy_equals().
Referenced by MeshRefinement::add_point(), and Parallel::sync_dofobject_data_by_xyz().
{
START_LOG('find()','LocationMap');
// Look for a likely key in the multimap
unsigned int pointkey = this->key(p);
// Look for the exact key first
std::pair<typename map_type::iterator,
typename map_type::iterator>
pos = _map.equal_range(pointkey);
while (pos.first != pos.second)
if (p.absolute_fuzzy_equals
(this->point_of(*(pos.first->second)), tol))
{
STOP_LOG('find()','LocationMap');
return pos.first->second;
}
else
++pos.first;
// Look for neighboring bins' keys next
for (int xoffset = -1; xoffset != 2; ++xoffset)
{
for (int yoffset = -1; yoffset != 2; ++yoffset)
{
for (int zoffset = -1; zoffset != 2; ++zoffset)
{
std::pair<typename map_type::iterator,
typename map_type::iterator>
pos = _map.equal_range(pointkey +
xoffset*chunkmax*chunkmax +
yoffset*chunkmax +
zoffset);
while (pos.first != pos.second)
if (p.absolute_fuzzy_equals
(this->point_of(*(pos.first->second)), tol))
{
STOP_LOG('find()','LocationMap');
return pos.first->second;
}
else
++pos.first;
}
}
}
STOP_LOG('find()','LocationMap');
return NULL;
}
Definition at line 49 of file location_maps.C.
References MeshBase::is_serial(), std::max(), std::min(), MeshBase::nodes_begin(), and MeshBase::nodes_end().
Referenced by MeshCommunication::make_nodes_parallel_consistent(), and MeshRefinement::update_nodes_map().
{
// This function must be run on all processors at once
// for non-serial meshes
if (!mesh.is_serial())
parallel_only();
START_LOG('init()', 'LocationMap');
// Clear the old map
_map.clear();
// Cache a bounding box
_lower_bound.clear();
_lower_bound.resize(3, std::numeric_limits<Real>::max());
_upper_bound.clear();
_upper_bound.resize(3, -std::numeric_limits<Real>::max());
MeshBase::node_iterator it = mesh.nodes_begin();
const MeshBase::node_iterator end = mesh.nodes_end();
for (; it != end; ++it)
{
Node* node = *it;
// Expand the bounding box if necessary
_lower_bound[0] = std::min(_lower_bound[0],
(*node)(0));
_lower_bound[1] = std::min(_lower_bound[1],
(*node)(1));
_lower_bound[2] = std::min(_lower_bound[2],
(*node)(2));
_upper_bound[0] = std::max(_upper_bound[0],
(*node)(0));
_upper_bound[1] = std::max(_upper_bound[1],
(*node)(1));
_upper_bound[2] = std::max(_upper_bound[2],
(*node)(2));
}
// On a parallel mesh we might not yet have a full bounding box
if (!mesh.is_serial())
{
Parallel::min(_lower_bound);
Parallel::max(_upper_bound);
}
this->fill(mesh);
STOP_LOG('init()', 'LocationMap');
}
Definition at line 104 of file location_maps.C.
Referenced by MeshRefinement::add_point(), and LocationMap< Node >::fill().
{
this->_map.insert(std::make_pair(this->key(this->point_of(t)), &t));
}
Definition at line 184 of file location_maps.C.
{
Real xscaled = (p(0) - _lower_bound[0])/
(_upper_bound[0] - _lower_bound[0]),
yscaled = (p(1) - _lower_bound[1])/
(_upper_bound[1] - _lower_bound[1]),
zscaled = (p(2) - _lower_bound[2])/
(_upper_bound[2] - _lower_bound[2]);
unsigned int n0 = static_cast<unsigned int> (chunkfloat * xscaled),
n1 = static_cast<unsigned int> (chunkfloat * yscaled),
n2 = static_cast<unsigned int> (chunkfloat * zscaled);
return chunkmax*chunkmax*n0 + chunkmax*n1 + n2;
}
Definition at line 120 of file location_maps.C.
References Elem::centroid().
{
return elem.centroid();
}
Referenced by Parallel::sync_dofobject_data_by_xyz().
Definition at line 101 of file location_maps.h.
Definition at line 100 of file location_maps.h.
Referenced by LocationMap< Node >::clear(), and LocationMap< Node >::empty().
Definition at line 102 of file location_maps.h.
Generated automatically by Doxygen for libMesh from the source code.