Constraints.hpp 2.08 KB
Newer Older
1
2
#pragma once

3
#include <amdis/Output.hpp>
4
5
6

namespace AMDiS
{
7
  // forward declaration
Praetorius, Simon's avatar
Praetorius, Simon committed
8
  template <class RB, class CB, class T, class Traits>
9
10
11
  class BiLinearForm;


12
13
14
  template <class Matrix>
  struct Constraints
  {
15
16
    template <class Mat, class Sol, class Rhs, class BitVec>
    static void dirichletBC(Mat& matrix, Sol& solution, Rhs& rhs, BitVec const& nodes, bool setDiagonal = true)
17
18
    {
      /* do nothing */
19
      warning("dirichletBC not implemented for this matrix type.");
20
21
    }

22
23
    template <class Mat, class Sol, class Rhs, class BitVec, class Assoc>
    static void periodicBC(Mat& matrix, Sol& solution, Rhs& rhs, BitVec const& left, Assoc const& association, bool setDiagonal = true)
24
25
    {
      /* do nothing */
26
      warning("periodicBC not implemented for this matrix type.");
27
28
29
    }
  };

30
31
32
33
34
35
36
37
38
39
40
41
42
  template <class Mat, class Sol, class Rhs, class BitVec>
  void dirichletBC(Mat& matrix, Sol& solution, Rhs& rhs, BitVec const& nodes, bool setDiagonal = true)
  {
    Constraints<Mat>::dirichletBC(matrix, solution, rhs, nodes, setDiagonal);
  }

  template <class Mat, class Sol, class Rhs, class BitVec, class Assoc>
  void periodicBC(Mat& matrix, Sol& solution, Rhs& rhs, BitVec const& left, Assoc const& association, bool setDiagonal = true)
  {
    Constraints<Mat>::periodicBC(matrix, solution, rhs, left, association, setDiagonal);
  }


Praetorius, Simon's avatar
Praetorius, Simon committed
43
44
  template <class RB, class CB, class T, class Traits>
  struct Constraints<BiLinearForm<RB,CB,T,Traits>>
45
  {
Praetorius, Simon's avatar
Praetorius, Simon committed
46
    using Matrix = BiLinearForm<RB,CB,T,Traits>;
47

48
49
    template <class Sol, class Rhs, class BitVec>
    static void dirichletBC(Matrix& matrix, Sol& solution, Rhs& rhs, BitVec const& nodes, bool setDiagonal = true)
50
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
51
      AMDiS::dirichletBC(matrix.impl(), solution.impl(), rhs.impl(), nodes, setDiagonal);
52
53
    }

54
55
    template <class Sol, class Rhs, class BitVec, class Assoc>
    static void periodicBC(Matrix& matrix, Sol& solution, Rhs& rhs, BitVec const& left, Assoc const& association, bool setDiagonal = true)
56
    {
Praetorius, Simon's avatar
Praetorius, Simon committed
57
      AMDiS::periodicBC(matrix.impl(), solution.impl(), rhs.impl(), left, association, setDiagonal);
58
59
60
61
    }
  };

} // end namespace AMDiS