Back to index

salome-smesh  6.5.0
Public Member Functions | Protected Attributes
SMDS_VtkCellIteratorPolyH Class Reference

#include <SMDS_VtkCellIterator.hxx>

Inheritance diagram for SMDS_VtkCellIteratorPolyH:
Inheritance graph
[legend]
Collaboration diagram for SMDS_VtkCellIteratorPolyH:
Collaboration graph
[legend]

List of all members.

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_MeshElement * next ()
 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 153 of file SMDS_VtkCellIterator.cxx.

                                                                                                             :
  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);
  }
}

Definition at line 198 of file SMDS_VtkCellIterator.cxx.

{
}

Member Function Documentation

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

Definition at line 37 of file SMDS_VtkCellIterator.hxx.

  {
    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 202 of file SMDS_VtkCellIterator.cxx.

{
  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 54 of file SMDS_VtkCellIterator.cxx.

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

Delete the current element and step to the next one.

Definition at line 44 of file SMDS_Iterator.hxx.

{}

Member Data Documentation

int SMDS_VtkCellIterator::_cellId [protected, inherited]

Definition at line 48 of file SMDS_VtkCellIterator.hxx.

int SMDS_VtkCellIterator::_index [protected, inherited]

Definition at line 49 of file SMDS_VtkCellIterator.hxx.

SMDS_Mesh* SMDS_VtkCellIterator::_mesh [protected, inherited]

Definition at line 45 of file SMDS_VtkCellIterator.hxx.

int SMDS_VtkCellIterator::_nbNodes [protected, inherited]

Definition at line 50 of file SMDS_VtkCellIterator.hxx.

Definition at line 69 of file SMDS_VtkCellIterator.hxx.

Definition at line 51 of file SMDS_VtkCellIterator.hxx.

vtkIdList* SMDS_VtkCellIterator::_vtkIdList [protected, inherited]

Definition at line 52 of file SMDS_VtkCellIterator.hxx.


The documentation for this class was generated from the following files: