From e48d18a34af7c7188788ad8dc30f0674a96f76e7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 1 Aug 2009 02:18:37 +0000 Subject: [PATCH] Make sure we back out of the steepest decent if the gradient is zero. This happens, for example, in bits/distorted_cells_06 without this hunk. git-svn-id: https://svn.dealii.org/trunk@19159 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/grid/grid_tools.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/deal.II/deal.II/source/grid/grid_tools.cc b/deal.II/deal.II/source/grid/grid_tools.cc index b328ca0fd2..97e7977728 100644 --- a/deal.II/deal.II/source/grid/grid_tools.cc +++ b/deal.II/deal.II/source/grid/grid_tools.cc @@ -1541,6 +1541,18 @@ namespace internal step_length); } + // sometimes, the + // (unprojected) gradient + // is perpendicular to + // the manifold, but we + // can't go there if + // respect_manifold==true. in + // that case, gradient=0, + // and we simply need to + // quite the loop here + if (gradient.norm() == 0) + break; + // so we need to go in // direction -gradient. the // optimal value of the -- 2.39.5