From d48bfe2a64a1d0beb4b9d75a5e177ea026d390e2 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Wed, 10 Apr 2019 01:44:43 +0200 Subject: [PATCH] ParsedConvergenceTable, custom error computation. --- tests/base/parsed_convergence_table_07.cc | 60 +++++++++++++++++++ tests/base/parsed_convergence_table_07.output | 7 +++ 2 files changed, 67 insertions(+) create mode 100644 tests/base/parsed_convergence_table_07.cc create mode 100644 tests/base/parsed_convergence_table_07.output diff --git a/tests/base/parsed_convergence_table_07.cc b/tests/base/parsed_convergence_table_07.cc new file mode 100644 index 0000000000..81a216edf0 --- /dev/null +++ b/tests/base/parsed_convergence_table_07.cc @@ -0,0 +1,60 @@ +// --------------------------------------------------------------------- +// +// 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 +// custom error computations + +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +#include + +#include "../tests.h" + +int +main() +{ + initlog(); + + ParsedConvergenceTable table({"u"}, {{ParsedConvergenceTableFlags::custom}}); + + ParameterHandler prm; + table.add_parameters(prm); + + Triangulation<2> tria; + GridGenerator::hyper_cube(tria); + + FESystem<2> fe(FE_Q<2>(1), 1); + DoFHandler<2> dh(tria); + + for (unsigned int i = 0; i < 5; ++i) + { + tria.refine_global(1); + dh.distribute_dofs(fe); + auto cycle = [&](const unsigned int) { return (i + 1) * 1.0; }; + table.custom_error(cycle, dh, "cycle", true); + } + table.output_table(deallog.get_file_stream()); +} diff --git a/tests/base/parsed_convergence_table_07.output b/tests/base/parsed_convergence_table_07.output new file mode 100644 index 0000000000..fe2d44fefa --- /dev/null +++ b/tests/base/parsed_convergence_table_07.output @@ -0,0 +1,7 @@ + +dofs cells u_cycle +9 4 1.000e+00 - +25 16 2.000e+00 -1.36 +81 64 3.000e+00 -0.69 +289 256 4.000e+00 -0.45 +1089 1024 5.000e+00 -0.34 -- 2.39.5