X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FINTERP_KERNEL%2FBBTree.txx;h=5694fa4bca40fb6c20161969a8e4ebf9b6508806;hb=943d5f6fa12e585a425212a5fc6bd657a535a7b4;hp=dfb54606d38f2e7bf09d97147413bf86ddbacd0b;hpb=0511285d155a0682ff6dad10ac916ac53f577476;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/BBTree.txx b/src/INTERP_KERNEL/BBTree.txx index dfb54606d..5694fa4bc 100644 --- a/src/INTERP_KERNEL/BBTree.txx +++ b/src/INTERP_KERNEL/BBTree.txx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -194,6 +194,39 @@ public: _right->getIntersectingElems(bb,elems); } + /*! + * This method is very close to getIntersectingElems except that it returns number of elems instead of elems themselves. + */ + int getNbOfIntersectingElems(const double* bb) + { + // terminal node : return list of elements intersecting bb + int ret(0); + if (_terminal) + { + for (int i=0; i<_nbelems; i++) + { + const double* const bb_ptr=_bb+_elems[i]*2*dim; + bool intersects = true; + for (int idim=0; idim-_epsilon|| bb_ptr[idim*2+1]-bb[idim*2]<_epsilon) + intersects=false; + } + if (intersects) + ret++; + } + return ret; + } + //non terminal node + double min = bb[(_level%dim)*2]; + double max = bb[(_level%dim)*2+1]; + if (max < _min_right) + return _left->getNbOfIntersectingElems(bb); + if (min> _max_left) + return _right->getNbOfIntersectingElems(bb); + return _left->getNbOfIntersectingElems(bb)+_right->getNbOfIntersectingElems(bb); + } + /*! returns in \a elems the list of elements potentially containing the point pointed to by \a xx \param xx pointer to query point coords