13 #include "libmesh/threads.h" 14 #include "libmesh/node.h" 20 : _max_patch_percentage(0.0), _mesh(
mesh), _neighbor_nodes(neighbor_nodes)
26 : _max_patch_percentage(x._max_patch_percentage),
28 _neighbor_nodes(x._neighbor_nodes)
41 for (
const auto & node_id : range)
45 const Node * closest_node = NULL;
48 const std::vector<dof_id_type> & neighbor_nodes =
_neighbor_nodes[node_id];
50 unsigned int n_neighbor_nodes = neighbor_nodes.size();
52 for (
unsigned int k = 0; k < n_neighbor_nodes; k++)
54 const Node * cur_node = &
_mesh.
nodeRef(neighbor_nodes[k]);
59 Real patch_percentage =
static_cast<Real>(k) / static_cast<Real>(n_neighbor_nodes);
66 closest_node = cur_node;
72 for (
unsigned int k = 0; k < n_neighbor_nodes; k++)
74 const Node * cur_node = &
_mesh.
nodeRef(neighbor_nodes[k]);
75 if (std::isnan((*cur_node)(0)) || std::isinf((*cur_node)(0)) ||
76 std::isnan((*cur_node)(1)) || std::isinf((*cur_node)(1)) ||
77 std::isnan((*cur_node)(2)) || std::isinf((*cur_node)(2)))
79 "Failure in NearestNodeThread because solution contains inf or not-a-number " 80 "entries. This is likely due to a failed factorization of the Jacobian " 88 info._nearest_node = closest_node;
89 info._distance = closest_distance;
std::map< dof_id_type, std::vector< dof_id_type > > & _neighbor_nodes
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
std::map< dof_id_type, NearestNodeLocator::NearestNodeInfo > _nearest_node_info
void join(const NearestNodeThread &other)
Real distance(const Point &p)
virtual const Node & nodeRef(const dof_id_type i) const
auto max(const L &left, const R &right)
Data structure used to hold nearest node info.
Real _max_patch_percentage
NearestNodeThread(const MooseMesh &mesh, std::map< dof_id_type, std::vector< dof_id_type >> &neighbor_nodes)
void operator()(const NodeIdRange &range)
Save a patch of nodes that are close to each of the secondary nodes to speed the search algorithm TOD...
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Provides a way for users to bail out of the current solve.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real