--- /dev/null
+// ---------------------------------------------------------------------
+//
+// 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, writing to files
+
+#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"}, {{ParsedConvergenceTableFlags::custom}});
+
+ ParameterHandler prm;
+ table.add_parameters(prm);
+
+ std::string input = "set Extra columns = dt, dofs, cells\n"
+ "set Rate key = cells\n"
+ "set Enable output to streams = false\n";
+
+ prm.parse_input_from_string(input);
+
+ 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 1.0 / ((i + 1) * (i + 1));
+ };
+ table.custom_error(cycle, dh, "cycle", true, i + 1);
+ }
+
+ input = "set Error file name = error.txt\n";
+ prm.parse_input_from_string(input);
+ table.output_table();
+ cat_file("error.txt");
+
+ input = "set Error file name = error.org\n";
+ prm.parse_input_from_string(input);
+ table.output_table();
+ cat_file("error.org");
+
+ input = "set Error file name = error.tex\n";
+ prm.parse_input_from_string(input);
+ table.output_table();
+ cat_file("error.tex");
+}
--- /dev/null
+
+dofs cells dt u_cycle
+ 9 4 1.0000 1.000e+00 -
+ 25 16 2.0000 2.500e-01 2.00
+ 81 64 3.0000 1.111e-01 1.17
+ 289 256 4.0000 6.250e-02 0.83
+1089 1024 5.0000 4.000e-02 0.64
+
+| dofs | cells | dt | u_cycle | u_cycle...red.rate.log2 |
+| 9 | 4 | 1.0000 | 1.000e+00 | - |
+| 25 | 16 | 2.0000 | 2.500e-01 | 2.00 |
+| 81 | 64 | 3.0000 | 1.111e-01 | 1.17 |
+| 289 | 256 | 4.0000 | 6.250e-02 | 0.83 |
+| 1089 | 1024 | 5.0000 | 4.000e-02 | 0.64 |
+
+\documentclass[10pt]{report}
+\usepackage{float}
+
+
+\begin{document}
+\begin{table}[H]
+\begin{center}
+\begin{tabular}{|r|r|r|c|c|} \hline
+\# dofs & \# cells & \Delta t &
+\multicolumn{2}{|c|}{$\| u - u_h \|_{\text{cycle} $}\\ \hline
+9 & 4 & 1.0000 & 1.000e+00 & -\\ \hline
+25 & 16 & 2.0000 & 2.500e-01 & 2.00\\ \hline
+81 & 64 & 3.0000 & 1.111e-01 & 1.17\\ \hline
+289 & 256 & 4.0000 & 6.250e-02 & 0.83\\ \hline
+1089 & 1024 & 5.0000 & 4.000e-02 & 0.64\\ \hline
+\end{tabular}
+\end{center}
+\end{table}
+\end{document}
+