]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Small clean-ups.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 17 Jul 2000 08:05:40 +0000 (08:05 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 17 Jul 2000 08:05:40 +0000 (08:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@3167 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/derivative_approximation.cc
deal.II/deal.II/source/numerics/gradient_estimator.cc

index 0c90b9e97e65d2ff5f8da539cb0dbb591d04701e..ed250e198151904a70fa25a3bac92c70a8a8e8d7 100644 (file)
@@ -204,8 +204,8 @@ GradientEstimator::estimate_threaded (const DoFHandler<dim> &dof_handler,
                                           // direction between
                                           // the centers of two
                                           // cells
-         Point<dim> y        = neighbor_center - this_center;
-         double     distance = sqrt(y.square());
+         Point<dim>   y        = neighbor_center - this_center;
+         const double distance = sqrt(y.square());
                                           // normalize y
          y /= distance;
          
@@ -234,23 +234,17 @@ GradientEstimator::estimate_threaded (const DoFHandler<dim> &dof_handler,
                                       // otherwise we would not have
                                       // all components of the
                                       // gradient
-      if (determinant(Y) != 0)
-       {
-                                          // compute Y^-1 g
-         Point<dim> gradient;
-         Tensor<2,dim> Y_inverse = invert(Y);
-         
-                                          // compute Y^-1 g
-         for (unsigned int i=0; i<dim; ++i)
-           for (unsigned int j=0; j<dim; ++j)
-             gradient[i] += Y_inverse[i][j] * projected_gradient[j];
+      AssertThrow (determinant(Y) != 0,
+                  ExcInsufficientDirections());
+
+                                       // compute Y^-1 g
+      Point<dim> 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());
     };
 };
 
index 0c90b9e97e65d2ff5f8da539cb0dbb591d04701e..ed250e198151904a70fa25a3bac92c70a8a8e8d7 100644 (file)
@@ -204,8 +204,8 @@ GradientEstimator::estimate_threaded (const DoFHandler<dim> &dof_handler,
                                           // direction between
                                           // the centers of two
                                           // cells
-         Point<dim> y        = neighbor_center - this_center;
-         double     distance = sqrt(y.square());
+         Point<dim>   y        = neighbor_center - this_center;
+         const double distance = sqrt(y.square());
                                           // normalize y
          y /= distance;
          
@@ -234,23 +234,17 @@ GradientEstimator::estimate_threaded (const DoFHandler<dim> &dof_handler,
                                       // otherwise we would not have
                                       // all components of the
                                       // gradient
-      if (determinant(Y) != 0)
-       {
-                                          // compute Y^-1 g
-         Point<dim> gradient;
-         Tensor<2,dim> Y_inverse = invert(Y);
-         
-                                          // compute Y^-1 g
-         for (unsigned int i=0; i<dim; ++i)
-           for (unsigned int j=0; j<dim; ++j)
-             gradient[i] += Y_inverse[i][j] * projected_gradient[j];
+      AssertThrow (determinant(Y) != 0,
+                  ExcInsufficientDirections());
+
+                                       // compute Y^-1 g
+      Point<dim> 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());
     };
 };
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.