LCOV - code coverage report
Current view: top level - src/relationshipmanagers - GhostLowerDElems.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 27 28 96.4 %
Date: 2025-07-17 01:28:37 Functions: 7 7 100.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             : // App includes
      11             : #include "GhostLowerDElems.h"
      12             : #include "Executioner.h"
      13             : #include "FEProblemBase.h"
      14             : #include "MooseApp.h"
      15             : 
      16             : // libMesh includes
      17             : #include "libmesh/elem.h"
      18             : #include "libmesh/mesh_base.h"
      19             : #include "libmesh/boundary_info.h"
      20             : 
      21             : registerMooseObject("MooseApp", GhostLowerDElems);
      22             : 
      23             : using namespace libMesh;
      24             : 
      25             : InputParameters
      26      255122 : GhostLowerDElems::validParams()
      27             : {
      28      255122 :   InputParameters params = RelationshipManager::validParams();
      29      255122 :   params.set<bool>("attach_geometric_early") = false;
      30      255122 :   return params;
      31           0 : }
      32             : 
      33      107816 : GhostLowerDElems::GhostLowerDElems(const InputParameters & params) : RelationshipManager(params) {}
      34             : 
      35       25225 : GhostLowerDElems::GhostLowerDElems(const GhostLowerDElems & other) : RelationshipManager(other) {}
      36             : 
      37             : std::string
      38          34 : GhostLowerDElems::getInfo() const
      39             : {
      40          34 :   std::ostringstream oss;
      41          34 :   oss << "GhostLowerDElems";
      42          68 :   return oss.str();
      43          34 : }
      44             : 
      45             : void
      46       32262 : GhostLowerDElems::operator()(const MeshBase::const_element_iterator & range_begin,
      47             :                              const MeshBase::const_element_iterator & range_end,
      48             :                              const processor_id_type p,
      49             :                              map_type & coupled_elements)
      50             : {
      51             :   mooseAssert(_moose_mesh,
      52             :               "The MOOSE mesh must be non-null in order for this relationship manager to work.");
      53       32262 :   if (!_moose_mesh->hasLowerD())
      54       32046 :     return;
      55             : 
      56             :   static const CouplingMatrix * const null_mat = nullptr;
      57             : 
      58        9710 :   for (const Elem * const elem : as_range(range_begin, range_end))
      59       20611 :     for (const auto s : elem->side_index_range())
      60             :     {
      61       15864 :       const Elem * const neighbor = elem->neighbor_ptr(s);
      62       15864 :       const bool elem_owns_lowerd = !neighbor || elem->id() < neighbor->id();
      63             : 
      64             :       const Elem * const lower_d_elem =
      65             :           elem_owns_lowerd
      66       15864 :               ? _moose_mesh->getLowerDElem(elem, s)
      67        6426 :               : _moose_mesh->getLowerDElem(neighbor, neighbor->which_neighbor_am_i(elem));
      68             : 
      69       15864 :       if (lower_d_elem && lower_d_elem->processor_id() != p)
      70         110 :         coupled_elements.emplace(lower_d_elem, null_mat);
      71         216 :     }
      72             : }
      73             : 
      74             : bool
      75      275978 : GhostLowerDElems::operator>=(const RelationshipManager & other) const
      76             : {
      77      275978 :   return dynamic_cast<const GhostLowerDElems *>(&other);
      78             : }
      79             : 
      80             : std::unique_ptr<GhostingFunctor>
      81       25225 : GhostLowerDElems::clone() const
      82             : {
      83       25225 :   return _app.getFactory().copyConstruct(*this);
      84             : }

Generated by: LCOV version 1.14