From 8fa38cd2647bb7266a1546b1cde16754d83174c8 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 17 Jul 2000 08:05:40 +0000 Subject: [PATCH] Small clean-ups. git-svn-id: https://svn.dealii.org/trunk@3167 0785d39b-7218-0410-832d-ea1e28bc413d --- .../numerics/derivative_approximation.cc | 30 ++++++++----------- .../source/numerics/gradient_estimator.cc | 30 ++++++++----------- 2 files changed, 24 insertions(+), 36 deletions(-) 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()); }; }; -- 2.39.5