16 #include <deal.II/base/convergence_table.h> 19 DEAL_II_NAMESPACE_OPEN
22 const std::string &reference_column_key,
24 const unsigned int dim)
31 if (rate_mode ==
none)
38 std::vector<internal::TableEntry> &entries=
columns[data_column_key].entries;
39 std::vector<internal::TableEntry> &ref_entries=
columns[reference_column_key].entries;
40 std::string rate_key = data_column_key+
"...";
42 const unsigned int n = entries.size();
43 const unsigned int n_ref = ref_entries.size();
46 std::vector<double> values(n);
47 std::vector<double> ref_values(n_ref);
49 for (
unsigned int i=0; i<n; ++i)
51 values[i] = entries[i].get_numeric_value();
52 ref_values[i] = ref_entries[i].get_numeric_value();
55 unsigned int no_rate_entries = 0;
61 rate_key +=
"red.rate";
62 no_rate_entries =
columns[rate_key].entries.size();
64 for (
unsigned int i = no_rate_entries; i<n; ++i)
73 add_value(rate_key, values[i-1]/values[i] *
74 ref_values[i]/ref_values[i-1]);
79 rate_key +=
"red.rate.log2";
80 no_rate_entries =
columns[rate_key].entries.size();
82 for (
unsigned int i = no_rate_entries; i<n; ++i)
91 add_value(rate_key, dim*std::log(std::fabs(values[i-1]/values[i])) /
92 std::log(std::fabs(ref_values[i]/ref_values[i-1])));
104 const std::string &superkey = data_column_key;
112 if (no_rate_entries == 0)
131 std::vector<internal::TableEntry> &entries =
columns[data_column_key].entries;
132 std::string rate_key=data_column_key+
"...";
134 const unsigned int n=entries.size();
136 std::vector<double> values(n);
137 for (
unsigned int i=0; i<n; ++i)
138 values[i] = entries[i].get_numeric_value();
140 unsigned int no_rate_entries = 0;
148 rate_key+=
"red.rate";
149 no_rate_entries =
columns[rate_key].entries.size();
151 for (
unsigned int i = no_rate_entries; i<n; ++i)
160 add_value(rate_key, values[i-1]/values[i]);
166 rate_key+=
"red.rate.log2";
167 no_rate_entries =
columns[rate_key].entries.size();
169 for (
unsigned int i = no_rate_entries; i<n; ++i)
178 add_value(rate_key, std::log(std::fabs(values[i-1]/values[i]))/std::log(2.0));
192 const std::string &superkey=data_column_key;
202 if (no_rate_entries == 0)
215 const std::map<std::string, Column>::iterator col_iter=
columns.find(key);
216 col_iter->second.flag=1;
225 for (std::map<std::string, Column>::const_iterator col_iter=
columns.begin();
226 col_iter!=
columns.end(); ++col_iter)
227 if (!col_iter->second.flag)
236 for (std::map<std::string, Column>::const_iterator col_iter=
columns.begin();
237 col_iter!=
columns.end(); ++col_iter)
238 if (!col_iter->second.flag)
242 DEAL_II_NAMESPACE_CLOSE
void set_precision(const std::string &key, const unsigned int precision)
void set_tex_supercaption(const std::string &superkey, const std::string &tex_supercaption)
void add_value(const std::string &key, const T value)
#define AssertThrow(cond, exc)
void add_column_to_supercolumn(const std::string &key, const std::string &superkey)
void omit_column_from_convergence_rate_evaluation(const std::string &key)
void evaluate_all_convergence_rates(const std::string &reference_column_key, const RateMode rate_mode)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void evaluate_convergence_rates(const std::string &data_column_key, const std::string &reference_column_key, const RateMode rate_mode, const unsigned int dim=2)
static ::ExceptionBase & ExcColumnNotExistent(std::string arg1)
static ::ExceptionBase & ExcNotImplemented()
std::map< std::string, Column > columns
std::map< std::string, std::vector< std::string > > supercolumns
static ::ExceptionBase & ExcInternalError()
void set_auto_fill_mode(const bool state)