[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
tests.h
1 #ifndef __TESTS_H__
2 #define __TESTS_H__
3 
4 #include "parameters/all_parameters.h"
5 #include <string>
6 #include <deal.II/grid/tria.h>
7 #include <deal.II/base/conditional_ostream.h>
8 #include <deal.II/base/parameter_handler.h>
9 
10 //#include "dg/dg.h"
11 namespace PHiLiP {
12 namespace Tests {
13 
15 
17 class TestsBase
18 {
19 public:
21  //const int ndim; ///< Number of dimensions. Run-time variable instead of compile-time constant.
22  //const int nstate; ///< Number of state variables. Run-time variable instead of compile-time constant.
23 
25  TestsBase () = delete;
27 
29  explicit TestsBase(const Parameters::AllParameters *const parameters_input);
30 
32  virtual ~TestsBase() = default;
33 
35 
37  virtual int run_test() const = 0;
38 protected:
39  const MPI_Comm mpi_communicator;
40  const int mpi_rank;
41  const int n_mpi;
42 
45  dealii::ConditionalOStream pcout;
46 
48 
51  std::vector<int> get_number_1d_cells(const int ngrids) const;
52 
53  // /// Evaluates the number of cells to generate the grids for 1D grid based on input file.
54  // void globally_refine_and_interpolate(DGBase<dim, double> &dg) const;
55 
57  std::string get_pde_string(const Parameters::AllParameters *const param) const;
58 
60  std::string get_conv_num_flux_string(const Parameters::AllParameters *const param) const;
61 
63  std::string get_diss_num_flux_string(const Parameters::AllParameters *const param) const;
64 
66  std::string get_manufactured_solution_string(const Parameters::AllParameters *const param) const;
67 };
68 
70 template<int dim, int nstate, typename MeshType = dealii::Triangulation<dim>>
72 {
73 public:
75 
82  static std::unique_ptr< TestsBase > create_test(
83  const Parameters::AllParameters *const parameters_input,
84  dealii::ParameterHandler &parameter_handler_input);
85 
87 
90  static std::unique_ptr< TestsBase > select_mesh(
91  const Parameters::AllParameters *const parameters_input,
92  dealii::ParameterHandler &parameter_handler_input);
93 
95 
98  static std::unique_ptr< TestsBase > select_test(
99  const Parameters::AllParameters *const parameters_input,
100  dealii::ParameterHandler &parameter_handler_input);
101 };
102 
103 } // Tests namespace
104 } // PHiLiP namespace
105 #endif
106 
virtual int run_test() const =0
Basically the main and only function of this class.
virtual ~TestsBase()=default
Destructor.
const MPI_Comm mpi_communicator
MPI communicator.
Definition: tests.h:39
Test factory, that will create the correct test with the right template parameters.
Definition: tests.h:71
Files for the baseline physics.
Definition: ADTypes.hpp:10
TestsBase()=delete
Constructor. Deleted the default constructor since it should not be used.
Main parameter class that contains the various other sub-parameter classes.
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
Definition: tests.h:20
std::string get_conv_num_flux_string(const Parameters::AllParameters *const param) const
Returns a string describing which convective numerical flux is being used.
Definition: tests.cpp:132
const int mpi_rank
MPI rank.
Definition: tests.h:40
std::string get_pde_string(const Parameters::AllParameters *const param) const
Returns a string describing which PDE is being used.
Definition: tests.cpp:82
std::string get_diss_num_flux_string(const Parameters::AllParameters *const param) const
Returns a string describing which dissipative numerical flux is being used.
Definition: tests.cpp:153
std::string get_manufactured_solution_string(const Parameters::AllParameters *const param) const
Returns a string describing which manufactured solution is being used.
Definition: tests.cpp:163
dealii::ConditionalOStream pcout
ConditionalOStream.
Definition: tests.h:45
std::vector< int > get_number_1d_cells(const int ngrids) const
Evaluates the number of cells to generate the grids for 1D grid based on input file.
Definition: tests.cpp:71
Base class of all the tests.
Definition: tests.h:17