22#ifndef EXADG_POISSON_SOLVER_H_
23#define EXADG_POISSON_SOLVER_H_
26#include <exadg/grid/grid_data.h>
27#include <exadg/operators/resolution_parameters.h>
28#include <exadg/poisson/driver.h>
29#include <exadg/poisson/user_interface/declare_get_application.h>
30#include <exadg/utilities/general_parameters.h>
35create_input_file(std::string
const & input_file)
37 dealii::ParameterHandler prm;
40 general.add_parameters(prm);
43 spatial.add_parameters(prm);
47 unsigned int const Dim = 2;
48 typedef double Number;
49 Poisson::get_application<Dim, 1, Number>(input_file, MPI_COMM_WORLD)->add_parameters(prm);
51 prm.print_parameters(input_file,
52 dealii::ParameterHandler::Short |
53 dealii::ParameterHandler::KeepDeclarationOrder);
56template<
int dim,
typename Number>
58run(std::vector<SolverResult> & results,
59 std::string
const & input_file,
60 unsigned int const degree,
61 unsigned int const refine_space,
62 MPI_Comm
const & mpi_comm,
68 std::shared_ptr<Poisson::ApplicationBase<dim, 1, Number>> application =
69 Poisson::get_application<dim, 1, Number>(input_file, mpi_comm);
71 application->set_parameters_convergence_study(degree, refine_space);
73 std::shared_ptr<Poisson::Driver<dim, Number>> driver =
74 std::make_shared<Poisson::Driver<dim, Number>>(mpi_comm, application, is_test,
false);
80 SolverResult result = driver->print_performance_results(timer.wall_time());
81 results.push_back(result);
86main(
int argc,
char ** argv)
88 dealii::Utilities::MPI::MPI_InitFinalize mpi(argc, argv, 1);
90 MPI_Comm mpi_comm(MPI_COMM_WORLD);
92 std::string input_file;
96 if(dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0)
98 std::cout <<
"To run the program, use: ./solver input_file" << std::endl
99 <<
"To setup the input file, use: ./solver input_file --help" << std::endl;
106 input_file = std::string(argv[1]);
108 if(argc == 3 and std::string(argv[2]) ==
"--help")
110 if(dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0)
111 ExaDG::create_input_file(input_file);
120 std::vector<ExaDG::SolverResult> results;
123 for(
unsigned int degree = spatial.degree_min; degree <= spatial.degree_max; ++degree)
126 for(
unsigned int refine_space = spatial.refine_space_min;
127 refine_space <= spatial.refine_space_max;
130 if(general.dim == 2 and general.precision ==
"float")
132 ExaDG::run<2, float>(results, input_file, degree, refine_space, mpi_comm, general.is_test);
134 else if(general.dim == 2 and general.precision ==
"double")
136 ExaDG::run<2, double>(results, input_file, degree, refine_space, mpi_comm, general.is_test);
138 else if(general.dim == 3 and general.precision ==
"float")
140 ExaDG::run<3, float>(results, input_file, degree, refine_space, mpi_comm, general.is_test);
142 else if(general.dim == 3 and general.precision ==
"double")
144 ExaDG::run<3, double>(results, input_file, degree, refine_space, mpi_comm, general.is_test);
149 dealii::ExcMessage(
"Only dim = 2|3 and precision = float|double implemented."));
154 if(not(general.is_test))
155 print_results(results, mpi_comm);
Definition general_parameters.h:34
Definition print_solver_results.h:238
Definition resolution_parameters.h:34