From: eap Date: Tue, 4 Oct 2011 07:17:28 +0000 (+0000) Subject: 0021275: EDF 1681 SMESH: Find the number of nodes of any group X-Git-Tag: V6_4_0a1~63 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=af3090f59b7e706bcae33baeefc2676322a4b3fb;p=modules%2Fsmesh.git 0021275: EDF 1681 SMESH: Find the number of nodes of any group + virtual int GetTic() const; --- diff --git a/src/SMESHDS/SMESHDS_Group.cxx b/src/SMESHDS/SMESHDS_Group.cxx index 1a9a75655..587b51e20 100644 --- a/src/SMESHDS/SMESHDS_Group.cxx +++ b/src/SMESHDS/SMESHDS_Group.cxx @@ -161,6 +161,17 @@ SMDS_ElemIteratorPtr SMESHDS_Group::GetElements() const return SMDS_ElemIteratorPtr( new MyGroupIterator ( myGroup )); } +//================================================================================ +/*! + * \brief Return a value allowing to find out if a group has changed or not + */ +//================================================================================ + +int SMESHDS_Group::GetTic() const +{ + return myGroup.Tic(); +} + //======================================================================= //function : SetType //purpose : diff --git a/src/SMESHDS/SMESHDS_Group.hxx b/src/SMESHDS/SMESHDS_Group.hxx index 8dea353dd..4bba3713a 100644 --- a/src/SMESHDS/SMESHDS_Group.hxx +++ b/src/SMESHDS/SMESHDS_Group.hxx @@ -56,6 +56,8 @@ class SMESHDS_EXPORT SMESHDS_Group : public SMESHDS_GroupBase virtual SMDS_ElemIteratorPtr GetElements() const; + virtual int GetTic() const; + bool Add (const int theID); bool Remove (const int theID); diff --git a/src/SMESHDS/SMESHDS_GroupBase.hxx b/src/SMESHDS/SMESHDS_GroupBase.hxx index cd3378b1d..5c1bd90e0 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.hxx +++ b/src/SMESHDS/SMESHDS_GroupBase.hxx @@ -71,6 +71,8 @@ class SMESHDS_EXPORT SMESHDS_GroupBase virtual int GetID (const int theIndex); // use it for iterations 1..Extent() + virtual int GetTic() const = 0; + virtual ~SMESHDS_GroupBase() {} void SetColor (const Quantity_Color& theColor) diff --git a/src/SMESHDS/SMESHDS_GroupOnFilter.cxx b/src/SMESHDS/SMESHDS_GroupOnFilter.cxx index 8870f971f..c631f832c 100644 --- a/src/SMESHDS/SMESHDS_GroupOnFilter.cxx +++ b/src/SMESHDS/SMESHDS_GroupOnFilter.cxx @@ -40,7 +40,7 @@ SMESHDS_GroupOnFilter::SMESHDS_GroupOnFilter (const int theID, const SMESHDS_Mesh* theMesh, const SMDSAbs_ElementType theType, const SMESH_PredicatePtr& thePredicate) - : SMESHDS_GroupBase(theID,theMesh,theType), myMeshModifTime(0) + : SMESHDS_GroupBase(theID,theMesh,theType), myMeshModifTime(0), myPredicateTic(0) { setChanged(); SetPredicate( thePredicate ); @@ -55,6 +55,7 @@ SMESHDS_GroupOnFilter::SMESHDS_GroupOnFilter (const int theID, void SMESHDS_GroupOnFilter::SetPredicate( const SMESH_PredicatePtr& thePredicate) { myPredicate = thePredicate; + ++myPredicateTic; setChanged(); if ( myPredicate ) myPredicate->SetMesh( GetMesh() ); @@ -123,6 +124,17 @@ int SMESHDS_GroupOnFilter::GetID (const int theIndex) return myElements[ theIndex-1 ]->GetID(); } +//================================================================================ +/*! + * \brief Return a value allowing to find out if a group has changed or not + */ +//================================================================================ + +int SMESHDS_GroupOnFilter::GetTic() const +{ + return myMeshModifTime * myPredicateTic; +} + //================================================================================ /*! * \brief Updates myElements if necessary diff --git a/src/SMESHDS/SMESHDS_GroupOnFilter.hxx b/src/SMESHDS/SMESHDS_GroupOnFilter.hxx index 5b820a0cf..f17917aab 100644 --- a/src/SMESHDS/SMESHDS_GroupOnFilter.hxx +++ b/src/SMESHDS/SMESHDS_GroupOnFilter.hxx @@ -56,6 +56,8 @@ class SMESHDS_EXPORT SMESHDS_GroupOnFilter: public SMESHDS_GroupBase virtual int GetID (const int theIndex); + virtual int GetTic() const; + private: void update() const; @@ -64,6 +66,7 @@ class SMESHDS_EXPORT SMESHDS_GroupOnFilter: public SMESHDS_GroupBase SMESH_PredicatePtr myPredicate; std::vector< const SMDS_MeshElement*> myElements; unsigned long myMeshModifTime; // when myElements was filled + int myPredicateTic; }; #endif diff --git a/src/SMESHDS/SMESHDS_GroupOnGeom.cxx b/src/SMESHDS/SMESHDS_GroupOnGeom.cxx index 8aa2d8c02..28201179b 100644 --- a/src/SMESHDS/SMESHDS_GroupOnGeom.cxx +++ b/src/SMESHDS/SMESHDS_GroupOnGeom.cxx @@ -128,3 +128,14 @@ bool SMESHDS_GroupOnGeom::Contains (const SMDS_MeshElement* elem) return mySubMesh->Contains( elem ); } +//================================================================================ +/*! + * \brief Return a value allowing to find out if a group has changed or not + */ +//================================================================================ + +int SMESHDS_GroupOnGeom::GetTic() const +{ + return GetMesh()->GetMTime(); +} + diff --git a/src/SMESHDS/SMESHDS_GroupOnGeom.hxx b/src/SMESHDS/SMESHDS_GroupOnGeom.hxx index c8447ed71..3dc4d93c3 100644 --- a/src/SMESHDS/SMESHDS_GroupOnGeom.hxx +++ b/src/SMESHDS/SMESHDS_GroupOnGeom.hxx @@ -53,6 +53,8 @@ class SMESHDS_EXPORT SMESHDS_GroupOnGeom: public SMESHDS_GroupBase virtual SMDS_ElemIteratorPtr GetElements() const; + virtual int GetTic() const; + private: TopoDS_Shape myShape;