From ffd93fa9095d6ed2cf91b91e3468e99ea7992b1f Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 5 Nov 2009 09:27:11 +0000 Subject: [PATCH] Suppression of bug on empty mesh. --- src/INTERP_KERNEL/InterpolationPlanar.txx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) 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; } -- 2.39.2