6 #include <dune/common/ftraits.hh> 7 #include <dune/common/typeutilities.hh> 8 #include <dune/functions/common/defaultderivativetraits.hh> 9 #include <dune/functions/functionspacebases/flatvectorview.hh> 10 #include <dune/functions/gridfunctions/gridviewentityset.hh> 11 #include <dune/typetree/childextraction.hh> 13 #include <amdis/common/Tags.hpp> 14 #include <amdis/functions/NodeCache.hpp> 15 #include <amdis/linearalgebra/Access.hpp> 16 #include <amdis/typetree/FiniteElementType.hpp> 17 #include <amdis/typetree/RangeType.hpp> 18 #include <amdis/typetree/TreePath.hpp> 35 template <
class Coeff,
class GB,
class TreePath,
class Range =
void>
40 template <
class Coeff,
class GB,
class TreePath,
class R>
47 using Coefficients = Coeff;
48 using GlobalBasis = GB;
52 template <
class... Path>
54 :
Super(coefficients, basis, path...)
55 , mutableCoeff_(&coefficients)
58 template <
class... Path>
64 template <
class DV,
class... Path,
65 Dune::disableCopyMove<DiscreteFunction,DV> = 0,
66 class Coeff_ = TYPEOF(std::declval<DV>().
coefficients()),
67 class GB_ = TYPEOF(std::declval<DV>().basis())>
69 : DiscreteFunction(dofVector.coefficients(), dofVector.basis(), path...)
82 template <
class Expr,
class Tag = tag::average>
95 template <
class Expr,
class Tag = tag::average>
107 template <
class Expr>
115 template <
class Expr>
125 return *mutableCoeff_;
131 template <
class Range = void,
class... Indices>
132 auto child(Indices... ii)
134 auto tp = cat(this->treePath_, makeTreePath(ii...));
141 Coefficients* mutableCoeff_;
145 template <
class Coeff,
class GB,
class TreePath,
class R>
149 using Coefficients = std::remove_const_t<Coeff>;
150 using GlobalBasis = GB;
154 using Coefficient = TYPEOF(std::declval<Traits::Access>()(std::declval<Coeff const>(), std::declval<typename GB::MultiIndex>()));
157 using SubTree =
typename Dune::TypeTree::ChildForTreePath<Tree, TreePath>;
161 using EntitySet = Dune::Functions::GridViewEntitySet<GridView, 0>;
164 using Domain =
typename EntitySet::GlobalCoordinate;
167 using Range = std::conditional_t<std::is_same_v<R,void>, RangeType_t<SubTree,Coefficient>, R>;
171 enum { hasDerivative =
false };
175 template <
class Type>
180 template <
class... Path>
182 : coefficients_(&coefficients)
184 , treePath_(makeTreePath(path...))
185 , entitySet_(basis_->gridView())
188 template <
class... Path>
194 template <
class DV,
class... Path,
195 Dune::disableCopyMove<DiscreteFunction,DV> = 0,
196 class Coeff_ = TYPEOF(std::declval<DV>().
coefficients()),
197 class GB_ = TYPEOF(std::declval<DV>().basis())>
199 : DiscreteFunction(dofVector.coefficients(), dofVector.basis(), path...)
232 return *coefficients_;
235 template <
class Range = void,
class... Indices>
236 auto child(Indices... ii)
const 238 auto tp = cat(this->treePath_, makeTreePath(ii...));
243 Coefficients
const* coefficients_;
244 GlobalBasis
const* basis_;
252 template <
class C,
class Basis,
class... Indices,
253 class GB = Underlying_t<Basis>,
254 class TP = TYPEOF(makeTreePath(std::declval<Indices>()...)),
255 REQUIRES(Concepts::GlobalBasis<GB>)>
259 template <
class DV,
class... Indices,
261 class GB = decltype(std::declval<DV>().basis()),
262 class TP = TYPEOF(makeTreePath(std::declval<Indices>()...))>
271 template <
class Range = void,
class C,
class GB,
class TP,
class R,
class... Indices>
274 return df.template child<Range>(ii...);
278 template <
class Range = void,
class C,
class GB,
class TP,
class R,
class... Indices>
281 return df.template child<Range>(ii...);
285 template <
class Range = void,
class DV,
class... Indices,
287 class GB = decltype(std::declval<DV>().basis()),
288 class TP = TYPEOF(makeTreePath(std::declval<Indices>()...))>
289 auto valueOf(DV& dofVec, Indices... ii)
292 return DF{dofVec.
coefficients(), dofVec.basis(), makeTreePath(ii...)};
297 #include "DiscreteLocalFunction.inc.hpp" 298 #include "DiscreteFunction.inc.hpp" Self & operator<<(Expr &&expr)
Interpolation of GridFunction to DOFVector, alias to interpolate()
Definition: DiscreteFunction.hpp:100
DiscreteFunction(Coefficients const &coefficients, GlobalBasis const &basis, Path... path)
Constructor. Stores a pointer to the dofVector and a copy of the treePath.
Definition: DiscreteFunction.hpp:181
Self & operator-=(Expr &&expr)
interpolate (*this) - expr to DOFVector
Definition: DiscreteFunction.hpp:116
A Const DiscreteFunction.
Definition: DiscreteFunction.hpp:146
void interpolate(Expr &&expr, Tag strategy={})
Interpolation of GridFunction to DOFVector.
Definition: DiscreteFunction.inc.hpp:62
AMDiS::LocalView< Self > LocalView
Type of the local view on the restriction of the basis to a single element.
Definition: GlobalBasis.hpp:67
Definition: AdaptBase.hpp:6
A mutable view on the subspace of a DOFVector,.
Definition: DiscreteFunction.hpp:36
Node_t< typename GlobalBasis::PreBasis, PrefixPath > Tree
Tree of local finite elements / local shape function sets.
Definition: LocalView.hpp:41
Definition: DerivativeTraits.hpp:18
DiscreteFunction(DV const &dofVector, Path... path)
Construct a DiscreteFunction directly from a DOFVector.
Definition: DiscreteFunction.hpp:198
DiscreteFunction(DV &&dofVector, Path... path)
Construct a DiscreteFunction directly from a DOFVector.
Definition: DiscreteFunction.hpp:68
typename PreBasis::GridView GridView
The grid view that the FE space is defined on.
Definition: GlobalBasis.hpp:63
Coefficients & coefficients()
Return the mutable DOFVector.
Definition: DiscreteFunction.hpp:123
DiscreteFunction(Coefficients &coefficients, GlobalBasis const &basis, Path... path)
Constructor. Stores a pointer to the mutable dofvector.
Definition: DiscreteFunction.hpp:53
TreePath const & treePath() const
Return treePath associated with this discrete function.
Definition: DiscreteFunction.hpp:224
Dune::Functions::GridViewEntitySet< GridView, 0 > EntitySet
Set of entities the DiscreteFunction is defined on.
Definition: DiscreteFunction.hpp:161
std::conditional_t< std::is_same_v< R, void >, RangeType_t< SubTree, Coefficient >, R > Range
Range type of this DiscreteFunction. If R=void deduce the Range automatically, using RangeType_t...
Definition: DiscreteFunction.hpp:167
Coefficients const & coefficients() const
Return const coefficient vector.
Definition: DiscreteFunction.hpp:230
EntitySet const & entitySet() const
Return a Dune::Functions::GridViewEntitySet.
Definition: DiscreteFunction.hpp:212
LocalFunction< tag::value > makeLocalFunction() const
Create a local function for this view on the DOFVector.
Definition: DiscreteFunction.hpp:206
void interpolate_noalias(Expr &&expr, Tag strategy={})
Interpolation of GridFunction to DOFVector, assuming that there is no reference to this DOFVector in ...
Definition: DiscreteFunction.inc.hpp:37
Self & operator+=(Expr &&expr)
interpolate (*this) + expr to DOFVector
Definition: DiscreteFunction.hpp:108
typename EntitySet::GlobalCoordinate Domain
Global coordinates of the EntitySet.
Definition: DiscreteFunction.hpp:164
GlobalBasis const & basis() const
Return global basis bound to the DOFVector.
Definition: DiscreteFunction.hpp:218