From 59f6f6d3e6afefee078c6623f385ebf8e7d34fb5 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 25 Apr 2002 12:28:45 +0000 Subject: [PATCH] Change some smaller things. git-svn-id: https://svn.dealii.org/trunk@5734 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-14/step-14.cc | 64 ++++++++++------------------- 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/deal.II/examples/step-14/step-14.cc b/deal.II/examples/step-14/step-14.cc index 78fecea409..0502b8a43a 100644 --- a/deal.II/examples/step-14/step-14.cc +++ b/deal.II/examples/step-14/step-14.cc @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -106,8 +105,7 @@ namespace Evaluation class PointValueEvaluation : public EvaluationBase { public: - PointValueEvaluation (const Point &evaluation_point, - TableHandler &results_table); + PointValueEvaluation (const Point &evaluation_point); virtual void operator () (const DoFHandler &dof_handler, const Vector &solution) const; @@ -118,17 +116,14 @@ namespace Evaluation << " was not found among the vertices of the present grid."); private: const Point evaluation_point; - TableHandler &results_table; }; template PointValueEvaluation:: - PointValueEvaluation (const Point &evaluation_point, - TableHandler &results_table) + PointValueEvaluation (const Point &evaluation_point) : - evaluation_point (evaluation_point), - results_table (results_table) + evaluation_point (evaluation_point) {}; @@ -160,9 +155,6 @@ namespace Evaluation AssertThrow (evaluation_point_found, ExcEvaluationPointNotFound(evaluation_point)); - results_table.add_value ("DoFs", dof_handler.n_dofs()); - results_table.add_value ("u(x_0)", point_value); - std::cout << " Point value=" << point_value << std::endl; }; @@ -195,8 +187,7 @@ namespace Evaluation class PointXDerivativeEvaluation : public EvaluationBase { public: - PointXDerivativeEvaluation (const Point &evaluation_point, - TableHandler &results_table); + PointXDerivativeEvaluation (const Point &evaluation_point); virtual void operator () (const DoFHandler &dof_handler, const Vector &solution) const; @@ -207,17 +198,14 @@ namespace Evaluation << " was not found among the vertices of the present grid."); private: const Point evaluation_point; - TableHandler &results_table; }; template PointXDerivativeEvaluation:: - PointXDerivativeEvaluation (const Point &evaluation_point, - TableHandler &results_table) + PointXDerivativeEvaluation (const Point &evaluation_point) : - evaluation_point (evaluation_point), - results_table (results_table) + evaluation_point (evaluation_point) {}; @@ -375,13 +363,7 @@ namespace Evaluation // contributions of all adjacent // cells, so we still have to // compute the mean value. Once - // this is done, enter the result - // into the provided table: - point_derivative /= evaluation_point_hits; - results_table.add_value ("DoFs", dof_handler.n_dofs()); - results_table.add_value ("d_x u(x_0)", point_derivative); - - // At the end report the status: + // this is done, report the status: std::cout << " Point x-derivative=" << point_derivative << std::endl; }; @@ -1192,8 +1174,8 @@ namespace LaplaceSolver // is only commented out to // avoid warnings by the // compiler. - const double x = cell->center()(0); - const double y = cell->center()(1); +/* const double x = cell->center()(0); */ +/* const double y = cell->center()(1); */ /* const double h = cell->diameter(); */ // From this we compute the @@ -1202,9 +1184,7 @@ namespace LaplaceSolver // precomputed indicator. My // default is boring but // efficient. Do it better! - const double weight = 1./((x-0.75)*(x-0.75)+ - (y-0.75)*(y-0.75) + - (0.1*0.1)); + const double weight = 1.; // Finally use this weight: estimated_error(cell_index) *= weight; @@ -1959,7 +1939,7 @@ namespace DualFunctional typename DoFHandler::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); - for (; (cell!=endc) && !evaluation_point_found; ++cell) + for (; cell!=endc; ++cell) for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) @@ -3563,6 +3543,9 @@ void Framework::run (const ProblemDescription &descriptor) solver->solve_problem (); solver->output_solution (); + std::cout << " Number of degrees of freedom=" + << solver->n_dofs() << std::endl; + for (typename EvaluatorList::const_iterator e = descriptor.evaluator_list.begin(); e != descriptor.evaluator_list.end(); ++e) @@ -3651,17 +3634,17 @@ int main () // evaluation objects. We // choose as default the // evaluation of the - // x-derivative at an + // value at an // evaluation point, // represented by the classes - // ``PointXDerivativeEvaluation'' + // ``PointValueEvaluation'' // in the namespaces of // evaluation and dual // functional classes. You can // also set the - // ``PointValueEvaluation'' - // classes for the value - // instead of the x-derivative + // ``PointXDerivativeEvaluation'' + // classes for the x-derivative + // instead of the value // at the evaluation point. // // Note that dual functional @@ -3677,11 +3660,10 @@ int main () // grid in each step. const Point evaluation_point (0.75, 0.75); descriptor.dual_functional - = new DualFunctional::PointXDerivativeEvaluation (evaluation_point); + = new DualFunctional::PointValueEvaluation (evaluation_point); - TableHandler results_table; - Evaluation::PointXDerivativeEvaluation - postprocessor1 (evaluation_point, results_table); + Evaluation::PointValueEvaluation + postprocessor1 (evaluation_point); Evaluation::GridOutput postprocessor2 ("grid"); @@ -3700,8 +3682,6 @@ int main () // runs the entire solution // with it: Framework::run (descriptor); - - results_table.write_text (std::cout); } // Catch exceptions to give -- 2.39.5