libMesh
point_neighbor_coupling.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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 namespace libMesh
27 {
28 
29 // Forward declarations
30 class PeriodicBoundaries;
31 
32 
42 {
43 public:
44 
49  _dof_coupling(nullptr),
50 #ifdef LIBMESH_ENABLE_PERIODIC
51  _periodic_bcs(nullptr),
52 #endif
53  _mesh(nullptr),
54  _n_levels(0)
55  {}
56 
57  // Change coupling matrix after construction
58  void set_dof_coupling(const CouplingMatrix * dof_coupling)
59  { _dof_coupling = dof_coupling; }
60 
61  // Return number of levels of point neighbors we will couple.
62  unsigned int n_levels()
63  { return _n_levels; }
64 
65  // Change number of levels of point neighbors to couple.
66  void set_n_levels(unsigned int n_levels)
67  { _n_levels = n_levels; }
68 
69 #ifdef LIBMESH_ENABLE_PERIODIC
70  // Set PeriodicBoundaries to couple.
71  //
72  // FIXME: This capability is not currently implemented.
73  void set_periodic_boundaries(const PeriodicBoundaries * periodic_bcs)
74  { _periodic_bcs = periodic_bcs; }
75 #endif
76 
77  // Set MeshBase for use in checking for periodic boundary ids
78  void set_mesh(const MeshBase * mesh)
79  { _mesh = mesh; }
80 
85  virtual void mesh_reinit () override;
86 
87  virtual void redistribute () override
88  { this->mesh_reinit(); }
89 
90  virtual void delete_remote_elements() override
91  { this->mesh_reinit(); }
92 
100  virtual void operator() (const MeshBase::const_element_iterator & range_begin,
101  const MeshBase::const_element_iterator & range_end,
103  map_type & coupled_elements) override;
104 
105 private:
106 
108 #ifdef LIBMESH_ENABLE_PERIODIC
110 #endif
111  const MeshBase * _mesh;
112  unsigned int _n_levels;
113 };
114 
115 } // namespace libMesh
116 
117 #endif // LIBMESH_POINT_NEIGHBOR_COUPLING_H
libMesh::PeriodicBoundaries
We're using a class instead of a typedef to allow forward declarations and future flexibility.
Definition: periodic_boundaries.h:51
libMesh::PointNeighborCoupling::operator()
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...
Definition: point_neighbor_coupling.C:55
libMesh::PointNeighborCoupling::_mesh
const MeshBase * _mesh
Definition: point_neighbor_coupling.h:111
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::GhostingFunctor::map_type
std::unordered_map< const Elem *, const CouplingMatrix * > map_type
What elements do we care about and what variables do we care about on each element?
Definition: ghosting_functor.h:171
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::PointNeighborCoupling::redistribute
virtual void redistribute() override
GhostingFunctor subclasses with relatively long-lasting caches may want to redistribute those caches ...
Definition: point_neighbor_coupling.h:87
libMesh::PointNeighborCoupling::set_mesh
void set_mesh(const MeshBase *mesh)
Definition: point_neighbor_coupling.h:78
libMesh::PointNeighborCoupling::_n_levels
unsigned int _n_levels
Definition: point_neighbor_coupling.h:112
libMesh::MeshBase
This is the MeshBase class.
Definition: mesh_base.h:78
libMesh::PointNeighborCoupling::_dof_coupling
const CouplingMatrix * _dof_coupling
Definition: point_neighbor_coupling.h:107
libMesh::PointNeighborCoupling::delete_remote_elements
virtual void delete_remote_elements() override
GhostingFunctor subclasses with relatively long-lasting caches may want to delete the no-longer-relev...
Definition: point_neighbor_coupling.h:90
libMesh::PointNeighborCoupling::_periodic_bcs
const PeriodicBoundaries * _periodic_bcs
Definition: point_neighbor_coupling.h:109
libMesh::GhostingFunctor
This abstract base class defines the interface by which library code and user code can report associa...
Definition: ghosting_functor.h:153
libMesh::processor_id_type
uint8_t processor_id_type
Definition: id_types.h:104
libMesh::PointNeighborCoupling::PointNeighborCoupling
PointNeighborCoupling()
Constructor.
Definition: point_neighbor_coupling.h:48
libMesh::PointNeighborCoupling::set_n_levels
void set_n_levels(unsigned int n_levels)
Definition: point_neighbor_coupling.h:66
libMesh::PointNeighborCoupling::mesh_reinit
virtual void mesh_reinit() override
If we have periodic boundaries, then we'll need the mesh to have an updated point locator whenever we...
Definition: point_neighbor_coupling.C:34
libMesh::MeshBase::const_element_iterator
The definition of the const_element_iterator struct.
Definition: mesh_base.h:1891
libMesh::PointNeighborCoupling::set_dof_coupling
void set_dof_coupling(const CouplingMatrix *dof_coupling)
Definition: point_neighbor_coupling.h:58
libMesh::PointNeighborCoupling::n_levels
unsigned int n_levels()
Definition: point_neighbor_coupling.h:62
libMesh::PointNeighborCoupling::set_periodic_boundaries
void set_periodic_boundaries(const PeriodicBoundaries *periodic_bcs)
Definition: point_neighbor_coupling.h:73
libMesh::CouplingMatrix
This class defines a coupling matrix.
Definition: coupling_matrix.h:54
libMesh::PointNeighborCoupling
This class implements the default algebraic coupling in libMesh: elements couple to themselves,...
Definition: point_neighbor_coupling.h:41