36 const unsigned int chunkmax = 1024;
37 const Real chunkfloat = 1024.0;
53 LOG_SCOPE(
"init()",
"LocationMap");
65 for (
unsigned int i=0; i != LIBMESH_DIM; ++i)
68 _lower_bound[i] =
std::min(_lower_bound[i],
70 _upper_bound[i] =
std::max(_upper_bound[i],
89 this->_map.insert(std::make_pair(this->key(this->point_of(t)), &t));
110 template <
typename T>
114 LOG_SCOPE(
"find()",
"LocationMap");
117 unsigned int pointkey = this->key(p);
120 for (
const auto & pr :
as_range(_map.equal_range(pointkey)))
125 for (
int xoffset = -1; xoffset != 2; ++xoffset)
127 for (
int yoffset = -1; yoffset != 2; ++yoffset)
129 for (
int zoffset = -1; zoffset != 2; ++zoffset)
131 auto key_pos = _map.equal_range(pointkey +
132 xoffset*chunkmax*chunkmax +
135 for (
const auto & pr :
as_range(key_pos))
147 template <
typename T>
150 Real xscaled = 0., yscaled = 0., zscaled = 0.;
152 Real deltax = _upper_bound[0] - _lower_bound[0];
155 xscaled = (p(0) - _lower_bound[0])/deltax;
159 Real deltay = _upper_bound[1] - _lower_bound[1];
162 yscaled = (p(1) - _lower_bound[1])/deltay;
167 Real deltaz = _upper_bound[2] - _lower_bound[2];
170 zscaled = (p(2) - _lower_bound[2])/deltaz;
173 unsigned int n0 =
static_cast<unsigned int> (chunkfloat * xscaled),
174 n1 = static_cast<unsigned int> (chunkfloat * yscaled),
175 n2 =
static_cast<unsigned int> (chunkfloat * zscaled);
177 return chunkmax*chunkmax*n0 + chunkmax*n1 + n2;
T * find(const Point &, const Real tol=TOLERANCE)
A geometric point in (x,y,z) space associated with a DOF.
The base class for all geometric element types.
const Parallel::Communicator & comm() const
Point point_of(const T &) const
static const Real TOLERANCE
virtual SimpleRange< element_iterator > active_element_ptr_range()=0
long double max(long double a, double b)
virtual bool is_serial() const
virtual SimpleRange< node_iterator > node_ptr_range()=0
SimpleRange< I > as_range(const std::pair< I, I > &p)
bool absolute_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
std::map-like data structure using hashed Points for keys.
unsigned int key(const Point &)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
long double min(long double a, double b)
A geometric point in (x,y,z) space.
virtual Point centroid() const