From: eap Date: Wed, 12 May 2010 10:14:55 +0000 (+0000) Subject: 0020873: [CEA] Failure with ParaMedMem X-Git-Tag: V5_1_main_FINAL~117 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8ca41c05b7bee264fd7c7b0c36a03bb1650a461a;p=tools%2Fmedcoupling.git 0020873: [CEA] Failure with ParaMedMem * Correct work of an empty box --- diff --git a/src/INTERP_KERNEL/DirectedBoundingBox.cxx b/src/INTERP_KERNEL/DirectedBoundingBox.cxx index 9c275da70..72b5c5101 100644 --- a/src/INTERP_KERNEL/DirectedBoundingBox.cxx +++ b/src/INTERP_KERNEL/DirectedBoundingBox.cxx @@ -202,7 +202,7 @@ namespace INTERP_KERNEL */ //================================================================================ - DirectedBoundingBox::DirectedBoundingBox():_dim(-1) + DirectedBoundingBox::DirectedBoundingBox():_dim(0) { } @@ -594,6 +594,8 @@ namespace INTERP_KERNEL bool DirectedBoundingBox::isDisjointWith(const DirectedBoundingBox& box) const { + if ( _dim < 1 || box._dim < 1 ) return false; // empty box includes all + // boxes are disjoined if their minmaxes in local CS of either of boxes do not intersect for ( int isThisCS = 0; isThisCS < 2; ++isThisCS ) { @@ -629,6 +631,8 @@ namespace INTERP_KERNEL bool DirectedBoundingBox::isDisjointWith(const double* box) const { + if ( _dim < 1 ) return false; // empty box includes all + // boxes are disjoined if their minmaxes in local CS of either of boxes do not intersect // compare minmaxes in locals CS of this directed box @@ -673,6 +677,8 @@ namespace INTERP_KERNEL bool DirectedBoundingBox::isOut(const double* point) const { + if ( _dim < 1 ) return false; // empty box includes all + double pLoc[3]; toLocalCS( point, pLoc ); bool out = isLocalOut( pLoc ); @@ -699,8 +705,11 @@ namespace INTERP_KERNEL vector DirectedBoundingBox::getData() const { vector data(1, _dim); - data.insert( data.end(), &_axes[0], &_axes[0] + _axes.size()); - data.insert( data.end(), &_minmax[0], &_minmax[0] + _minmax.size()); + if ( _dim > 0 ) + { + data.insert( data.end(), &_axes[0], &_axes[0] + _axes.size()); + data.insert( data.end(), &_minmax[0], &_minmax[0] + _minmax.size()); + } if ( data.size() < dataSize( _dim )) data.resize( dataSize( _dim ), 0 ); return data;