PRISMS-PF  v2.1
nonUniformDirichletBC.h
Go to the documentation of this file.
1 #ifndef INCLUDE_NONUNIFORMDIRICHLETBCS_H_
2 #define INCLUDE_NONUNIFORMDIRICHLETBCS_H_
3 
4 #include "userInputParameters.h"
5 #include "matrixFreePDE.h"
6 
7 template <int dim, int degree>
8 class NonUniformDirichletBC : public dealii::Function<dim>
9 {
10 public:
11 
12  dealii::Vector<double> values;
13 
14  NonUniformDirichletBC (const unsigned int _index, const unsigned int _direction, const double _time, MatrixFreePDE<dim,degree>* _matrix_free_pde) : dealii::Function<dim>(1), index(_index), direction(_direction), time(_time), matrix_free_pde(_matrix_free_pde) {
15  std::srand(dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)+1);
16  }
17  // IC for scalar values
18  double value (const dealii::Point<dim> &p, const unsigned int component=0) const {
19  double scalar_BC = 0.0;
20  dealii::Vector<double> vector_BC(dim);
21 
22  matrix_free_pde->setNonUniformDirichletBCs(p, index, direction, time, scalar_BC, vector_BC);
23 
24  return scalar_BC;
25  };
26 
27 private:
28  const unsigned int index;
29  const unsigned int direction;
30  const double time;
32 };
33 
34 
35 template <int dim, int degree>
36 class NonUniformDirichletBCVector : public dealii::Function<dim>
37 {
38 public:
39 
40  dealii::Vector<double> values;
41 
42  NonUniformDirichletBCVector (const unsigned int _index, const unsigned int _direction, const double _time, MatrixFreePDE<dim,degree>* _matrix_free_pde) : dealii::Function<dim>(dim), index(_index), direction(_direction), time(_time), matrix_free_pde(_matrix_free_pde) {
43  std::srand(dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)+1);
44  }
45 
46  // IC for vector values
47  void vector_value (const dealii::Point<dim> &p,dealii::Vector<double> &vector_BC) const {
48  double scalar_BC = 0.0;
49 
50  vector_BC.reinit(dim);
51  matrix_free_pde->setNonUniformDirichletBCs(p, index, direction, time, scalar_BC, vector_BC);
52  };
53 
54 private:
55  const unsigned int index;
56  const unsigned int direction;
57  const double time;
59 };
60 
61 
62 #endif // INCLUDE_NONUNIFORMDIRICHLETBCS_H_
NonUniformDirichletBC(const unsigned int _index, const unsigned int _direction, const double _time, MatrixFreePDE< dim, degree > *_matrix_free_pde)
double value(const dealii::Point< dim > &p, const unsigned int component=0) const
const unsigned int index
const unsigned int direction
dealii::Vector< double > values
dealii::Vector< double > values
NonUniformDirichletBCVector(const unsigned int _index, const unsigned int _direction, const double _time, MatrixFreePDE< dim, degree > *_matrix_free_pde)
MatrixFreePDE< dim, degree > * matrix_free_pde
void vector_value(const dealii::Point< dim > &p, dealii::Vector< double > &vector_BC) const
MatrixFreePDE< dim, degree > * matrix_free_pde