Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
boundaryconstraints.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE-FUFEM Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUFEM_CONSTRAINTS_BOUNDARYCONSTRAINTS_HH
8#define DUNE_FUFEM_CONSTRAINTS_BOUNDARYCONSTRAINTS_HH
9
10#include <variant>
11
13
18
19
20
21namespace Dune::Fufem {
22
49template<class BV, class V, class MI, class C, class Basis, class Function, class IntersectionSet>
51void computeBoundaryConstraints(AffineConstraints<BV, V, MI, C>& constraints, const Basis& basis, Function&& f, const IntersectionSet& intersectionSet)
52{
53 auto&& isConstrained = Dune::Functions::istlVectorBackend(constraints.isConstrained());
54 auto isNewConstrained = constraints.isConstrained();
55 Dune::Fufem::markIntersectionDofs(intersectionSet, basis, isNewConstrained);
56 Dune::Fufem::recursiveForEachVectorEntry(isNewConstrained, [&](auto&& isNewConstrained_i, const auto& i)
57 {
58 isNewConstrained_i = isNewConstrained_i and not isConstrained[i];
59 isConstrained[i] = isNewConstrained_i or isConstrained[i];
60 });
61 Dune::Functions::interpolate(basis, constraints.constantTerm(), f, isNewConstrained);
62 constraints.resolveDependencies();
63}
64
65
88template<class BV, class V, class MI, class C, class Basis, class Function>
89void computeBoundaryConstraints(AffineConstraints<BV, V, MI, C>& constraints, const Basis& basis, Function&& f)
90{
92}
93
94
121template<class BitVector=std::monostate, class Vector=std::monostate, class Basis, class Function, class IntersectionSet>
123auto makeBoundaryConstraints(const Basis& basis, Function&& f, const IntersectionSet& intersectionSet)
124{
125 auto constraints = makeAffineConstraints<BitVector, Vector>(basis);
126 computeBoundaryConstraints(constraints, basis, f, intersectionSet);
127 return constraints;
128}
129
130
153template<class BitVector=std::monostate, class Vector=std::monostate, class Basis, class Function>
154auto makeBoundaryConstraints(const Basis& basis, Function&& f)
155{
156 auto constraints = makeAffineConstraints<BitVector, Vector>(basis);
157 computeBoundaryConstraints(constraints, basis, f);
158 return constraints;
159}
160
161} // namespace Dune::Fufem
162
163
164
165#endif // DUNE_FUFEM_CONSTRAINTS_BOUNDARYCONSTRAINTS_HH
auto istlVectorBackend(Vector &v)
void interpolate(const B &basis, C &&coeff, const F &f, const BV &bv, const NTRE &nodeToRangeEntry)
void markIntersectionDofs(const IntersectionSet &intersectionSet, const Basis &basis, Vector &vector)
For a given basis and intersection set, determine all degrees of freedom on the patch.
Definition boundarydofs.hh:45
auto makeBoundaryConstraints(const Basis &basis, Function &&f, const IntersectionSet &intersectionSet)
Compute constraints for essential boundary conditions.
Definition boundaryconstraints.hh:123
void computeBoundaryConstraints(AffineConstraints< BV, V, MI, C > &constraints, const Basis &basis, Function &&f, const IntersectionSet &intersectionSet)
Compute constraints for essential boundary conditions.
Definition boundaryconstraints.hh:51
constexpr Boundary boundary
Object representing the full grid view boundary as integration domain.
Definition domains.hh:242
Definition dunefunctionsboundaryfunctionalassembler.hh:29
Class to handle affine constraints on a subset of DOFs.
Definition affineconstraints.hh:201
void resolveDependencies()
Resolve dependencies of constrained DOFs on other constrained DOFs.
Definition affineconstraints.hh:756
bool isConstrained(const MultiIndexType &i) const
Check if i-th DOF is constrained.
Definition affineconstraints.hh:315
const ConstantTerm & constantTerm() const
Const access to constant part of affine map.
Definition affineconstraints.hh:389
Traits class to identify boundary integration domains.
Definition domains.hh:49
Traits class to identify skeleton integration domains.
Definition domains.hh:62