30 template <
class CG,
class Node,
class Quad,
class LF,
class Vec>
31 void assemble(CG
const& contextGeo, Node
const& node, Quad
const& quad,
32 LF
const& localFct, Vec& elementVector)
const
34 static_assert(Dune::TypeTree::Concept::UniformInnerTreeNode<Node>,
"Node must be a Power-Node.");
35 static_assert(static_size_v<typename LF::Range> == 1,
36 "Expression must be of scalar type.");
37 assert(node.degree() == CG::dow);
39 std::size_t feSize = node.child(0).size();
41 using RangeFieldType =
typename Dune::TypeTree::Child<Node,0>::LocalBasis::Traits::RangeFieldType;
42 using WorldVector = FieldVector<RangeFieldType,CG::dow>;
43 std::vector<WorldVector> gradients;
45 for (
auto const& qp : quad) {
47 auto&& local = contextGeo.coordinateInElement(qp.position());
50 const auto jacobian = contextGeo.elementGeometry().jacobianInverseTransposed(local);
53 const auto factor = localFct(local) * contextGeo.integrationElement(qp.position()) * qp.weight();
56 auto const& shapeGradients = node.child(0).localBasisJacobiansAt(local);
59 gradients.resize(shapeGradients.size());
61 for (std::size_t i = 0; i < gradients.size(); ++i)
62 jacobian.mv(shapeGradients[i][0], gradients[i]);
64 for (std::size_t j = 0; j < feSize; ++j) {
65 for (std::size_t k = 0; k < CG::dow; ++k) {
66 const auto local_kj = node.child(k).localIndex(j);
67 elementVector[local_kj] += factor * gradients[j][k];