From: 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-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50ad8358abf633caa927b13e485f143577036e93;p=dealii-svn.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