]> https://gitweb.dealii.org/ - dealii.git/commitdiff
new test
authorweiler <weiler@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 28 Aug 2010 12:58:12 +0000 (12:58 +0000)
committerweiler <weiler@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 28 Aug 2010 12:58:12 +0000 (12:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@21762 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/Makefile
tests/base/convergence_table_01.cc [new file with mode: 0644]
tests/base/convergence_table_01/cmp/generic [new file with mode: 0644]

index 08127dedd9c8c684f2e30ad2d144e7427b1b16fd..fec220202dbaebe3697ad160611dcd8de76238b0 100644 (file)
@@ -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 (file)
index 0000000..9011aaf
--- /dev/null
@@ -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 <base/data_out_base.h>
+#include <base/table_handler.h>
+#include <base/convergence_table.h>
+#include <base/logstream.h>
+
+#include <vector>
+#include <iomanip>
+#include <fstream>
+#include <string>
+
+// 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 (file)
index 0000000..33b3c9a
--- /dev/null
@@ -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 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.