www.mooseframework.org
NearestNodeLocator.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef NEARESTNODELOCATOR_H
16 #define NEARESTNODELOCATOR_H
17 
18 // Moose
19 #include "Restartable.h"
20 
21 // Forward declarations
22 class SubProblem;
23 class MooseMesh;
24 
30 {
31 public:
32  NearestNodeLocator(SubProblem & subproblem,
33  MooseMesh & mesh,
34  BoundaryID boundary1,
35  BoundaryID boundary2);
36 
38 
42  void findNodes();
43 
48  void reinit();
49 
53  Real distance(dof_id_type node_id);
54 
58  const Node * nearestNode(dof_id_type node_id);
59 
63  std::vector<dof_id_type> & slaveNodes() { return _slave_nodes; }
64 
70 
75  {
76  public:
78 
79  const Node * _nearest_node;
80  Real _distance;
81  };
82 
83 protected:
85 
87 
89 
90 public:
91  std::map<dof_id_type, NearestNodeInfo> _nearest_node_info;
92 
95 
96  bool _first;
97  std::vector<dof_id_type> _slave_nodes;
98 
99  std::map<dof_id_type, std::vector<dof_id_type>> _neighbor_nodes;
100 
101  // The following parameter controls the patch size that is searched for each nearest neighbor
102  static const unsigned int _patch_size;
103 
104  // The furthest through the patch that had to be searched for any node last time
106 };
107 
108 #endif // NEARESTNODELOCATOR_H
std::map< dof_id_type, std::vector< dof_id_type > > _neighbor_nodes
void findNodes()
This is the main method that is going to start the search.
A class for creating restricted objects.
Definition: Restartable.h:31
StoredRange< std::vector< dof_id_type >::iterator, dof_id_type > NodeIdRange
Definition: MooseTypes.h:81
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
Real distance(dof_id_type node_id)
Valid to call this after findNodes() has been called to get the distance to the nearest node...
void reinit()
Completely redo the search from scratch.
NearestNodeLocator(SubProblem &subproblem, MooseMesh &mesh, BoundaryID boundary1, BoundaryID boundary2)
Data structure used to hold nearest node info.
std::map< dof_id_type, NearestNodeInfo > _nearest_node_info
std::vector< dof_id_type > & slaveNodes()
Returns the list of slave nodes this Locator is tracking.
std::vector< dof_id_type > _slave_nodes
NodeIdRange & slaveNodeRange()
Returns the NodeIdRange of slave nodes to be used for calling threaded functions operating on the sla...
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
NodeIdRange * _slave_node_range
static const unsigned int _patch_size
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
const Node * nearestNode(dof_id_type node_id)
Valid to call this after findNodes() has been called to get a pointer to the nearest node...
SubProblem & _subproblem
boundary_id_type BoundaryID
Definition: MooseTypes.h:75