From: vbd Date: Fri, 14 Sep 2007 12:27:47 +0000 (+0000) Subject: staffan : X-Git-Tag: trio_trio_coupling~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0b565076bd97343abe8fa60d4326668548fa7ffe;p=tools%2Fmedcoupling.git staffan : * bug fix --- 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() {