From 15ce005bf278924cc483f72173476b7e0d3bac37 Mon Sep 17 00:00:00 2001 From: weiler Date: Sat, 28 Aug 2010 12:58:12 +0000 Subject: [PATCH] new test git-svn-id: https://svn.dealii.org/trunk@21762 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/Makefile | 3 +- tests/base/convergence_table_01.cc | 51 +++++++++++++++++++++ tests/base/convergence_table_01/cmp/generic | 11 +++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tests/base/convergence_table_01.cc create mode 100644 tests/base/convergence_table_01/cmp/generic diff --git a/tests/base/Makefile b/tests/base/Makefile index 08127dedd9..fec220202d 100644 --- a/tests/base/Makefile +++ b/tests/base/Makefile @@ -98,7 +98,8 @@ tests_x = geometry_info_* \ parallel_* \ mutex_* \ scalar_* \ - conditional_ostream + conditional_ostream \ + convergence_table_* # add threading tests. note that we have # to list them individually, without wildcards, because the .cc files are diff --git a/tests/base/convergence_table_01.cc b/tests/base/convergence_table_01.cc new file mode 100644 index 0000000000..9011aaf12c --- /dev/null +++ b/tests/base/convergence_table_01.cc @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// $Id: convergence_table_01.cc 20952 2010-04-06 15:02:46Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2010 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//----------------------------------------------------------------------------- + +#include "../tests.h" +#include +#include +#include +#include + +#include +#include +#include +#include + +// test the method evaluate_convergence_rates with argument reference_column_key, + +int main () +{ + std::ofstream logfile("convergence_table_01/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + ConvergenceTable table; + ConvergenceTable table_2; + + for (unsigned int i=1; i<=4; ++i) + { + table.add_value("error", 3.*i); + table.add_value("key", i); + table_2.add_value("error", std::pow(1./sqrt(i),4.)); + table_2.add_value("key", i); + } + + table.evaluate_convergence_rates("error", "key", ConvergenceTable::reduction_rate); + table_2.evaluate_convergence_rates("error", "key", ConvergenceTable::reduction_rate_log2); + + // output + table.write_text(deallog.get_file_stream()); + table_2.write_text(deallog.get_file_stream()); +} diff --git a/tests/base/convergence_table_01/cmp/generic b/tests/base/convergence_table_01/cmp/generic new file mode 100644 index 0000000000..33b3c9a973 --- /dev/null +++ b/tests/base/convergence_table_01/cmp/generic @@ -0,0 +1,11 @@ + + error key +3.0000 - 1 +6.0000 1.00 2 +9.0000 1.00 3 +12.0000 1.00 4 +error key +1.0000 - 1 +0.2500 4.00 2 +0.1111 4.00 3 +0.0625 4.00 4 -- 2.39.5