From: hartmann Date: Tue, 5 Jul 2005 17:15:29 +0000 (+0000) Subject: Now the measure value can be positive or negative. Add an assertion which checks... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93e7674c3cfcbb68e643ceb8172097da35b08d09;p=dealii-svn.git Now the measure value can be positive or negative. Add an assertion which checks that the computed measure is in fact positive. git-svn-id: https://svn.dealii.org/trunk@11056 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 30b0a9b8c1..3c3d23ad16 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -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