From: ageay Date: Thu, 5 Nov 2009 09:27:11 +0000 (+0000) Subject: Suppression of bug on empty mesh. X-Git-Tag: V5_1_main_FINAL~287 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ffd93fa9095d6ed2cf91b91e3468e99ea7992b1f;p=tools%2Fmedcoupling.git Suppression of bug on empty mesh. --- diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx index d22325813..295360db4 100644 --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -41,6 +41,7 @@ #include "VectorUtils.hxx" #include "BBTree.txx" +#include #include namespace INTERP_KERNEL @@ -130,16 +131,24 @@ namespace INTERP_KERNEL double BoxS[2*SPACEDIM]; myMeshS.getBoundingBox(BoxS); double BoxT[2*SPACEDIM]; myMeshT.getBoundingBox(BoxT); - double diagonalS=getDistanceBtw2Pts(BoxS+SPACEDIM,BoxS); - double DimCaracteristicS=diagonalS/nbMailleS; - double diagonalT=getDistanceBtw2Pts(BoxT+SPACEDIM,BoxT); - double DimCaracteristicT=diagonalT/nbMailleT; + double diagonalS,dimCaracteristicS=std::numeric_limits::max(); + if(nbMailleS!=0) + { + diagonalS=getDistanceBtw2Pts(BoxS+SPACEDIM,BoxS); + dimCaracteristicS=diagonalS/nbMailleS; + } + double diagonalT,dimCaracteristicT=std::numeric_limits::max(); + if(nbMailleT!=0) + { + diagonalT=getDistanceBtw2Pts(BoxT+SPACEDIM,BoxT); + dimCaracteristicT=diagonalT/nbMailleT; + } - _dim_caracteristic=std::min(DimCaracteristicS, DimCaracteristicT); + _dim_caracteristic=std::min(dimCaracteristicS, dimCaracteristicT); if (InterpolationOptions::getPrintLevel()>=1) { - std::cout << " - Characteristic size of the source mesh : " << DimCaracteristicS << std::endl; - std::cout << " - Characteristic size of the target mesh: " << DimCaracteristicT << std::endl; + std::cout << " - Characteristic size of the source mesh : " << dimCaracteristicS << std::endl; + std::cout << " - Characteristic size of the target mesh: " << dimCaracteristicT << std::endl; std::cout << "InterpolationPlanar::computation of the intersections" << std::endl; }