// $Id$
// Version: $Name$
//
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2011, 2012 by the deal.II authors
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2011, 2012, 2013 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
Assert(columns.count(reference_column_key),
ExcColumnNotExistent(reference_column_key));
- if (rate_mode==none)
+ if (rate_mode == none)
return;
- // reset the auto fill mode flag since we
- // are going to fill columns from the top
- // that don't yet exist
+ // reset the auto fill mode flag since we are going to fill columns from
+ // the top that don't yet exist
set_auto_fill_mode (false);
std::vector<internal::TableEntry> &entries=columns[data_column_key].entries;
std::vector<internal::TableEntry> &ref_entries=columns[reference_column_key].entries;
- std::string rate_key=data_column_key;
+ std::string rate_key = data_column_key;
- const unsigned int n=entries.size();
- const unsigned int n_ref=ref_entries.size();
+ const unsigned int n = entries.size();
+ const unsigned int n_ref = ref_entries.size();
Assert(n == n_ref, ExcDimensionMismatch(n, n_ref));
std::vector<double> values(n);
ref_values[i] = ref_entries[i].get_numeric_value();
}
+ unsigned int no_rate_entries = 0;
+
switch (rate_mode)
{
case none:
break;
case reduction_rate:
- rate_key+="red.rate";
- Assert(columns.count(rate_key)==0, ExcRateColumnAlreadyExists(rate_key));
- // no value available for the
- // first row
- add_value(rate_key, std::string("-"));
- for (unsigned int i=1; i<n; ++i)
- add_value(rate_key, values[i-1]/values[i] *
- ref_values[i]/ref_values[i-1]);
+ rate_key += "red.rate";
+ no_rate_entries = columns[rate_key].entries.size();
+ // Calculate all missing rate values:
+ for (unsigned int i = no_rate_entries; i<n; ++i)
+ {
+ if(i == 0)
+ {
+ // no value available for the first row
+ add_value(rate_key, std::string("-"));
+ }
+ else
+ {
+ add_value(rate_key, values[i-1]/values[i] *
+ ref_values[i]/ref_values[i-1]);
+ }
+ }
break;
case reduction_rate_log2:
- rate_key+="red.rate";
- Assert(columns.count(rate_key)==0, ExcRateColumnAlreadyExists(rate_key));
- // no value available for the
- // first row
- add_value(rate_key, std::string("-"));
- for (unsigned int i=1; i<n; ++i)
- add_value(rate_key, 2*std::log(std::fabs(values[i-1]/values[i])) /
- std::log(std::fabs(ref_values[i]/ref_values[i-1])));
+ rate_key += "red.rate";
+ no_rate_entries = columns[rate_key].entries.size();
+ // Calculate all missing rate values:
+ for (unsigned int i = no_rate_entries; i<n; ++i)
+ {
+ if(i == 0)
+ {
+ // no value available for the first row
+ add_value(rate_key, std::string("-"));
+ }
+ else
+ {
+ add_value(rate_key, 2*std::log(std::fabs(values[i-1]/values[i])) /
+ std::log(std::fabs(ref_values[i]/ref_values[i-1])));
+ }
+ }
break;
default:
- Assert(false, ExcNotImplemented());
+ AssertThrow(false, ExcNotImplemented());
}
Assert(columns.count(rate_key), ExcInternalError());
- columns[rate_key].flag=1;
+ columns[rate_key].flag = 1;
set_precision(rate_key, 2);
- std::string superkey=data_column_key;
+ std::string superkey = data_column_key;
if (!supercolumns.count(superkey))
{
add_column_to_supercolumn(data_column_key, superkey);
set_tex_supercaption(superkey, columns[data_column_key].tex_caption);
}
- add_column_to_supercolumn(rate_key, superkey);
+ // only add rate_key to the supercolumn once
+ if(no_rate_entries == 0)
+ {
+ add_column_to_supercolumn(rate_key, superkey);
+ }
+
}
{
Assert(columns.count(data_column_key), ExcColumnNotExistent(data_column_key));
- // reset the auto fill mode flag since we
- // are going to fill columns from the top
- // that don't yet exist
+ // reset the auto fill mode flag since we are going to fill columns from
+ // the top that don't yet exist
set_auto_fill_mode (false);
std::vector<internal::TableEntry> &entries = columns[data_column_key].entries;
for (unsigned int i=0; i<n; ++i)
values[i] = entries[i].get_numeric_value();
+ unsigned int no_rate_entries = 0;
+
switch (rate_mode)
{
case none:
case reduction_rate:
rate_key+="red.rate";
- Assert(columns.count(rate_key)==0, ExcRateColumnAlreadyExists(rate_key));
- // no value available for the
- // first row
- add_value(rate_key, std::string("-"));
- for (unsigned int i=1; i<n; ++i)
- add_value(rate_key, values[i-1]/values[i]);
+ no_rate_entries = columns[rate_key].entries.size();
+ // Calculate all missing rate values:
+ for (unsigned int i = no_rate_entries; i<n; ++i)
+ {
+ if(i == 0)
+ {
+ // no value available for the first row
+ add_value(rate_key, std::string("-"));
+ }
+ else
+ {
+ add_value(rate_key, values[i-1]/values[i]);
+ }
+ }
break;
case reduction_rate_log2:
rate_key+="red.rate.log2";
- Assert(columns.count(rate_key)==0, ExcRateColumnAlreadyExists(rate_key));
- // no value available for the
- // first row
- add_value(rate_key, std::string("-"));
- for (unsigned int i=1; i<n; ++i)
- add_value(rate_key, std::log(std::fabs(values[i-1]/values[i]))/std::log(2.0));
+ no_rate_entries = columns[rate_key].entries.size();
+ // Calculate all missing rate values:
+ for (unsigned int i = no_rate_entries; i<n; ++i)
+ {
+ if(i == 0)
+ {
+ // no value available for the first row
+ add_value(rate_key, std::string("-"));
+ }
+ else
+ {
+ add_value(rate_key, std::log(std::fabs(values[i-1]/values[i]))/std::log(2.0));
+ }
+ }
break;
default:
- Assert(false, ExcNotImplemented());
+ AssertThrow(false, ExcNotImplemented());
}
Assert(columns.count(rate_key), ExcInternalError());
// set the superkey equal to the key
std::string superkey=data_column_key;
- // and set the tex caption of the supercolumn
- // to the tex caption of the data_column.
+ // and set the tex caption of the supercolumn to the tex caption of the
+ // data_column.
if (!supercolumns.count(superkey))
{
add_column_to_supercolumn(data_column_key, superkey);
set_tex_supercaption(superkey, columns[data_column_key].tex_caption);
}
- add_column_to_supercolumn(rate_key, superkey);
+ // only add rate_key to the supercolumn once
+ if(no_rate_entries == 0)
+ {
+ add_column_to_supercolumn(rate_key, superkey);
+ }
}