]> https://gitweb.dealii.org/ - dealii.git/commitdiff
ParsedConvergenceTable, non scalar functions
authorLuca Heltai <luca.heltai@sissa.it>
Tue, 9 Apr 2019 23:22:29 +0000 (01:22 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Tue, 30 Apr 2019 15:45:34 +0000 (17:45 +0200)
tests/base/parsed_convergence_table_03.cc [new file with mode: 0644]
tests/base/parsed_convergence_table_03.output [new file with mode: 0644]

diff --git a/tests/base/parsed_convergence_table_03.cc b/tests/base/parsed_convergence_table_03.cc
new file mode 100644 (file)
index 0000000..20b22cb
--- /dev/null
@@ -0,0 +1,63 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2019 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+// Test the functionality of the ParsedConvergenceTable class for
+// non scalar functions.
+
+#include <deal.II/base/function_lib.h>
+#include <deal.II/base/parsed_convergence_table.h>
+
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_system.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria.h>
+
+#include <deal.II/lac/vector.h>
+
+#include <map>
+
+#include "../tests.h"
+
+int
+main()
+{
+  initlog();
+
+  ParsedConvergenceTable table({"u", "v"},
+                               {{ParsedConvergenceTableFlags::L2},
+                                {ParsedConvergenceTableFlags::H1}});
+
+  ParameterHandler prm;
+  table.add_parameters(prm);
+
+  Triangulation<2> tria;
+  GridGenerator::hyper_cube(tria);
+
+  FESystem<2>   fe(FE_Q<2>(1), 2);
+  DoFHandler<2> dh(tria);
+
+  for (unsigned int i = 0; i < 5; ++i)
+    {
+      tria.refine_global(1);
+      dh.distribute_dofs(fe);
+      Vector<double> sol(dh.n_dofs());
+      VectorTools::interpolate(dh, Functions::CosineFunction<2>(2), sol);
+      table.error_from_exact(dh, sol, Functions::CosineFunction<2>(2));
+    }
+  table.output_table(deallog.get_file_stream());
+}
diff --git a/tests/base/parsed_convergence_table_03.output b/tests/base/parsed_convergence_table_03.output
new file mode 100644 (file)
index 0000000..6217010
--- /dev/null
@@ -0,0 +1,7 @@
+
+dofs cells      u_L2           v_H1      
+18   4     5.156e-02 -    2.615e-01 -    
+50   16    1.333e-02 2.65 1.272e-01 1.41 
+162  64    3.360e-03 2.34 6.313e-02 1.19 
+578  256   8.418e-04 2.18 3.150e-02 1.09 
+2178 1024  2.106e-04 2.09 1.574e-02 1.05 

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.