Salome HOME
[GPUSPHGUI - Feature #267] 7.5.8. Tracking special boundaries
authoreap <eap@opencascade.com>
Wed, 13 Sep 2017 17:29:28 +0000 (20:29 +0300)
committereap <eap@opencascade.com>
Wed, 13 Sep 2017 17:29:28 +0000 (20:29 +0300)
src/SMDS/SMDS_Mesh.hxx
src/SMDS/SMDS_SetIterator.hxx
src/SMESH_I/SMESH_MeshPartDS.hxx
src/SMESH_I/SMESH_Mesh_i.cxx

index 459befaa9d8eaf087bb99552db9e3a603f031d6e..d8a669d7c330c505b49c8196fa6f1cadb2d3c370 100644 (file)
@@ -654,7 +654,7 @@ public:
                                 int idnode4, int idnode5, int idnode6) const;
   const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
                                 int idnode5, int idnode6, int idnode7, int idnode8) const;
-  const SMDS_MeshElement *FindElement(int IDelem) const;
+  virtual const SMDS_MeshElement *FindElement(int IDelem) const;
   static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n);
   static const SMDS_BallElement* FindBall(const SMDS_MeshNode * n);
   static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
index e0b3c8b0888938ca1eafaed263dc8bbb4b69e437..3402cbf6a9e783ffd9d158e3421c8822550b0b74 100644 (file)
@@ -51,6 +51,11 @@ namespace SMDS {
     static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) it->second; }
   };
 
+  template<typename VALUE,typename VALUE_SET_ITERATOR>
+  struct PointerAccessor {
+    static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) &(*it); }
+  };
+
   ///////////////////////////////////////////////////////////////////////////////
   /// Filters of value pointed by iterator
   ///////////////////////////////////////////////////////////////////////////////
index 6d2c959ef06a60f0ef4142afb5a7e345373b991e..986ee3c06ad4ffa93801c99a3f1b5fd76c453842 100644 (file)
@@ -56,6 +56,8 @@ public:
   virtual SMDS_ElemIteratorPtr elementGeomIterator(SMDSAbs_GeometryType type) const;
   virtual SMDS_ElemIteratorPtr elementEntityIterator(SMDSAbs_EntityType type) const;
 
+  virtual const SMDS_MeshElement *FindElement(int IDelem) const;
+
 private:
   TIDSortedElemSet _elements[ SMDSAbs_NbElementTypes ];
   SMESHDS_Mesh*    _meshDS;
@@ -66,6 +68,17 @@ private:
   {
     void Add(const SMDS_MeshElement* e) { SMDS_MeshInfo::addWithPoly( e ); }
   };
+  /*!
+   * \brief Element holing its ID only
+   */
+  struct TElemID : public SMDS_MeshElement
+  {
+    TElemID(int ID) : SMDS_MeshElement( ID ) {}
+    virtual SMDSAbs_ElementType  GetType() const { return SMDSAbs_All; }
+    virtual SMDSAbs_EntityType   GetEntityType() const { return SMDSEntity_Last; }
+    virtual SMDSAbs_GeometryType GetGeomType() const { return SMDSGeom_NONE; }
+    virtual vtkIdType            GetVtkType() const { return -1; }
+  };
 };
 
 #endif
index dc12084e7aa5d3f7a42604c50a59876eddc49c5a..4178c81ac0847e2677e59f849fb75b3a52d1303e 100644 (file)
@@ -6137,6 +6137,21 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(const std::list< const SMDS_MeshElement* > &
   myInfo = tmpInfo;
 }
 // -------------------------------------------------------------------------------------
+const SMDS_MeshElement * SMESH_MeshPartDS::FindElement(int IDelem) const
+{
+  if ( _meshDS ) return _meshDS->FindElement( IDelem );
+
+  TElemID elem( IDelem );
+  for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType )
+    if ( !_elements[ iType ].empty() )
+    {
+      TIDSortedElemSet::const_iterator it = _elements[ iType ].find( &elem );
+      if ( it != _elements[ iType ].end() )
+        return *it;
+    }
+  return 0;
+}
+// -------------------------------------------------------------------------------------
 SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementGeomIterator(SMDSAbs_GeometryType geomType) const
 {
   if ( _meshDS ) return _meshDS->elementGeomIterator( geomType );