From: wolf Date: Fri, 14 Sep 2001 13:23:26 +0000 (+0000) Subject: Generate output in tables, rather than by hand. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=667630e9b911d7f041b4da355a7890c491d16748;p=dealii-svn.git Generate output in tables, rather than by hand. git-svn-id: https://svn.dealii.org/trunk@5011 0785d39b-7218-0410-832d-ea1e28bc413d --- 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; };