ExaDG
Loading...
Searching...
No Matches
print_general_infos.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_UTILITIES_PRINT_GENERAL_INFOS_H_
23#define INCLUDE_EXADG_UTILITIES_PRINT_GENERAL_INFOS_H_
24
25// deal.II
26#include <deal.II/base/conditional_ostream.h>
27#include <deal.II/base/utilities.h>
28#include <deal.II/distributed/tria_base.h>
29#include <deal.II/fe/mapping_q.h>
30
31// ExaDG
32#include <exadg/grid/grid.h>
33#include <exadg/utilities/print_functions.h>
34
35namespace ExaDG
36{
37void
38print_exadg_header(dealii::ConditionalOStream const & pcout);
39
40// print MPI info
41void
42print_MPI_info(dealii::ConditionalOStream const & pcout, MPI_Comm const & mpi_comm);
43
44template<typename Number>
45inline std::string get_type(Number)
46{
47 return "unknown type";
48}
49
50inline std::string
51get_type(float)
52{
53 return "float";
54}
55
56inline std::string
57get_type(double)
58{
59 return "double";
60}
61
62// print deal.II info
63void
64print_dealii_info(dealii::ConditionalOStream const & pcout);
65
66// print ExaDG info
67void
68print_exadg_info(dealii::ConditionalOStream const & pcout);
69
70template<typename Number>
71inline void
72print_matrixfree_info(dealii::ConditionalOStream const & pcout)
73{
74 unsigned int const n_vect_doubles = dealii::VectorizedArray<Number>::size();
75 unsigned int const n_vect_bits = 8 * sizeof(Number) * n_vect_doubles;
76 std::string const vect_level = dealii::Utilities::System::get_current_vectorization_level();
77 std::string const type = get_type(Number());
78
79 // clang-format off
80 pcout << std::endl
81 << "MatrixFree info:" << std::endl
82 << std::endl
83 << " vectorization level = " << DEAL_II_COMPILER_VECTORIZATION_LEVEL
84 << std::endl
85 << " Vectorization over "
86 << n_vect_doubles << " " << type << " = " << n_vect_bits << " bits (" << vect_level << ")"
87 << std::endl;
88 // clang-format on
89}
90
91template<int dim>
92inline void
93print_grid_info(dealii::ConditionalOStream const & pcout, Grid<dim> const & grid)
94{
95 pcout << std::endl
96 << "Generating grid for " << dim << "-dimensional problem:" << std::endl
97 << std::endl;
98
99 print_parameter(pcout, "Max. number of refinements", grid.triangulation->n_global_levels() - 1);
100 print_parameter(pcout, "Number of cells", grid.triangulation->n_global_active_cells());
101}
102
103template<typename Number>
104inline void
105print_general_info(dealii::ConditionalOStream const & pcout,
106 MPI_Comm const & mpi_comm,
107 bool const is_test)
108{
109 print_exadg_header(pcout);
110
111 if(not(is_test))
112 {
113 print_exadg_info(pcout);
114 print_dealii_info(pcout);
115 print_matrixfree_info<Number>(pcout);
116 }
117
118 print_MPI_info(pcout, mpi_comm);
119}
120
121} // namespace ExaDG
122
123#endif /* INCLUDE_EXADG_UTILITIES_PRINT_GENERAL_INFOS_H_ */
Definition driver.cpp:33