5#include <amdis/GridFunctionOperator.hpp>
6#include <amdis/common/StaticSize.hpp>
28 template <
class CG,
class RN,
class CN,
class Quad,
class LocalFct,
class Mat>
29 void assemble(CG
const& contextGeo, RN
const& rowNode, CN
const& colNode,
30 Quad
const& quad, LocalFct
const& localFct, Mat& elementMatrix)
const
32 static_assert(static_size_v<typename LocalFct::Range> == CG::dow,
"Expression must be of vector type.");
33 static_assert(RN::isLeaf && CN::isLeaf,
34 "Operator can be applied to Leaf-Nodes only.");
36 std::size_t rowSize = rowNode.size();
37 std::size_t colSize = colNode.size();
39 using RangeFieldType =
typename CN::LocalBasis::Traits::RangeFieldType;
40 using WorldVector = FieldVector<RangeFieldType,CG::dow>;
41 std::vector<WorldVector> colGradients;
43 for (
auto const& qp : quad) {
45 auto&& local = contextGeo.coordinateInElement(qp.position());
48 const auto jacobian = contextGeo.elementGeometry().jacobianInverseTransposed(local);
51 const auto factor = contextGeo.integrationElement(qp.position()) * qp.weight();
52 const auto b = localFct(local);
55 auto const& shapeValues = rowNode.localBasisValuesAt(local);
58 auto const& shapeGradients = colNode.localBasisJacobiansAt(local);
61 colGradients.resize(shapeGradients.size());
63 for (std::size_t i = 0; i < colGradients.size(); ++i)
64 jacobian.mv(shapeGradients[i][0], colGradients[i]);
66 for (std::size_t j = 0; j < colSize; ++j) {
67 const auto local_j = colNode.localIndex(j);
68 const auto value = factor * (b * colGradients[j]);
69 for (std::size_t i = 0; i < rowSize; ++i) {
70 const auto local_i = rowNode.localIndex(i);
71 elementMatrix[local_i][local_j] += value * shapeValues[i];
82 static constexpr int degree = 1;
first-order operator
Definition: FirstOrderTestGradTrial.hpp:24
auto fot(Expr &&expr, tag::grad_trial, int quadOrder=-1)
Create a first-order term with derivative on test-function.
Definition: FirstOrderTestGradTrial.hpp:89
auto makeOperator(Tag const &tag, Expr &&expr, int gridFctDeg=-1)
Definition: GridFunctionOperator.hpp:235
Registry to specify a tag for each implementation type.
Definition: GridFunctionOperator.hpp:216
Definition: FirstOrderTestGradTrial.hpp:18
Definition: FirstOrderTestGradTrial.hpp:17