PRISMS-PF  v2.1
initialConditions.h
Go to the documentation of this file.
1 /*
2  * initialConditions.h
3  *
4  * Created on: Feb 27, 2017
5  * Author: stephendewitt
6  */
7 
8 #ifndef INCLUDE_INITIALCONDITIONS_H_
9 #define INCLUDE_INITIALCONDITIONS_H_
10 
11 #include "userInputParameters.h"
12 #include "matrixFreePDE.h"
13 
14 template <int dim, int degree>
15 class InitialCondition : public dealii::Function<dim>
16 {
17 public:
18  const unsigned int index;
20  dealii::Vector<double> values;
21  InitialCondition (const unsigned int _index, const userInputParameters<dim> _userInputs, MatrixFreePDE<dim,degree>* _matrix_free_pde) : dealii::Function<dim>(1), index(_index), userInputs(_userInputs),matrix_free_pde(_matrix_free_pde) {
22  std::srand(dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)+1);
23  }
24  // IC for scalar values
25  double value (const dealii::Point<dim> &p, const unsigned int component=0) const {
26  double scalar_IC = 0.0;
27  dealii::Vector<double> vector_IC(dim);
28 
29  matrix_free_pde->setInitialCondition(p, index, scalar_IC, vector_IC);
30  return scalar_IC;
31  };
32 
33 private:
35 };
36 
37 template <int dim, int degree>
38 class InitialConditionVector : public dealii::Function<dim>
39 {
40 public:
41  const unsigned int index;
43  dealii::Vector<double> values;
44  InitialConditionVector (const unsigned int _index, const userInputParameters<dim> _userInputs, MatrixFreePDE<dim,degree>* _matrix_free_pde) : dealii::Function<dim>(dim), index(_index), userInputs(_userInputs),matrix_free_pde(_matrix_free_pde) {
45  std::srand(dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)+1);
46  }
47 
48  // IC for vector values
49  void vector_value (const dealii::Point<dim> &p,dealii::Vector<double> &vector_IC) const {
50  double scalar_IC = 0.0;
51  vector_IC.reinit(dim);
52  matrix_free_pde->setInitialCondition(p, index, scalar_IC, vector_IC);
53  };
54 
55 private:
57 };
58 
59 #endif /* INCLUDE_INITIALCONDITIONS_H_ */
InitialConditionVector(const unsigned int _index, const userInputParameters< dim > _userInputs, MatrixFreePDE< dim, degree > *_matrix_free_pde)
double value(const dealii::Point< dim > &p, const unsigned int component=0) const
const unsigned int index
MatrixFreePDE< dim, degree > * matrix_free_pde
InitialCondition(const unsigned int _index, const userInputParameters< dim > _userInputs, MatrixFreePDE< dim, degree > *_matrix_free_pde)
dealii::Vector< double > values
const unsigned int index
void vector_value(const dealii::Point< dim > &p, dealii::Vector< double > &vector_IC) const
MatrixFreePDE< dim, degree > * matrix_free_pde
dealii::Vector< double > values
const userInputParameters< dim > userInputs
const userInputParameters< dim > userInputs