Version: 6.3.1
Public Member Functions | Protected Member Functions | Protected Attributes

SMDS_VtkCellIterator Class Reference

#include <SMDS_VtkCellIterator.hxx>

Inheritance diagram for SMDS_VtkCellIterator:
Inheritance graph
[legend]

Public Member Functions

 SMDS_VtkCellIterator (SMDS_Mesh *mesh, int vtkCellId, SMDSAbs_EntityType aType)
virtual ~SMDS_VtkCellIterator ()
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 Member Functions

 SMDS_VtkCellIterator ()

Protected Attributes

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

Detailed Description

Definition at line 30 of file SMDS_VtkCellIterator.hxx.


Constructor & Destructor Documentation

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

Definition at line 23 of file SMDS_VtkCellIterator.cxx.

References _cellId, _mesh, _nbNodes, _type, _vtkIdList, exchange(), SMDS_Mesh.getGrid(), ex11_grid3partition.grid, MESSAGE, SMDSEntity_Hexa, SMDSEntity_Penta, SMDSEntity_Polyhedra, SMDSEntity_Pyramid, SMDSEntity_Quad_Hexa, SMDSEntity_Quad_Penta, SMDSEntity_Quad_Pyramid, SMDSEntity_Quad_Tetra, and SMDSEntity_Tetra.

                                                                                                   :
  _mesh(mesh), _cellId(vtkCellId), _index(0), _type(aType)
{
  //MESSAGE("SMDS_VtkCellIterator " << _type);
  _vtkIdList = vtkIdList::New();
  vtkUnstructuredGrid* grid = _mesh->getGrid();
  grid->GetCellPoints(_cellId, _vtkIdList);
  _nbNodes = _vtkIdList->GetNumberOfIds();
  switch (_type)
  {
    case SMDSEntity_Tetra:
      {
        this->exchange(1, 2);
        break;
      }
    case SMDSEntity_Pyramid:
      {
        this->exchange(1, 3);
        break;
      }
    case SMDSEntity_Penta:
      {
        //this->exchange(1, 2);
        //this->exchange(4, 5);
        break;
      }
    case SMDSEntity_Hexa:
      {
        this->exchange(1, 3);
        this->exchange(5, 7);
        break;
      }
    case SMDSEntity_Quad_Tetra:
      {
        this->exchange(1, 2);
        this->exchange(4, 6);
        this->exchange(8, 9);
        break;
      }
    case SMDSEntity_Quad_Pyramid:
      {
        this->exchange(1, 3);
        this->exchange(5, 8);
        this->exchange(6, 7);
        this->exchange(10, 12);
        break;
      }
    case SMDSEntity_Quad_Penta:
      {
        //this->exchange(1, 2);
        //this->exchange(4, 5);
        //this->exchange(6, 8);
        //this->exchange(9, 11);
        //this->exchange(13, 14);
        break;
      }
    case SMDSEntity_Quad_Hexa:
      {
        MESSAGE("SMDS_VtkCellIterator Quad_Hexa");
        this->exchange(1, 3);
        this->exchange(5, 7);
        this->exchange(8, 11);
        this->exchange(9, 10);
        this->exchange(12, 15);
        this->exchange(13, 14);
        this->exchange(17, 19);
        break;
      }
    case SMDSEntity_Polyhedra:
      MESSAGE("SMDS_VtkCellIterator Polyhedra (iterate on actual nodes)");
      break;
    default:
      break;
  }
}
SMDS_VtkCellIterator::~SMDS_VtkCellIterator ( ) [virtual]

Definition at line 99 of file SMDS_VtkCellIterator.cxx.

References _vtkIdList.

{
  _vtkIdList->Delete();
}
SMDS_VtkCellIterator.SMDS_VtkCellIterator ( ) [protected]

Definition at line 45 of file SMDS_VtkCellIterator.hxx.

{};

Member Function Documentation

void SMDS_VtkCellIterator.exchange ( vtkIdType  a,
vtkIdType  b 
)

Definition at line 37 of file SMDS_VtkCellIterator.hxx.

References _vtkIdList.

Referenced by SMDS_VtkCellIterator().

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

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

Implements SMDS_Iterator< const SMDS_MeshElement * >.

Reimplemented in SMDS_VtkCellIteratorPolyH.

Definition at line 104 of file SMDS_VtkCellIterator.cxx.

References _index, and _nbNodes.

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

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 _index, _mesh, _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

vtkIdList* SMDS_VtkCellIterator._vtkIdList [protected]
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