AMDiS 2.11-git
The Adaptive Multi-Dimensional Simulation Toolbox
 
Loading...
Searching...
No Matches
ZeroOrderTestvec.hpp
1#pragma once
2
3#include <type_traits>
4
5#include <amdis/GridFunctionOperator.hpp>
6#include <amdis/common/FieldMatVec.hpp>
7#include <amdis/common/StaticSize.hpp>
8
9#include <dune/common/typetree/nodeconcepts.hh>
10
11namespace AMDiS
12{
18 namespace tag
19 {
20 struct testvec {};
21 }
22
23
26 {
27 public:
29
30 template <class CG, class Node, class Quad, class LocalFct, class Vec>
31 void assemble(CG const& contextGeo, Node const& node, Quad const& quad,
32 LocalFct const& localFct, Vec& elementVector) const
33 {
34 static_assert(static_size_v<typename LocalFct::Range> == CG::dow,
35 "Expression must be of vector type." );
36 static_assert(Dune::TypeTree::Concept::UniformInnerTreeNode<Node>,
37 "Operator can be applied to Power-Nodes only.");
38
39 assert(node.degree() == CG::dow);
40
41 std::size_t size = node.child(0).size();
42
43 for (auto const& qp : quad) {
44 // Position of the current quadrature point in the reference element
45 auto&& local = contextGeo.coordinateInElement(qp.position());
46
47 // The multiplicative factor in the integral transformation formula
48 const auto dx = contextGeo.integrationElement(qp.position()) * qp.weight();
49 const auto exprValue = localFct(local);
50
51 auto const& shapeValues = node.child(0).localBasisValuesAt(local);
52
53 for (std::size_t i = 0; i < size; ++i) {
54 for (std::size_t k = 0; k < node.degree(); ++k) {
55 const auto local_ki = node.child(k).localIndex(i);
56 elementVector[local_ki] += Dune::at(exprValue,k) * shapeValues[i] * dx;
57 }
58 }
59 }
60 }
61 };
62
63 template <class LC>
64 struct GridFunctionOperatorRegistry<tag::testvec, LC>
65 {
66 static constexpr int degree = 0;
67 using type = ZeroOrderTestVec;
68 };
69
72} // end namespace AMDiS
zero-order vector-operator
Definition ZeroOrderTestvec.hpp:26
Registry to specify a tag for each implementation type.
Definition GridFunctionOperator.hpp:216
Definition ZeroOrderTestvec.hpp:20