AdaptionInterface.hpp 1.53 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once

#include <amdis/common/ConceptsBase.hpp>

namespace AMDiS
{
  /**
   * \addtogroup Concepts
   * @{
   **/

  namespace Concepts
  {
    namespace Definition
    {
      struct InterpolateData
      {
        template <class Data>
Praetorius, Simon's avatar
Praetorius, Simon committed
19
        auto require(Data const& data) -> decltype(
20
21
22
23
24
25
26
27
            const_cast<Data&>(data).preAdapt(true),
            const_cast<Data&>(data).postAdapt(true)
          );
      };

      struct UpdateData
      {
        template <class Basis>
Praetorius, Simon's avatar
Praetorius, Simon committed
28
        auto require(Basis const& basis) -> decltype(
29
30
31
32
33
34
35
36
37
            const_cast<Basis&>(basis).update(basis.gridView())
          );
      };

    } // end namespace Definition

    template <class Data>
    constexpr bool InterpolateData = models<Definition::InterpolateData(Data)>;

Praetorius, Simon's avatar
Praetorius, Simon committed
38
39
40
41
    template <class Data>
    using InterpolateData_t = models_t<Definition::InterpolateData(Data)>;


42
43
44
    template <class Basis>
    constexpr bool UpdateData = models<Definition::UpdateData(Basis)>;

Praetorius, Simon's avatar
Praetorius, Simon committed
45
46
47
    template <class Basis>
    using UpdateData_t = models_t<Definition::UpdateData(Basis)>;

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  } // end namespace Concepts

  /// @}


  /**
   * \addtogroup Adaption
   * @{
   **/

  /// \brief Interface for transfer between grid changes
  class AdaptionInterface
  {
  public:
    virtual ~AdaptionInterface() = default;

    /// Prepare the grid and the data for the adaption
    virtual bool preAdapt() = 0;

    /// Do the grid adaption
    virtual bool adapt() = 0;

    // Perform data adaption to the new grid
    virtual void postAdapt() = 0;
  };

  /// @}

} // end namespace AMDiS