DirichletBC.hpp 2 KB
 Praetorius, Simon committed Mar 13, 2016 1 2 3 4 5 6 #pragma once #include #include #include  Praetorius, Simon committed Nov 13, 2017 7 #include  Praetorius, Simon committed Mar 13, 2016 8   Praetorius, Simon committed Sep 19, 2016 9 #include  Praetorius, Simon committed Mar 19, 2016 10   Praetorius, Simon committed Mar 13, 2016 11 12 namespace AMDiS {  Praetorius, Simon committed May 07, 2016 13 14  /// Implements a boundary condition of Dirichlet-type. /**  Praetorius, Simon committed Sep 19, 2016 15  * By calling the methods \ref init() and \ref finish before and after  Praetorius, Simon committed May 07, 2016 16  * assembling the system-matrix, respectively, dirichlet boundary conditions  Praetorius, Simon committed Sep 19, 2016 17  * can be applied to the matrix and system vector. Therefore a predicate  Praetorius, Simon committed May 07, 2016 18  * functions indicates the DOFs where values should be enforced and a second  Praetorius, Simon committed Sep 19, 2016 19  * functor provided in the constructor is responsible for determining the  Praetorius, Simon committed May 07, 2016 20  * values to be set at the DOFs.  Praetorius, Simon committed Sep 19, 2016 21 22 23 24  * * In the \ref finish method the matrix is called with \ref applyDirichletBC * to erase the corresponding rows and columns for the DOF indices. This * application of boundary conditions can be symmetric if the matrix does  Praetorius, Simon committed May 07, 2016 25 26 27  * support this symmetric modification. As a result, this method returns a list * of columns values, that should be subtracted from the rhs. **/  Praetorius, Simon committed Mar 13, 2016 28 29 30 31 32  template class DirichletBC { public: template && Concepts::Functor) >  Praetorius, Simon committed Mar 13, 2016 35 36  DirichletBC(Predicate&& predicate, Values&& values) : predicate(std::forward(predicate))  Praetorius, Simon committed Mar 13, 2016 37  , values(std::forward(values))  Praetorius, Simon committed Mar 13, 2016 38  {}  Praetorius, Simon committed Sep 19, 2016 39 40   Praetorius, Simon committed Mar 20, 2016 41  template  Praetorius, Simon committed Sep 19, 2016 42  void init(bool apply,  Praetorius, Simon committed Nov 08, 2017 43 44 45  Matrix& matrix, VectorX& rhs, VectorB& solution);  Praetorius, Simon committed Sep 19, 2016 46 47   Praetorius, Simon committed Mar 20, 2016 48  template  Praetorius, Simon committed Sep 19, 2016 49  void finish(bool apply,  Praetorius, Simon committed Nov 08, 2017 50 51 52  Matrix& matrix, VectorX& rhs, VectorB& solution);  Praetorius, Simon committed Sep 19, 2016 53   Praetorius, Simon committed Mar 13, 2016 54 55 56  private: std::function predicate; std::function values;  Praetorius, Simon committed Sep 19, 2016 57   Praetorius, Simon committed Mar 13, 2016 58 59 60 61 62 63 64  bool initialized = false; std::vector dirichletNodes; }; } // end namespace AMDiS #include "DirichletBC.inc.hpp"