Salome HOME
IPAL 0051561: Hexotic algorithm fail
[modules/smesh.git] / src / SMDS / SMDS_MeshElement.hxx
index 9eb3c142a28488749af73daadf6c683093e2c407..918ebb668efe33ac67a27d406d4447f14296d1f7 100644 (file)
@@ -1,4 +1,4 @@
-// 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
@@ -80,11 +80,11 @@ public:
 
   ///Return the type of the current element
   virtual SMDSAbs_ElementType GetType() const = 0;
+  virtual SMDSAbs_EntityType GetEntityType() const = 0;
+  virtual SMDSAbs_GeometryType GetGeomType() const = 0;
   virtual vtkIdType GetVtkType() const = 0;
-  virtual bool IsPoly() const { return false; };
+  virtual bool IsPoly() const { return false; }
   virtual bool IsQuadratic() const;
-  //! Return type of entity
-  virtual SMDSAbs_EntityType  GetEntityType() const = 0;
 
   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
   virtual int  NbCornerNodes() const;
@@ -140,10 +140,32 @@ public:
    */
   int GetNodeIndex( const SMDS_MeshNode* node ) const;
 
-  inline ShortType getMeshId() const {return myMeshId; }
-  inline LongType  getshapeId() const {return myShapeId; }
-  inline int getIdInShape() const { return myIdInShape; }
-  inline int getVtkId() const { return myVtkID; }
+  inline ShortType getMeshId()  const { return myMeshId; }
+  inline LongType  getshapeId() const { return myShapeId; }
+  inline int getIdInShape()     const { return myIdInShape; }
+  inline int getVtkId()         const { return myVtkID; }
+
+  /*!
+   * \brief Filters of elements, to be used with SMDS_SetIterator
+   */
+  struct TypeFilter
+  {
+    SMDSAbs_ElementType _type;
+    TypeFilter( SMDSAbs_ElementType t = SMDSAbs_NbElementTypes ):_type(t) {}
+    bool operator()(const SMDS_MeshElement* e) const { return e && e->GetType() == _type; }
+  };
+  struct EntityFilter
+  {
+    SMDSAbs_EntityType _type;
+    EntityFilter( SMDSAbs_EntityType t = SMDSEntity_Last ):_type(t) {}
+    bool operator()(const SMDS_MeshElement* e) const { return e && e->GetEntityType() == _type; }
+  };
+  struct GeomFilter
+  {
+    SMDSAbs_GeometryType _type;
+    GeomFilter( SMDSAbs_GeometryType t = SMDSGeom_NONE ):_type(t) {}
+    bool operator()(const SMDS_MeshElement* e) const { return e && e->GetGeomType() == _type; }
+  };
 
 protected:
   inline void setId(int id) {myID = id; }