https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NearestNodeLocator.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12// Moose
13#include "Restartable.h"
14#include "PerfGraphInterface.h"
15
16// Forward declarations
17class SubProblem;
18class MooseMesh;
19
25{
26public:
27 NearestNodeLocator(SubProblem & subproblem,
29 BoundaryID boundary1,
30 BoundaryID boundary2);
31
33
37 void findNodes();
38
43 void reinit();
44
48 Real distance(dof_id_type node_id);
49
53 const Node * nearestNode(dof_id_type node_id);
54
58 std::vector<dof_id_type> & secondaryNodes() { return _secondary_nodes; }
59
65
70 void updatePatch(std::vector<dof_id_type> & secondary_nodes);
71
76 void updateGhostedElems();
77
82 {
83 public:
85
86 const Node * _nearest_node;
88 };
89
90protected:
92
94
95 std::unique_ptr<NodeIdRange> _secondary_node_range;
96
97public:
98 std::map<dof_id_type, NearestNodeInfo> _nearest_node_info;
99
102
103 bool _first;
104
105 // Compute neighborhood nodes around the secondary nodes if iteration update strategy is selected.
106 // This flag is required for (at least initial) adaptivity in parallel and is set to true on
107 // reinit()
109
110 std::vector<dof_id_type> _secondary_nodes;
111
112 std::map<dof_id_type, std::vector<dof_id_type>> _neighbor_nodes;
113
114 // The following parameter controls the patch size that is searched for each nearest neighbor
115 static const unsigned int _patch_size;
116
117 // Contact patch update strategy
119
120 // The furthest through the patch that had to be searched for any node last time
122
123 // The list of ghosted elements added during a time step for iteration patch update strategy
124 std::vector<dof_id_type> _new_ghosted_elems;
125};
boundary_id_type BoundaryID
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
Data structure used to hold nearest node info.
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around.
const Moose::PatchUpdateType _patch_update_strategy
static const unsigned int _patch_size
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.
std::map< dof_id_type, std::vector< dof_id_type > > _neighbor_nodes
std::unique_ptr< NodeIdRange > _secondary_node_range
std::vector< dof_id_type > & secondaryNodes()
Returns the list of secondary nodes this Locator is tracking.
NodeIdRange & secondaryNodeRange()
Returns the NodeIdRange of secondary nodes to be used for calling threaded functions operating on the...
std::vector< dof_id_type > _new_ghosted_elems
void updatePatch(std::vector< dof_id_type > &secondary_nodes)
Reconstructs the KDtree, updates the patch for the nodes in secondary_nodes, and updates the closest ...
Real distance(dof_id_type node_id)
Valid to call this after findNodes() has been called to get the distance to the nearest node.
std::vector< dof_id_type > _secondary_nodes
void reinit()
Completely redo the search from scratch.
std::map< dof_id_type, NearestNodeInfo > _nearest_node_info
void findNodes()
This is the main method that is going to start the search.
void updateGhostedElems()
Updates the ghosted elements at the start of the time step for iteration patch update strategy.
Interface for objects interacting with the PerfGraph.
A class for creating restricted objects.
Definition Restartable.h:29
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
MeshBase & mesh
PatchUpdateType
Type of patch update strategy for modeling node-face constraints or contact.