Version: 6.3.1
Public Member Functions | Protected Attributes

SMDS_VtkCellIteratorToUNV Class Reference

#include <SMDS_VtkCellIterator.hxx>

Inheritance diagram for SMDS_VtkCellIteratorToUNV:
Inheritance graph
[legend]

Public Member Functions

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

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

Detailed Description

Definition at line 55 of file SMDS_VtkCellIterator.hxx.


Constructor & Destructor Documentation

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

Definition at line 115 of file SMDS_VtkCellIterator.cxx.

References SMDS_VtkCellIterator._cellId, SMDS_VtkCellIterator._index, SMDS_VtkCellIterator._mesh, SMDS_VtkCellIterator._nbNodes, SMDS_VtkCellIterator._type, SMDS_VtkCellIterator._vtkIdList, SMDS_Mesh.getGrid(), ex11_grid3partition.grid, SMESH_test.ids, PAL_MESH_041_mesh.mesh, SMDSEntity_Penta, SMDSEntity_Polygon, SMDSEntity_Polyhedra, SMDSEntity_Quad_Edge, SMDSEntity_Quad_Hexa, SMDSEntity_Quad_Penta, SMDSEntity_Quad_Polygon, SMDSEntity_Quad_Polyhedra, SMDSEntity_Quad_Pyramid, SMDSEntity_Quad_Quadrangle, SMDSEntity_Quad_Tetra, and SMDSEntity_Quad_Triangle.

                                                                                                             :
  SMDS_VtkCellIterator()
{
  _mesh = mesh;
  _cellId = vtkCellId;
  _index = 0;
  _type = aType;
  //MESSAGE("SMDS_VtkCellInterlacedIterator (UNV)" << _type);

  _vtkIdList = vtkIdList::New();
  vtkIdType* pts;
  vtkUnstructuredGrid* grid = _mesh->getGrid();
  grid->GetCellPoints((vtkIdType)_cellId, (vtkIdType&)_nbNodes, pts);
  _vtkIdList->SetNumberOfIds(_nbNodes);
  int *ids = 0;
  switch (_type)
  {
    case SMDSEntity_Quad_Edge:
      {
        static int id[] = { 0, 2, 1 };
        ids = id;
        break;
      }
    case SMDSEntity_Quad_Triangle:
      {
        static int id[] = { 0, 3, 1, 4, 2, 5 };
        ids = id;
        break;
      }
    case SMDSEntity_Quad_Quadrangle:
      {
        static int id[] = { 0, 4, 1, 5, 2, 6, 3, 7 };
        ids = id;
        break;
      }
    case SMDSEntity_Quad_Tetra:
      {
        static int id[] = { 0, 4, 1, 5, 2, 6, 7, 8, 9, 3 };
        ids = id;
        break;
      }
    case SMDSEntity_Quad_Pyramid:
      {
        static int id[] = { 0, 5, 1, 6, 2, 7, 3, 8, 9, 10, 11, 12, 4 };
        ids = id;
        break;
      }
    case SMDSEntity_Penta:
      {
        static int id[] = { 0, 2, 1, 3, 5, 4 };
        ids = id;
        break;
      }
    case SMDSEntity_Quad_Penta:
      {
        static int id[] = { 0, 8, 2, 7, 1, 6, 12, 14, 13, 3, 11, 5, 10, 4, 9 };
        ids = id;
        break;
      }
    case SMDSEntity_Quad_Hexa:
      {
        static int id[] = { 0, 8, 1, 9, 2, 10, 3, 11, 16, 17, 18, 19, 4, 12, 5, 13, 6, 14, 7, 15 };
        ids = id;
        break;
      }
    case SMDSEntity_Polygon:
    case SMDSEntity_Quad_Polygon:
    case SMDSEntity_Polyhedra:
    case SMDSEntity_Quad_Polyhedra:
    default:
      {
        static int id[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
                            25, 26, 27, 28, 29 };
        ids = id;
        break;
      }
  }
  //MESSAGE("_nbNodes " << _nbNodes);
  for (int i = 0; i < _nbNodes; i++)
    _vtkIdList->SetId(i, pts[ids[i]]);
}
SMDS_VtkCellIteratorToUNV::~SMDS_VtkCellIteratorToUNV ( ) [virtual]

Definition at line 197 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_VtkCellIterator::more ( ) [virtual, inherited]

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 SMDS_VtkCellIterator._index, and SMDS_VtkCellIterator._nbNodes.

{
  return (_index < _nbNodes);
}
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]
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