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

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

diff --git a/tests/base/convergence_table_02.cc b/tests/base/convergence_table_02.cc
new file mode 100644 (file)
index 0000000..81e586b
--- /dev/null
@@ -0,0 +1,49 @@
+//-----------------------------------------------------------------------------
+//    $Id: convergence_table_02.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_all_convergence_rates with argument reference_column_key, 
+
+int main ()
+{
+  std::ofstream logfile("convergence_table_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  ConvergenceTable table;
+
+  for (unsigned int i=1; i<=4; ++i)
+  {
+    table.add_value("error", 1./sqrt(i));
+    table.add_value("error2", std::pow(1./sqrt(i),2.));
+    table.add_value("error3", std::pow(1./sqrt(i),3.));
+    table.add_value("error4", std::pow(1./sqrt(i),4.));
+    table.add_value("key", i);
+  }
+  table.omit_column_from_convergence_rate_evaluation ( "key" );
+  table.evaluate_all_convergence_rates("key", ConvergenceTable::reduction_rate_log2);
+
+                                 // output
+  table.write_text(deallog.get_file_stream());
+}
diff --git a/tests/base/convergence_table_02/cmp/generic b/tests/base/convergence_table_02/cmp/generic
new file mode 100644 (file)
index 0000000..b03eb2d
--- /dev/null
@@ -0,0 +1,6 @@
+
+error  error2 error3 error4  key   
+1.0000 -      1.0000 -      1.0000 -    1.0000 -    1 
+0.7071 1.00   0.5000 2.00   0.3536 3.00 0.2500 4.00 2 
+0.5774 1.00   0.3333 2.00   0.1925 3.00 0.1111 4.00 3 
+0.5000 1.00   0.2500 2.00   0.1250 3.00 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.