From: Wolfgang Bangerth Date: Sat, 1 Aug 2009 02:18:37 +0000 (+0000) Subject: Make sure we back out of the steepest decent if the gradient is X-Git-Tag: v8.0.0~7406 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e48d18a34af7c7188788ad8dc30f0674a96f76e7;p=dealii.git 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 --- 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