Salome HOME
0021275: EDF 1681 SMESH: Find the number of nodes of any group
authoreap <eap@opencascade.com>
Tue, 4 Oct 2011 07:17:28 +0000 (07:17 +0000)
committereap <eap@opencascade.com>
Tue, 4 Oct 2011 07:17:28 +0000 (07:17 +0000)
+  virtual int GetTic() const;

src/SMESHDS/SMESHDS_Group.cxx
src/SMESHDS/SMESHDS_Group.hxx
src/SMESHDS/SMESHDS_GroupBase.hxx
src/SMESHDS/SMESHDS_GroupOnFilter.cxx
src/SMESHDS/SMESHDS_GroupOnFilter.hxx
src/SMESHDS/SMESHDS_GroupOnGeom.cxx
src/SMESHDS/SMESHDS_GroupOnGeom.hxx

index 1a9a75655510aeb7df366325a8a17bfee365d290..587b51e20f313b39118d9fa7e5e350d25657c443 100644 (file)
@@ -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  : 
index 8dea353ddfcf93b4a62c88f385d0b5b252fbd7cd..4bba3713aea88321f66ae8705cde62e31a8311a1 100644 (file)
@@ -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);
index cd3378b1d968923b815c647a77ec9b23df3b2c44..5c1bd90e009c22bcb23f948cf76f5eaf44b03a17 100644 (file)
@@ -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)
index 8870f971fa34ac942d7b41e7950589729a029cbe..c631f832cbdc5bbe6537a20b3bbf270c053aa5af 100644 (file)
@@ -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
index 5b820a0cf5e20cbfb8c86c5cbe317c2acb2e120a..f17917aabe1089f9f862d3b8113714cd547fcdbf 100644 (file)
@@ -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
index 8aa2d8c021aa9dd0f044817f1634ab15ff0c49a0..28201179b64c9c5e98fac1b0e8fe1ad52587f948 100644 (file)
@@ -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();
+}
+
index c8447ed71afed4b1bcc2b76354284a142fb624ce..3dc4d93c3274d1dda4e762f81e5d5737d4086d55 100644 (file)
@@ -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;