21 #include "libmesh/elem.h" 
   22 #include "libmesh/libmesh_logging.h" 
   23 #include "libmesh/location_maps.h" 
   24 #include "libmesh/mesh_base.h" 
   25 #include "libmesh/node.h" 
   26 #include "libmesh/parallel.h" 
   37 const unsigned int chunkmax = 1024;
 
   38 const Real chunkfloat = 1024.0;
 
   54   LOG_SCOPE(
"init()", 
"LocationMap");
 
   61   _lower_bound.resize(LIBMESH_DIM, std::numeric_limits<Real>::max());
 
   63   _upper_bound.resize(LIBMESH_DIM, -std::numeric_limits<Real>::max());
 
   66     for (
unsigned int i=0; i != LIBMESH_DIM; ++i)
 
   69         _lower_bound[i] = std::min(_lower_bound[i],
 
   71         _upper_bound[i] = std::max(_upper_bound[i],
 
   90   this->_map.insert(std::make_pair(this->key(this->point_of(t)), &t));
 
  111 template <
typename T>
 
  115   LOG_SCOPE(
"find()", 
"LocationMap");
 
  118   unsigned int pointkey = this->key(p);
 
  121   for (
const auto & pr : 
as_range(_map.equal_range(pointkey)))
 
  126   for (
int xoffset = -1; xoffset != 2; ++xoffset)
 
  128       for (
int yoffset = -1; yoffset != 2; ++yoffset)
 
  130           for (
int zoffset = -1; zoffset != 2; ++zoffset)
 
  132               auto key_pos = _map.equal_range(pointkey +
 
  133                                               xoffset*chunkmax*chunkmax +
 
  136               for (
const auto & pr : 
as_range(key_pos))
 
  148 template <
typename T>
 
  151   Real xscaled = 0., yscaled = 0., zscaled = 0.;
 
  153   Real deltax = _upper_bound[0] - _lower_bound[0];
 
  156     xscaled = (p(0) - _lower_bound[0])/deltax;
 
  160   Real deltay = _upper_bound[1] - _lower_bound[1];
 
  163     yscaled = (p(1) - _lower_bound[1])/deltay;
 
  168   Real deltaz = _upper_bound[2] - _lower_bound[2];
 
  171     zscaled = (p(2) - _lower_bound[2])/deltaz;
 
  174   unsigned int n0 = static_cast<unsigned int> (chunkfloat * xscaled),
 
  175     n1 = static_cast<unsigned int> (chunkfloat * yscaled),
 
  176     n2 = static_cast<unsigned int> (chunkfloat * zscaled);
 
  178   return chunkmax*chunkmax*n0 + chunkmax*n1 + n2;