From f2118588828e04e547b0bb8d9f704bb321049f1d Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 14 Nov 2002 22:10:30 +0000 Subject: [PATCH] Take floating point round-off into consideration. git-svn-id: https://svn.dealii.org/trunk@6766 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-14/step-14.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deal.II/examples/step-14/step-14.cc b/deal.II/examples/step-14/step-14.cc index 6569c4c532..38e96efc4f 100644 --- a/deal.II/examples/step-14/step-14.cc +++ b/deal.II/examples/step-14/step-14.cc @@ -144,7 +144,9 @@ namespace Evaluation for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) - if (cell->vertex(vertex) == evaluation_point) + if (cell->vertex(vertex).distance (evaluation_point) + < + cell->diameter() * 1e-8) { point_value = solution(cell->vertex_dof_index(vertex,0)); @@ -1936,7 +1938,10 @@ namespace DualFunctional // ...then loop over cells and // find the evaluation point - // among the vertices: + // among the vertices (or very + // close to a vertex, which may + // happen due to floating point + // round-off): typename DoFHandler::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); @@ -1944,7 +1949,8 @@ namespace DualFunctional for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) - if (cell->vertex(vertex) == evaluation_point) + if (cell->vertex(vertex).distance(evaluation_point) + < cell->diameter()*1e-8) { // Ok, found, so set // corresponding entry, -- 2.39.5