ExaDG
Loading...
Searching...
No Matches
driver.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef INCLUDE_EXADG_POISSON_DRIVER_H_
23#define INCLUDE_EXADG_POISSON_DRIVER_H_
24
25// deal.II
26#include <deal.II/base/revision.h>
27#include <deal.II/base/timer.h>
28
29// ExaDG
30#include <exadg/matrix_free/matrix_free_data.h>
31#include <exadg/poisson/spatial_discretization/operator.h>
32#include <exadg/poisson/user_interface/application_base.h>
33#include <exadg/utilities/print_solver_results.h>
34#include <exadg/utilities/timer_tree.h>
35
36namespace ExaDG
37{
38namespace Poisson
39{
40enum class OperatorType
41{
42 Evaluate,
43 Apply
44};
45
46template<int dim, typename Number>
47class Driver
48{
49public:
50 Driver(MPI_Comm const & mpi_comm,
51 std::shared_ptr<ApplicationBase<dim, 1, Number>> application,
52 bool const is_test,
53 bool const is_throughput_study);
54
55 void
56 setup();
57
58 void
59 solve();
60
62 print_performance_results(double const total_time) const;
63
64 /*
65 * Throughput study
66 */
67 std::tuple<unsigned int, dealii::types::global_dof_index, double>
68 apply_operator(OperatorType const & operator_type,
69 unsigned int const n_repetitions_inner,
70 unsigned int const n_repetitions_outer) const;
71
72private:
73 // MPI communicator
74 MPI_Comm const mpi_comm;
75
76 // output to std::cout
77 dealii::ConditionalOStream pcout;
78
79 // do not print wall times if is_test
80 bool const is_test;
81
82 // do not set up certain data structures (solver, postprocessor) in case of throughput study
83 bool const is_throughput_study;
84
85 // application
86 std::shared_ptr<ApplicationBase<dim, 1, Number>> application;
87
88 // Grid and mapping
89 std::shared_ptr<Grid<dim>> grid;
90
91 std::shared_ptr<dealii::Mapping<dim>> mapping;
92
93 std::shared_ptr<MultigridMappings<dim, Number>> multigrid_mappings;
94
95 std::shared_ptr<Operator<dim, 1, Number>> pde_operator;
96 std::shared_ptr<PostProcessorBase<dim, 1, Number>> postprocessor;
97
98 // number of iterations
99 mutable unsigned int iterations;
100
101 // Computation time (wall clock time)
102 mutable TimerTree timer_tree;
103 mutable double solve_time;
104};
105
106} // namespace Poisson
107} // namespace ExaDG
108
109
110#endif /* INCLUDE_EXADG_POISSON_DRIVER_H_ */
Definition application_base.h:49
Definition driver.h:48
Definition timer_tree.h:36
Definition driver.cpp:33
Definition print_solver_results.h:238