LocalAssemblerBase.hpp 1.62 KB
Newer Older
1
2
3
4
#pragma once

#include <type_traits>

5
6
#include <boost/numeric/mtl/mtl.hpp>

7
#include <amdis/ContextGeometry.hpp>
8
9
10
11
12
13
14
15

namespace AMDiS
{
  /// Abstract base-class of a \ref LocalAssembler
  template <class LocalContext, class... Nodes>
  class LocalAssemblerBase
  {
  public:
16
    /// The codim=0 grid entity
17
    using Element = typename Impl::ContextTypes<LocalContext>::Entity;
18
    /// The geometry of the \ref Element
19
20
21
22
23
24
    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!");

25
26
27
    using ElementMatrix = mtl::mat::dense2D<double>; // TODO: choose correct value_type
    using ElementVector = mtl::vec::dense_vector<double>;

28
    /// Either an ElementVector or an ElementMatrix (depending on the number of nodes)
29
    using ElementMatrixVector = std::conditional_t<
30
31
      (sizeof...(Nodes)==1), ElementVector, std::conditional_t<
      (sizeof...(Nodes)==2), ElementMatrix, void>>;
32
33

  public:
34
    /// Virtual destructor
35
36
    virtual ~LocalAssemblerBase() {}

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

    /// Unbind from the element
41
42
43
    virtual void unbind() = 0;

    /// Assemble an element matrix or element vector on the test- (and trial-) function node(s)
44
45
46
    virtual void assemble(LocalContext const& localContext,
                          Nodes const&... nodes,
                          ElementMatrixVector& elementMatrixVector) = 0;
47
48
49
  };

} // end namespace AMDiS