libMesh
point_neighbor_coupling.h
Go to the documentation of this file.
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_POINT_NEIGHBOR_COUPLING_H
21 #define LIBMESH_POINT_NEIGHBOR_COUPLING_H
22 
23 // Local Includes
24 #include "libmesh/ghosting_functor.h"
25 
26 // C++ Includes
27 #include <memory>
28 
29 namespace libMesh
30 {
31 
32 // Forward declarations
33 class PeriodicBoundaries;
34 
35 
45 {
46 public:
47 
52  _dof_coupling(nullptr),
53 #ifdef LIBMESH_ENABLE_PERIODIC
54  _periodic_bcs(nullptr),
55 #endif
56  _n_levels(0)
57  {}
58 
63  GhostingFunctor(other),
65 #ifdef LIBMESH_ENABLE_PERIODIC
67 #endif
68  _n_levels(other._n_levels)
69  {}
70 
75  virtual std::unique_ptr<GhostingFunctor> clone () const override
76  { return std::make_unique<PointNeighborCoupling>(*this); }
77 
78  // Change coupling matrix after construction
79  void set_dof_coupling(const CouplingMatrix * dof_coupling)
80  { _dof_coupling = dof_coupling; }
81 
82  // Return number of levels of point neighbors we will couple.
83  unsigned int n_levels()
84  { return _n_levels; }
85 
86  // Change number of levels of point neighbors to couple.
87  void set_n_levels(unsigned int n_levels)
88  { _n_levels = n_levels; }
89 
90 #ifdef LIBMESH_ENABLE_PERIODIC
91  // Set PeriodicBoundaries to couple.
92  //
93  // FIXME: This capability is not currently implemented.
94  void set_periodic_boundaries(const PeriodicBoundaries * periodic_bcs) override
95  { _periodic_bcs = periodic_bcs; }
96 #endif
97 
102  virtual void mesh_reinit () override;
103 
104  virtual void redistribute () override
105  { this->mesh_reinit(); }
106 
107  virtual void delete_remote_elements() override
108  { this->mesh_reinit(); }
109 
117  virtual void operator() (const MeshBase::const_element_iterator & range_begin,
118  const MeshBase::const_element_iterator & range_end,
120  map_type & coupled_elements) override;
121 
122 private:
123 
125 #ifdef LIBMESH_ENABLE_PERIODIC
127 #endif
128  unsigned int _n_levels;
129 };
130 
131 } // namespace libMesh
132 
133 #endif // LIBMESH_POINT_NEIGHBOR_COUPLING_H
virtual void delete_remote_elements() override
GhostingFunctor subclasses with relatively long-lasting caches may want to delete the no-longer-relev...
This abstract base class defines the interface by which library code and user code can report associa...
The definition of the const_element_iterator struct.
Definition: mesh_base.h:2216
We&#39;re using a class instead of a typedef to allow forward declarations and future flexibility...
void set_n_levels(unsigned int n_levels)
void set_periodic_boundaries(const PeriodicBoundaries *periodic_bcs) override
virtual void operator()(const MeshBase::const_element_iterator &range_begin, const MeshBase::const_element_iterator &range_end, processor_id_type p, map_type &coupled_elements) override
For the specified range of active elements, find the elements which will be coupled to them in the sp...
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
What elements do we care about and what variables do we care about on each element?
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t processor_id_type
Definition: id_types.h:104
This class implements ghosting of point neighbors (elements on the same manifold that share points)...
const PeriodicBoundaries * _periodic_bcs
void set_dof_coupling(const CouplingMatrix *dof_coupling)
PointNeighborCoupling(const PointNeighborCoupling &other)
Constructor.
virtual void redistribute() override
GhostingFunctor subclasses with relatively long-lasting caches may want to redistribute those caches ...
virtual void mesh_reinit() override
If we have periodic boundaries, then we&#39;ll need the mesh to have an updated point locator whenever we...
virtual std::unique_ptr< GhostingFunctor > clone() const override
A clone() is needed because GhostingFunctor can not be shared between different meshes.
This class defines a coupling matrix.