X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_GroupOnFilter.cxx;h=3d8f98fc993ffbc6e96cda6c1b2e855a8926c8c8;hb=0fc0831670e27a5611b941c52dc152fd63964515;hp=7653e176ce6811b594cd62b99d60e335bf8d7079;hpb=911ca90c3d986ebefe41bf070c8f6506d0a69208;p=modules%2Fsmesh.git diff --git a/src/SMESHDS/SMESHDS_GroupOnFilter.cxx b/src/SMESHDS/SMESHDS_GroupOnFilter.cxx index 7653e176c..3d8f98fc9 100644 --- a/src/SMESHDS/SMESHDS_GroupOnFilter.cxx +++ b/src/SMESHDS/SMESHDS_GroupOnFilter.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -26,11 +26,14 @@ #include "SMESHDS_GroupOnFilter.hxx" #include "SMDS_SetIterator.hxx" +#include "ObjectPool.hxx" #include "SMESHDS_Mesh.hxx" #include #include +#include + using namespace std; //#undef WITH_TBB @@ -45,11 +48,12 @@ SMESHDS_GroupOnFilter::SMESHDS_GroupOnFilter (const int theID, const SMESHDS_Mesh* theMesh, const SMDSAbs_ElementType theType, const SMESH_PredicatePtr& thePredicate) - : SMESHDS_GroupBase(theID,theMesh,theType), + : SMESHDS_GroupBase( theID, theMesh, theType ), + SMDS_ElementHolder( theMesh ), myMeshInfo( SMDSEntity_Last, 0 ), - myMeshModifTime(0), - myPredicateTic(0), - myNbElemToSkip(0) + myMeshModifTime( 0 ), + myPredicateTic( 0 ), + myNbElemToSkip( 0 ) { SetPredicate( thePredicate ); } @@ -143,6 +147,7 @@ namespace // Iterator size_t myNbToFind, myNbFound, myTotalNb; vector< const SMDS_MeshElement*>& myFoundElems; bool & myFoundElemsOK; + bool myFoundElemsChecked; TIterator( const SMESH_PredicatePtr& filter, SMDS_ElemIteratorPtr& elems, @@ -157,14 +162,15 @@ namespace // Iterator myNbFound( 0 ), myTotalNb( totalNb ), myFoundElems( foundElems ), - myFoundElemsOK( foundElemsOK ) + myFoundElemsOK( foundElemsOK ), + myFoundElemsChecked( false ) { myFoundElemsOK = false; next(); } ~TIterator() { - if ( !myFoundElemsOK ) + if ( !myFoundElemsChecked && !myFoundElemsOK ) clearVector( myFoundElems ); } virtual bool more() @@ -221,6 +227,8 @@ namespace // Iterator } if ( !myFoundElemsOK ) clearVector( myFoundElems ); + + myFoundElemsChecked = true; // in destructor: not to clearVector() which may already die } }; @@ -387,6 +395,14 @@ void SMESHDS_GroupOnFilter::update() const //================================================================================ #ifdef WITH_TBB +#ifdef WIN32 +// See https://docs.microsoft.com/en-gb/cpp/porting/modifying-winver-and-win32-winnt?view=vs-2019 +// Windows 10 = 0x0A00 +#define WINVER 0x0A00 +#define _WIN32_WINNT 0x0A00 + +#endif + #include #include "tbb/enumerable_thread_specific.h" @@ -532,3 +548,38 @@ SMESHDS_GroupOnFilter::setNbElemToSkip( SMDS_ElemIteratorPtr& okElemIt ) } return firstOkElem; } + +//================================================================================ +/*! + * \brief Return elements before mesh compacting + */ +//================================================================================ + +SMDS_ElemIteratorPtr SMESHDS_GroupOnFilter::getElements() +{ + return boost::make_shared< SMDS_ElementVectorIterator >( myElements.begin(), myElements.end() ); +} + +//================================================================================ +/*! + * \brief clear myElements before re-filling after mesh compacting + */ +//================================================================================ + +void SMESHDS_GroupOnFilter::tmpClear() +{ + std::vector< const SMDS_MeshElement*> newElems( myElements.size() ); + myElements.swap( newElems ); + myElements.clear(); +} + +//================================================================================ +/*! + * \brief Re-fill myElements after mesh compacting + */ +//================================================================================ + +void SMESHDS_GroupOnFilter::add( const SMDS_MeshElement* element ) +{ + myElements.push_back( element ); +}