From: eap Date: Thu, 20 May 2010 11:48:16 +0000 (+0000) Subject: 0020873: [CEA] Failure with ParaMedMem X-Git-Tag: V5_1_4^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FV5_1_4_BR;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; diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index 1ae99850c..e694c4e1d 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -157,6 +157,7 @@ namespace ParaMEDMEM _local_cell_mesh->getNumberOfNodes(), _local_cell_mesh_space_dim); std::vector dbbData = dbb.getData(); + if ( dbbData.size() < bbSize ) dbbData.resize(bbSize,0); double * minmax= &dbbData[0]; #else int bbSize = 2*_local_cell_mesh_space_dim; @@ -185,7 +186,10 @@ namespace ParaMEDMEM _distant_proc_ids.push_back(rank); } } +#ifdef USE_DIRECTED_BB +#else delete [] minmax; +#endif }