16 #include <deal.II/base/convergence_table.h> 19 DEAL_II_NAMESPACE_OPEN
26 const std::string &reference_column_key,
28 const unsigned int dim)
35 if (rate_mode ==
none)
42 std::vector<internal::TableEntry> &entries=
columns[data_column_key].entries;
43 std::vector<internal::TableEntry> &ref_entries=
columns[reference_column_key].entries;
44 std::string rate_key = data_column_key+
"...";
46 const unsigned int n = entries.size();
47 const unsigned int n_ref = ref_entries.size();
50 std::vector<double> values(n);
51 std::vector<double> ref_values(n_ref);
53 for (
unsigned int i=0; i<n; ++i)
55 values[i] = entries[i].get_numeric_value();
56 ref_values[i] = ref_entries[i].get_numeric_value();
59 unsigned int no_rate_entries = 0;
65 rate_key +=
"red.rate";
66 no_rate_entries =
columns[rate_key].entries.size();
68 for (
unsigned int i = no_rate_entries; i<n; ++i)
77 add_value(rate_key, values[i-1]/values[i] *
78 ref_values[i]/ref_values[i-1]);
83 rate_key +=
"red.rate.log2";
84 no_rate_entries =
columns[rate_key].entries.size();
86 for (
unsigned int i = no_rate_entries; i<n; ++i)
95 add_value(rate_key, dim*std::log(std::fabs(values[i-1]/values[i])) /
96 std::log(std::fabs(ref_values[i]/ref_values[i-1])));
108 std::string superkey = data_column_key;
116 if (no_rate_entries == 0)
135 std::vector<internal::TableEntry> &entries =
columns[data_column_key].entries;
136 std::string rate_key=data_column_key+
"...";
138 const unsigned int n=entries.size();
140 std::vector<double> values(n);
141 for (
unsigned int i=0; i<n; ++i)
142 values[i] = entries[i].get_numeric_value();
144 unsigned int no_rate_entries = 0;
152 rate_key+=
"red.rate";
153 no_rate_entries =
columns[rate_key].entries.size();
155 for (
unsigned int i = no_rate_entries; i<n; ++i)
164 add_value(rate_key, values[i-1]/values[i]);
170 rate_key+=
"red.rate.log2";
171 no_rate_entries =
columns[rate_key].entries.size();
173 for (
unsigned int i = no_rate_entries; i<n; ++i)
182 add_value(rate_key, std::log(std::fabs(values[i-1]/values[i]))/std::log(2.0));
196 std::string superkey=data_column_key;
206 if (no_rate_entries == 0)
219 const std::map<std::string, Column>::iterator col_iter=
columns.find(key);
220 col_iter->second.flag=1;
229 for (std::map<std::string, Column>::const_iterator col_iter=
columns.begin();
230 col_iter!=
columns.end(); ++col_iter)
231 if (!col_iter->second.flag)
240 for (std::map<std::string, Column>::const_iterator col_iter=
columns.begin();
241 col_iter!=
columns.end(); ++col_iter)
242 if (!col_iter->second.flag)
246 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)