22#ifndef INCLUDE_FUNCTIONALITIES_PRINTFUNCTIONS_H_
23#define INCLUDE_FUNCTIONALITIES_PRINTFUNCTIONS_H_
30#include <deal.II/base/conditional_ostream.h>
31#include <deal.II/base/mpi.h>
34#include <exadg/utilities/enum_utilities.h>
38template<
typename ParameterType>
40print_parameter(dealii::ConditionalOStream
const & pcout,
41 std::string
const name,
42 ParameterType
const value);
45print_name(dealii::ConditionalOStream
const & pcout, std::string
const name);
47template<
typename ParameterType>
49print_value(dealii::ConditionalOStream
const & pcout, ParameterType
const value);
53print_value(dealii::ConditionalOStream
const & pcout,
bool const value);
57print_value(dealii::ConditionalOStream
const & pcout,
double const value);
60template<
typename ParameterType>
62print_parameter(dealii::ConditionalOStream
const & pcout,
63 std::string
const name,
64 ParameterType
const value)
66 print_name(pcout, name);
67 print_value(pcout, value);
73print_name(dealii::ConditionalOStream
const & pcout, std::string
const name)
75 unsigned int const max_length_name = 45;
77 pcout <<
" " << name <<
":" ;
78 int const remaining_spaces = max_length_name - 2 - 1 - name.length();
80 for(
int i = 0; i < remaining_spaces; ++i)
85template<
typename ParameterType>
87print_value(dealii::ConditionalOStream
const & pcout, ParameterType
const value)
92 pcout << value << std::endl;
98print_value(dealii::ConditionalOStream
const & pcout,
bool const value)
100 std::string value_string =
"default";
101 value_string = (value ==
true) ?
"true" :
"false";
102 print_value(pcout, value_string);
108print_value(dealii::ConditionalOStream
const & pcout,
double const value)
110 pcout << std::scientific << std::setprecision(4) << value << std::endl;
114print_horizontal_line()
116 return "________________________________________________________________________________";
120print_write_output_time(
double const time,
121 unsigned int const counter,
123 MPI_Comm
const & mpi_comm)
125 dealii::ConditionalOStream pcout(std::cout,
126 dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0);
130 <<
"OUTPUT << Write data at time t = " << std::scientific << std::setprecision(4) << time
136 <<
"OUTPUT << Write " << (counter == 0 ?
"initial" :
"solution") <<
" data" << std::endl;
constexpr bool is_enum()
Checks if given type is an enum or enum class.
Definition enum_utilities.h:42
std::string enum_to_string(EnumType const enum_type)
Converts and enum to a string, returning the string.
Definition enum_utilities.h:69