DirichletBC.inc.hpp 1.21 KB
Newer Older
1
2
3
#pragma once

#include <dune/functions/functionspacebases/interpolate.hh>
4
#include <dune/amdis/LinearAlgebra.hpp>
5
6
7

namespace AMDiS
{
8
  template <class WorldVector>
9
10
11
12
13
    template <class Matrix, class VectorX, class VectorB>
  void DirichletBC<WorldVector>::init(bool apply,
				      Matrix& matrix, 
                                      VectorX& solution, 
				      VectorB& rhs)
14
15
16
  {
    using Dune::Functions::interpolate;
    
17
    if (!initialized) {
18
      interpolate(matrix.getRowFeSpace(), dirichletNodes, predicate);
19
20
      initialized = true;
    }
21
22
23
  }
    
    
24
  template <class WorldVector>
25
26
27
28
29
    template <class Matrix, class VectorX, class VectorB>
  void DirichletBC<WorldVector>::finish(bool apply,
					Matrix& matrix, 
                                        VectorX& solution, 
					VectorB& rhs)
30
31
32
  {
    using Dune::Functions::interpolate;
    
33
    AMDIS_TEST_EXIT( initialized, "Boundary condition not initialized!" );
34
    matrix.clearDirichletRows(dirichletNodes, apply);
35
36

    if (apply) {
37
38
      interpolate(matrix.getRowFeSpace(), wrapper(rhs.getVector()), values, dirichletNodes);
      interpolate(matrix.getColFeSpace(), wrapper(solution.getVector()), values, dirichletNodes);
39
40
    }
  }
41
  
42
43

} // end namespace AMDiS