5 #include <dune/functions/functionspacebases/subentitydofs.hh> 7 #include <amdis/functions/Interpolate.hpp> 8 #include <amdis/LinearAlgebra.hpp> 16 template <
class Basis,
class F>
17 void forEachInteriorBoundaryDOF(Basis
const& basis, F&& f)
19 auto localView = basis.localView();
20 auto seDOFs = Dune::Functions::subEntityDOFs(basis);
21 auto const& gridView = basis.gridView();
22 for (
auto const& element : elements(gridView,
typename BackendTraits<Basis>::PartitionSet{})) {
23 if (element.hasBoundaryIntersections()) {
24 localView.bind(element);
25 for(
auto const& intersection: intersections(gridView, element))
26 if (intersection.boundary())
27 for(
auto localIndex: seDOFs.bind(localView,intersection))
28 f(localIndex, localView, intersection);
36 template <
class Mat,
class Sol,
class Rhs,
class RB,
class CB,
class V>
41 dirichletNodes_.assign(colBasis_.dimension(),
false);
42 Impl::forEachInteriorBoundaryDOF(colBasis_,
43 [&](
int localIndex, LV
const& localView, Intersection
const& intersection) {
44 dirichletNodes_[localView.index(localIndex)] = dirichletNodes_[localView.index(localIndex)]
45 || boundarySubset_(intersection);
50 template <
class Mat,
class Sol,
class Rhs,
class RB,
class CB,
class V>
52 apply(Mat& matrix, Sol& solution, Rhs& rhs)
55 dirichletBC(matrix, solution, rhs, dirichletNodes_);
void init() override
Definition: DirichletBC.inc.hpp:38
void interpolate(Basis const &basis, Vec &vec, GF const &gf, TP const &tp_, C &&c_, BV &&bv_, Assign &&a_)
Interpolate given function in discrete function space.
Definition: Interpolate.hpp:120
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
constexpr bool LocalView
A Dune::Functions::LocalView type.
Definition: Concepts.hpp:182
void apply(Mat &matrix, Sol &solution, Rhs &rhs) override
Apply dirichlet BC to matrix and vector.
Definition: DirichletBC.inc.hpp:52