Salome HOME
#16609: EDF - mesh computation : strange behavior
[modules/smesh.git] / src / SMDS / SMDS_VtkCellIterator.hxx
index 2a974a4b56d5fc41d8614a4eb10f4bea7ac4ddff..01bd72cbc0ac19bb3ef686818e317ebae1dce60f 100644 (file)
@@ -25,7 +25,8 @@
 #include "SMDSAbs_ElementType.hxx"
 
 #include <vtkCell.h>
-#include <vtkIdList.h>
+
+typedef std::vector< vtkIdType > TVtkIdList;
 
 //--------------------------------------------------------------------------------
 /*!
  */
 struct _GetVtkNodes
 {
-  _GetVtkNodes( vtkIdList* nodeIds, SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType type);
+  _GetVtkNodes( TVtkIdList& nodeIds, SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType type);
 };
 struct _GetVtkNodesToUNV
 {
-  _GetVtkNodesToUNV( vtkIdList* nodeIds, SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType type);
+  _GetVtkNodesToUNV( TVtkIdList& nodeIds, SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType type);
 };
 struct _GetVtkNodesPolyh
 {
-  _GetVtkNodesPolyh( vtkIdList* nodeIds, SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType type);
+  _GetVtkNodesPolyh( TVtkIdList& nodeIds, SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType type);
 };
 
 //--------------------------------------------------------------------------------
@@ -55,20 +56,20 @@ public:
   typedef typename SMDS_ITERATOR::value_type result_type;
 
   SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType)
-    : _mesh(mesh), _index(0), _vtkIdList( vtkIdList::New() )
+    : _mesh(mesh), _index(0)
   {
     GET_VTK_NODES getNodes( _vtkIdList, mesh, vtkCellId, aType );
   }
-  virtual ~SMDS_VtkCellIterator() { _vtkIdList->Delete(); }
-  virtual bool        more()      {  return ( _index < _vtkIdList->GetNumberOfIds() ); }
+  virtual ~SMDS_VtkCellIterator() {}
+  virtual bool        more()      {  return ( _index < _vtkIdList.size() ); }
   virtual result_type next()      {
-    vtkIdType id = _vtkIdList->GetId( _index++ );
+    vtkIdType id = _vtkIdList[ _index++ ];
     return static_cast<result_type>( _mesh->FindNodeVtk( id ));
   }
 protected:
   SMDS_Mesh* _mesh;
-  int        _index;
-  vtkIdList* _vtkIdList;
+  size_t     _index;
+  TVtkIdList _vtkIdList;
 };
 
 //--------------------------------------------------------------------------------