From 1552ada90ccde63250b87ba5664095c3e71bd1b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert=20Kl=C3=B6fkorn?=
 <robertk@mathematik.uni-stuttgart.de>
Date: Wed, 16 Sep 2009 14:57:57 +0000
Subject: [PATCH] added check for determinant

git-svn-id: https://dune.mathematik.uni-freiburg.de/svn/alugrid/trunk@1082 0d966ed9-3843-0410-af09-ebfb50bd7c74
---
 src/serial/gitter_hexa_top.h | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/serial/gitter_hexa_top.h b/src/serial/gitter_hexa_top.h
index fa784a4a9..0502aebb6 100644
--- a/src/serial/gitter_hexa_top.h
+++ b/src/serial/gitter_hexa_top.h
@@ -1326,16 +1326,23 @@ template < class A > inline HexaTop < A >
   // if mapping is not affine recalculate volume 
   if( ! _affine )
   {
+    TrilinearMapping triMap (this->myvertex(0)->Point(),
+                             this->myvertex(1)->Point(),
+                             this->myvertex(2)->Point(),
+                             this->myvertex(3)->Point(),
+                             this->myvertex(4)->Point(),
+                             this->myvertex(5)->Point(),
+                             this->myvertex(6)->Point(),
+                             this->myvertex(7)->Point() );
+
+#ifndef NDEBUG 
+    // make sure determinant is ok 
+    double point[3] = { 0.0, 0.0, 0.0 };
+    assert( triMap.det( point ) > 0 );
+#endif
+
     // calculate volume 
-    _volume = QuadraturCube3D < VolumeCalc >
-                (TrilinearMapping (this->myvertex(0)->Point(), 
-                                   this->myvertex(1)->Point(),
-                                   this->myvertex(2)->Point(), 
-                                   this->myvertex(3)->Point(),
-                                   this->myvertex(4)->Point(), 
-                                   this->myvertex(5)->Point(),
-                                   this->myvertex(6)->Point(), 
-                                   this->myvertex(7)->Point())).integrate2 (0.0);
+    _volume = QuadraturCube3D < VolumeCalc > (triMap).integrate2 (0.0);
   }
 
   // make sure that given volume is the same as calulated 
-- 
GitLab