DirichletBC.inc.hpp 1.18 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
    template <class Matrix, class VectorX, class VectorB>
  void DirichletBC<WorldVector>::init(bool apply,
11
12
				      Matrix& matrix,
                                      VectorX& solution,
13
				      VectorB& rhs)
14
15
  {
    using Dune::Functions::interpolate;
16

17
    if (!initialized) {
18
      interpolate(matrix.getRowFeSpace(), dirichletNodes, predicate);
19
20
      initialized = true;
    }
21
  }
22
23


24
  template <class WorldVector>
25
26
    template <class Matrix, class VectorX, class VectorB>
  void DirichletBC<WorldVector>::finish(bool apply,
27
28
					Matrix& matrix,
                                        VectorX& solution,
29
					VectorB& rhs)
30
31
  {
    using Dune::Functions::interpolate;
32
33

    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