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 24 of file GeometricSearchData.C.

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

◆ ~GeometricSearchData()

GeometricSearchData::~GeometricSearchData ( )
virtual

Definition at line 29 of file GeometricSearchData.C.

30 {
31  for (auto & it : _penetration_locators)
32  delete it.second;
33 
34  for (auto & it : _nearest_node_locators)
35  delete it.second;
36 }
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 392 of file GeometricSearchData.C.

394 {
395  _element_pair_locators[interface_id] = epl;
396 }
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 124 of file GeometricSearchData.C.

Referenced by FEProblemBase::possiblyRebuildGeomSearchPatches().

125 {
126  for (const auto & nnl_it : _nearest_node_locators)
127  {
128  NearestNodeLocator * nnl = nnl_it.second;
129  nnl->reinit();
130  }
131 }
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 399 of file GeometricSearchData.C.

Referenced by getMortarNearestNodeLocator(), and reinitMortarNodes().

402 {
403  // Have we already generated quadrature nodes for this boundary id?
404  if (_mortar_boundaries.find(std::pair<unsigned int, unsigned int>(master_id, slave_id)) !=
405  _mortar_boundaries.end())
406  return;
407 
408  _mortar_boundaries.insert(std::pair<unsigned int, unsigned int>(master_id, slave_id));
409 
410  MooseMesh::MortarInterface * iface = _mesh.getMortarInterface(master_id, slave_id);
411 
412  const MooseArray<Point> & qpoints = _subproblem.assembly(0).qPoints();
413  for (const auto & elem : iface->_elems)
414  {
416  _subproblem.assembly(0).reinit(elem);
417 
418  for (unsigned int qp = 0; qp < qpoints.size(); qp++)
419  _mesh.addQuadratureNode(elem, 0, qp, qslave_id, qpoints[qp]);
420  }
421 }
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:920
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:805
const MooseArray< Point > & qPoints()
Returns the reference to the quadrature points.
Definition: Assembly.h:223
MooseMesh::MortarInterface * getMortarInterface(BoundaryID master, BoundaryID slave)
Definition: MooseMesh.C:2701
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
Definition: Assembly.C:1475
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:250
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 318 of file GeometricSearchData.C.

Referenced by reinitQuadratureNodes(), and update().

319 {
320  // Have we already generated quadrature nodes for this boundary id?
321  if (_quadrature_boundaries.find(slave_id) != _quadrature_boundaries.end())
322  return;
323 
324  _quadrature_boundaries.insert(slave_id);
325 
326  const MooseArray<Point> & points_face = _subproblem.assembly(0).qPointsFace();
327 
329  for (const auto & belem : range)
330  {
331  const Elem * elem = belem->_elem;
332  unsigned short int side = belem->_side;
333  BoundaryID boundary_id = belem->_bnd_id;
334 
335  if (elem->processor_id() == _subproblem.processor_id())
336  {
337  if (boundary_id == (BoundaryID)slave_id)
338  {
340  _subproblem.prepare(elem, 0);
341  _subproblem.reinitElemFace(elem, side, boundary_id, 0);
342 
343  for (unsigned int qp = 0; qp < points_face.size(); qp++)
344  _mesh.addQuadratureNode(elem, side, qp, qslave_id, points_face[qp]);
345  }
346  }
347  }
348 }
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:920
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:284
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
Definition: MooseMesh.h:1269
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:250
virtual void prepare(const Elem *elem, THREAD_ID tid)=0
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
Definition: MooseMesh.C:802
boundary_id_type BoundaryID
Definition: MooseTypes.h:122

◆ getMortarNearestNodeLocator() [1/2]

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

Definition at line 351 of file GeometricSearchData.C.

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

354 {
355  unsigned int master_id = _mesh.getBoundaryID(master);
356  unsigned int slave_id = _mesh.getBoundaryID(slave);
357 
358  return getMortarNearestNodeLocator(master_id, slave_id, side_type);
359 }
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:1002

◆ getMortarNearestNodeLocator() [2/2]

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

Definition at line 362 of file GeometricSearchData.C.

365 {
366  unsigned int mortarboundary_id, boundary;
367 
368  switch (side_type)
369  {
370  case Moose::Master:
371  boundary = master_id;
372  mortarboundary_id = MORTAR_BASE_ID + slave_id;
373  _boundary_to_mortarboundary[slave_id] = mortarboundary_id;
374  break;
375 
376  case Moose::Slave:
377  boundary = slave_id;
378  mortarboundary_id = MORTAR_BASE_ID + master_id;
379  _boundary_to_mortarboundary[master_id] = mortarboundary_id;
380  break;
381 
382  default:
383  mooseError("Unknown side type");
384  }
385 
386  generateMortarNodes(master_id, slave_id, 1001);
387 
388  return getNearestNodeLocator(boundary, 1001);
389 }
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 215 of file GeometricSearchData.C.

Referenced by GeometricSearchInterface::getMortarPenetrationLocator().

219 {
220  unsigned int master_id = _mesh.getBoundaryID(master);
221  unsigned int slave_id = _mesh.getBoundaryID(slave);
222 
223  // Generate a new boundary id
224  // TODO: Make this better!
225  unsigned int mortar_boundary_id = 0;
226  unsigned int boundary_id = 0;
227  switch (side_type)
228  {
229  case Moose::Master:
230  boundary_id = master_id;
231  mortar_boundary_id = MORTAR_BASE_ID + slave_id;
232  _boundary_to_mortarboundary[slave_id] = mortar_boundary_id;
233  break;
234 
235  case Moose::Slave:
236  boundary_id = slave_id;
237  mortar_boundary_id = MORTAR_BASE_ID + master_id;
238  _boundary_to_mortarboundary[master_id] = mortar_boundary_id;
239  break;
240  }
241 
242  PenetrationLocator * pl =
243  _penetration_locators[std::pair<unsigned int, unsigned int>(boundary_id, mortar_boundary_id)];
244  if (!pl)
245  {
247  *this,
248  _mesh,
249  boundary_id,
250  mortar_boundary_id,
251  order,
252  getMortarNearestNodeLocator(master_id, slave_id, side_type));
253  _penetration_locators[std::pair<unsigned int, unsigned int>(boundary_id, mortar_boundary_id)] =
254  pl;
255  }
256 
257  return *pl;
258 }
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:1002

◆ getNearestNodeLocator() [1/2]

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

Definition at line 261 of file GeometricSearchData.C.

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

262 {
263  unsigned int master_id = _mesh.getBoundaryID(master);
264  unsigned int slave_id = _mesh.getBoundaryID(slave);
265 
266  _subproblem.addGhostedBoundary(master_id);
268 
269  return getNearestNodeLocator(master_id, slave_id);
270 }
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:1002

◆ getNearestNodeLocator() [2/2]

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

Definition at line 273 of file GeometricSearchData.C.

275 {
276  NearestNodeLocator * nnl =
277  _nearest_node_locators[std::pair<unsigned int, unsigned int>(master_id, slave_id)];
278 
279  _subproblem.addGhostedBoundary(master_id);
281 
282  if (!nnl)
283  {
284  nnl = new NearestNodeLocator(_subproblem, _mesh, master_id, slave_id);
285  _nearest_node_locators[std::pair<unsigned int, unsigned int>(master_id, slave_id)] = nnl;
286  }
287 
288  return *nnl;
289 }
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 150 of file GeometricSearchData.C.

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

153 {
154  unsigned int master_id = _mesh.getBoundaryID(master);
155  unsigned int slave_id = _mesh.getBoundaryID(slave);
156 
157  _subproblem.addGhostedBoundary(master_id);
159 
160  PenetrationLocator * pl =
161  _penetration_locators[std::pair<unsigned int, unsigned int>(master_id, slave_id)];
162 
163  if (!pl)
164  {
166  *this,
167  _mesh,
168  master_id,
169  slave_id,
170  order,
171  getNearestNodeLocator(master_id, slave_id));
172  _penetration_locators[std::pair<unsigned int, unsigned int>(master_id, slave_id)] = pl;
173  }
174 
175  return *pl;
176 }
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:1002

◆ getQuadratureNearestNodeLocator() [1/2]

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

Definition at line 292 of file GeometricSearchData.C.

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

294 {
295  unsigned int master_id = _mesh.getBoundaryID(master);
296  unsigned int slave_id = _mesh.getBoundaryID(slave);
297 
298  _subproblem.addGhostedBoundary(master_id);
300 
301  return getQuadratureNearestNodeLocator(master_id, slave_id);
302 }
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:1002

◆ getQuadratureNearestNodeLocator() [2/2]

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

Definition at line 305 of file GeometricSearchData.C.

307 {
308  // TODO: Make this better!
309  unsigned int base_id = 1e6;
310  unsigned int qslave_id = slave_id + base_id;
311 
312  _slave_to_qslave[slave_id] = qslave_id;
313 
314  return getNearestNodeLocator(master_id, qslave_id);
315 }
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 179 of file GeometricSearchData.C.

Referenced by GeometricSearchInterface::getQuadraturePenetrationLocator().

182 {
183  unsigned int master_id = _mesh.getBoundaryID(master);
184  unsigned int slave_id = _mesh.getBoundaryID(slave);
185 
186  _subproblem.addGhostedBoundary(master_id);
188 
189  // Generate a new boundary id
190  // TODO: Make this better!
191  unsigned int base_id = 1e6;
192  unsigned int qslave_id = slave_id + base_id;
193 
194  _slave_to_qslave[slave_id] = qslave_id;
195 
196  PenetrationLocator * pl =
197  _penetration_locators[std::pair<unsigned int, unsigned int>(master_id, qslave_id)];
198 
199  if (!pl)
200  {
202  *this,
203  _mesh,
204  master_id,
205  qslave_id,
206  order,
207  getQuadratureNearestNodeLocator(master_id, slave_id));
208  _penetration_locators[std::pair<unsigned int, unsigned int>(master_id, qslave_id)] = pl;
209  }
210 
211  return *pl;
212 }
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:1002

◆ 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 134 of file GeometricSearchData.C.

135 {
136  Real max = 0.0;
137 
138  for (const auto & nnl_it : _nearest_node_locators)
139  {
140  NearestNodeLocator * nnl = nnl_it.second;
141 
142  if (nnl->_max_patch_percentage > max)
143  max = nnl->_max_patch_percentage;
144  }
145 
146  return max;
147 }
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 96 of file GeometricSearchData.C.

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

97 {
99  // Update the position of quadrature nodes first
100  for (const auto & qbnd : _quadrature_boundaries)
101  reinitQuadratureNodes(qbnd);
103 
104  for (const auto & nnl_it : _nearest_node_locators)
105  {
106  NearestNodeLocator * nnl = nnl_it.second;
107  nnl->reinit();
108  }
109 
110  for (const auto & pl_it : _penetration_locators)
111  {
112  PenetrationLocator * pl = pl_it.second;
113  pl->reinit();
114  }
115 
116  for (const auto & epl_it : _element_pair_locators)
117  {
118  ElementPairLocator & epl = *(epl_it.second);
119  epl.reinit();
120  }
121 }
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:990
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 476 of file GeometricSearchData.C.

Referenced by reinit().

477 {
478  _mortar_boundaries.clear();
479  // Regenerate the quadrature nodes for mortar spaces
480  auto & ifaces = _mesh.getMortarInterfaces();
481  for (const auto & iface : ifaces)
482  {
483  unsigned int master_id = _mesh.getBoundaryID(iface->_master);
484  unsigned int slave_id = _mesh.getBoundaryID(iface->_slave);
485  generateMortarNodes(master_id, slave_id, 0);
486  }
487 }
std::vector< std::unique_ptr< MooseMesh::MortarInterface > > & getMortarInterfaces()
Definition: MooseMesh.h:815
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:1002

◆ reinitQuadratureNodes()

void GeometricSearchData::reinitQuadratureNodes ( unsigned int  slave_id)
private

Completely redo quadrature nodes.

Definition at line 451 of file GeometricSearchData.C.

Referenced by reinit().

452 {
453  // Regenerate the quadrature nodes
454  for (const auto & it : _slave_to_qslave)
455  generateQuadratureNodes(it.first, it.second);
456 }
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 39 of file GeometricSearchData.C.

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

40 {
41  if (type == ALL || type == QUADRATURE || type == NEAREST_NODE)
42  {
43  if (_first) // Only do this once
44  {
45  _first = false;
46 
47  for (const auto & it : _slave_to_qslave)
48  generateQuadratureNodes(it.first, it.second);
49 
50  // reinit on displaced mesh before update
51  for (const auto & epl_it : _element_pair_locators)
52  {
53  ElementPairLocator & epl = *(epl_it.second);
54  epl.reinit();
55  }
56  }
57 
58  // Update the position of quadrature nodes first
59  for (const auto & qbnd : _quadrature_boundaries)
61  }
62 
63  if (type == ALL || type == MORTAR)
64  if (_mortar_boundaries.size() > 0)
66 
67  if (type == ALL || type == NEAREST_NODE)
68  {
69  for (const auto & nnl_it : _nearest_node_locators)
70  {
71  NearestNodeLocator * nnl = nnl_it.second;
72  nnl->findNodes();
73  }
74  }
75 
76  if (type == ALL || type == PENETRATION)
77  {
78  for (const auto & pl_it : _penetration_locators)
79  {
80  PenetrationLocator * pl = pl_it.second;
81  pl->detectPenetration();
82  }
83  }
84 
85  if (type == ALL || type == PENETRATION)
86  {
87  for (auto & elem_pair_locator_pair : _element_pair_locators)
88  {
89  ElementPairLocator & epl = (*elem_pair_locator_pair.second);
90  epl.update();
91  }
92  }
93 }
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 490 of file GeometricSearchData.C.

Referenced by FEProblemBase::possiblyRebuildGeomSearchPatches().

491 {
492  for (const auto & nnl_it : _nearest_node_locators)
493  {
494  NearestNodeLocator * nnl = nnl_it.second;
495  nnl->updateGhostedElems();
496  }
497 }
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 459 of file GeometricSearchData.C.

Referenced by update().

460 {
461  const MooseArray<Point> & qpoints = _subproblem.assembly(0).qPoints();
462 
463  auto & ifaces = _mesh.getMortarInterfaces();
464  for (const auto & iface : ifaces)
465  for (const auto & elem : iface->_elems)
466  {
468  _subproblem.assembly(0).reinit(elem);
469 
470  for (unsigned int qp = 0; qp < qpoints.size(); qp++)
471  (*_mesh.getQuadratureNode(elem, 0, qp)) = qpoints[qp];
472  }
473 }
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:223
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
Definition: Assembly.C:1475
std::vector< std::unique_ptr< MooseMesh::MortarInterface > > & getMortarInterfaces()
Definition: MooseMesh.h:815
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:250
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
Definition: MooseMesh.C:972

◆ updateQuadratureNodes()

void GeometricSearchData::updateQuadratureNodes ( unsigned int  slave_id)
private

Update the positions of the quadrature nodes.

Definition at line 424 of file GeometricSearchData.C.

Referenced by update().

425 {
426  const MooseArray<Point> & points_face = _subproblem.assembly(0).qPointsFace();
427 
429  for (const auto & belem : range)
430  {
431  const Elem * elem = belem->_elem;
432  unsigned short int side = belem->_side;
433  BoundaryID boundary_id = belem->_bnd_id;
434 
435  if (elem->processor_id() == _subproblem.processor_id())
436  {
437  if (boundary_id == (BoundaryID)slave_id)
438  {
440  _subproblem.prepare(elem, 0);
441  _subproblem.reinitElemFace(elem, side, boundary_id, 0);
442 
443  for (unsigned int qp = 0; qp < points_face.size(); qp++)
444  (*_mesh.getQuadratureNode(elem, side, qp)) = points_face[qp];
445  }
446  }
447  }
448 }
const MooseArray< Point > & qPointsFace()
Returns the reference to the current quadrature being used.
Definition: Assembly.h:284
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
Definition: MooseMesh.h:1269
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:250
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:972
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
Definition: MooseMesh.C:802
boundary_id_type BoundaryID
Definition: MooseTypes.h:122

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: