BoundaryCondition.hpp 1.05 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
#pragma once

#include <memory>

#include <amdis/Boundary.hpp>
#include <amdis/BoundaryManager.hpp>

namespace AMDiS
{
  class BoundaryCondition
  {
  public:
    BoundaryCondition() = default;
    BoundaryCondition(std::shared_ptr<BoundaryManagerBase const> const& boundaryManager, BoundaryType id)
      : boundaryManager_(boundaryManager)
      , id_(id)
    {}

    /// Return true if intersection is on boundary with id
    template <class Intersection>
    bool onBoundary(Intersection const& is) const
    {
      return is.boundary() && (!boundaryManager_  || boundaryManager_->boundaryId(is) == id_);
    }

    template <class RowBasis, class ColBasis>
    void init(RowBasis const& rowBasis, ColBasis const& colBasis) { /* do nothing */ }

    template <class Matrix, class X, class B, class RN, class CN>
    void fillBoundaryCondition(Matrix& A, X& x, B& b, RN const& rowNode, CN const& colNode) { /* do nothing */ }

  protected:
    std::shared_ptr<BoundaryManagerBase const> boundaryManager_{nullptr};
    BoundaryType id_{0};
  };

} // end namespace AMDiS