AssemblerInterface.hpp 1.51 KB
Newer Older
1
2
3
4
#pragma once

#include <type_traits>

5
6
#include <dune/common/dynmatrix.hh>
#include <dune/common/dynvector.hh>
7

8
#include <amdis/ContextGeometry.hpp>
9
10
11

namespace AMDiS
{
12
13
14
15
16
17
18
  template <class LC, class C>
  struct DefaultAssemblerTraits
  {
    using LocalContext = LC;
    using ElementContainer = C;
  };

19
  /// Abstract base-class of a \ref Assembler
20
  template <class Traits, class... Nodes>
21
  class AssemblerInterface
22
  {
23
    using LocalContext = typename Traits::LocalContext;
24
25
    using ContextType = Impl::ContextTypes<LocalContext>;

26
  public:
27
    /// The codim=0 grid entity
28
    using Element = typename ContextType::Entity;
29
    /// The geometry of the \ref Element
30
31
32
33
34
35
36
    using Geometry = typename Element::Geometry;

    static constexpr int numNodes = sizeof...(Nodes);
    static_assert( numNodes == 1 || numNodes == 2,
      "VectorAssembler gets 1 Node, MatrixAssembler gets 2 Nodes!");

  public:
37
    /// Virtual destructor
38
    virtual ~AssemblerInterface() = default;
39

40
    /// Bind the local-assembler to the grid-element with its corresponding geometry
41
    virtual void bind(Element const& element, Geometry const& geometry) = 0;
42
43

    /// Unbind from the element
44
45
46
    virtual void unbind() = 0;

    /// Assemble an element matrix or element vector on the test- (and trial-) function node(s)
47
    virtual void assemble(typename Traits::LocalContext const& localContext,
48
                          Nodes const&... nodes,
49
                          typename Traits::ElementContainer& elementMatrixVector) = 0;
50
51
52
  };

} // end namespace AMDiS