www.mooseframework.org
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | List of all members
GeometricSearchData Class Reference

#include <GeometricSearchData.h>

Public Types

enum  GeometricSearchType {
  ALL, NEAREST_NODE, PENETRATION, QUADRATURE,
  MORTAR, ELEMENTPAIR
}
 Used to select groups of geometric search objects to update. More...
 

Public Member Functions

 GeometricSearchData (SubProblem &subproblem, MooseMesh &mesh)
 
virtual ~GeometricSearchData ()
 
PenetrationLocatorgetPenetrationLocator (const BoundaryName &master, const BoundaryName &slave, Order order=FIRST)
 
PenetrationLocatorgetQuadraturePenetrationLocator (const BoundaryName &master, const BoundaryName &slave, Order order=FIRST)
 
PenetrationLocatorgetMortarPenetrationLocator (const BoundaryName &master, const BoundaryName &slave, Moose::ConstraintType side_type, Order order=FIRST)
 
NearestNodeLocatorgetNearestNodeLocator (const BoundaryName &master, const BoundaryName &slave)
 
NearestNodeLocatorgetNearestNodeLocator (const unsigned int master_id, const unsigned int slave_id)
 
NearestNodeLocatorgetQuadratureNearestNodeLocator (const BoundaryName &master, const BoundaryName &slave)
 
NearestNodeLocatorgetQuadratureNearestNodeLocator (const unsigned int master_id, const unsigned int slave_id)
 
NearestNodeLocatorgetMortarNearestNodeLocator (const BoundaryName &domain, const BoundaryName &slave, Moose::ConstraintType side_type)
 
NearestNodeLocatorgetMortarNearestNodeLocator (const unsigned int master_id, const unsigned int slave_id, Moose::ConstraintType side_type)
 
void addElementPairLocator (const unsigned int &interface_id, std::shared_ptr< ElementPairLocator > epl)
 
void update (GeometricSearchType type=ALL)
 Update all of the search objects. More...
 
void reinit ()
 Completely redo all geometric search objects. More...
 
void clearNearestNodeLocators ()
 Clear out the Penetration Locators so they will redo the search. More...
 
Real maxPatchPercentage ()
 Maximum percentage through the search patch that any NearestNodeLocator had to look. More...
 
void updateGhostedElems ()
 Updates the list of ghosted elements at the start of each time step for the nonlinear iteration patch update strategy. More...
 

Public Attributes

SubProblem_subproblem
 
MooseMesh_mesh
 
std::map< std::pair< unsigned int, unsigned int >, PenetrationLocator * > _penetration_locators
 
std::map< std::pair< unsigned int, unsigned int >, NearestNodeLocator * > _nearest_node_locators
 
std::map< unsigned int, std::shared_ptr< ElementPairLocator > > _element_pair_locators
 

Protected Attributes

std::set< unsigned int > _quadrature_boundaries
 These are real boundaries that have quadrature nodes on them. More...
 
std::map< unsigned int, unsigned int > _slave_to_qslave
 A mapping of the real boundary id to the slave boundary ids. More...
 
std::set< std::pair< unsigned int, unsigned int > > _mortar_boundaries
 These are real boundaries that have quadrature nodes on them. More...
 
std::map< unsigned int, unsigned int > _boundary_to_mortarboundary
 A mapping of the real boundary id to the slave boundary ids for mortar spaces. More...
 

Private Member Functions

void generateQuadratureNodes (unsigned int slave_id, unsigned int qslave_id)
 Add Quadrature Nodes to the Mesh in support of Quadrature based penetration location and nearest node searching. More...
 
void generateMortarNodes (unsigned int master_id, unsigned int slave_id, unsigned int qslave_id)
 Add Quadrature Nodes to the Mesh in support of mortar based penetration location and nearest node searching. More...
 
void updateQuadratureNodes (unsigned int slave_id)
 Update the positions of the quadrature nodes. More...
 
void reinitQuadratureNodes (unsigned int slave_id)
 Completely redo quadrature nodes. More...
 
void updateMortarNodes ()
 Update the positions of the quadrature nodes for mortar interfaces. More...
 
void reinitMortarNodes ()
 Completely redo quadrature nodes for mortar interfaces. More...
 

Private Attributes

bool _first
 Denotes whether this is the first time the geometric search objects have been updated. More...
 

Detailed Description

Definition at line 29 of file GeometricSearchData.h.

Member Enumeration Documentation

◆ GeometricSearchType

Used to select groups of geometric search objects to update.

Enumerator
ALL 
NEAREST_NODE 
PENETRATION 
QUADRATURE 
MORTAR 
ELEMENTPAIR 

Definition at line 33 of file GeometricSearchData.h.

Constructor & Destructor Documentation

◆ GeometricSearchData()

GeometricSearchData::GeometricSearchData ( SubProblem subproblem,
MooseMesh mesh 
)

Definition at line 21 of file GeometricSearchData.C.

22  : _subproblem(subproblem), _mesh(mesh), _first(true)
23 {
24 }
bool _first
Denotes whether this is the first time the geometric search objects have been updated.

◆ ~GeometricSearchData()

GeometricSearchData::~GeometricSearchData ( )
virtual

Definition at line 26 of file GeometricSearchData.C.

27 {
28  for (auto & it : _penetration_locators)
29  delete it.second;
30 
31  for (auto & it : _nearest_node_locators)
32  delete it.second;
33 }
std::map< std::pair< unsigned int, unsigned int >, PenetrationLocator * > _penetration_locators
std::map< std::pair< unsigned int, unsigned int >, NearestNodeLocator * > _nearest_node_locators

Member Function Documentation

◆ addElementPairLocator()

void GeometricSearchData::addElementPairLocator ( const unsigned int &  interface_id,
std::shared_ptr< ElementPairLocator epl 
)

Definition at line 389 of file GeometricSearchData.C.

391 {
392  _element_pair_locators[interface_id] = epl;
393 }
std::map< unsigned int, std::shared_ptr< ElementPairLocator > > _element_pair_locators

◆ clearNearestNodeLocators()

void GeometricSearchData::clearNearestNodeLocators ( )

Clear out the Penetration Locators so they will redo the search.

Definition at line 121 of file GeometricSearchData.C.

Referenced by FEProblemBase::possiblyRebuildGeomSearchPatches().

122 {
123  for (const auto & nnl_it : _nearest_node_locators)
124  {
125  NearestNodeLocator * nnl = nnl_it.second;
126  nnl->reinit();
127  }
128 }
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
void reinit()
Completely redo the search from scratch.
std::map< std::pair< unsigned int, unsigned int >, NearestNodeLocator * > _nearest_node_locators

◆ generateMortarNodes()

void GeometricSearchData::generateMortarNodes ( unsigned int  master_id,
unsigned int  slave_id,
unsigned int  qslave_id 
)
private

Add Quadrature Nodes to the Mesh in support of mortar based penetration location and nearest node searching.

Parameters
master_idThe id of the master node
slave_idThe actual slave_id (the one in the mesh)
qslave_idThe "fictitious" slave_id that is going to be used for this quadrature nodeset

Definition at line 396 of file GeometricSearchData.C.

Referenced by getMortarNearestNodeLocator(), and reinitMortarNodes().

399 {
400  // Have we already generated quadrature nodes for this boundary id?
401  if (_mortar_boundaries.find(std::pair<unsigned int, unsigned int>(master_id, slave_id)) !=
402  _mortar_boundaries.end())
403  return;
404 
405  _mortar_boundaries.insert(std::pair<unsigned int, unsigned int>(master_id, slave_id));
406 
407  MooseMesh::MortarInterface * iface = _mesh.getMortarInterface(master_id, slave_id);
408 
409  const MooseArray<Point> & qpoints = _subproblem.assembly(0).qPoints();
410  for (const auto & elem : iface->_elems)
411  {
413  _subproblem.assembly(0).reinit(elem);
414 
415  for (unsigned int qp = 0; qp < qpoints.size(); qp++)
416  _mesh.addQuadratureNode(elem, 0, qp, qslave_id, qpoints[qp]);
417  }
418 }
Node * addQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp, BoundaryID bid, const Point &point)
Adds a fictitious "QuadratureNode".
Definition: MooseMesh.C:961
virtual Assembly & assembly(THREAD_ID tid)=0
virtual void setCurrentSubdomainID(const Elem *elem, THREAD_ID tid)=0
std::vector< Elem * > _elems
List of elements on this interface.
Definition: MooseMesh.h:780
const MooseArray< Point > & qPoints()
Returns the reference to the quadrature points.
Definition: Assembly.h:216
MooseMesh::MortarInterface * getMortarInterface(BoundaryID master, BoundaryID slave)
Definition: MooseMesh.C:2651
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
Definition: Assembly.C:709
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:245
std::set< std::pair< unsigned int, unsigned int > > _mortar_boundaries
These are real boundaries that have quadrature nodes on them.

◆ generateQuadratureNodes()

void GeometricSearchData::generateQuadratureNodes ( unsigned int  slave_id,
unsigned int  qslave_id 
)
private

Add Quadrature Nodes to the Mesh in support of Quadrature based penetration location and nearest node searching.

Parameters
slave_idThe actual slave_id (the one in the mesh)
qslave_idThe "fictitious" slave_id that is going to be used for this quadrature nodeset

Definition at line 315 of file GeometricSearchData.C.

Referenced by reinitQuadratureNodes(), and update().

316 {
317  // Have we already generated quadrature nodes for this boundary id?
318  if (_quadrature_boundaries.find(slave_id) != _quadrature_boundaries.end())
319  return;
320 
321  _quadrature_boundaries.insert(slave_id);
322 
323  const MooseArray<Point> & points_face = _subproblem.assembly(0).qPointsFace();
324 
326  for (const auto & belem : range)
327  {
328  const Elem * elem = belem->_elem;
329  unsigned short int side = belem->_side;
330  BoundaryID boundary_id = belem->_bnd_id;
331 
332  if (elem->processor_id() == _subproblem.processor_id())
333  {
334  if (boundary_id == (BoundaryID)slave_id)
335  {
337  _subproblem.prepare(elem, 0);
338  _subproblem.reinitElemFace(elem, side, boundary_id, 0);
339 
340  for (unsigned int qp = 0; qp < points_face.size(); qp++)
341  _mesh.addQuadratureNode(elem, side, qp, qslave_id, points_face[qp]);
342  }
343  }
344  }
345 }
Node * addQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp, BoundaryID bid, const Point &point)
Adds a fictitious "QuadratureNode".
Definition: MooseMesh.C:961
std::set< unsigned int > _quadrature_boundaries
These are real boundaries that have quadrature nodes on them.
const MooseArray< Point > & qPointsFace()
Returns the reference to the current quadrature being used.
Definition: Assembly.h:252
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
Definition: MooseMesh.h:1244
virtual Assembly & assembly(THREAD_ID tid)=0
virtual void setCurrentSubdomainID(const Elem *elem, THREAD_ID tid)=0
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)=0
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:245
virtual void prepare(const Elem *elem, THREAD_ID tid)=0
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
Definition: MooseMesh.C:843
boundary_id_type BoundaryID
Definition: MooseTypes.h:93

◆ getMortarNearestNodeLocator() [1/2]

NearestNodeLocator & GeometricSearchData::getMortarNearestNodeLocator ( const BoundaryName &  domain,
const BoundaryName &  slave,
Moose::ConstraintType  side_type 
)

Definition at line 348 of file GeometricSearchData.C.

Referenced by GeometricSearchInterface::getMortarNearestNodeLocator(), and getMortarPenetrationLocator().

351 {
352  unsigned int master_id = _mesh.getBoundaryID(master);
353  unsigned int slave_id = _mesh.getBoundaryID(slave);
354 
355  return getMortarNearestNodeLocator(master_id, slave_id, side_type);
356 }
NearestNodeLocator & getMortarNearestNodeLocator(const BoundaryName &domain, const BoundaryName &slave, Moose::ConstraintType side_type)
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:1043

◆ getMortarNearestNodeLocator() [2/2]

NearestNodeLocator & GeometricSearchData::getMortarNearestNodeLocator ( const unsigned int  master_id,
const unsigned int  slave_id,
Moose::ConstraintType  side_type 
)

Definition at line 359 of file GeometricSearchData.C.

362 {
363  unsigned int mortarboundary_id, boundary;
364 
365  switch (side_type)
366  {
367  case Moose::Master:
368  boundary = master_id;
369  mortarboundary_id = MORTAR_BASE_ID + slave_id;
370  _boundary_to_mortarboundary[slave_id] = mortarboundary_id;
371  break;
372 
373  case Moose::Slave:
374  boundary = slave_id;
375  mortarboundary_id = MORTAR_BASE_ID + master_id;
376  _boundary_to_mortarboundary[master_id] = mortarboundary_id;
377  break;
378 
379  default:
380  mooseError("Unknown side type");
381  }
382 
383  generateMortarNodes(master_id, slave_id, 1001);
384 
385  return getNearestNodeLocator(boundary, 1001);
386 }
static const unsigned int MORTAR_BASE_ID
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
NearestNodeLocator & getNearestNodeLocator(const BoundaryName &master, const BoundaryName &slave)
std::map< unsigned int, unsigned int > _boundary_to_mortarboundary
A mapping of the real boundary id to the slave boundary ids for mortar spaces.
void generateMortarNodes(unsigned int master_id, unsigned int slave_id, unsigned int qslave_id)
Add Quadrature Nodes to the Mesh in support of mortar based penetration location and nearest node sea...

◆ getMortarPenetrationLocator()

PenetrationLocator & GeometricSearchData::getMortarPenetrationLocator ( const BoundaryName &  master,
const BoundaryName &  slave,
Moose::ConstraintType  side_type,
Order  order = FIRST 
)

Definition at line 212 of file GeometricSearchData.C.

Referenced by GeometricSearchInterface::getMortarPenetrationLocator().

216 {
217  unsigned int master_id = _mesh.getBoundaryID(master);
218  unsigned int slave_id = _mesh.getBoundaryID(slave);
219 
220  // Generate a new boundary id
221  // TODO: Make this better!
222  unsigned int mortar_boundary_id = 0;
223  unsigned int boundary_id = 0;
224  switch (side_type)
225  {
226  case Moose::Master:
227  boundary_id = master_id;
228  mortar_boundary_id = MORTAR_BASE_ID + slave_id;
229  _boundary_to_mortarboundary[slave_id] = mortar_boundary_id;
230  break;
231 
232  case Moose::Slave:
233  boundary_id = slave_id;
234  mortar_boundary_id = MORTAR_BASE_ID + master_id;
235  _boundary_to_mortarboundary[master_id] = mortar_boundary_id;
236  break;
237  }
238 
239  PenetrationLocator * pl =
240  _penetration_locators[std::pair<unsigned int, unsigned int>(boundary_id, mortar_boundary_id)];
241  if (!pl)
242  {
244  *this,
245  _mesh,
246  boundary_id,
247  mortar_boundary_id,
248  order,
249  getMortarNearestNodeLocator(master_id, slave_id, side_type));
250  _penetration_locators[std::pair<unsigned int, unsigned int>(boundary_id, mortar_boundary_id)] =
251  pl;
252  }
253 
254  return *pl;
255 }
static const unsigned int MORTAR_BASE_ID
NearestNodeLocator & getMortarNearestNodeLocator(const BoundaryName &domain, const BoundaryName &slave, Moose::ConstraintType side_type)
std::map< std::pair< unsigned int, unsigned int >, PenetrationLocator * > _penetration_locators
std::map< unsigned int, unsigned int > _boundary_to_mortarboundary
A mapping of the real boundary id to the slave boundary ids for mortar spaces.
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:1043

◆ getNearestNodeLocator() [1/2]

NearestNodeLocator & GeometricSearchData::getNearestNodeLocator ( const BoundaryName &  master,
const BoundaryName &  slave 
)

Definition at line 258 of file GeometricSearchData.C.

Referenced by getMortarNearestNodeLocator(), GeometricSearchInterface::getNearestNodeLocator(), getPenetrationLocator(), and getQuadratureNearestNodeLocator().

259 {
260  unsigned int master_id = _mesh.getBoundaryID(master);
261  unsigned int slave_id = _mesh.getBoundaryID(slave);
262 
263  _subproblem.addGhostedBoundary(master_id);
265 
266  return getNearestNodeLocator(master_id, slave_id);
267 }
NearestNodeLocator & getNearestNodeLocator(const BoundaryName &master, const BoundaryName &slave)
virtual void addGhostedBoundary(BoundaryID boundary_id)=0
Will make sure that all necessary elements from boundary_id are ghosted to this processor.
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:1043

◆ getNearestNodeLocator() [2/2]

NearestNodeLocator & GeometricSearchData::getNearestNodeLocator ( const unsigned int  master_id,
const unsigned int  slave_id 
)

Definition at line 270 of file GeometricSearchData.C.

272 {
273  NearestNodeLocator * nnl =
274  _nearest_node_locators[std::pair<unsigned int, unsigned int>(master_id, slave_id)];
275 
276  _subproblem.addGhostedBoundary(master_id);
278 
279  if (!nnl)
280  {
281  nnl = new NearestNodeLocator(_subproblem, _mesh, master_id, slave_id);
282  _nearest_node_locators[std::pair<unsigned int, unsigned int>(master_id, slave_id)] = nnl;
283  }
284 
285  return *nnl;
286 }
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
std::map< std::pair< unsigned int, unsigned int >, NearestNodeLocator * > _nearest_node_locators
virtual void addGhostedBoundary(BoundaryID boundary_id)=0
Will make sure that all necessary elements from boundary_id are ghosted to this processor.

◆ getPenetrationLocator()

PenetrationLocator & GeometricSearchData::getPenetrationLocator ( const BoundaryName &  master,
const BoundaryName &  slave,
Order  order = FIRST 
)

Definition at line 147 of file GeometricSearchData.C.

Referenced by DMSetUp_Moose_Pre(), and GeometricSearchInterface::getPenetrationLocator().

150 {
151  unsigned int master_id = _mesh.getBoundaryID(master);
152  unsigned int slave_id = _mesh.getBoundaryID(slave);
153 
154  _subproblem.addGhostedBoundary(master_id);
156 
157  PenetrationLocator * pl =
158  _penetration_locators[std::pair<unsigned int, unsigned int>(master_id, slave_id)];
159 
160  if (!pl)
161  {
163  *this,
164  _mesh,
165  master_id,
166  slave_id,
167  order,
168  getNearestNodeLocator(master_id, slave_id));
169  _penetration_locators[std::pair<unsigned int, unsigned int>(master_id, slave_id)] = pl;
170  }
171 
172  return *pl;
173 }
NearestNodeLocator & getNearestNodeLocator(const BoundaryName &master, const BoundaryName &slave)
std::map< std::pair< unsigned int, unsigned int >, PenetrationLocator * > _penetration_locators
virtual void addGhostedBoundary(BoundaryID boundary_id)=0
Will make sure that all necessary elements from boundary_id are ghosted to this processor.
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:1043

◆ getQuadratureNearestNodeLocator() [1/2]

NearestNodeLocator & GeometricSearchData::getQuadratureNearestNodeLocator ( const BoundaryName &  master,
const BoundaryName &  slave 
)

Definition at line 289 of file GeometricSearchData.C.

Referenced by GeometricSearchInterface::getQuadratureNearestNodeLocator(), and getQuadraturePenetrationLocator().

291 {
292  unsigned int master_id = _mesh.getBoundaryID(master);
293  unsigned int slave_id = _mesh.getBoundaryID(slave);
294 
295  _subproblem.addGhostedBoundary(master_id);
297 
298  return getQuadratureNearestNodeLocator(master_id, slave_id);
299 }
NearestNodeLocator & getQuadratureNearestNodeLocator(const BoundaryName &master, const BoundaryName &slave)
virtual void addGhostedBoundary(BoundaryID boundary_id)=0
Will make sure that all necessary elements from boundary_id are ghosted to this processor.
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:1043

◆ getQuadratureNearestNodeLocator() [2/2]

NearestNodeLocator & GeometricSearchData::getQuadratureNearestNodeLocator ( const unsigned int  master_id,
const unsigned int  slave_id 
)

Definition at line 302 of file GeometricSearchData.C.

304 {
305  // TODO: Make this better!
306  unsigned int base_id = 1e6;
307  unsigned int qslave_id = slave_id + base_id;
308 
309  _slave_to_qslave[slave_id] = qslave_id;
310 
311  return getNearestNodeLocator(master_id, qslave_id);
312 }
std::map< unsigned int, unsigned int > _slave_to_qslave
A mapping of the real boundary id to the slave boundary ids.
NearestNodeLocator & getNearestNodeLocator(const BoundaryName &master, const BoundaryName &slave)

◆ getQuadraturePenetrationLocator()

PenetrationLocator & GeometricSearchData::getQuadraturePenetrationLocator ( const BoundaryName &  master,
const BoundaryName &  slave,
Order  order = FIRST 
)

Definition at line 176 of file GeometricSearchData.C.

Referenced by GeometricSearchInterface::getQuadraturePenetrationLocator().

179 {
180  unsigned int master_id = _mesh.getBoundaryID(master);
181  unsigned int slave_id = _mesh.getBoundaryID(slave);
182 
183  _subproblem.addGhostedBoundary(master_id);
185 
186  // Generate a new boundary id
187  // TODO: Make this better!
188  unsigned int base_id = 1e6;
189  unsigned int qslave_id = slave_id + base_id;
190 
191  _slave_to_qslave[slave_id] = qslave_id;
192 
193  PenetrationLocator * pl =
194  _penetration_locators[std::pair<unsigned int, unsigned int>(master_id, qslave_id)];
195 
196  if (!pl)
197  {
199  *this,
200  _mesh,
201  master_id,
202  qslave_id,
203  order,
204  getQuadratureNearestNodeLocator(master_id, slave_id));
205  _penetration_locators[std::pair<unsigned int, unsigned int>(master_id, qslave_id)] = pl;
206  }
207 
208  return *pl;
209 }
std::map< unsigned int, unsigned int > _slave_to_qslave
A mapping of the real boundary id to the slave boundary ids.
NearestNodeLocator & getQuadratureNearestNodeLocator(const BoundaryName &master, const BoundaryName &slave)
std::map< std::pair< unsigned int, unsigned int >, PenetrationLocator * > _penetration_locators
virtual void addGhostedBoundary(BoundaryID boundary_id)=0
Will make sure that all necessary elements from boundary_id are ghosted to this processor.
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:1043

◆ maxPatchPercentage()

Real GeometricSearchData::maxPatchPercentage ( )

Maximum percentage through the search patch that any NearestNodeLocator had to look.

As this goes towards 1.0 it's indicative of needing to rebuild the patches.

Definition at line 131 of file GeometricSearchData.C.

132 {
133  Real max = 0.0;
134 
135  for (const auto & nnl_it : _nearest_node_locators)
136  {
137  NearestNodeLocator * nnl = nnl_it.second;
138 
139  if (nnl->_max_patch_percentage > max)
140  max = nnl->_max_patch_percentage;
141  }
142 
143  return max;
144 }
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
std::map< std::pair< unsigned int, unsigned int >, NearestNodeLocator * > _nearest_node_locators

◆ reinit()

void GeometricSearchData::reinit ( )

Completely redo all geometric search objects.

This should be called when the mesh is adapted.

Definition at line 93 of file GeometricSearchData.C.

Referenced by DisplacedProblem::meshChanged(), and FEProblemBase::meshChangedHelper().

94 {
96  // Update the position of quadrature nodes first
97  for (const auto & qbnd : _quadrature_boundaries)
100 
101  for (const auto & nnl_it : _nearest_node_locators)
102  {
103  NearestNodeLocator * nnl = nnl_it.second;
104  nnl->reinit();
105  }
106 
107  for (const auto & pl_it : _penetration_locators)
108  {
109  PenetrationLocator * pl = pl_it.second;
110  pl->reinit();
111  }
112 
113  for (const auto & epl_it : _element_pair_locators)
114  {
115  ElementPairLocator & epl = *(epl_it.second);
116  epl.reinit();
117  }
118 }
std::set< unsigned int > _quadrature_boundaries
These are real boundaries that have quadrature nodes on them.
virtual void reinit()
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
void reinit()
Completely redo the search from scratch.
void clearQuadratureNodes()
Clear out any existing quadrature nodes.
Definition: MooseMesh.C:1031
void reinitQuadratureNodes(unsigned int slave_id)
Completely redo quadrature nodes.
std::map< unsigned int, std::shared_ptr< ElementPairLocator > > _element_pair_locators
This is the ElementPairLocator class.
void reinitMortarNodes()
Completely redo quadrature nodes for mortar interfaces.
std::map< std::pair< unsigned int, unsigned int >, PenetrationLocator * > _penetration_locators
std::map< std::pair< unsigned int, unsigned int >, NearestNodeLocator * > _nearest_node_locators
void reinit()
Completely redo the search from scratch.

◆ reinitMortarNodes()

void GeometricSearchData::reinitMortarNodes ( )
private

Completely redo quadrature nodes for mortar interfaces.

Definition at line 473 of file GeometricSearchData.C.

Referenced by reinit().

474 {
475  _mortar_boundaries.clear();
476  // Regenerate the quadrature nodes for mortar spaces
477  auto & ifaces = _mesh.getMortarInterfaces();
478  for (const auto & iface : ifaces)
479  {
480  unsigned int master_id = _mesh.getBoundaryID(iface->_master);
481  unsigned int slave_id = _mesh.getBoundaryID(iface->_slave);
482  generateMortarNodes(master_id, slave_id, 0);
483  }
484 }
std::vector< std::unique_ptr< MooseMesh::MortarInterface > > & getMortarInterfaces()
Definition: MooseMesh.h:790
std::set< std::pair< unsigned int, unsigned int > > _mortar_boundaries
These are real boundaries that have quadrature nodes on them.
void generateMortarNodes(unsigned int master_id, unsigned int slave_id, unsigned int qslave_id)
Add Quadrature Nodes to the Mesh in support of mortar based penetration location and nearest node sea...
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:1043

◆ reinitQuadratureNodes()

void GeometricSearchData::reinitQuadratureNodes ( unsigned int  slave_id)
private

Completely redo quadrature nodes.

Definition at line 448 of file GeometricSearchData.C.

Referenced by reinit().

449 {
450  // Regenerate the quadrature nodes
451  for (const auto & it : _slave_to_qslave)
452  generateQuadratureNodes(it.first, it.second);
453 }
std::map< unsigned int, unsigned int > _slave_to_qslave
A mapping of the real boundary id to the slave boundary ids.
void generateQuadratureNodes(unsigned int slave_id, unsigned int qslave_id)
Add Quadrature Nodes to the Mesh in support of Quadrature based penetration location and nearest node...

◆ update()

void GeometricSearchData::update ( GeometricSearchType  type = ALL)

Update all of the search objects.

Definition at line 36 of file GeometricSearchData.C.

Referenced by DisplacedProblem::updateGeomSearch(), FEProblemBase::updateGeomSearch(), and DisplacedProblem::updateMesh().

37 {
38  if (type == ALL || type == QUADRATURE || type == NEAREST_NODE)
39  {
40  if (_first) // Only do this once
41  {
42  _first = false;
43 
44  for (const auto & it : _slave_to_qslave)
45  generateQuadratureNodes(it.first, it.second);
46 
47  // reinit on displaced mesh before update
48  for (const auto & epl_it : _element_pair_locators)
49  {
50  ElementPairLocator & epl = *(epl_it.second);
51  epl.reinit();
52  }
53  }
54 
55  // Update the position of quadrature nodes first
56  for (const auto & qbnd : _quadrature_boundaries)
58  }
59 
60  if (type == ALL || type == MORTAR)
61  if (_mortar_boundaries.size() > 0)
63 
64  if (type == ALL || type == NEAREST_NODE)
65  {
66  for (const auto & nnl_it : _nearest_node_locators)
67  {
68  NearestNodeLocator * nnl = nnl_it.second;
69  nnl->findNodes();
70  }
71  }
72 
73  if (type == ALL || type == PENETRATION)
74  {
75  for (const auto & pl_it : _penetration_locators)
76  {
77  PenetrationLocator * pl = pl_it.second;
78  pl->detectPenetration();
79  }
80  }
81 
82  if (type == ALL || type == PENETRATION)
83  {
84  for (auto & elem_pair_locator_pair : _element_pair_locators)
85  {
86  ElementPairLocator & epl = (*elem_pair_locator_pair.second);
87  epl.update();
88  }
89  }
90 }
std::set< unsigned int > _quadrature_boundaries
These are real boundaries that have quadrature nodes on them.
void findNodes()
This is the main method that is going to start the search.
virtual void reinit()
virtual void update()
bool _first
Denotes whether this is the first time the geometric search objects have been updated.
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
void updateMortarNodes()
Update the positions of the quadrature nodes for mortar interfaces.
void updateQuadratureNodes(unsigned int slave_id)
Update the positions of the quadrature nodes.
std::map< unsigned int, unsigned int > _slave_to_qslave
A mapping of the real boundary id to the slave boundary ids.
std::map< unsigned int, std::shared_ptr< ElementPairLocator > > _element_pair_locators
This is the ElementPairLocator class.
std::map< std::pair< unsigned int, unsigned int >, PenetrationLocator * > _penetration_locators
MatType type
std::set< std::pair< unsigned int, unsigned int > > _mortar_boundaries
These are real boundaries that have quadrature nodes on them.
std::map< std::pair< unsigned int, unsigned int >, NearestNodeLocator * > _nearest_node_locators
void generateQuadratureNodes(unsigned int slave_id, unsigned int qslave_id)
Add Quadrature Nodes to the Mesh in support of Quadrature based penetration location and nearest node...

◆ updateGhostedElems()

void GeometricSearchData::updateGhostedElems ( )

Updates the list of ghosted elements at the start of each time step for the nonlinear iteration patch update strategy.

Definition at line 487 of file GeometricSearchData.C.

Referenced by FEProblemBase::possiblyRebuildGeomSearchPatches().

488 {
489  for (const auto & nnl_it : _nearest_node_locators)
490  {
491  NearestNodeLocator * nnl = nnl_it.second;
492  nnl->updateGhostedElems();
493  }
494 }
Finds the nearest node to each node in boundary1 to each node in boundary2 and the other way around...
void updateGhostedElems()
Updates the ghosted elements at the start of the time step for iterion patch update strategy...
std::map< std::pair< unsigned int, unsigned int >, NearestNodeLocator * > _nearest_node_locators

◆ updateMortarNodes()

void GeometricSearchData::updateMortarNodes ( )
private

Update the positions of the quadrature nodes for mortar interfaces.

Definition at line 456 of file GeometricSearchData.C.

Referenced by update().

457 {
458  const MooseArray<Point> & qpoints = _subproblem.assembly(0).qPoints();
459 
460  auto & ifaces = _mesh.getMortarInterfaces();
461  for (const auto & iface : ifaces)
462  for (const auto & elem : iface->_elems)
463  {
465  _subproblem.assembly(0).reinit(elem);
466 
467  for (unsigned int qp = 0; qp < qpoints.size(); qp++)
468  (*_mesh.getQuadratureNode(elem, 0, qp)) = qpoints[qp];
469  }
470 }
virtual Assembly & assembly(THREAD_ID tid)=0
virtual void setCurrentSubdomainID(const Elem *elem, THREAD_ID tid)=0
const MooseArray< Point > & qPoints()
Returns the reference to the quadrature points.
Definition: Assembly.h:216
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
Definition: Assembly.C:709
std::vector< std::unique_ptr< MooseMesh::MortarInterface > > & getMortarInterfaces()
Definition: MooseMesh.h:790
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:245
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
Definition: MooseMesh.C:1013

◆ updateQuadratureNodes()

void GeometricSearchData::updateQuadratureNodes ( unsigned int  slave_id)
private

Update the positions of the quadrature nodes.

Definition at line 421 of file GeometricSearchData.C.

Referenced by update().

422 {
423  const MooseArray<Point> & points_face = _subproblem.assembly(0).qPointsFace();
424 
426  for (const auto & belem : range)
427  {
428  const Elem * elem = belem->_elem;
429  unsigned short int side = belem->_side;
430  BoundaryID boundary_id = belem->_bnd_id;
431 
432  if (elem->processor_id() == _subproblem.processor_id())
433  {
434  if (boundary_id == (BoundaryID)slave_id)
435  {
437  _subproblem.prepare(elem, 0);
438  _subproblem.reinitElemFace(elem, side, boundary_id, 0);
439 
440  for (unsigned int qp = 0; qp < points_face.size(); qp++)
441  (*_mesh.getQuadratureNode(elem, side, qp)) = points_face[qp];
442  }
443  }
444  }
445 }
const MooseArray< Point > & qPointsFace()
Returns the reference to the current quadrature being used.
Definition: Assembly.h:252
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
Definition: MooseMesh.h:1244
virtual Assembly & assembly(THREAD_ID tid)=0
virtual void setCurrentSubdomainID(const Elem *elem, THREAD_ID tid)=0
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)=0
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:245
virtual void prepare(const Elem *elem, THREAD_ID tid)=0
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
Definition: MooseMesh.C:1013
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
Definition: MooseMesh.C:843
boundary_id_type BoundaryID
Definition: MooseTypes.h:93

Member Data Documentation

◆ _boundary_to_mortarboundary

std::map<unsigned int, unsigned int> GeometricSearchData::_boundary_to_mortarboundary
protected

A mapping of the real boundary id to the slave boundary ids for mortar spaces.

Definition at line 123 of file GeometricSearchData.h.

Referenced by getMortarNearestNodeLocator(), and getMortarPenetrationLocator().

◆ _element_pair_locators

std::map<unsigned int, std::shared_ptr<ElementPairLocator> > GeometricSearchData::_element_pair_locators

◆ _first

bool GeometricSearchData::_first
private

Denotes whether this is the first time the geometric search objects have been updated.

Definition at line 158 of file GeometricSearchData.h.

Referenced by update().

◆ _mesh

MooseMesh& GeometricSearchData::_mesh

◆ _mortar_boundaries

std::set<std::pair<unsigned int, unsigned int> > GeometricSearchData::_mortar_boundaries
protected

These are real boundaries that have quadrature nodes on them.

Definition at line 120 of file GeometricSearchData.h.

Referenced by generateMortarNodes(), reinitMortarNodes(), and update().

◆ _nearest_node_locators

std::map<std::pair<unsigned int, unsigned int>, NearestNodeLocator *> GeometricSearchData::_nearest_node_locators

◆ _penetration_locators

std::map<std::pair<unsigned int, unsigned int>, PenetrationLocator *> GeometricSearchData::_penetration_locators

◆ _quadrature_boundaries

std::set<unsigned int> GeometricSearchData::_quadrature_boundaries
protected

These are real boundaries that have quadrature nodes on them.

Definition at line 114 of file GeometricSearchData.h.

Referenced by generateQuadratureNodes(), reinit(), and update().

◆ _slave_to_qslave

std::map<unsigned int, unsigned int> GeometricSearchData::_slave_to_qslave
protected

A mapping of the real boundary id to the slave boundary ids.

Definition at line 117 of file GeometricSearchData.h.

Referenced by getQuadratureNearestNodeLocator(), getQuadraturePenetrationLocator(), reinitQuadratureNodes(), and update().

◆ _subproblem

SubProblem& GeometricSearchData::_subproblem

The documentation for this class was generated from the following files: