LCOV - code coverage report
Current view: top level - include/ghosting - ghost_point_neighbors.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4417 (f0ff5e) with base 9bbd75 Lines: 12 17 70.6 %
Date: 2026-11-16 16:30:47 Functions: 5 7 71.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
       3             : 
       4             : // This library is free software; you can redistribute it and/or
       5             : // modify it under the terms of the GNU Lesser General Public
       6             : // License as published by the Free Software Foundation; either
       7             : // version 2.1 of the License, or (at your option) any later version.
       8             : 
       9             : // This library is distributed in the hope that it will be useful,
      10             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12             : // Lesser General Public License for more details.
      13             : 
      14             : // You should have received a copy of the GNU Lesser General Public
      15             : // License along with this library; if not, write to the Free Software
      16             : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      17             : 
      18             : 
      19             : 
      20             : #ifndef LIBMESH_GHOST_POINT_NEIGHBORS_H
      21             : #define LIBMESH_GHOST_POINT_NEIGHBORS_H
      22             : 
      23             : // Local Includes
      24             : #include "libmesh/ghosting_functor.h"
      25             : 
      26             : // C++ Includes
      27             : #include <memory>
      28             : 
      29             : namespace libMesh
      30             : {
      31             : #ifdef LIBMESH_ENABLE_PERIODIC
      32             : class PeriodicBoundaries;
      33             : #endif
      34             : 
      35             : /**
      36             :  * This class implements the original default geometry ghosting
      37             :  * requirements in libMesh: point neighbors on the same manifold,
      38             :  * including across periodic boundaries, and interior_parent elements.
      39             :  *
      40             :  * \author Roy H. Stogner
      41             :  * \date 2016
      42             :  */
      43        3920 : class GhostPointNeighbors : public GhostingFunctor
      44             : {
      45             : public:
      46             : 
      47             :   /**
      48             :    * Constructor.
      49             :    */
      50      513907 :   GhostPointNeighbors(const MeshBase & mesh) :
      51             :       GhostingFunctor(mesh)
      52             : #ifdef LIBMESH_ENABLE_PERIODIC
      53             :       ,
      54      513907 :       _periodic_bcs(nullptr)
      55             : #endif
      56        2576 :     {}
      57             : 
      58             :   /**
      59             :    * Constructor.
      60             :    */
      61           0 :   GhostPointNeighbors(const GhostPointNeighbors & other) :
      62             :       GhostingFunctor(other)
      63             : #ifdef LIBMESH_ENABLE_PERIODIC
      64             :         ,
      65             :       // We do not simply want to copy over the other's periodic bcs because
      66             :       // they may very well correspond to periodic bcs from a \p DofMap entirely
      67             :       // unrelated to any \p DofMaps that depend on this objects ghosting
      68           0 :       _periodic_bcs(nullptr)
      69             : #endif
      70           0 :     {}
      71             : 
      72             :   /**
      73             :    * A clone() is needed because GhostingFunctor can not be shared between
      74             :    * different meshes. The operations in  GhostingFunctor are mesh dependent.
      75             :    */
      76           0 :   virtual std::unique_ptr<GhostingFunctor> clone () const override
      77           0 :   { return std::make_unique<GhostPointNeighbors>(*this); }
      78             : 
      79             : #ifdef LIBMESH_ENABLE_PERIODIC
      80             :   // Set PeriodicBoundaries to couple
      81      369928 :   void set_periodic_boundaries(const PeriodicBoundaries * periodic_bcs) override
      82      369928 :   { _periodic_bcs = periodic_bcs; }
      83             : 
      84      373799 :   const PeriodicBoundaries * get_periodic_boundaries() override
      85      373799 :   { return _periodic_bcs; }
      86             : #endif
      87             : 
      88             :   /**
      89             :    * If we have periodic boundaries, then we'll need the mesh to have
      90             :    * an updated point locator whenever we're about to query them.
      91             :    */
      92             :   virtual void mesh_reinit () override;
      93             : 
      94      883443 :   virtual void redistribute () override
      95      883443 :   { this->mesh_reinit(); }
      96             : 
      97      557776 :   virtual void delete_remote_elements() override
      98      557776 :   { this->mesh_reinit(); }
      99             : 
     100             :   /**
     101             :    * For the specified range of active elements, find their point
     102             :    * neighbors and interior_parent elements, ignoring those on
     103             :    * processor p.
     104             :    */
     105             :   virtual void operator() (const MeshBase::const_element_iterator & range_begin,
     106             :                            const MeshBase::const_element_iterator & range_end,
     107             :                            processor_id_type p,
     108             :                            map_type & coupled_elements) override;
     109             : 
     110             : private:
     111             : #ifdef LIBMESH_ENABLE_PERIODIC
     112             :   const PeriodicBoundaries * _periodic_bcs;
     113             : #endif
     114             : };
     115             : 
     116             : } // namespace libMesh
     117             : 
     118             : #endif // LIBMESH_GHOST_POINT_NEIGHBORS_H

Generated by: LCOV version 1.14