LCOV - code coverage report
Current view: top level - src/relationshipmanagers - GhostHigherDLowerDPointNeighbors.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 32 38 84.2 %
Date: 2025-07-17 01:28:37 Functions: 6 7 85.7 %
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 "GhostHigherDLowerDPointNeighbors.h"
      12             : #include "Executioner.h"
      13             : #include "FEProblemBase.h"
      14             : #include "MooseApp.h"
      15             : #include "GhostLowerDElems.h"
      16             : 
      17             : // libMesh includes
      18             : #include "libmesh/elem.h"
      19             : #include "libmesh/mesh_base.h"
      20             : #include "libmesh/boundary_info.h"
      21             : 
      22             : registerMooseObject("MooseApp", GhostHigherDLowerDPointNeighbors);
      23             : 
      24             : using namespace libMesh;
      25             : 
      26             : InputParameters
      27       22495 : GhostHigherDLowerDPointNeighbors::validParams()
      28             : {
      29       22495 :   InputParameters params = RelationshipManager::validParams();
      30       22495 :   params.set<bool>("attach_geometric_early") = false;
      31       22495 :   return params;
      32           0 : }
      33             : 
      34        3688 : GhostHigherDLowerDPointNeighbors::GhostHigherDLowerDPointNeighbors(const InputParameters & params)
      35        3688 :   : RelationshipManager(params)
      36             : {
      37        3688 : }
      38             : 
      39         854 : GhostHigherDLowerDPointNeighbors::GhostHigherDLowerDPointNeighbors(
      40         854 :     const GhostHigherDLowerDPointNeighbors & other)
      41         854 :   : RelationshipManager(other)
      42             : {
      43         854 : }
      44             : 
      45             : std::string
      46           0 : GhostHigherDLowerDPointNeighbors::getInfo() const
      47             : {
      48           0 :   std::ostringstream oss;
      49           0 :   oss << "GhostHigherDLowerDPointNeighbors";
      50           0 :   return oss.str();
      51           0 : }
      52             : 
      53             : void
      54         228 : GhostHigherDLowerDPointNeighbors::operator()(const MeshBase::const_element_iterator & range_begin,
      55             :                                              const MeshBase::const_element_iterator & range_end,
      56             :                                              const processor_id_type p,
      57             :                                              map_type & coupled_elements)
      58             : {
      59             :   mooseAssert(_moose_mesh,
      60             :               "The MOOSE mesh must be non-null in order for this relationship manager to work.");
      61         228 :   const auto & node_to_elem_map = _moose_mesh->nodeToElemMap();
      62             : 
      63             :   static const CouplingMatrix * const null_mat = nullptr;
      64             : 
      65       19422 :   for (const Elem * const elem : as_range(range_begin, range_end))
      66             :   {
      67        9597 :     if (elem->dim() != _mesh->mesh_dimension())
      68             :       // not a higher-dimensional element
      69        1338 :       continue;
      70             : 
      71       59680 :     for (const auto & node : elem->node_ref_range())
      72             :     {
      73             :       // We want to ghost the adjoining lower-d elements if the node hasn't been partitioned yet
      74             :       // (e.g. we don't know what processes it will be) or if its processor id matches our
      75             :       // processes's id
      76       51421 :       if (node.processor_id() != p)
      77        2339 :         continue;
      78             : 
      79       49082 :       const auto & elem_node_neighbors = libmesh_map_find(node_to_elem_map, node.id());
      80      333843 :       for (const auto elem_id : elem_node_neighbors)
      81             :       {
      82      284761 :         const Elem * const elem_node_neighbor = _mesh->elem_ptr(elem_id);
      83      299669 :         if (elem_node_neighbor->dim() != _mesh->mesh_dimension() &&
      84       14908 :             elem_node_neighbor->processor_id() != p)
      85         281 :           coupled_elements.emplace(elem_node_neighbor, null_mat);
      86             :       }
      87             :     }
      88         228 :   }
      89         228 : }
      90             : 
      91             : bool
      92       17013 : GhostHigherDLowerDPointNeighbors::operator>=(const RelationshipManager & other) const
      93             : {
      94       31104 :   return dynamic_cast<const GhostHigherDLowerDPointNeighbors *>(&other) ||
      95       31104 :          dynamic_cast<const GhostLowerDElems *>(&other);
      96             : }
      97             : 
      98             : std::unique_ptr<GhostingFunctor>
      99         854 : GhostHigherDLowerDPointNeighbors::clone() const
     100             : {
     101         854 :   return _app.getFactory().copyConstruct(*this);
     102             : }

Generated by: LCOV version 1.14