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