From b9c02bfa4f8798fb7ff61f5b766f5e86d509559b Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Wed, 10 Apr 2019 01:10:43 +0200 Subject: [PATCH] ParsedConvergenceTable, scalar function --- tests/base/parsed_convergence_table_01.cc | 59 +++++++++++++++++++ tests/base/parsed_convergence_table_01.output | 7 +++ 2 files changed, 66 insertions(+) create mode 100644 tests/base/parsed_convergence_table_01.cc create mode 100644 tests/base/parsed_convergence_table_01.output diff --git a/tests/base/parsed_convergence_table_01.cc b/tests/base/parsed_convergence_table_01.cc new file mode 100644 index 0000000000..0057e2c6f8 --- /dev/null +++ b/tests/base/parsed_convergence_table_01.cc @@ -0,0 +1,59 @@ +// --------------------------------------------------------------------- +// +// 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 + +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + +#include "../tests.h" + +int +main() +{ + initlog(); + + ParsedConvergenceTable table; + + ParameterHandler prm; + table.add_parameters(prm); + + Triangulation<2> tria; + GridGenerator::hyper_cube(tria); + + FE_Q<2> fe(1); + DoFHandler<2> dh(tria); + + for (unsigned int i = 0; i < 5; ++i) + { + tria.refine_global(1); + dh.distribute_dofs(fe); + Vector sol(dh.n_dofs()); + VectorTools::interpolate(dh, Functions::CosineFunction<2>(1), sol); + table.error_from_exact(dh, sol, Functions::CosineFunction<2>(1)); + } + table.output_table(deallog.get_file_stream()); +} diff --git a/tests/base/parsed_convergence_table_01.output b/tests/base/parsed_convergence_table_01.output new file mode 100644 index 0000000000..dda330200a --- /dev/null +++ b/tests/base/parsed_convergence_table_01.output @@ -0,0 +1,7 @@ + +dofs cells u_Linfty u_L2 u_H1 +9 4 1.183e-01 - 5.156e-02 - 2.615e-01 - +25 16 3.291e-02 2.50 1.333e-02 2.65 1.272e-01 1.41 +81 64 8.449e-03 2.31 3.360e-03 2.34 6.313e-02 1.19 +289 256 2.126e-03 2.17 8.418e-04 2.18 3.150e-02 1.09 +1089 1024 5.325e-04 2.09 2.106e-04 2.09 1.574e-02 1.05 -- 2.39.5