1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: VTKViewer_ExtractUnstructuredGrid.cxx
24 // Author: Alexey PETROV
26 #include "VTKViewer_ExtractUnstructuredGrid.h"
27 #include "VTKViewer_CellLocationsArray.h"
29 #include <vtkUnsignedCharArray.h>
30 #include <vtkUnstructuredGrid.h>
31 #include <vtkObjectFactory.h>
32 #include <vtkCellArray.h>
33 #include <vtkIdList.h>
35 #include <vtkCellData.h>
36 #include <vtkInformation.h>
37 #include <vtkInformationVector.h>
38 #include <vtkVersion.h>
40 #include "utilities.h"
48 #define VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION)
50 vtkStandardNewMacro(VTKViewer_ExtractUnstructuredGrid);
53 VTKViewer_ExtractUnstructuredGrid::VTKViewer_ExtractUnstructuredGrid():
54 myExtractionMode(eCells), myChangeMode(ePassAll), myStoreMapping( false ), myPassAll( false )
58 VTKViewer_ExtractUnstructuredGrid::~VTKViewer_ExtractUnstructuredGrid()
61 void VTKViewer_ExtractUnstructuredGrid::RegisterCell(vtkIdType theCellId)
63 if ( myCellIds.insert(theCellId).second )
68 void VTKViewer_ExtractUnstructuredGrid::RegisterCellsWithType(vtkIdType theCellType)
70 if ( myCellTypes.insert(theCellType).second )
75 void VTKViewer_ExtractUnstructuredGrid::SetStoreMapping(int theStoreMapping)
77 if ( myStoreMapping != ( theStoreMapping != 0 ))
79 myStoreMapping = theStoreMapping != 0;
84 vtkIdType VTKViewer_ExtractUnstructuredGrid::GetInputId(int theOutId) const
86 if ( myPassAll || ( myCellIds.empty() && myCellTypes.empty() ))
89 if ( theOutId<0 || theOutId >= (int)myOut2InId.size() )
91 return myOut2InId[theOutId];
94 void VTKViewer_ExtractUnstructuredGrid::BuildOut2InMap()
96 if ( myPassAll || !myOut2InId.empty() ) return;
98 vtkUnstructuredGrid *anInput = dynamic_cast< vtkUnstructuredGrid*>( this->GetInput() );
99 if ( !anInput ) return;
101 // use a vector of cellTypes to avoid searching in myCellTypes map
102 // for a better performance (IPAL53103)
103 TVectorId cellTypesVec( VTK_NUMBER_OF_CELL_TYPES, -1 );
104 for ( TSetId::iterator type = myCellTypes.begin(); type != myCellTypes.end(); ++type )
106 if ( *type >= (int)cellTypesVec.size() ) cellTypesVec.resize( *type+1, -1 );
108 cellTypesVec[ *type ] = *type;
111 // same code as in RequestData() excluding cells copying
112 vtkIdType aNbElems = 0;
113 if ( myExtractionMode == eCells )
115 aNbElems = anInput->GetNumberOfCells();
116 if (( myChangeMode == ePassAll ) ||
117 ( myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving))
123 if ( !myCellIds.empty() && myCellTypes.empty() )
125 if ( myChangeMode == eAdding )
127 myOut2InId.reserve(myCellIds.size());
129 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
130 if ( myCellIds.find(aCellId) != myCellIds.end() )
131 myOut2InId.push_back( aCellId );
135 myOut2InId.reserve( std::max( vtkIdType(0), vtkIdType(aNbElems - myCellIds.size())));
137 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
138 if ( myCellIds.find(aCellId) == myCellIds.end() )
139 myOut2InId.push_back( aCellId );
142 else if ( myCellIds.empty() && !myCellTypes.empty() )
144 myOut2InId.reserve( aNbElems );
145 if ( myChangeMode == eAdding )
147 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
149 vtkIdType aType = anInput->GetCellType(aCellId);
150 if ( cellTypesVec[ aType ] == aType )
151 myOut2InId.push_back( aCellId );
156 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
158 vtkIdType aType = anInput->GetCellType(aCellId);
159 if ( cellTypesVec[ aType ] != aType )
160 myOut2InId.push_back( aCellId );
164 else if ( !myCellIds.empty() && !myCellTypes.empty())
166 myOut2InId.reserve( aNbElems );
168 if ( myChangeMode == eAdding )
170 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
172 vtkIdType aType = anInput->GetCellType(aCellId);
173 if ( cellTypesVec[ aType ] == aType )
174 if ( myCellIds.find(aCellId) != myCellIds.end() )
175 myOut2InId.push_back( aCellId );
180 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
182 vtkIdType aType = anInput->GetCellType(aCellId);
183 if ( cellTypesVec[ aType ] != aType )
184 if ( myCellIds.find(aCellId) == myCellIds.end())
185 myOut2InId.push_back( aCellId );
193 aNbElems = anInput->GetNumberOfPoints();
195 if (( myChangeMode == ePassAll ) ||
196 ( myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving) ||
197 ( !anInput->GetCellTypesArray() ))
201 else if ( !myCellIds.empty() && myCellTypes.empty())
203 if ( myChangeMode == eAdding )
205 myOut2InId.reserve( myCellIds.size() );
207 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
208 if ( myCellIds.find(aCellId) != myCellIds.end())
209 myOut2InId.push_back( aCellId );
213 myOut2InId.reserve( std::max( vtkIdType(0), vtkIdType(aNbElems - myCellIds.size())));
215 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
216 if ( myCellIds.find(aCellId) == myCellIds.end())
217 myOut2InId.push_back( aCellId );
220 else if ( myCellIds.empty() && !myCellTypes.empty())
222 myOut2InId.reserve( aNbElems );
224 if ( myChangeMode == eAdding )
226 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
228 vtkIdType aType = anInput->GetCellType(aCellId);
229 if ( cellTypesVec[ aType ] == aType )
230 myOut2InId.push_back( aCellId );
235 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
237 vtkIdType aType = anInput->GetCellType(aCellId);
238 if ( cellTypesVec[ aType ] != aType )
239 myOut2InId.push_back( aCellId );
243 else if ( !myCellIds.empty() && !myCellTypes.empty() )
245 if ( myChangeMode == eAdding )
247 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
249 vtkIdType aType = anInput->GetCellType(aCellId);
250 if ( cellTypesVec[ aType ] == aType )
251 if ( myCellIds.find(aCellId) != myCellIds.end())
252 myOut2InId.push_back( aCellId );
257 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++)
259 vtkIdType aType = anInput->GetCellType(aCellId);
260 if ( cellTypesVec[ aType ] != aType )
261 if ( myCellIds.find(aCellId) == myCellIds.end())
262 myOut2InId.push_back( aCellId );
268 if ((vtkIdType) myOut2InId.size() == aNbElems )
271 TVectorId().swap( myOut2InId );
276 // vtkIdType VTKViewer_ExtractUnstructuredGrid::GetOutputId(int theInId) const{
277 // if(myCellIds.empty() && myCellTypes.empty()) return theInId;
278 // TMapId::const_iterator anIter = myIn2OutId.find(theInId);
279 // if(anIter == myIn2OutId.end()) return -1;
280 // return anIter->second;
284 inline int InsertCell(vtkUnstructuredGrid *theInput,
285 vtkCellArray *theConnectivity,
286 vtkUnsignedCharArray* theCellTypesArray,
287 vtkIdTypeArray*& theFaces,
288 vtkIdTypeArray*& theFaceLocations,
290 vtkIdList *theIdList,
291 bool theStoreMapping,
293 VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId/*,
294 VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId*/)
296 vtkCell *aCell = theInput->GetCell(theCellId);
297 vtkIdType aCellType = aCell->GetCellType();
298 vtkIdType aCellId = -1;
299 #if VTK_XVERSION > 50700
300 if (aCellType != VTK_POLYHEDRON)
303 aCellId = theConnectivity->InsertNextCell( aCell->GetPointIds() ); //theIdList);
304 if (theFaceLocations)
305 theFaceLocations->InsertNextValue(-1);
306 #if VTK_XVERSION > 50700
310 //MESSAGE("InsertCell type VTK_POLYHEDRON " << theStoreMapping);
313 theFaces = vtkIdTypeArray::New();
314 theFaces->Allocate(theCellTypesArray->GetSize());
315 theFaceLocations = vtkIdTypeArray::New();
316 theFaceLocations->Allocate(theCellTypesArray->GetSize());
317 // FaceLocations must be padded until the current position
318 for (vtkIdType i = 0; i <= theCellTypesArray->GetMaxId(); i++)
320 theFaceLocations->InsertNextValue(-1);
323 // insert face location
324 theFaceLocations->InsertNextValue(theFaces->GetMaxId() + 1);
326 // insert cell connectivity and faces stream
327 vtkIdType nfaces = 0;
330 theInput->GetFaceStream(theCellId, nfaces, face);
331 vtkUnstructuredGrid::DecomposeAPolyhedronCell(
332 nfaces, face, realnpts, theConnectivity, theFaces);
336 /*vtkIdType anID = */theCellTypesArray->InsertNextValue(aCellType);
338 theOut2InId.push_back( theCellId );
339 //theIn2OutId.insert( theIn2OutId.end(), std::make_pair( theCellId, theOutId ));
344 inline void InsertPointCell(vtkCellArray *theConnectivity,
345 vtkUnsignedCharArray* theCellTypesArray,
347 vtkIdList *theIdList,
348 bool theStoreMapping,
350 VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId/*,
351 VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId*/)
353 theIdList->SetId(0,theCellId);
354 theConnectivity->InsertNextCell(theIdList);
355 theCellTypesArray->InsertNextValue(VTK_VERTEX);
357 theOut2InId.push_back(theCellId);
358 //theIn2OutId.insert( theIn2OutId.end(), std::make_pair( theCellId, theOutId ));
363 int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(request),
364 vtkInformationVector **inputVector,
365 vtkInformationVector *outputVector)
367 // get the info objects
368 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
369 vtkInformation *outInfo = outputVector->GetInformationObject(0);
371 // get the input and ouptut
372 vtkUnstructuredGrid *anInput =
373 vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
374 vtkUnstructuredGrid *anOutput =
375 vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
377 //vtkUnstructuredGrid *anInput = this->GetInput();
378 //vtkUnstructuredGrid *anOutput = this->GetOutput();
381 TVectorId().swap( myOut2InId );
383 // use a vector of cellTypes to avoid searching in myCellTypes map
384 // for a better performance (IPAL53103)
385 TVectorId cellTypesVec( VTK_NUMBER_OF_CELL_TYPES, -1 );
386 for ( TSetId::iterator type = myCellTypes.begin(); type != myCellTypes.end(); ++type )
388 if ( *type >= (int)cellTypesVec.size() ) cellTypesVec.resize( *type+1, -1 );
390 cellTypesVec[ *type ] = *type;
394 MESSAGE("Execute - anInput->GetNumberOfCells() = "<<anInput->GetNumberOfCells());
395 MESSAGE("Execute - myCellTypes.size() = "<<myCellTypes.size());
396 MESSAGE("Execute - myCellIds.size() = "<<myCellIds.size());
397 MESSAGE("Execute - myExtractionMode = "<<myExtractionMode);
398 MESSAGE("Execute - myChangeMode = "<<myChangeMode);
400 vtkIdType aNbElems = 0;
401 if(myExtractionMode == eCells)
403 aNbElems = anInput->GetNumberOfCells();
404 if(myChangeMode == ePassAll || (myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving)){
407 anOutput->ShallowCopy(anInput);
408 //if(myStoreMapping) myOut2InId.reserve(aNbElems);
409 // if(myStoreMapping){
410 // for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
411 // myOut2InId.push_back(aCellId);
412 // //myIn2OutId.insert( myIn2OutId.end(), std::make_pair( aCellId, anOutId ));
417 vtkIdList *anIdList = vtkIdList::New();
418 vtkCellArray *aConnectivity = vtkCellArray::New();
419 aConnectivity->Allocate(2*aNbElems,0);
420 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
421 aCellTypesArray->SetNumberOfComponents(1);
422 aCellTypesArray->Allocate(aNbElems*aCellTypesArray->GetNumberOfComponents());
423 anOutput->GetCellData()->CopyAllocate(anInput->GetCellData(),aNbElems,aNbElems/2);
425 vtkIdTypeArray *newFaces = 0;
426 vtkIdTypeArray *newFaceLocations = 0;
428 if(!myCellIds.empty() && myCellTypes.empty()){
429 if(myStoreMapping) myOut2InId.reserve(myCellIds.size());
430 if(myChangeMode == eAdding){
431 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
432 if(myCellIds.find(aCellId) != myCellIds.end()){
433 vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
434 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
435 anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
439 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
440 if(myCellIds.find(aCellId) == myCellIds.end()){
441 vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
442 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
443 anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
447 }else if(myCellIds.empty() && !myCellTypes.empty()){
448 if(myChangeMode == eAdding){
449 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
450 vtkIdType aType = anInput->GetCellType(aCellId);
451 if ( cellTypesVec[ aType ] == aType ) {
452 vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
453 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
454 anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
458 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
459 vtkIdType aType = anInput->GetCellType(aCellId);
460 if ( cellTypesVec[ aType ] != aType ) {
461 vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
462 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
463 anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
467 }else if(!myCellIds.empty() && !myCellTypes.empty()){
468 if(myChangeMode == eAdding){
469 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
470 vtkIdType aType = anInput->GetCellType(aCellId);
471 if ( cellTypesVec[ aType ] == aType ) {
472 if(myCellIds.find(aCellId) != myCellIds.end()){
473 vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
474 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
475 anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
480 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
481 vtkIdType aType = anInput->GetCellType(aCellId);
482 if ( cellTypesVec[ aType ] != aType ) {
483 if(myCellIds.find(aCellId) == myCellIds.end()){
484 vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
485 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
486 anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
492 if ( vtkIdType newNbElems = aConnectivity->GetNumberOfCells() ) {
493 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
494 aCellLocationsArray->SetNumberOfComponents(1);
495 aCellLocationsArray->SetNumberOfTuples(newNbElems);
496 aConnectivity->InitTraversal();
497 for(vtkIdType i = 0, *pts, npts; aConnectivity->GetNextCell(npts,pts); i++){
498 aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
500 #if VTK_XVERSION > 50700
501 anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity,newFaceLocations,newFaces);
503 anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
505 anOutput->SetPoints(anInput->GetPoints());
506 aCellLocationsArray->Delete();
508 aCellTypesArray->Delete();
509 aConnectivity->Delete();
511 if ( newFaceLocations ) newFaceLocations->Delete();
512 if ( newFaces ) newFaces->Delete();
517 vtkIdList *anIdList = vtkIdList::New();
518 anIdList->SetNumberOfIds(1);
519 vtkCellArray *aConnectivity = vtkCellArray::New();
520 aNbElems = anInput->GetNumberOfPoints();
521 aConnectivity->Allocate(2*aNbElems,0);
522 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
523 aCellTypesArray->SetNumberOfComponents(1);
524 aCellTypesArray->Allocate(aNbElems*aCellTypesArray->GetNumberOfComponents());
525 // additional condition has been added to treat a case described in IPAL21372
526 // note that it is significant only when myExtractionMode == ePoints
527 if(myChangeMode == ePassAll || (myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving) ||
528 !anInput->GetCellTypesArray()){
530 //if(myStoreMapping) myOut2InId.reserve(aNbElems);
531 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
532 InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
533 /*theStoreMapping=*/false,anOutId,myOut2InId/*,myIn2OutId*/);
535 }else if(!myCellIds.empty() && myCellTypes.empty()){
536 if(myStoreMapping) myOut2InId.reserve(myCellIds.size());
537 if(myChangeMode == eAdding){
538 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
539 if(myCellIds.find(aCellId) != myCellIds.end()){
540 InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
541 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
545 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
546 if(myCellIds.find(aCellId) == myCellIds.end()){
547 InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
548 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
552 }else if(myCellIds.empty() && !myCellTypes.empty()){
553 if(myChangeMode == eAdding){
554 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
555 vtkIdType aType = anInput->GetCellType(aCellId);
556 if ( cellTypesVec[ aType ] == aType ) {
557 InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
558 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
562 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
563 vtkIdType aType = anInput->GetCellType(aCellId);
564 if ( cellTypesVec[ aType ] != aType ) {
565 InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
566 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
570 }else if(!myCellIds.empty() && !myCellTypes.empty()){
571 if(myChangeMode == eAdding){
572 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
573 vtkIdType aType = anInput->GetCellType(aCellId);
574 if ( cellTypesVec[ aType ] == aType ) {
575 if(myCellIds.find(aCellId) != myCellIds.end()){
576 InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
577 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
582 for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
583 vtkIdType aType = anInput->GetCellType(aCellId);
584 if ( cellTypesVec[ aType ] != aType ) {
585 if(myCellIds.find(aCellId) == myCellIds.end()){
586 InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
587 myStoreMapping,anOutId,myOut2InId/*,myIn2OutId*/);
593 if (vtkIdType newNbElems = aConnectivity->GetNumberOfCells() ) {
594 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
595 aCellLocationsArray->SetNumberOfComponents(1);
596 aCellLocationsArray->SetNumberOfTuples( newNbElems );
597 aConnectivity->InitTraversal();
598 for(vtkIdType i = 0, *pts, npts; aConnectivity->GetNextCell(npts,pts); i++){
599 aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
601 #if VTK_XVERSION > 50700
602 anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity,0, 0);
604 anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
606 anOutput->SetPoints(anInput->GetPoints());
607 aCellLocationsArray->Delete();
609 aCellTypesArray->Delete();
610 aConnectivity->Delete();
614 if ( aNbElems == (vtkIdType) myOut2InId.size() )
617 TVectorId().swap( myOut2InId );
620 MESSAGE("Execute - anOutput->GetNumberOfCells() = "<<anOutput->GetNumberOfCells());
622 MESSAGE("Execute - myOut2InId.size() = "<<myOut2InId.size());
623 MESSAGE("Execute - myIn2OutId.size() = "<<myIn2OutId.size());