LCOV - code coverage report
Current view: top level - src/userobjects - GhostElemPD.C (source / functions) Hit Total Coverage
Test: idaholab/moose peridynamics: #32971 (54bef8) with base c6cf66 Lines: 19 23 82.6 %
Date: 2026-05-29 20:38:14 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         504 : GhostElemPD::validParams()
      17             : {
      18         504 :   InputParameters params = GeneralUserObjectBasePD::validParams();
      19         504 :   params.addClassDescription("Class for ghosting elements accross processors");
      20             : 
      21         504 :   return params;
      22           0 : }
      23             : 
      24         252 : GhostElemPD::GhostElemPD(const InputParameters & parameters) : GeneralUserObjectBasePD(parameters)
      25             : {
      26         252 :   ghostElements();
      27         252 : }
      28             : 
      29             : void
      30           0 : GhostElemPD::meshChanged()
      31             : {
      32           0 :   ghostElements();
      33           0 : }
      34             : 
      35             : void
      36         252 : GhostElemPD::ghostElements()
      37             : {
      38             :   // Loop through the active local elements and ghost elements from other processors due to
      39             :   // formulation nonlocality
      40         252 :   const MeshBase::const_element_iterator end_elem = _mesh.getMesh().active_local_elements_end();
      41         504 :   for (MeshBase::const_element_iterator elem = _mesh.getMesh().active_local_elements_begin();
      42       58952 :        elem != end_elem;
      43       58700 :        ++elem)
      44       58700 :     if ((*elem)->type() == 0) // only ghost neighbors for Edge2 elems
      45      176100 :       for (unsigned int i = 0; i < _nnodes; ++i)
      46             :       {
      47      117400 :         std::vector<dof_id_type> neighbors = _pdmesh.getNeighbors((*elem)->node_id(i));
      48     3325088 :         for (unsigned int j = 0; j < neighbors.size(); ++j)
      49     3207688 :           _subproblem.addGhostedElem(_pdmesh.getBonds((*elem)->node_id(i))[j]);
      50      117400 :       }
      51         252 : }

Generated by: LCOV version 1.14