AMDiS  0.3
The Adaptive Multi-Dimensional Simulation Toolbox
Constraints.hpp
1 #pragma once
2 
3 #include <amdis/Output.hpp>
4 
5 namespace AMDiS
6 {
7  // forward declaration
8  template <class RB, class CB, class T, class Traits>
9  class BiLinearForm;
10 
11 
12  template <class Matrix>
13  struct Constraints
14  {
15  template <class Mat, class Sol, class Rhs, class BitVec>
16  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  template <class Mat, class Sol, class Rhs, class BitVec, class Assoc>
23  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  template <class Mat, class Sol, class Rhs, class BitVec>
31  void dirichletBC(Mat& matrix, Sol& solution, Rhs& rhs, BitVec const& nodes, bool setDiagonal = true)
32  {
33  Constraints<Mat>::dirichletBC(matrix, solution, rhs, nodes, setDiagonal);
34  }
35 
36  template <class Mat, class Sol, class Rhs, class BitVec, class Assoc>
37  void periodicBC(Mat& matrix, Sol& solution, Rhs& rhs, BitVec const& left, Assoc const& association, bool setDiagonal = true)
38  {
39  Constraints<Mat>::periodicBC(matrix, solution, rhs, left, association, setDiagonal);
40  }
41 
42 
43  template <class RB, class CB, class T, class Traits>
44  struct Constraints<BiLinearForm<RB,CB,T,Traits>>
45  {
47 
48  template <class Sol, class Rhs, class BitVec>
49  static void dirichletBC(Matrix& matrix, Sol& solution, Rhs& rhs, BitVec const& nodes, bool setDiagonal = true)
50  {
51  AMDiS::dirichletBC(matrix.impl(), solution.impl(), rhs.impl(), nodes, setDiagonal);
52  }
53 
54  template <class Sol, class Rhs, class BitVec, class Assoc>
55  static void periodicBC(Matrix& matrix, Sol& solution, Rhs& rhs, BitVec const& left, Assoc const& association, bool setDiagonal = true)
56  {
57  AMDiS::periodicBC(matrix.impl(), solution.impl(), rhs.impl(), left, association, setDiagonal);
58  }
59  };
60 
61 } // end namespace AMDiS
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
Definition: BiLinearForm.hpp:27
Definition: Constraints.hpp:13
Impl const & impl() const
Return the underlying matrix backend.
Definition: MatrixFacade.hpp:38