- _TPolygon* polygon = new _TPolygon( );
- for( long j = 0; j < nPoints; ++j )
- polygon->AddPointId( cell->GetPointId( j ) );
- icell.TakeOwnership( polygon );
+ vtkSmartPointer< vtkIdList > ids =
+ vtkSmartPointer< vtkIdList >::New( );
+ arrays[ c ]->InitTraversal( );
+ while( arrays[ c ]->GetNextCell( ids ) == 1 )
+ {
+ long nPoints = ids->GetNumberOfIds( );
+ _TCellAutoPointer icell;
+ if( nPoints == 2 )
+ {
+ icell.TakeOwnership( new _TLine );
+ icell->SetPointId( 0, ids->GetId( 0 ) );
+ icell->SetPointId( 1, ids->GetId( 1 ) );
+ }
+ else if( nPoints == 3 )
+ {
+ icell.TakeOwnership( new _TTriangle );
+ icell->SetPointId( 0, ids->GetId( 0 ) );
+ icell->SetPointId( 1, ids->GetId( 1 ) );
+ icell->SetPointId( 2, ids->GetId( 2 ) );
+ }
+ else if( nPoints > 3 )
+ {
+ _TPolygon* polygon = new _TPolygon( );
+ for( long j = 0; j < nPoints; ++j )
+ polygon->AddPointId( ids->GetId( j ) );
+ icell.TakeOwnership( polygon );
+
+ } // fi
+ imesh->SetCell( imesh->GetNumberOfCells( ), icell );
+
+ } // elihw