LCOV - code coverage report
Current view: top level - src/userobjects - GhostElemPD.C (source / functions) Hit Total Coverage
Test: idaholab/moose peridynamics: #31405 (292dce) with base fef103 Lines: 19 23 82.6 %
Date: 2025-09-04 07:55:08 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      15             : InputParameters
      16         506 : GhostElemPD::validParams()
      17             : {
      18         506 :   InputParameters params = GeneralUserObjectBasePD::validParams();
      19         506 :   params.addClassDescription("Class for ghosting elements accross processors");
      20             : 
      21         506 :   return params;
      22           0 : }
      23             : 
      24         253 : GhostElemPD::GhostElemPD(const InputParameters & parameters) : GeneralUserObjectBasePD(parameters)
      25             : {
      26         253 :   ghostElements();
      27         253 : }
      28             : 
      29             : void
      30           0 : GhostElemPD::meshChanged()
      31             : {
      32           0 :   ghostElements();
      33           0 : }
      34             : 
      35             : void
      36         253 : GhostElemPD::ghostElements()
      37             : {
      38             :   // Loop through the active local elements and ghost elements from other processors due to
      39             :   // formulation nonlocality
      40         253 :   const MeshBase::const_element_iterator end_elem = _mesh.getMesh().active_local_elements_end();
      41         506 :   for (MeshBase::const_element_iterator elem = _mesh.getMesh().active_local_elements_begin();
      42       59138 :        elem != end_elem;
      43       58885 :        ++elem)
      44       58885 :     if ((*elem)->type() == 0) // only ghost neighbors for Edge2 elems
      45      176655 :       for (unsigned int i = 0; i < _nnodes; ++i)
      46             :       {
      47      117770 :         std::vector<dof_id_type> neighbors = _pdmesh.getNeighbors((*elem)->node_id(i));
      48     3330906 :         for (unsigned int j = 0; j < neighbors.size(); ++j)
      49     3213136 :           _subproblem.addGhostedElem(_pdmesh.getBonds((*elem)->node_id(i))[j]);
      50      117770 :       }
      51         253 : }

Generated by: LCOV version 1.14