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