Assembler.hpp 1.31 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once

#include <memory>
#include <dune/amdis/QuadratureRules.hpp>
#include <dune/amdis/common/TypeDefs.hpp>

namespace AMDiS
{
  template <class GridView, class Element>
  class Assembler
  {
    static constexpr int dim = GridView::dimension;
    using ctype = typename GridView::ctype;

    using QuadratureRule = QuadratureRuleFactory_t<Element, ctype, dim>;
    using Geometry = typename Impl::Get<Element>::Geometry;

  public:
    template <class Operator>
    Assembler(Operator& op, Element const& element, int degree, FirstOrderType type = GRD_PHI)
      : geometry(get_geometry(element))
    {
      int order = op.getQuadratureDegree(geometry.type(), geometry, degree, type);
      auto const& quad = Dune::QuadratureRules<ctype, Element::mydimension>::rule(geometry.type(), order);

      quadrature.reset(new QuadratureRule(element, quad));
    }

    auto const& getQuadrature() const
    {
      return quadrature->getRule();
    }

    auto const& getTransformedQuadrature() const
    {
      return *quadrature;
    }

    Geometry const& getGeometry() const
    {
      return geometry;
    }

  private:
    std::shared_ptr<QuadratureRule const> quadrature;
    Geometry geometry; // TODO: create geometry just once for each element, e.g. in ProblemStat when traversing the grid
  };

} // end namespace AMDiS