From 2e8f9fb3f6bd9db1e07e3ce753c0fb5ca27de4db Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 14 Sep 2001 13:23:26 +0000 Subject: [PATCH] Generate output in tables, rather than by hand. git-svn-id: https://svn.dealii.org/trunk@5011 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-11/step-11.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/deal.II/examples/step-11/step-11.cc b/deal.II/examples/step-11/step-11.cc index fdbe64cd78..7d734fe575 100644 --- a/deal.II/examples/step-11/step-11.cc +++ b/deal.II/examples/step-11/step-11.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -41,7 +42,7 @@ // following file for its // declaration: #include - +#include // Then we declare a class which @@ -93,6 +94,8 @@ class LaplaceProblem Vector solution; Vector system_rhs; + + TableHandler output_table; }; @@ -555,13 +558,10 @@ void LaplaceProblem::assemble_and_solve () // vector: const double norm = norm_per_cell.l2_norm(); - // Last task -- show output: - std::cout << " " << triangulation.n_active_cells() << " cells: " - << " |u|_1=" - << norm - << ", error=" - << fabs(norm-sqrt(3.14159265358/2)) - << std::endl; + // Last task -- generate output: + output_table.add_value ("cells", triangulation.n_active_cells()); + output_table.add_value ("|u|_1", norm); + output_table.add_value ("error", fabs(norm-sqrt(3.14159265358/2))); }; @@ -626,6 +626,14 @@ void LaplaceProblem::run () setup_system (); assemble_and_solve (); }; + + // After all the data is generated, + // write a table of results to the + // screen: + output_table.set_precision("|u|_1", 6); + output_table.set_scientific("error", true); + output_table.write_text (std::cout); + std::cout << std::endl; }; -- 2.39.5