Version: 6.3.1
Public Member Functions | Protected Attributes

SMDS_VtkCellIteratorPolyH Class Reference

#include <SMDS_VtkCellIterator.hxx>

Inheritance diagram for SMDS_VtkCellIteratorPolyH:
Inheritance graph
[legend]

Public Member Functions

 SMDS_VtkCellIteratorPolyH (SMDS_Mesh *mesh, int vtkCellId, SMDSAbs_EntityType aType)
virtual ~SMDS_VtkCellIteratorPolyH ()
virtual bool more ()
 Return true if and only if there are other object in this iterator.
virtual const SMDS_MeshElementnext ()
 Return the current object and step to the next one.
void exchange (vtkIdType a, vtkIdType b)
virtual void remove ()
 Delete the current element and step to the next one.

Protected Attributes

int _nbNodesInFaces
SMDS_Mesh_mesh
int _cellId
int _index
int _nbNodes
SMDSAbs_EntityType _type
vtkIdList * _vtkIdList

Detailed Description

Definition at line 62 of file SMDS_VtkCellIterator.hxx.


Constructor & Destructor Documentation

SMDS_VtkCellIteratorPolyH::SMDS_VtkCellIteratorPolyH ( SMDS_Mesh mesh,
int  vtkCellId,
SMDSAbs_EntityType  aType 
)

Definition at line 201 of file SMDS_VtkCellIterator.cxx.

References SMDS_VtkCellIterator._cellId, SMDS_VtkCellIterator._index, SMDS_VtkCellIterator._mesh, SMDS_VtkCellIterator._nbNodes, _nbNodesInFaces, SMDS_VtkCellIterator._type, SMDS_VtkCellIterator._vtkIdList, SMDS_Mesh.getGrid(), ex11_grid3partition.grid, PAL_MESH_041_mesh.mesh, and SMDSEntity_Polyhedra.

                                                                                                             :
  SMDS_VtkCellIterator()
{
  _mesh = mesh;
  _cellId = vtkCellId;
  _index = 0;
  _type = aType;
  //MESSAGE("SMDS_VtkCellIteratorPolyH " << _type);
  _vtkIdList = vtkIdList::New();
  vtkUnstructuredGrid* grid = _mesh->getGrid();
  grid->GetCellPoints(_cellId, _vtkIdList);
  _nbNodes = _vtkIdList->GetNumberOfIds();
  switch (_type)
  {
    case SMDSEntity_Polyhedra:
      {
        //MESSAGE("SMDS_VtkCellIterator Polyhedra");
        vtkIdType nFaces = 0;
        vtkIdType* ptIds = 0;
        grid->GetFaceStream(_cellId, nFaces, ptIds);
        int id = 0;
        _nbNodesInFaces = 0;
        for (int i = 0; i < nFaces; i++)
          {
            int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
            _nbNodesInFaces += nodesInFace;
            id += (nodesInFace + 1);
          }
        _vtkIdList->SetNumberOfIds(_nbNodesInFaces);
        id = 0;
        int n = 0;
        for (int i = 0; i < nFaces; i++)
          {
            int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
            for (int k = 1; k <= nodesInFace; k++)
              _vtkIdList->SetId(n++, ptIds[id + k]);
            id += (nodesInFace + 1);
          }
        break;
      }
    default:
      assert(0);
  }
}
SMDS_VtkCellIteratorPolyH::~SMDS_VtkCellIteratorPolyH ( ) [virtual]

Definition at line 246 of file SMDS_VtkCellIterator.cxx.

{
}

Member Function Documentation

void SMDS_VtkCellIterator.exchange ( vtkIdType  a,
vtkIdType  b 
) [inherited]

Definition at line 37 of file SMDS_VtkCellIterator.hxx.

References SMDS_VtkCellIterator._vtkIdList.

Referenced by SMDS_VtkCellIterator.SMDS_VtkCellIterator().

  {
    vtkIdType t = _vtkIdList->GetId(a);
    _vtkIdList->SetId(a, _vtkIdList->GetId(b));
    _vtkIdList->SetId(b, t);
  }
bool SMDS_VtkCellIteratorPolyH::more ( ) [virtual]

Return true if and only if there are other object in this iterator.

Reimplemented from SMDS_VtkCellIterator.

Definition at line 250 of file SMDS_VtkCellIterator.cxx.

References SMDS_VtkCellIterator._index, and _nbNodesInFaces.

{
  return (_index < _nbNodesInFaces);
}
const SMDS_MeshElement * SMDS_VtkCellIterator::next ( ) [virtual, inherited]

Return the current object and step to the next one.

Implements SMDS_Iterator< const SMDS_MeshElement * >.

Definition at line 109 of file SMDS_VtkCellIterator.cxx.

References SMDS_VtkCellIterator._index, SMDS_VtkCellIterator._mesh, SMDS_VtkCellIterator._vtkIdList, and SMDS_Mesh.FindNodeVtk().

{
  vtkIdType id = _vtkIdList->GetId(_index++);
  return _mesh->FindNodeVtk(id);
}
virtual void SMDS_Iterator< const SMDS_MeshElement * >.remove ( ) [virtual, inherited]

Delete the current element and step to the next one.

Definition at line 44 of file SMDS_Iterator.hxx.

{}

Field Documentation

int SMDS_VtkCellIterator._cellId [protected, inherited]
int SMDS_VtkCellIterator._index [protected, inherited]
SMDS_Mesh* SMDS_VtkCellIterator._mesh [protected, inherited]
int SMDS_VtkCellIterator._nbNodes [protected, inherited]

Definition at line 69 of file SMDS_VtkCellIterator.hxx.

Referenced by more(), and SMDS_VtkCellIteratorPolyH().

vtkIdList* SMDS_VtkCellIterator._vtkIdList [protected, inherited]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS