X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDPartitioner%2FMEDPARTITIONER_Utils.cxx;h=12538cf5f1caca822fd286b9a3d87b065a44e7ad;hb=d9a53c35a1b1e11594bbe617e37f05fca29a37a1;hp=6bbe1a86c2b6e3bf54e65dd28de5aebd07bff9a2;hpb=94d102d362379da8b0dc676e72a7af0a0a0af49a;p=modules%2Fmed.git diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx index 6bbe1a86c..12538cf5f 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2013 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 @@ -826,3 +826,54 @@ ParaMEDMEM::MEDCouplingUMesh* MEDPARTITIONER::CreateEmptyMEDCouplingUMesh() umesh->checkCoherency(); return umesh; } + +namespace MEDPARTITIONER +{ + BBTreeOfDim::BBTreeOfDim( int dim, + const double* bbs, + int* elems, + int level, + int nbelems, + double epsilon) + { + switch ( dim ) + { + case 3: + _tree=new BBTree<3> (bbs,elems,level,nbelems,epsilon); + _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 3 >; + _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 3 >; + break; + case 2: + _tree=new BBTree<2> (bbs,elems,level,nbelems,epsilon); + _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 2 >; + _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 2 >; + break; + case 1: + _tree=new BBTree<1> (bbs,elems,level,nbelems,epsilon); + _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 1 >; + _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 1 >; + break; + default: + _tree=0; + throw INTERP_KERNEL::Exception("BBTreeOfDim(): wrong space dimension"); + } + } + + BBTreeOfDim::~BBTreeOfDim() + { + delete (BBTree<3>*)_tree; + } + + void BBTreeOfDim::getElementsAroundPoint( const double* coordsPtr, + std::vector& elems ) const + { + BBTreeOfDim* me = (BBTreeOfDim*) this; + (me->*_PgetElementsAroundPoint) ( coordsPtr, elems ); + } + void BBTreeOfDim::getIntersectingElems(const double* bb, + std::vector& elems) const + { + BBTreeOfDim* me = (BBTreeOfDim*) this; + (me->*_PgetIntersectingElems) ( bb, elems ); + } +}