-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
int SMESHDS_GroupOnFilter::GetTic() const
{
- return myMeshModifTime * myPredicateTic;
+ return GetMesh()->GetMTime() * myPredicateTic;
+}
+
+//================================================================================
+/*!
+ * \brief Return false if update() is needed
+ */
+//================================================================================
+
+bool SMESHDS_GroupOnFilter::IsUpToDate() const
+{
+ return !( myMeshModifTime < GetMesh()->GetMTime() );
}
//================================================================================
void SMESHDS_GroupOnFilter::update() const
{
- if ( myMeshModifTime < GetMesh()->GetMTime() )
+ if ( !IsUpToDate() )
{
SMESHDS_GroupOnFilter* me = const_cast<SMESHDS_GroupOnFilter*>( this );
me->myElements.clear();
if ( myPredicate )
{
+ myPredicate->SetMesh( GetMesh() ); // hope myPredicate updates self here if necessary
me->myElements.reserve( GetMesh()->GetMeshInfo().NbElements(GetType()));
SMDS_ElemIteratorPtr elIt = GetMesh()->elementsIterator(GetType());
while ( elIt->more() )
if ( myPredicate->IsSatisfy( e->GetID() ))
me->myElements.push_back( e );
}
- me->myElements.resize( myElements.size() );
+ vector< const SMDS_MeshElement*> elems( me->myElements.begin(), me->myElements.end() );
+ me->myElements.swap( elems );
}
me->setChanged( false );
}