libMesh
Loading...
Searching...
No Matches
periodic_boundary_base.h
Go to the documentation of this file.
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#ifndef LIBMESH_PERIODIC_BOUNDARY_BASE_H
19#define LIBMESH_PERIODIC_BOUNDARY_BASE_H
20
21// Local Includes
22#include "libmesh/libmesh_config.h"
23
24#ifdef LIBMESH_ENABLE_PERIODIC
25
26// Local Includes
27#include "libmesh/point.h"
28#include "libmesh/dense_matrix.h"
29
30// C++ Includes
31#include <set>
32#include <memory>
33
34namespace libMesh
35{
36
37// Forward Declarations
38class Elem;
39class MeshBase;
40
49{
50public:
54
59
64
69
73 virtual ~PeriodicBoundaryBase() = default;
74
80 virtual Point get_corresponding_pos(const Point & pt) const = 0;
81
96 virtual std::unique_ptr<PeriodicBoundaryBase> clone(TransformationType t = FORWARD) const = 0;
97
98 void set_variable(unsigned int var);
99
100 void merge(const PeriodicBoundaryBase & pb);
101
102 bool is_my_variable(unsigned int var_num) const;
103
107 bool has_transformation_matrix() const;
108
114
122 void set_transformation_matrix(const DenseMatrix<Real> & matrix);
123
127 const std::set<unsigned int> & get_variables() const;
128
129protected:
130
134 std::set<unsigned int> variables;
135
146 std::unique_ptr<DenseMatrix<Real>> _transformation_matrix;
147
148};
149
150} // namespace libmesh
151
152#endif // LIBMESH_ENABLE_PERIODIC
153
154#endif // LIBMESH_PERIODIC_BOUNDARY_BASE_H
Defines a dense matrix for use in Finite Element-type computations.
The base class for defining periodic boundaries.
std::set< unsigned int > variables
Set of variables for this periodic boundary, empty means all variables possible.
const DenseMatrix< Real > & get_transformation_matrix() const
Get the transformation matrix, if it is defined.
bool is_my_variable(unsigned int var_num) const
const std::set< unsigned int > & get_variables() const
Get the set of variables for this periodic boundary condition.
virtual Point get_corresponding_pos(const Point &pt) const =0
This function should be overridden by derived classes to define how one finds corresponding nodes on ...
boundary_id_type myboundary
The boundary ID of this boundary and its counterpart.
std::unique_ptr< DenseMatrix< Real > > _transformation_matrix
A DenseMatrix that defines the mapping of variables on this boundary and the counterpart boundary.
void set_transformation_matrix(const DenseMatrix< Real > &matrix)
Set the transformation matrix.
virtual ~PeriodicBoundaryBase()=default
Destructor.
void merge(const PeriodicBoundaryBase &pb)
virtual std::unique_ptr< PeriodicBoundaryBase > clone(TransformationType t=FORWARD) const =0
If we want the DofMap to be able to make copies of references and store them in the underlying map,...
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40
The libMesh namespace provides an interface to certain functionality in the library.
int8_t boundary_id_type
Definition id_types.h:51