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

#include <type_traits>

5
#include <amdis/ContextGeometry.hpp>
6
// #include <amdis/common/ConceptsBase.hpp>
7
#include <amdis/common/TypeDefs.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
    /// Either an ElementVector or an ElementMatrix (depending on the number of nodes)
26
27
28
29
30
    using ElementMatrixVector = std::conditional_t<
      (sizeof...(Nodes)==1), Impl::ElementVector, std::conditional_t<
      (sizeof...(Nodes)==2), Impl::ElementMatrix, void>>;

  public:
31
    /// Virtual destructor
32
33
    virtual ~LocalAssemblerBase() {}

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

    /// Unbind from the element
38
39
40
    virtual void unbind() = 0;

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

} // end namespace AMDiS