Back to index

salome-smesh  6.5.0
SMDS_VtkCellIterator.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2010-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef _SMDS_VTKCELLITERATOR_HXX_
00021 #define _SMDS_VTKCELLITERATOR_HXX_
00022 
00023 #include "SMDS_ElemIterator.hxx"
00024 #include "SMDS_Mesh.hxx"
00025 #include "SMDSAbs_ElementType.hxx"
00026 
00027 #include <vtkCell.h>
00028 #include <vtkIdList.h>
00029 
00030 class SMDS_VtkCellIterator: public SMDS_ElemIterator
00031 {
00032 public:
00033   SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType);
00034   virtual ~SMDS_VtkCellIterator();
00035   virtual bool more();
00036   virtual const SMDS_MeshElement* next();
00037   inline void exchange(vtkIdType a, vtkIdType b)
00038   {
00039     vtkIdType t = _vtkIdList->GetId(a);
00040     _vtkIdList->SetId(a, _vtkIdList->GetId(b));
00041     _vtkIdList->SetId(b, t);
00042   }
00043 
00044 protected:
00045   SMDS_VtkCellIterator() {};
00046 
00047   SMDS_Mesh* _mesh;
00048   int _cellId;
00049   int _index;
00050   int _nbNodes;
00051   SMDSAbs_EntityType _type;
00052   vtkIdList* _vtkIdList;
00053 };
00054 
00055 class SMDS_VtkCellIteratorToUNV: public SMDS_VtkCellIterator
00056 {
00057 public:
00058   SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType);
00059   virtual ~SMDS_VtkCellIteratorToUNV();
00060 };
00061 
00062 class SMDS_VtkCellIteratorPolyH: public SMDS_VtkCellIterator
00063 {
00064 public:
00065   SMDS_VtkCellIteratorPolyH(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType);
00066   virtual ~SMDS_VtkCellIteratorPolyH();
00067   virtual bool more();
00068 protected:
00069   int _nbNodesInFaces;
00070 };
00071 
00072 #endif