]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Now the measure value can be positive or negative. Add an assertion which checks...
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 5 Jul 2005 17:15:29 +0000 (17:15 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 5 Jul 2005 17:15:29 +0000 (17:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@11056 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 30b0a9b8c1ee0af0c07a2f3754c8a40f904d306d..3c3d23ad169ed7b8517db8e392bcd664eeef1be9 100644 (file)
@@ -570,8 +570,9 @@ double TriaObjectAccessor<2, 2>::measure () const
                        vertex(2)(1),
                        vertex(3)(1)  };
 
-  return (-x[0]*y[3]/2.0-x[1]*y[0]/2.0+x[2]*y[3]/2.0+x[3]*y[0]/2.0+
-         x[0]*y[1]/2.0-x[3]*y[2]/2.0+x[1]*y[2]/2.0-x[2]*y[1]/2.0);
+  const double measure=-x[0]*y[3]/2.0-x[1]*y[0]/2.0+x[2]*y[3]/2.0+x[3]*y[0]/2.0+x[0]*y[1]/2.0-x[3]*y[2]/2.0+x[1]*y[2]/2.0-x[2]*y[1]/2.0;
+  Assert(measure>=0, ExcNegativeMeasure());
+  return measure;
 }
 
 
@@ -1627,12 +1628,14 @@ double TriaObjectAccessor<3, 3>::measure () const
                                   // the inside-out orientation of
                                   // the other one). the measure is
                                   // thus negative. Thus take the
-                                  // absolute value of the result
-  return std::fabs(s3+x[5]*y[4]*z[1]/12.0-x[5]*y[4]*z[6]/12.0-x[3]*y[7]*z[4]/12.0+x[6]*
+                                  // negative value of the result
+  const double measure= -(s3+x[5]*y[4]*z[1]/12.0-x[5]*y[4]*z[6]/12.0-x[3]*y[7]*z[4]/12.0+x[6]*
     y[3]*z[7]/12.0-y[1]*x[6]*z[5]/12.0-z[5]*x[1]*y[4]/12.0+z[5]*x[6]*y[4]/12.0+z[5]
     *x[4]*y[1]/12.0-z[5]*x[4]*y[6]/12.0-x[6]*y[7]*z[3]/12.0-x[4]*y[3]*z[7]/12.0+x
     [4]*y[7]*z[3]/12.0-x[1]*y[5]*z[6]/12.0-y[6]*x[7]*z[4]/12.0-y[1]*x[2]*z[6]/12.0-
     y[2]*x[3]*z[6]/12.0+s2+s1+x[2]*y[0]*z[3]/12.0);
+  Assert(measure>=0, ExcNegativeMeasure());
+  return measure;
 }
 
 #endif

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.