AMDiS  0.1 The Adaptive Multi-Dimensional Simulation Toolbox
FirstOrderPartialTest.hpp
1 #pragma once
2
3 #include <type_traits>
4
5 #include <amdis/localoperators/FirstOrderTestPartialTrial.hpp>
6
7 namespace AMDiS
8 {
14  namespace tag
15  {
16  struct partialtest
17  {
18  std::size_t comp;
19  };
20  }
21
22
24
25  template <class LC, class GridFct>
26  class GridFunctionOperator<tag::partialtest, LC, GridFct>
27  : public GridFunctionOperatorBase<GridFunctionOperator<tag::partialtest, LC, GridFct>, LC, GridFct>
28  {
29  using Self = GridFunctionOperator;
31
32  static_assert( static_size_v<typename GridFct::Range> == 1, "Expression must be of scalar type." );
33
34  public:
36  : Super(expr, 1)
37  , comp_(tag.comp)
38  {}
39
40  template <class CG, class Node, class Vec>
41  void getElementVector(CG const& contextGeo, Node const& node, Vec& elementVector)
42  {
43  static_assert(Node::isLeaf, "Operator can be applied to Leaf-Nodes only.");
44
47
48  for (auto const& qp : quad) {
49  // Position of the current quadrature point in the reference element
50  decltype(auto) local = contextGeo.local(qp.position());
51
52  // The multiplicative factor in the integral transformation formula
53  auto dx = contextGeo.integrationElement(qp.position()) * qp.weight();
54  dx *= Super::coefficient(local);
55
56  // Compute the shape function gradients on the real element
57  auto const& partial = localBasis.partialsAt(local, comp_);
58
59  for (std::size_t j = 0; j < localBasis.size(); ++j) {
60  const auto local_j = node.localIndex(j);
61  elementVector[local_j] += dx * partial[j];
62  }
63  }
64  }
65
66  private:
67  std::size_t comp_;
68  };
69
72 } // end namespace AMDiS
Definition: FirstOrderPartialTest.hpp:16
Convert a simple (scalar) local basis into a global basis.