12#ifndef DUMUX_DIRICHLET_CONSTRAINTS_HH
13#define DUMUX_DIRICHLET_CONSTRAINTS_HH
16#include <unordered_map>
22template<
class Info,
class Values>
38template<
class DirichletConstra
intInfo,
class DirichletValues,
class IndexType>
57 typename C::value_type v,
58 typename C::value_type::ConstraintInfo info,
59 typename C::value_type::ConstraintValues vals,
60 typename C::value_type::GridIndexType idx
63 {
typename C::value_type{info, vals, idx} };
78template<
class Problem,
class DirichletFunction, Detail::DirichletConstra
intContainer Constra
ints>
80 const DirichletFunction& dirichletFunction,
81 Constraints& constraints)
83 using Data =
typename Constraints::value_type;
85 using DirichletValues =
typename Data::ConstraintValues;
87 auto fvGeometry =
localView(problem.gridGeometry());
88 for (
const auto& element : elements(problem.gridGeometry().gridView()))
90 fvGeometry.bind(element);
91 for (
const auto& intersection : intersections(problem.gridGeometry().gridView(), element))
93 if(!intersection.boundary() || intersection.neighbor())
96 const auto& bcTypes = problem.boundaryTypes(fvGeometry, intersection);
97 if (bcTypes.hasDirichlet())
99 for (
const auto& localDof :
localDofs(fvGeometry, intersection))
103 for (
int eqIdx = 0; eqIdx < DirichletValues::size(); ++eqIdx)
104 if (bcTypes.isDirichlet(eqIdx))
105 info.
set(bcTypes.eqToDirichletIndex(eqIdx), eqIdx);
107 auto dirichletValues = dirichletFunction(fvGeometry, intersection, localDof);
108 constraints.push_back(Data{std::move(info), std::move(dirichletValues), localDof.dofIndex()});
Class to specify information related to constraints.
Definition: constraintinfo.hh:26
void set(int eqIdx)
Set a constraint condition for a single equation.
Definition: constraintinfo.hh:64
Definition: dirichletconstraints.hh:55
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:26
Definition: dirichletconstraints.hh:52
Definition: cvfe/interpolationpointdata.hh:17
void appendDirichletConstraints(const Problem &problem, const DirichletFunction &dirichletFunction, Constraints &constraints)
Append constraints for Dirichlet boundaries.
Definition: dirichletconstraints.hh:79
auto localDofs(const FVElementGeometry &fvGeometry)
range over local dofs
Definition: localdof.hh:50
Definition: dirichletconstraints.hh:24
Info ConstraintInfo
Definition: dirichletconstraints.hh:25
const ConstraintValues & values() const
Definition: dirichletconstraints.hh:31
ConstraintValues values_
Definition: dirichletconstraints.hh:35
ConstraintInfo info_
Definition: dirichletconstraints.hh:34
Values ConstraintValues
Definition: dirichletconstraints.hh:26
const ConstraintInfo & constraintInfo() const
Definition: dirichletconstraints.hh:28
Definition: dirichletconstraints.hh:40
IndexType GridIndexType
Definition: dirichletconstraints.hh:41
GridIndexType dofIndex() const
Definition: dirichletconstraints.hh:43
GridIndexType dofIdx_
Definition: dirichletconstraints.hh:46