8#include <dune/common/concept.hh>
9#include <dune/functions/functionspacebases/concepts.hh>
10#include <dune/functions/functionspacebases/subspacebasis.hh>
12#include <amdis/BoundaryCondition.hpp>
13#include <amdis/BoundarySubset.hpp>
14#include <amdis/common/ConceptsBase.hpp>
15#include <amdis/common/FieldMatVec.hpp>
16#include <amdis/common/TypeTraits.hpp>
17#include <amdis/typetree/TreePath.hpp>
23 template <
class ct,
int dow>
26 using WorldMatrix = FieldMatrix<ct, dow, dow>;
27 using WorldVector = FieldVector<ct, dow>;
35 WorldVector evaluate(WorldVector
const& x)
const
42 WorldVector evaluateInverse(WorldVector
const& y)
const
44 WorldVector ys = y -
shift_;
60 template <
class Basis,
class TP>
63 using SubspaceBasis = Dune::Functions::SubspaceBasis<Basis, TP>;
66 using Domain =
typename SubspaceBasis::GridView::template Codim<0>::Geometry::GlobalCoordinate;
69 using Intersection =
typename SubspaceBasis::GridView::Intersection;
75 : basis_(std::move(basis))
76 , boundarySubset_(std::move(boundarySubset))
77 , faceTrafo_(std::move(faceTrafo))
94 template <
class Mat,
class Sol,
class Rhs>
95 void apply(Mat& matrix, Sol& solution, Rhs& rhs);
100 return associations_;
106 return periodicNodes_;
110 void initAssociations();
111 void initAssociations2();
114 template <
class Node>
115 auto coords(Node
const& node, std::vector<std::size_t>
const& localIndices)
const;
118 SubspaceBasis basis_;
120 FaceTrafo faceTrafo_;
122 std::vector<bool> periodicNodes_;
123 std::map<std::size_t, std::size_t> associations_;
124 std::optional<bool> hasConnectedIntersections_;
128 template <
class Basis>
129 using FaceTrafo = FaceTransformation<
130 typename Basis::GridView::template Codim<0>::Geometry::GlobalCoordinate::field_type,
131 Basis::GridView::template Codim<0>::Geometry::GlobalCoordinate::dimension>;
136 template <
class B,
class TP>
137 auto makePeriodicBC(Dune::Functions::SubspaceBasis<B, TP> basis,
138 BoundarySubset<typename B::GridView::Intersection> boundarySubset,
139 Impl::FaceTrafo<B> trafo)
141 using BcType = PeriodicBC<B, TP>;
142 return BcType(std::move(basis), std::move(boundarySubset), std::move(trafo));
146 template <
class B,
class TP,
147 REQUIRES(Concepts::GlobalBasis<B>)>
148 auto makePeriodicBC(B
const& basis, TP
const& tp,
149 BoundarySubset<typename B::GridView::Intersection> boundarySubset,
150 Impl::FaceTrafo<B> trafo)
152 return makePeriodicBC(Dune::Functions::subspaceBasis(basis, tp),
153 std::move(boundarySubset), std::move(trafo));
158 REQUIRES(Concepts::GlobalBasis<B>)>
159 auto makePeriodicBC(B
const& basis,
160 BoundarySubset<typename B::GridView::Intersection> boundarySubset,
161 Impl::FaceTrafo<B> trafo)
163 return makePeriodicBC(basis, makeTreePath(), std::move(boundarySubset),
169#include "PeriodicBC.inc.hpp"
Implements a periodic boundary condition.
Definition: PeriodicBC.hpp:62
void init()
Compute the pairs of associated boundary DOFs.
Definition: PeriodicBC.inc.hpp:18
auto const & associations() const
Return the map of DOF associations.
Definition: PeriodicBC.hpp:98
void apply(Mat &matrix, Sol &solution, Rhs &rhs)
Move matrix rows (and columns) of dependant DOFs to the corresponding master DOFs.
Definition: PeriodicBC.inc.hpp:235
auto const & periodicNodes() const
Return the boolean boundary indicator.
Definition: PeriodicBC.hpp:104
PeriodicBC(SubspaceBasis basis, BoundarySubset< Intersection > boundarySubset, FaceTrafo faceTrafo)
Create the BoundaryCondition and store the face transformation in a local variable.
Definition: PeriodicBC.hpp:73
constexpr bool MultiIndex
A multi-index type.
Definition: Concepts.hpp:149