From e97c0e76a6d67f411cd905558a425cef81c1ee1f Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 8 Apr 2013 13:55:10 +0000 Subject: [PATCH] Bugfix: Allow to call ConvergenceTable::evaluate_convergence_rates multiple times The corresponding methods will now just update missing entries in the corresponding rows instead of insisting that a row must be empty... git-svn-id: https://svn.dealii.org/trunk@29217 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 6 + deal.II/source/base/convergence_table.cc | 137 +++++++++++++++-------- 2 files changed, 96 insertions(+), 47 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index ae9c06b683..0d7ec5d70a 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -87,6 +87,12 @@ this function.

Specific improvements

+
  • Fixed: It is now possible to call ConvergenceTable::evaluate_convergence_rates +multiple times. +
    +(Matthias Maier, 2013/04/08) +
  • +
    1. Fixed: GridTools::distort_random (previously called Triangulation::distort_random) had a bug where points were only ever moved in positive coordinate diff --git a/deal.II/source/base/convergence_table.cc b/deal.II/source/base/convergence_table.cc index 7443c212c7..eb668c53f0 100644 --- a/deal.II/source/base/convergence_table.cc +++ b/deal.II/source/base/convergence_table.cc @@ -2,7 +2,7 @@ // $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 @@ -30,20 +30,19 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column 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 &entries=columns[data_column_key].entries; std::vector &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 values(n); @@ -55,46 +54,69 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column 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 &entries = columns[data_column_key].entries; @@ -119,6 +140,8 @@ ConvergenceTable::evaluate_convergence_rates(const std::string &data_column_key, for (unsigned int i=0; i