DirichletBC.hpp 1.12 KB
Newer Older
1
2
3
4
5
6
#pragma once

#include <functional>
#include <type_traits>
#include <vector>

7
#include <dune/amdis/common/ConceptsBase.hpp>
8

9
10
#include "Log.hpp"

11
12
13
14
15
16
17
namespace AMDiS
{
  template <class WorldVector>
  class DirichletBC
  {
  public:
    template <class Predicate, class Values,
18
19
      class = std::enable_if_t< concepts::Functor<Predicate, bool(WorldVector)> &&
				concepts::Functor<Values,  double(WorldVector)> > >
20
21
    DirichletBC(Predicate&& predicate, Values&& values)
      : predicate(std::forward<Predicate>(predicate))
22
      , values(std::forward<Values>(values))
23
24
25
    {}
    
    
26
    template <class Matrix, class VectorX, class VectorB>
27
    void init(bool apply, 
28
29
30
	      Matrix& matrix, 
	      VectorX& rhs, 
	      VectorB& solution);
31
32
    
    
33
    template <class Matrix, class VectorX, class VectorB>
34
    void finish(bool apply, 
35
36
37
		Matrix& matrix, 
		VectorX& rhs, 
		VectorB& solution);
38
39
40
41
42
43
44
45
46
47
48
49
    
  private:
    std::function<bool(WorldVector)> predicate;
    std::function<double(WorldVector)> values;
    
    bool initialized = false;
    std::vector<char> dirichletNodes;
  };

} // end namespace AMDiS

#include "DirichletBC.inc.hpp"