Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 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 3916 : class GhostPointNeighbors : public GhostingFunctor 44 : { 45 : public: 46 : 47 : /** 48 : * Constructor. 49 : */ 50 319311 : GhostPointNeighbors(const MeshBase & mesh) : 51 : GhostingFunctor(mesh) 52 : #ifdef LIBMESH_ENABLE_PERIODIC 53 : , 54 319311 : _periodic_bcs(nullptr) 55 : #endif 56 898 : {} 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 0 : void set_periodic_boundaries(const PeriodicBoundaries * periodic_bcs) override 82 0 : { _periodic_bcs = periodic_bcs; } 83 : #endif 84 : 85 : /** 86 : * If we have periodic boundaries, then we'll need the mesh to have 87 : * an updated point locator whenever we're about to query them. 88 : */ 89 : virtual void mesh_reinit () override; 90 : 91 567528 : virtual void redistribute () override 92 567528 : { this->mesh_reinit(); } 93 : 94 393959 : virtual void delete_remote_elements() override 95 393959 : { this->mesh_reinit(); } 96 : 97 : /** 98 : * For the specified range of active elements, find their point 99 : * neighbors and interior_parent elements, ignoring those on 100 : * processor p. 101 : */ 102 : virtual void operator() (const MeshBase::const_element_iterator & range_begin, 103 : const MeshBase::const_element_iterator & range_end, 104 : processor_id_type p, 105 : map_type & coupled_elements) override; 106 : 107 : private: 108 : #ifdef LIBMESH_ENABLE_PERIODIC 109 : const PeriodicBoundaries * _periodic_bcs; 110 : #endif 111 : }; 112 : 113 : } // namespace libMesh 114 : 115 : #endif // LIBMESH_GHOST_POINT_NEIGHBORS_H