From 0b565076bd97343abe8fa60d4326668548fa7ffe Mon Sep 17 00:00:00 2001 From: vbd Date: Fri, 14 Sep 2007 12:27:47 +0000 Subject: [PATCH] staffan : * bug fix --- src/INTERP_KERNEL/testUnitTetra.cxx | 41 ++++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/INTERP_KERNEL/testUnitTetra.cxx b/src/INTERP_KERNEL/testUnitTetra.cxx index c82b59e9d..2c8867119 100644 --- a/src/INTERP_KERNEL/testUnitTetra.cxx +++ b/src/INTERP_KERNEL/testUnitTetra.cxx @@ -1,8 +1,30 @@ #include "MEDMEM_Mesh.hxx" #include "Interpolation3D.hxx" +#include + using namespace MEDMEM; +double sumVolume(const IntersectionMatrix& m) +{ + vector volumes; + for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) + { + for(map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + { + volumes.push_back(iter2->second); + // vol += std::abs(iter2->second); + } + } + + // sum in ascending order to avoid rounding errors + + sort(volumes.begin(), volumes.end()); + const double vol = accumulate(volumes.begin(), volumes.end(), 0.0); + + return vol; +} + // simple test to see if a certain mesh is diagonal when intersected with itself void dumpIntersectionMatrix(const IntersectionMatrix& m) @@ -22,26 +44,7 @@ void dumpIntersectionMatrix(const IntersectionMatrix& m) std::cout << "Sum of volumes = " << sumVolume(m) << std::endl; } -double sumVolume(const IntersectionMatrix& m) -{ - - vector volumes; - for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) - { - for(map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) - { - volumes.push_back(iter2->second); - // vol += std::abs(iter2->second); - } - } - - // sum in ascending order to avoid rounding errors - sort(volumes.begin(), volumes.end()); - const double vol = accumulate(volumes.begin(), volumes.end(), 0.0); - - return vol; -} int main() { -- 2.39.2