6 #include <amdis/GridFunctions.hpp> 7 #include <amdis/LocalOperator.hpp> 8 #include <amdis/common/Transposed.hpp> 9 #include <amdis/common/TypeTraits.hpp> 10 #include <amdis/typetree/FiniteElementType.hpp> 11 #include <amdis/utility/QuadratureFactory.hpp> 38 template <
class Derived,
class LC,
class GF>
42 template <
class,
class>
45 using ContextType = Impl::ContextTypes<LC>;
49 using GridFunction = GF;
52 using LocalFunction = decltype(localFunction(std::declval<GF>()));
55 using Element =
typename ContextType::Entity;
58 using Geometry =
typename Element::Geometry;
61 using LocalCoordinate =
typename GF::EntitySet::LocalCoordinate;
73 template <
class Gr
idFct>
75 : gridFct_(FWD(gridFct))
76 , termOrder_(termOrder)
84 using ctype =
typename Geometry::ctype;
86 makeQuadratureFactory<ctype, LC::mydimension, LocalFunction>(FWD(pre)));
93 assert( this->bound_ );
94 return (*localFct_)(local);
99 template <
class... Nodes>
102 assert(
bool(quadFactory_) );
103 int quadDegree = this->
getDegree(termOrder_, quadFactory_->order(), nodes...);
104 return quadFactory_->rule(type, quadDegree);
117 void bind_impl(Element
const& element, Geometry
const& geometry)
119 assert(
bool(quadFactory_) );
120 localFct_.emplace(localFunction(gridFct_));
121 localFct_->bind(element);
122 quadFactory_->bind(localFct_.value());
137 std::optional<LocalFunction> localFct_;
140 std::shared_ptr<QuadFactory> quadFactory_;
149 template <
class Derived,
class Transposed>
151 :
public LocalOperator<Derived, typename Transposed::LocalContext>
153 template <
class,
class>
156 template <
class T,
class... Args>
157 using Constructable = decltype(
new T(std::declval<Args>()...) );
160 template <
class... Args,
161 std::enable_if_t<Dune::Std::is_detected<Constructable, Transposed, Args...>::value,
int> = 0>
163 : transposedOp_(FWD(args)...)
171 transposedOp_.setQuadFactory(FWD(pre));
176 template <
class Element,
class Geometry>
179 transposedOp_.bind(element, geometry);
185 transposedOp_.unbind();
195 template <
class CG,
class RN,
class CN,
class Mat>
196 void getElementMatrix(CG
const& contextGeometry, RN
const& rowNode, CN
const& colNode, Mat& elementMatrix)
198 auto elementMatrixTransposed = transposed(elementMatrix);
199 transposedOp_.getElementMatrix(
200 contextGeometry, colNode, rowNode, elementMatrixTransposed);
204 Transposed transposedOp_;
209 template <
class Tag,
class PreGr
idFct,
class PQF>
219 template <
class Tag,
class Expr,
class... QuadratureArgs>
222 auto pqf = makePreQuadratureFactory(FWD(args)...);
241 template <
class Tag,
class LC,
class Gr
idFct>
246 template <
class Context,
class Tag,
class GF,
class QF>
247 auto makeGridFunctionOperator(Tag tag, GF&& gf, QF&& qf)
250 gfo.setQuadFactory(FWD(qf));
257 template <
class Context,
class... Args,
class GridView>
261 return makeGridFunctionOperator<Context>(op.tag, std::move(gf), std::move(op.quadFactory));
264 template <
class Context,
class... Args,
class GridView>
269 return makeGridFunctionOperator<Context>(op.tag, std::move(gf), op.quadFactory);
auto makeOperator(Tag tag, Expr &&expr, QuadratureArgs &&... args)
Store tag and expression into a PreGridFunctionOperator to create a GridFunctionOperator.
Definition: GridFunctionOperator.hpp:220
Definition: GridFunctionOperator.hpp:210
The base-template for GridFunctionOperators.
Definition: GridFunctionOperator.hpp:242
void setQuadFactory(PQF &&pre)
Definition: GridFunctionOperator.hpp:82
decltype(auto) makeGridFunction(PreGridFct const &preGridFct, GridView const &gridView)
Generator for Gridfunctions from Expressions (PreGridfunctions)
Definition: GridFunction.hpp:154
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
auto coefficient(LocalCoordinate const &local) const
Return expression value at LocalCoordinates.
Definition: GridFunctionOperator.hpp:91
int getDegree(int derivOrder, int coeffDegree, RN const &rowNode, CN const &colNode) const
Return the quadrature degree for a matrix operator.
Definition: LocalOperator.hpp:130
auto makeLocalOperator(PreGridFunctionOperator< Args... > op, GridView const &gridView)
Definition: GridFunctionOperator.hpp:258
The main implementation of an operator to be used in a Assembler.
Definition: LocalOperator.hpp:28
typename ContextType::Entity Element
The codim=0 grid entity.
Definition: LocalOperator.hpp:37
The transposed operator, implemented in term of its transposed by calling getElementMatrix with inver...
Definition: GridFunctionOperator.hpp:150
auto const & getQuadratureRule(Dune::GeometryType type, Nodes const &... nodes) const
Definition: GridFunctionOperator.hpp:100
void setQuadFactory(PQF &&pre)
Definition: GridFunctionOperator.hpp:169
GridFunctionOperatorBase(GridFct &&gridFct, int termOrder)
Constructor. Stores a copy of gridFct.
Definition: GridFunctionOperator.hpp:74
Base class for quadrature factories for localFunctions.
Definition: QuadratureFactory.hpp:14
auto makeUniquePtr(Obj &&obj)
Create a unique_ptr by copy/move construction.
Definition: TypeTraits.hpp:107
The main implementation of an CRTP-base class for operators using a grid-function coefficient to be u...
Definition: GridFunctionOperator.hpp:39
typename Element::Geometry Geometry
The geometry of the Element.
Definition: LocalOperator.hpp:40