24 std::vector<std::string>
25 get_unique_component_names(
const std::vector<std::string> &component_names)
27 auto elements = component_names;
28 elements.erase(std::unique(elements.begin(), elements.end()),
35 std::vector<ComponentMask>
36 get_unique_component_masks(
const std::vector<std::string> &component_names)
38 const auto unique_component_names =
39 get_unique_component_names(component_names);
41 std::vector<ComponentMask> masks;
43 std::vector<std::vector<bool>> bools(
44 unique_component_names.size(),
45 std::vector<bool>(component_names.size(),
false));
48 for (
unsigned int i = 0; i < component_names.size(); ++i)
50 if (unique_component_names[j] != component_names[i])
51 masks.emplace_back(bools[j++]);
54 masks.emplace_back(bools[j++]);
63 const std::vector<std::string> &solution_names,
64 const std::vector<std::set<VectorTools::NormType>> &list_of_error_norms)
70 "reduction_rate_log2",
80 const std::vector<std::set<VectorTools::NormType>> &list_of_error_norms,
111 "When set to false, no computations are performed.");
115 "Number of digits to use when printing the error.",
120 "Set this to a filename with extension .txt, .gpl, .org, "
121 "or .tex to enable writing the convergence table to a "
125 "List of error norms to compute",
127 "Each component is separated by a semicolon "
128 "and each norm by a comma. See the documentation of VectorTools::NormType "
129 "for a list of implemented norms. If you want to skip a component, leave "
135 "The exponent to use when computing p-norms.",
140 "Extra columns to add to the table. Available options "
141 "are dofs and cells.",
146 "Key to use when computing convergence rates. If "
147 "this is set to a column that is not present, or to the "
148 "empty string, then no error rates are computed.");
152 "What type of error rate to compute. Available options are "
153 "reduction_rate_log2, reduction_rate, and none.",
155 "reduction_rate|reduction_rate_log2|none"));
168 bool has_key =
false;
175 table.omit_column_from_convergence_rate_evaluation(col);
179 if (extra_col.second.second ==
false)
183 table.omit_column_from_convergence_rate_evaluation(
190 table.evaluate_all_convergence_rates(
193 table.evaluate_all_convergence_rates(
204 "You specified the key <" +
rate_key +
205 "> to compute convergence rates, but that key does "
206 "not exist in the current table."));
220 table.write_text(out);
234 const std::string error_file_format =
239 if (error_file_format ==
"tex")
240 table.write_tex(table_file);
241 else if (error_file_format ==
"txt")
242 table.write_text(table_file);
243 else if (error_file_format ==
"gpl")
244 table.write_text(table_file,
246 else if (error_file_format ==
"org")
252 std::string(
"Unrecognized file format: ") +
263 const std::string &column_name,
264 const std::function<
double()> &custom_function,
265 const bool compute_rate)
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)
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()
const std::vector< std::string > component_names
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
const std::vector< ComponentMask > unique_component_masks
std::map< std::string, std::pair< std::function< double()>, bool > > extra_column_functions
@ table_with_separate_column_description
#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)