]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use a faster variant of functions.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Mar 2010 00:38:37 +0000 (00:38 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 9 Mar 2010 00:38:37 +0000 (00:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@20759 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/polynomials_adini.cc

index 9e25870cf41eb4a4bc49fe3da359a8a191d10c1f..1853754d1ae386c0b43b239b63d31e3f16025462 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -69,7 +69,7 @@ PolynomialsAdini::PolynomialsAdini() :
   ENTER_COEFFICIENTS( dy,  9, 0,-1, 0, 3, 0, 6,-2, 0,-6, 0, 0, 0);
   ENTER_COEFFICIENTS( dy, 10, 0, 0, 0,-1, 0, 0, 1, 0, 0, 0, 0, 0);
   ENTER_COEFFICIENTS( dy, 11, 0, 0, 0, 0, 0,-2, 0, 0, 3, 0, 0, 0);
-  
+
   //                       0  1  2  3  4  5  6  7  8  9 10 11
   ENTER_COEFFICIENTS( dxx,  0,-6, 12, 6, 0, 0,-12, 0, 0, 0, 0, 0, 0);
   ENTER_COEFFICIENTS( dxx,  1,-4,  6, 4, 0, 0, -6, 0, 0, 0, 0, 0, 0);
@@ -111,13 +111,13 @@ PolynomialsAdini::PolynomialsAdini() :
   ENTER_COEFFICIENTS( dxy, 11, 0, 0,-2, 0, 3, 0, 0, 0, 0, 0, 0, 0);
 }
 
-void 
-PolynomialsAdini::compute (const Point<2> &unit_point, 
+void
+PolynomialsAdini::compute (const Point<2> &unit_point,
                    std::vector<double> &values,
                    std::vector<Tensor<1,2> > &grads,
                    std::vector< Tensor<2,2> > &grad_grads) const
 {
-  if(values.size()>0)//nur dann was tun
+  if(values.empty() == false)//nur dann was tun
   {
     for(unsigned int i=0; i<values.size(); ++i)
     {
@@ -125,15 +125,15 @@ PolynomialsAdini::compute (const Point<2> &unit_point,
     }
   }
 
-  if(grads.size()>0)//nur dann was tun
+  if(grads.empty() == false)//nur dann was tun
   {
     for(unsigned int i=0; i<grads.size(); ++i)
     {
       grads[i] = compute_grad(i, unit_point);
     }
   }
-  
-  if(grad_grads.size()>0)//nur dann was tun
+
+  if(grad_grads.empty() == false)//nur dann was tun
   {
     for(unsigned int i=0; i<grad_grads.size(); ++i)
     {
@@ -147,17 +147,17 @@ double PolynomialsAdini::compute_value (const unsigned int i, const Point<2> &p)
 {
   const double x = p(0);
   const double y = p(1);
-  return coef( 0,i)           + 
-         coef( 1,i)*x         + 
-         coef( 2,i)*y         + 
-         coef( 3,i)*x*x       + 
-         coef( 4,i)*y*y       + 
-         coef( 5,i)*x*y       + 
-         coef( 6,i)*x*x*x     + 
-         coef( 7,i)*y*y*y     +  
-         coef( 8,i)*x*y*y     + 
-         coef( 9,i)*x*x*y     + 
-         coef(10,i)*x*x*x*y  + 
+  return coef( 0,i)           +
+         coef( 1,i)*x         +
+         coef( 2,i)*y         +
+         coef( 3,i)*x*x       +
+         coef( 4,i)*y*y       +
+         coef( 5,i)*x*y       +
+         coef( 6,i)*x*x*x     +
+         coef( 7,i)*y*y*y     +
+         coef( 8,i)*x*y*y     +
+         coef( 9,i)*x*x*y     +
+         coef(10,i)*x*x*x*y  +
          coef(11,i)*x*y*y*y;
 }
 
@@ -166,78 +166,78 @@ Tensor<1,2> PolynomialsAdini::compute_grad (const unsigned int i, const Point<2>
   const double x = p(0);
   const double y = p(1);
   Tensor<1,2> tensor;
-  tensor[0]= dx( 0,i)          + 
-             dx( 1,i)*x        + 
-             dx( 2,i)*y        + 
-             dx( 3,i)*x*x      + 
-             dx( 4,i)*y*y      + 
-             dx( 5,i)*x*y      + 
-             dx( 6,i)*x*x*x    + 
-             dx( 7,i)*y*y*y    + 
-             dx( 8,i)*x*y*y    + 
-             dx( 9,i)*x*x*y    + 
-             dx(10,i)*x*x*x*y + 
+  tensor[0]= dx( 0,i)          +
+             dx( 1,i)*x        +
+             dx( 2,i)*y        +
+             dx( 3,i)*x*x      +
+             dx( 4,i)*y*y      +
+             dx( 5,i)*x*y      +
+             dx( 6,i)*x*x*x    +
+             dx( 7,i)*y*y*y    +
+             dx( 8,i)*x*y*y    +
+             dx( 9,i)*x*x*y    +
+             dx(10,i)*x*x*x*y +
              dx(11,i)*x*y*y*y;
 
-  tensor[1]= dy( 0,i)          + 
-             dy( 1,i)*x        + 
-             dy( 2,i)*y        + 
-             dy( 3,i)*x*x      + 
-             dy( 4,i)*y*y      + 
-             dy( 5,i)*x*y      + 
-             dy( 6,i)*x*x*x    + 
-             dy( 7,i)*y*y*y    + 
-             dy( 8,i)*x*y*y    + 
-             dy( 9,i)*x*x*y    + 
-             dy(10,i)*x*x*x*y + 
+  tensor[1]= dy( 0,i)          +
+             dy( 1,i)*x        +
+             dy( 2,i)*y        +
+             dy( 3,i)*x*x      +
+             dy( 4,i)*y*y      +
+             dy( 5,i)*x*y      +
+             dy( 6,i)*x*x*x    +
+             dy( 7,i)*y*y*y    +
+             dy( 8,i)*x*y*y    +
+             dy( 9,i)*x*x*y    +
+             dy(10,i)*x*x*x*y +
              dy(11,i)*x*y*y*y;
   return tensor;
-}  
+}
 
 Tensor<2,2> PolynomialsAdini::compute_grad_grad (const unsigned int i, const Point<2> &p) const
 {
   const double x = p(0);
   const double y = p(1);
   Tensor<2,2> tensor;
-  tensor[0][0]= dxx( 0,i)          + 
-                dxx( 1,i)*x        + 
-                dxx( 2,i)*y        + 
-                dxx( 3,i)*x*x      + 
-                dxx( 4,i)*y*y      + 
+  tensor[0][0]= dxx( 0,i)          +
+                dxx( 1,i)*x        +
+                dxx( 2,i)*y        +
+                dxx( 3,i)*x*x      +
+                dxx( 4,i)*y*y      +
                 dxx( 5,i)*x*y      +
-                dxx( 6,i)*x*x*x    + 
-                dxx( 7,i)*y*y*y    + 
-                dxx( 8,i)*x*y*y    + 
-                dxx( 9,i)*x*x*y    + 
-                dxx(10,i)*x*x*x*y + 
+                dxx( 6,i)*x*x*x    +
+                dxx( 7,i)*y*y*y    +
+                dxx( 8,i)*x*y*y    +
+                dxx( 9,i)*x*x*y    +
+                dxx(10,i)*x*x*x*y +
                 dxx(11,i)*x*y*y*y;
-  tensor[0][1]= dxy( 0,i)          + 
-                dxy( 1,i)*x        + 
-                dxy( 2,i)*y        + 
-                dxy( 3,i)*x*x      + 
-                dxy( 4,i)*y*y      + 
+  tensor[0][1]= dxy( 0,i)          +
+                dxy( 1,i)*x        +
+                dxy( 2,i)*y        +
+                dxy( 3,i)*x*x      +
+                dxy( 4,i)*y*y      +
                 dxy( 5,i)*x*y      +
-                dxy( 6,i)*x*x*x    + 
-                dxy( 7,i)*y*y*y    + 
-                dxy( 8,i)*x*y*y    + 
-                dxy( 9,i)*x*x*y    + 
-                dxy(10,i)*x*x*x*y + 
+                dxy( 6,i)*x*x*x    +
+                dxy( 7,i)*y*y*y    +
+                dxy( 8,i)*x*y*y    +
+                dxy( 9,i)*x*x*y    +
+                dxy(10,i)*x*x*x*y +
                 dxy(11,i)*x*y*y*y;
   tensor[1][0]= tensor[0][1];
-  tensor[1][1]= dyy( 0,i)          + 
-                dyy( 1,i)*x        + 
-                dyy( 2,i)*y        + 
-                dyy( 3,i)*x*x      + 
-                dyy( 4,i)*y*y      + 
+  tensor[1][1]= dyy( 0,i)          +
+                dyy( 1,i)*x        +
+                dyy( 2,i)*y        +
+                dyy( 3,i)*x*x      +
+                dyy( 4,i)*y*y      +
                 dyy( 5,i)*x*y      +
-                dyy( 6,i)*x*x*x    + 
-                dyy( 7,i)*y*y*y    + 
-                dyy( 8,i)*x*y*y    + 
-                dyy( 9,i)*x*x*y    + 
-                dyy(10,i)*x*x*x*y + 
+                dyy( 6,i)*x*x*x    +
+                dyy( 7,i)*y*y*y    +
+                dyy( 8,i)*x*y*y    +
+                dyy( 9,i)*x*x*y    +
+                dyy(10,i)*x*x*x*y +
                 dyy(11,i)*x*y*y*y;
   return tensor;
-}  
+}
 
 
 DEAL_II_NAMESPACE_CLOSE

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.