AMDiS  0.1 The Adaptive Multi-Dimensional Simulation Toolbox
ZeroOrderTestvec.hpp
1 #pragma once
2
3 #include <type_traits>
4
5 #include <amdis/GridFunctionOperator.hpp>
6 #include <amdis/common/StaticSize.hpp>
7
8 namespace AMDiS
9 {
15  namespace tag
16  {
17  struct testvec {};
18  }
19
20
22  template <class LC, class GridFct>
23  class GridFunctionOperator<tag::testvec, LC, GridFct>
24  : public GridFunctionOperatorBase<GridFunctionOperator<tag::testvec, LC, GridFct>, LC, GridFct>
25  {
26  static const int dow = ContextGeometry<LC>::dow;
27  using Self = GridFunctionOperator;
29
30  static_assert( static_size_v<typename GridFct::Range> == dow, "Expression must be of vector type." );
31
32  public:
34  : Super(expr, 0)
35  {}
36
37  template <class CG, class Node, class Vec>
38  void getElementVector(CG const& contextGeo, Node const& node, Vec& elementVector)
39  {
40  static_assert(Node::isPower,
41  "Operator can be applied to Power-Nodes only.");
42
43  static const std::size_t CHILDREN = Node::CHILDREN;
44
46  std::size_t size = node.child(0).size();
47
48  for (auto const& qp : quad) {
49  // Position of the current quadrature point in the reference element
50  auto&& local = contextGeo.local(qp.position());
51
52  // The multiplicative factor in the integral transformation formula
53  const auto factor = contextGeo.integrationElement(qp.position()) * qp.weight();
54  const auto exprValue = Super::coefficient(local);
55
56  auto const& shapeValues = node.child(0).localBasisValuesAt(local);
57
58  for (std::size_t i = 0; i < size; ++i) {
59  const auto value = exprValue * (factor * shapeValues[i]);
60  for (std::size_t k = 0; k < CHILDREN; ++k) {
61  const auto local_ki = node.child(k).localIndex(i);
62  elementVector[local_ki] += at(value,k);
63  }
64  }
65  }
66  }
67  };
68
71 } // end namespace AMDiS
The base-template for GridFunctionOperators.
Definition: GridFunctionOperator.hpp:242
Contains all classes needed for solving linear and non linear equation systems.