39 template <
int ntables>
41 const std::string solution_names,
42 const std::string list_of_error_norms
45 solution_names(solution_names),
46 list_of_error_norms(list_of_error_norms)
51 template <
int ntables>
54 std::string dummy_names;
57 for (
unsigned int i=0; i<ntables-1; ++i)
64 dummy_names = dummy_names +
"error";
70 "Comma separated list of table names. ");
73 "Comma separated list of names for the components. This " 74 "will be used both for error tables in text format and to " 75 "output the solution to a file. Note that in the case " 76 "of a vector function the error name which is used to " 77 "compute the norm (supposing the type of the other " 78 "components is 'Add') is the first one.");
80 "Comma separated version of the same thing as above for " 81 "the latex version of the table.");
85 for (
unsigned int i=0; i<ntables; ++i)
88 sprintf(tmp,
"Table %d", i);
93 "and each norm by a comma. Implemented norms are Linfty, L2, " 94 "H1, AddUp, which means that the norm is added to the previous " 95 "component, and Custom.");
97 "Evaluate convergence rates and add a column to the table for each " 100 "The caption that will go under the table if we write the file in " 101 "tex format. The default value for this object is the same name " 102 "as the table name.");
105 "The extra columns to add to the table.");
108 "The key to use to compute the convergence rates.");
113 template <
int ntables>
121 std::string all_names = prm.
get (
"Table names");
130 ExcMessage(
"You tried to construct more tables than you have compiled for."));
135 std::map<std::string, bool> extra;
136 extra[
"dof"] =
false;
137 extra[
"cells"] =
false;
143 for (
unsigned int i=0; i<
names.size(); ++i)
146 sprintf(tmp,
"Table %d", i);
149 all_names = prm.
get(
"List of error norms to compute");
153 std::vector<std::string> all_extras =
156 for (
unsigned int x=0; x< all_extras.size(); ++x)
157 extras[i][all_extras[x]] =
true;
166 for (
unsigned int j=0; j<all_comps.size(); ++j)
168 std::vector<std::string> all_types =
176 for (
unsigned int k=0; k<all_types.size(); ++k)
178 if (all_types[k] ==
"Linfty")
182 else if (all_types[k] ==
"L2")
186 else if (all_types[k] ==
"W1infty")
190 else if (all_types[k] ==
"H1")
194 else if (all_types[k] ==
"AddUp")
198 else if (all_types[k] ==
"Custom")
213 template <
int ntables>
224 if (
extras[table_no][
"dofs"])
225 tables[table_no].omit_column_from_convergence_rate_evaluation(
"dofs");
226 if (
extras[table_no][
"cells"])
227 tables[table_no].omit_column_from_convergence_rate_evaluation(
"cells");
228 if (
extras[table_no][
"dt"])
229 tables[table_no].omit_column_from_convergence_rate_evaluation(
"dt");
240 std::string filename =
names[table_no] +
243 std::ofstream table_file(filename.c_str());
245 if (error_file_format ==
"tex")
246 tables[table_no].write_tex(table_file);
247 else if (error_file_format ==
"txt")
248 tables[table_no].write_text(table_file);
249 else if (error_file_format ==
"gpl")
250 tables[table_no].write_text(table_file,
252 else if (error_file_format ==
"org")
253 tables[table_no].write_text(table_file,
260 template <
int ntables>
269 template class deal2lkit::ErrorHandler<1>;
270 template class deal2lkit::ErrorHandler<2>;
271 template class deal2lkit::ErrorHandler<3>;
272 template class deal2lkit::ErrorHandler<4>;
table_with_separate_column_description
A parameter acceptor base class.
static ParameterHandler prm
Static parameter.
bool compute_error
Compute the error.
std::vector< ConvergenceTable > tables
Error results.
ErrorHandler(const std::string name="", const std::string solution_names="u", const std::string list_of_error_norms="Linfty, L2, H1")
The constructor takes an optional name, specifying the parameter entry.
static::ExceptionBase & ExcNotInitialized()
#define AssertThrow(cond, exc)
static::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
std::string get(const std::string &entry_string) const
std::ostream & get_stream() const
void enter_subsection(const std::string &subsection)
static::ExceptionBase & ExcMessage(std::string arg1)
const std::string list_of_error_norms
List of error norms to compute.
unsigned int precision
The precision with which the table is written.
virtual void declare_parameters(ParameterHandler &prm)
Initialize the given values for the paramter file.
std::string error_file_format
The error file format.
#define Assert(cond, exc)
static::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
bool output_error
Output the error file also on screen.
std::vector< std::string > latex_headers
Headers for latex tables.
std::vector< std::string > headers
Headers for tables and output.
void output_table(std::ostream &out=std::cout, const unsigned int table_no=0)
By default output first table.
bool initialized
The parameters have been read.
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
bool get_bool(const std::string &entry_name) const
virtual void parse_parameters(ParameterHandler &prm)
Parse the given parameter handler.
std::vector< std::map< std::string, bool > > extras
The extra column to add to the tables.
std::vector< std::string > rate_keys
Wether or not to calculate the rates according to the given keys.
std::vector< std::string > names
Names of the tables.
std::vector< std::string > split_string_list(const std::string &s, const char delimiter=',')
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
std::vector< std::string > latex_captions
Captions for latex.
std::vector< bool > add_rates
Add convergence rates.
bool write_error
Write the error files.
const std::string solution_names
Value of solution names.
long int get_integer(const std::string &entry_string) const