]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
replace repeated division (by 2) by a single division
authorleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Dec 2006 12:01:07 +0000 (12:01 +0000)
committerleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Dec 2006 12:01:07 +0000 (12:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@14232 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/tria_accessor.cc

index 1e53e2e611f1ec52dff8501d91d6195922f6dec6..92605d8832a56bad0e353cb433967e5013b421bc 100644 (file)
@@ -567,6 +567,8 @@ double TriaObjectAccessor<2, 2>::measure () const
   readlib(C):
 
   C(measure, optimized);
+
+  additional optimizaton: divide by 2 only one time
 */
 
   const double x[4] = { vertex(0)(0),
@@ -578,7 +580,7 @@ double TriaObjectAccessor<2, 2>::measure () const
                        vertex(2)(1),
                        vertex(3)(1)  };
 
-  return (-x[1]*y[0]/2+x[1]*y[3]/2+y[0]*x[2]/2+x[0]*y[1]/2-x[0]*y[2]/2-y[1]*x[3]/2-x[2]*y[3]/2+x[3]*y[2]/2);
+  return (-x[1]*y[0]+x[1]*y[3]+y[0]*x[2]+x[0]*y[1]-x[0]*y[2]-y[1]*x[3]-x[2]*y[3]+x[3]*y[2])/2;
 }
 
 

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.