28 std::vector<std::string>
29 get_unique_component_names(
const std::vector<std::string> &component_names)
31 auto elements = component_names;
32 elements.erase(std::unique(elements.begin(), elements.end()),
39 std::vector<ComponentMask>
40 get_unique_component_masks(
const std::vector<std::string> &component_names)
42 const auto unique_component_names =
43 get_unique_component_names(component_names);
45 std::vector<ComponentMask> masks;
47 std::vector<std::vector<bool>> bools(
48 unique_component_names.size(),
49 std::vector<bool>(component_names.size(),
false));
52 for (
unsigned int i = 0; i < component_names.size(); ++i)
54 if (unique_component_names[j] != component_names[i])
55 masks.emplace_back(bools[j++]);
58 masks.emplace_back(bools[j++]);
67 const std::vector<std::string> &solution_names,
68 const std::vector<std::set<VectorTools::NormType>> &list_of_error_norms)
74 "reduction_rate_log2",
83 const std::vector<std::string> &component_names,
84 const std::vector<std::set<VectorTools::NormType>> &list_of_error_norms,
85 const double exponent,
86 const std::set<std::string> &extra_columns,
87 const std::string &rate_key,
88 const std::string &rate_mode,
89 const std::string &error_file_name,
90 const unsigned int precision,
91 const bool compute_error)
92 : component_names(component_names)
93 , unique_component_names(get_unique_component_names(component_names))
94 , unique_component_masks(get_unique_component_masks(component_names))
95 , norms_per_unique_component(list_of_error_norms)
97 , extra_columns(extra_columns)
99 , rate_mode(rate_mode)
100 , precision(precision)
101 , error_file_name(error_file_name)
102 , compute_error(compute_error)
115 "When set to false, no computations are performed.");
119 "Number of digits to use when printing the error.",
124 "Set this to a filename with extension .txt, .gpl, .org, "
125 "or .tex to enable writing the convergence table to a "
129 "List of error norms to compute",
131 "Each component is separated by a semicolon "
132 "and each norm by a comma. See the documentation of VectorTools::NormType "
133 "for a list of implemented norms. If you want to skip a component, leave "
139 "The exponent to use when computing p-norms.",
144 "Extra columns to add to the table. Available options "
145 "are dofs and cells.",
150 "Key to use when computing convergence rates. If "
151 "this is set to a column that is not present, or to the "
152 "empty string, then no error rates are computed.");
156 "What type of error rate to compute. Available options are "
157 "reduction_rate_log2, reduction_rate, and none.",
159 "reduction_rate|reduction_rate_log2|none"));
172 bool has_key =
false;
183 if (extra_col.second.second ==
false)
208 "You specified the key <" +
rate_key +
209 "> to compute convergence rates, but that key does "
210 "not exist in the current table."));
238 const std::string error_file_format =
243 if (error_file_format ==
"tex")
245 else if (error_file_format ==
"txt")
247 else if (error_file_format ==
"gpl")
250 else if (error_file_format ==
"org")
266 const std::string &column_name,
267 const std::function<
double()> &custom_function,
268 const bool compute_rate)
void evaluate_all_convergence_rates(const std::string &reference_column_key, const RateMode rate_mode)
void omit_column_from_convergence_rate_evaluation(const std::string &key)
void add_parameter(const std::string &entry, ParameterType ¶meter, const std::string &documentation="", const Patterns::PatternBase &pattern= *Patterns::Tools::Convert< ParameterType >::to_pattern(), const bool has_to_be_set=false)
The ParsedConvergenceTable class.
void add_extra_column(const std::string &column_name, const std::function< double()> &custom_function, const bool compute_rate=true)
void add_parameters(ParameterHandler &prm)
std::string error_file_name
void prepare_table_for_output()
std::set< std::string > extra_columns
ParsedConvergenceTable(const std::vector< std::string > &component_names={"u"}, const std::vector< std::set< VectorTools::NormType > > &list_of_error_norms={ {VectorTools::H1_norm, VectorTools::L2_norm, VectorTools::Linfty_norm}})
const std::vector< std::string > unique_component_names
std::vector< std::set< VectorTools::NormType > > norms_per_unique_component
std::map< std::string, std::pair< std::function< double()>, bool > > extra_column_functions
void write_text(std::ostream &out, const TextOutputFormat format=table_with_headers) const
@ table_with_separate_column_description
void write_tex(std::ostream &file, const bool with_header=true) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)