6 #include <dune/functions/common/defaultderivativetraits.hh> 7 #include <dune/functions/functionspacebases/defaultnodetorangemap.hh> 8 #include <dune/functions/functionspacebases/flatvectorview.hh> 9 #include <dune/functions/gridfunctions/gridviewentityset.hh> 10 #include <dune/typetree/childextraction.hh> 12 #include <amdis/common/Tags.hpp> 13 #include <amdis/functions/NodeCache.hpp> 14 #include <amdis/typetree/FiniteElementType.hpp> 15 #include <amdis/typetree/RangeType.hpp> 16 #include <amdis/typetree/TreePath.hpp> 32 template <
class Coeff,
class GB,
class TreePath>
37 template <
class Coeff,
class GB,
class TreePath>
44 using Coefficients = Coeff;
45 using GlobalBasis = GB;
46 using ValueType =
typename Coeff::value_type;
50 template <
class... Path>
52 :
Super(dofVector, basis, path...)
53 , mutableCoeff_(&dofVector)
57 template <
class DV,
class... Path,
58 class Coeff_ = TYPEOF(std::declval<DV>().
coefficients()),
59 class GB_ = TYPEOF(*std::declval<DV>().basis())>
74 template <
class Expr,
class Tag = tag::average>
87 template <
class Expr,
class Tag = tag::average>
107 template <
class Expr>
117 return *mutableCoeff_;
126 auto tp = cat(this->treePath_, makeTreePath(ii...));
133 Coefficients* mutableCoeff_;
137 template <
class Coeff,
class GB,
class TreePath>
141 using Coefficients = std::remove_const_t<Coeff>;
142 using GlobalBasis = GB;
144 using ValueType =
typename Coefficients::value_type;
147 using SubTree =
typename Dune::TypeTree::ChildForTreePath<Tree, TreePath>;
150 using SubTreeCache =
typename Dune::TypeTree::ChildForTreePath<TreeCache, TreePath>;
152 using NodeToRangeEntry = Dune::Functions::DefaultNodeToRangeMap<SubTree>;
156 using EntitySet = Dune::Functions::GridViewEntitySet<GridView, 0>;
159 using Domain =
typename EntitySet::GlobalCoordinate;
166 enum { hasDerivative =
false };
170 template <
class Type>
171 class DerivativeLocalFunctionBase;
173 class GradientLocalFunction;
174 class PartialLocalFunction;
175 class DivergenceLocalFunction;
182 template <
class... Path>
184 : coefficients_(&coefficients)
186 , treePath_(makeTreePath(path...))
187 , entitySet_(basis_->gridView())
188 , nodeToRangeEntry_(
Dune::Functions::makeDefaultNodeToRangeMap(*basis_, treePath_))
192 template <
class DV,
class... Path,
193 class Coeff_ = TYPEOF(std::declval<DV>().
coefficients()),
194 class GB_ = TYPEOF(*std::declval<DV>().basis())>
206 return LocalFunction{*
this};
230 return *coefficients_;
234 auto child(
Indices... ii)
const 236 auto tp = cat(this->treePath_, makeTreePath(ii...));
241 Coefficients
const* coefficients_;
242 GlobalBasis
const* basis_;
245 NodeToRangeEntry nodeToRangeEntry_;
250 template <
class Coeff,
class GB,
class... Path,
251 class TP = TYPEOF(makeTreePath(std::declval<Path>()...)),
252 REQUIRES(Concepts::GlobalBasis<GB>)>
256 template <
class DV,
class... Path,
257 class Coeff = decltype(std::declval<DV>().
coefficients()),
258 class GB = decltype(*std::declval<DV>().basis()),
259 class TP = TYPEOF(makeTreePath(std::declval<Path>()...))>
268 template <
class Coeff,
class GB,
class... Path,
class...
Indices>
271 return df.child(ii...);
275 template <
class Coeff,
class GB,
class... Path,
class...
Indices>
278 return df.child(ii...);
282 template <
class DV,
class...
Indices,
284 class = decltype(std::declval<DV>().basis())>
292 #include "DiscreteLocalFunction.inc.hpp" 293 #include "DiscreteFunction.inc.hpp" Self & operator<<(Expr &&expr)
Interpolation of GridFunction to DOFVector, alias to interpolate()
Definition: DiscreteFunction.hpp:92
TreePath const & treePath() const
Return treePath associated with this discrete function.
Definition: DiscreteFunction.hpp:222
RangeType_t< SubTree, ValueType > Range
Range type of this DiscreteFunction.
Definition: DiscreteFunction.hpp:162
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:183
std::index_sequence< I... > Indices
class that represents a sequence of indices
Definition: Index.hpp:40
Self & operator-=(Expr &&expr)
interpolate (*this) - expr to DOFVector
Definition: DiscreteFunction.hpp:108
Definition: AdaptiveGrid.hpp:373
void interpolate(Expr &&expr, Tag strategy={})
Interpolation of GridFunction to DOFVector.
Definition: DiscreteFunction.inc.hpp:61
typename EntitySet::GlobalCoordinate Domain
Global coordinates of the EntitySet.
Definition: DiscreteFunction.hpp:159
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
A mutable view on the subspace of a DOFVector,.
Definition: DiscreteFunction.hpp:33
Node_t< typename GlobalBasis::PreBasis, PrefixPath > Tree
Tree of local finite elements / local shape function sets.
Definition: LocalView.hpp:40
Coefficients const & coefficients() const
Return const coefficient vector.
Definition: DiscreteFunction.hpp:228
A Const DiscreteFunction.
Definition: DiscreteFunction.hpp:138
DiscreteFunction(Coefficients &dofVector, GlobalBasis const &basis, Path... path)
Constructor. Stores a pointer to the mutable dofvector.
Definition: DiscreteFunction.hpp:51
Dune::Functions::GridViewEntitySet< GridView, 0 > EntitySet
Set of entities the DiscreteFunction is defined on.
Definition: DiscreteFunction.hpp:156
auto valueOf(DiscreteFunction< Coeff, GB, Path... > &df, Indices... ii)
A Generator for the childs of a mutable DiscreteFunction.
Definition: DiscreteFunction.hpp:269
typename PreBasis::GridView GridView
The grid view that the FE space is defined on.
Definition: GlobalBasis.hpp:66
GlobalBasis const & basis() const
Return global basis bound to the DOFVector.
Definition: DiscreteFunction.hpp:216
Coefficients & coefficients()
Return the mutable DOFVector.
Definition: DiscreteFunction.hpp:115
typename Impl::RangeTypeImpl< Node, R, typename Node::NodeTag >::type RangeType_t
Range type of a node in the basis tree, composed of the leaf basis range types.
Definition: RangeType.hpp:47
DiscreteFunction(DV const &dofVector, Path... path)
Construct a DiscreteFunction directly from a DOFVector.
Definition: DiscreteFunction.hpp:195
DiscreteFunction(DV &&dofVector, Path... path)
Construct a DiscreteFunction directly from a DOFVector.
Definition: DiscreteFunction.hpp:60
EntitySet const & entitySet() const
Return a Dune::Functions::GridViewEntitySet.
Definition: DiscreteFunction.hpp:210
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:36
LocalFunction makeLocalFunction() const
Create a local function for this view on the DOFVector.
Definition: DiscreteFunction.hpp:204
Self & operator+=(Expr &&expr)
interpolate (*this) + expr to DOFVector
Definition: DiscreteFunction.hpp:100
NodeCache_t< Tree > TreeCache
Cached basis-tree.
Definition: LocalView.hpp:43