From: Wolfgang Bangerth Date: Mon, 17 Jul 2000 08:05:40 +0000 (+0000) Subject: Small clean-ups. X-Git-Tag: v8.0.0~20259 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=182622483c7b09be0aa56cdead4bb90ab00a79ef;p=dealii.git Small clean-ups. git-svn-id: https://svn.dealii.org/trunk@3167 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/numerics/derivative_approximation.cc b/deal.II/deal.II/source/numerics/derivative_approximation.cc index 0c90b9e97e..ed250e1981 100644 --- a/deal.II/deal.II/source/numerics/derivative_approximation.cc +++ b/deal.II/deal.II/source/numerics/derivative_approximation.cc @@ -204,8 +204,8 @@ GradientEstimator::estimate_threaded (const DoFHandler &dof_handler, // direction between // the centers of two // cells - Point y = neighbor_center - this_center; - double distance = sqrt(y.square()); + Point y = neighbor_center - this_center; + const double distance = sqrt(y.square()); // normalize y y /= distance; @@ -234,23 +234,17 @@ GradientEstimator::estimate_threaded (const DoFHandler &dof_handler, // otherwise we would not have // all components of the // gradient - if (determinant(Y) != 0) - { - // compute Y^-1 g - Point gradient; - Tensor<2,dim> Y_inverse = invert(Y); - - // compute Y^-1 g - for (unsigned int i=0; i gradient; + Tensor<2,dim> Y_inverse = invert(Y); + + // compute Y^-1 g + contract (gradient, Y_inverse, projected_gradient); - *error_on_this_cell = sqrt(gradient.square()); - } - else - // not all search directions - // available - AssertThrow (false, ExcInsufficientDirections()); + *error_on_this_cell = sqrt(gradient.square()); }; }; diff --git a/deal.II/deal.II/source/numerics/gradient_estimator.cc b/deal.II/deal.II/source/numerics/gradient_estimator.cc index 0c90b9e97e..ed250e1981 100644 --- a/deal.II/deal.II/source/numerics/gradient_estimator.cc +++ b/deal.II/deal.II/source/numerics/gradient_estimator.cc @@ -204,8 +204,8 @@ GradientEstimator::estimate_threaded (const DoFHandler &dof_handler, // direction between // the centers of two // cells - Point y = neighbor_center - this_center; - double distance = sqrt(y.square()); + Point y = neighbor_center - this_center; + const double distance = sqrt(y.square()); // normalize y y /= distance; @@ -234,23 +234,17 @@ GradientEstimator::estimate_threaded (const DoFHandler &dof_handler, // otherwise we would not have // all components of the // gradient - if (determinant(Y) != 0) - { - // compute Y^-1 g - Point gradient; - Tensor<2,dim> Y_inverse = invert(Y); - - // compute Y^-1 g - for (unsigned int i=0; i gradient; + Tensor<2,dim> Y_inverse = invert(Y); + + // compute Y^-1 g + contract (gradient, Y_inverse, projected_gradient); - *error_on_this_cell = sqrt(gradient.square()); - } - else - // not all search directions - // available - AssertThrow (false, ExcInsufficientDirections()); + *error_on_this_cell = sqrt(gradient.square()); }; };