https://mooseframework.inl.gov
GhostElemPD.C
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 #include "GhostElemPD.h"
11 #include "PeridynamicsMesh.h"
12 
13 registerMooseObject("PeridynamicsApp", GhostElemPD);
14 
17 {
19  params.addClassDescription("Class for ghosting elements accross processors");
20 
21  return params;
22 }
23 
25 {
26  ghostElements();
27 }
28 
29 void
31 {
32  ghostElements();
33 }
34 
35 void
37 {
38  // Loop through the active local elements and ghost elements from other processors due to
39  // formulation nonlocality
40  const MeshBase::const_element_iterator end_elem = _mesh.getMesh().active_local_elements_end();
41  for (MeshBase::const_element_iterator elem = _mesh.getMesh().active_local_elements_begin();
42  elem != end_elem;
43  ++elem)
44  if ((*elem)->type() == 0) // only ghost neighbors for Edge2 elems
45  for (unsigned int i = 0; i < _nnodes; ++i)
46  {
47  std::vector<dof_id_type> neighbors = _pdmesh.getNeighbors((*elem)->node_id(i));
48  for (unsigned int j = 0; j < neighbors.size(); ++j)
49  _subproblem.addGhostedElem(_pdmesh.getBonds((*elem)->node_id(i))[j]);
50  }
51 }
MooseMesh & _mesh
Reference to Moose mesh.
std::vector< dof_id_type > getNeighbors(dof_id_type node_id)
Function to return neighbor nodes indices for node node_id.
static InputParameters validParams()
GhostElemPD(const InputParameters &parameters)
Definition: GhostElemPD.C:24
SubProblem & _subproblem
const unsigned int _nnodes
number of nodes for a edge element
PeridynamicsMesh & _pdmesh
Reference to peridynamics mesh.
MeshBase & getMesh()
registerMooseObject("PeridynamicsApp", GhostElemPD)
void ghostElements()
Function to ghost/copy element information from other processors.
Definition: GhostElemPD.C:36
Userobject class to ghost the required element for calculation on current processor from other proces...
Definition: GhostElemPD.h:19
virtual void addGhostedElem(dof_id_type elem_id)=0
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
std::vector< dof_id_type > getBonds(dof_id_type node_id)
Function to return the bond number connected with node node_id.
virtual void meshChanged() override
Definition: GhostElemPD.C:30
static InputParameters validParams()
Definition: GhostElemPD.C:16