#include <error_handler.h>
Public Member Functions | |
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. More... | |
virtual void | declare_parameters (ParameterHandler &prm) |
Initialize the given values for the paramter file. More... | |
virtual void | parse_parameters (ParameterHandler &prm) |
Parse the given parameter handler. More... | |
template<typename DH , typename VEC > | |
void | error_from_exact (const DH &vspace, const VEC &solution, const Function< DH::space_dimension > &exact, unsigned int table_no=0, double dt=0.) |
Calculate the error of the numeric solution in variuous norms. More... | |
template<typename DH , typename VEC > | |
void | error_from_exact (const Mapping< DH::dimension, DH::space_dimension > &mapping, const DH &vspace, const VEC &solution, const Function< DH::space_dimension > &exact, unsigned int table_no=0, double dt=0.) |
Same as above, with different mapping. More... | |
template<typename DH > | |
void | custom_error (const std::function< double(const unsigned int component)> &custom_error_function, const DH &dh, const std::string &error_name="custom", const bool add_table_extras=false, const unsigned int table_no=0, const double dt=0.) |
Call the given custom function to compute the custom error for the given component and store the result in the given table. More... | |
template<typename DH , typename VEC > | |
void | difference (const DH &, const VEC &, const DH &, const VEC &, unsigned int table_no=0, double dt=0.) |
Difference between two solutions in two different vector spaces. More... | |
template<typename DH , typename VEC > | |
void | difference (const DH &, const VEC &, const VEC &, unsigned int table_no=0, double dt=0.) |
Difference between two solutions in the same vector space. More... | |
void | output_table (std::ostream &out=std::cout, const unsigned int table_no=0) |
By default output first table. More... | |
void | output_table (ConditionalOStream &pcout, const unsigned int table_no=0) |
By default output first table. More... | |
template<typename DH , typename VECTOR > | |
void | difference (const DH &dh, const VECTOR &solution1, const VECTOR &solution2, unsigned int table_no, double dt) |
template<typename DH , typename VECTOR > | |
void | error_from_exact (const DH &dh, const VECTOR &solution, const Function< DH::space_dimension > &exact, unsigned int table_no, double dt) |
template<typename DH , typename VECTOR > | |
void | error_from_exact (const Mapping< DH::dimension, DH::space_dimension > &mapping, const DH &dh, const VECTOR &solution, const Function< DH::space_dimension > &exact, unsigned int table_no, double dt) |
Public Member Functions inherited from ParameterAcceptor | |
ParameterAcceptor (const std::string section_name="") | |
The constructor adds derived classes to the list of acceptors. More... | |
virtual | ~ParameterAcceptor () |
The destructor sets to zero the pointer relative to this index, so that it is safe to destroy the mother class. More... | |
virtual void | parse_parameters_call_back () |
Parse parameter call back. More... | |
std::string | get_section_name () const |
Return the section name of this class. More... | |
std::vector< std::string > | get_section_path () const |
Travers all registered classes, and figure out what subsections we need to enter. More... | |
template<class T > | |
void | add_parameter (ParameterHandler &prm, T *parameter, const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string()) |
Add a parameter the given parameter list. More... | |
template<class T > | |
void | add_parameter (T ¶meter, const std::string &entry, const std::string &documentation=std::string(), ParameterHandler &prm=ParameterAcceptor::prm) |
Add a parameter to the global parameter handler ParameterAcceptor::prm. More... | |
void | enter_my_subsection (ParameterHandler &prm) |
Make sure we enter the right subsection of the global parameter file. More... | |
void | leave_my_subsection (ParameterHandler &prm) |
This function undoes what the enter_my_subsection() function did. More... | |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const double &) |
double More... | |
template<> | |
std::string | to_string (const double &entry) |
template<> | |
double | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const int &) |
int More... | |
template<> | |
std::string | to_string (const int &entry) |
template<> | |
int | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const unsigned int &) |
unsigned int More... | |
template<> | |
std::string | to_string (const unsigned int &entry) |
template<> | |
unsigned int | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const bool &) |
bool More... | |
template<> | |
std::string | to_string (const bool &entry) |
template<> | |
bool | to_type (const std::string ¶meter) |
Public Member Functions inherited from Subscriptor | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) |
void | subscribe (const char *identifier=0) const |
void | unsubscribe (const char *identifier=0) const |
unsigned int | n_subscriptions () const |
void | list_subscribers () const |
void | serialize (Archive &ar, const unsigned int version) |
Private Attributes | |
const std::string | solution_names |
Value of solution names. More... | |
const std::string | list_of_error_norms |
List of error norms to compute. More... | |
std::vector< ConvergenceTable > | tables |
Error results. More... | |
std::vector< std::string > | headers |
Headers for tables and output. More... | |
std::vector< std::string > | latex_headers |
Headers for latex tables. More... | |
std::vector< std::string > | latex_captions |
Captions for latex. More... | |
std::vector< std::string > | names |
Names of the tables. More... | |
std::vector< std::vector< NormFlags > > | types |
Type of error to compute per components. More... | |
bool | initialized |
The parameters have been read. More... | |
bool | compute_error |
Compute the error. More... | |
std::vector< bool > | add_rates |
Add convergence rates. More... | |
bool | write_error |
Write the error files. More... | |
bool | output_error |
Output the error file also on screen. More... | |
std::string | error_file_format |
The error file format. More... | |
std::vector< std::map< std::string, bool > > | extras |
The extra column to add to the tables. More... | |
std::vector< std::string > | rate_keys |
Wether or not to calculate the rates according to the given keys. More... | |
unsigned int | precision |
The precision with which the table is written. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from ParameterAcceptor | |
static void | initialize (const std::string filename="", const std::string outfilename="") |
Call declare_all_parameters(), read filename (if it is present as input parameter) and parse_all_parameters() on the static member prm. More... | |
static void | clear () |
Clear class list and global parameter file. More... | |
static void | parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
Parse the given ParameterHandler. More... | |
static void | log_info () |
Print information about all stored classes. More... | |
static void | declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
Initialize the ParameterHandler with all derived classes parameters.This function enters the subsection returned by get_section_name() for each derived class, and declares all parameters that were added using add_parameter(). More... | |
template<class T > | |
static std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const T &) |
Given a class T, construct its default pattern to be used when declaring parameters. More... | |
template<class T > | |
static T | to_type (const std::string &) |
Given a string, fill the value of the given parameter. More... | |
template<class T > | |
static std::string | to_string (const T &) |
Given a parameter, return a string containing the given parameter. More... | |
Static Public Member Functions inherited from Subscriptor | |
static::ExceptionBase & | ExcInUse (int arg1, char *arg2, std::string &arg3) |
static::ExceptionBase & | ExcNoSubscriber (char *arg1, char *arg2) |
Static Public Attributes inherited from ParameterAcceptor | |
static ParameterHandler | prm |
Static parameter. More... | |
Protected Attributes inherited from ParameterAcceptor | |
const std::string | section_name |
The subsection name for this class. More... | |
Definition at line 82 of file error_handler.h.
ErrorHandler< ntables >::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.
Definition at line 40 of file error_handler.cc.
void ErrorHandler< ntables >::custom_error | ( | const std::function< double(const unsigned int component)> & | custom_error_function, |
const DH & | dh, | ||
const std::string & | error_name = "custom" , |
||
const bool | add_table_extras = false , |
||
const unsigned int | table_no = 0 , |
||
const double | dt = 0. |
||
) |
Call the given custom function to compute the custom error for the given component and store the result in the given table.
If a name is specified, then this function can be called several times on the same table to add different columns with different names, provided you use an appropriate function every time.
Should you wish to do so, then make sure the parameter add_table_extras is set to false for each call, except one, so that you only add dofs and cells informations once.
Definition at line 527 of file error_handler.h.
|
virtual |
Initialize the given values for the paramter file.
Reimplemented from ParameterAcceptor.
Definition at line 52 of file error_handler.cc.
void ErrorHandler< ntables >::difference | ( | const DH & | , |
const VEC & | , | ||
const DH & | , | ||
const VEC & | , | ||
unsigned int | table_no = 0 , |
||
double | dt = 0. |
||
) |
Difference between two solutions in two different vector spaces.
void ErrorHandler< ntables >::difference | ( | const DH & | , |
const VEC & | , | ||
const VEC & | , | ||
unsigned int | table_no = 0 , |
||
double | dt = 0. |
||
) |
Difference between two solutions in the same vector space.
void ErrorHandler< ntables >::difference | ( | const DH & | dh, |
const VECTOR & | solution1, | ||
const VECTOR & | solution2, | ||
unsigned int | table_no, | ||
double | dt | ||
) |
Definition at line 276 of file error_handler.h.
void ErrorHandler< ntables >::error_from_exact | ( | const DH & | vspace, |
const VEC & | solution, | ||
const Function< DH::space_dimension > & | exact, | ||
unsigned int | table_no = 0 , |
||
double | dt = 0. |
||
) |
Calculate the error of the numeric solution in variuous norms.
Store the result in the given table.
void ErrorHandler< ntables >::error_from_exact | ( | const Mapping< DH::dimension, DH::space_dimension > & | mapping, |
const DH & | vspace, | ||
const VEC & | solution, | ||
const Function< DH::space_dimension > & | exact, | ||
unsigned int | table_no = 0 , |
||
double | dt = 0. |
||
) |
Same as above, with different mapping.
void ErrorHandler< ntables >::error_from_exact | ( | const DH & | dh, |
const VECTOR & | solution, | ||
const Function< DH::space_dimension > & | exact, | ||
unsigned int | table_no, | ||
double | dt | ||
) |
Definition at line 294 of file error_handler.h.
void ErrorHandler< ntables >::error_from_exact | ( | const Mapping< DH::dimension, DH::space_dimension > & | mapping, |
const DH & | dh, | ||
const VECTOR & | solution, | ||
const Function< DH::space_dimension > & | exact, | ||
unsigned int | table_no, | ||
double | dt | ||
) |
Definition at line 306 of file error_handler.h.
void ErrorHandler< ntables >::output_table | ( | std::ostream & | out = std::cout , |
const unsigned int | table_no = 0 |
||
) |
By default output first table.
Definition at line 214 of file error_handler.cc.
void ErrorHandler< ntables >::output_table | ( | ConditionalOStream & | pcout, |
const unsigned int | table_no = 0 |
||
) |
By default output first table.
The output is according to to the condition of ConditionalOStream &pcout
Definition at line 261 of file error_handler.cc.
|
virtual |
Parse the given parameter handler.
Reimplemented from ParameterAcceptor.
Definition at line 114 of file error_handler.cc.
|
private |
Add convergence rates.
Definition at line 188 of file error_handler.h.
|
private |
Compute the error.
If this is false, all functions regarding errors are disabled and don't do anything.
Definition at line 185 of file error_handler.h.
|
private |
The error file format.
Definition at line 197 of file error_handler.h.
|
private |
The extra column to add to the tables.
Definition at line 200 of file error_handler.h.
|
private |
Headers for tables and output.
Contains the name of the solution components.
Definition at line 165 of file error_handler.h.
|
private |
The parameters have been read.
Definition at line 181 of file error_handler.h.
|
private |
Captions for latex.
Definition at line 172 of file error_handler.h.
|
private |
Headers for latex tables.
Contains the name of the solution components.
Definition at line 169 of file error_handler.h.
|
private |
List of error norms to compute.
Definition at line 158 of file error_handler.h.
|
private |
Names of the tables.
Definition at line 175 of file error_handler.h.
|
private |
Output the error file also on screen.
Definition at line 194 of file error_handler.h.
|
private |
The precision with which the table is written.
Definition at line 206 of file error_handler.h.
|
private |
Wether or not to calculate the rates according to the given keys.
Definition at line 203 of file error_handler.h.
|
private |
Value of solution names.
Definition at line 155 of file error_handler.h.
|
private |
Error results.
Definition at line 161 of file error_handler.h.
|
private |
Type of error to compute per components.
Definition at line 178 of file error_handler.h.
|
private |
Write the error files.
Definition at line 191 of file error_handler.h.