#include <vtkCellArray.h>
#include <vtkIdList.h>
#include <vtkCell.h>
+#include <vtkCellData.h>
#include <vtkInformation.h>
#include <vtkInformationVector.h>
#include <vtkVersion.h>
}
-inline void InsertCell(vtkUnstructuredGrid *theInput,
+inline int InsertCell(vtkUnstructuredGrid *theInput,
vtkCellArray *theConnectivity,
vtkUnsignedCharArray* theCellTypesArray,
vtkIdTypeArray*& theFaces,
vtkCell *aCell = theInput->GetCell(theCellId);
vtkIdList *aPntIds = aCell->GetPointIds();
vtkIdType aNbIds = aPntIds->GetNumberOfIds();
+ vtkIdType aCellId = -1;
theIdList->SetNumberOfIds(aNbIds);
for(vtkIdType i = 0; i < aNbIds; i++){
theIdList->SetId(i,aPntIds->GetId(i));
if (aCellType != VTK_POLYHEDRON)
{
#endif
- theConnectivity->InsertNextCell(theIdList);
+ aCellId = theConnectivity->InsertNextCell(theIdList);
if (theFaceLocations)
theFaceLocations->InsertNextValue(-1);
#if VTK_XVERSION > 50700
}
#endif
- theCellTypesArray->InsertNextValue(aCellType);
+ vtkIdType anID = theCellTypesArray->InsertNextValue(aCellType);
if(theStoreMapping){
theOut2InId.push_back(theCellId);
theIn2OutId[theCellId] = theOutId;
}
+ return aCellId;
}
inline void InsertPointCell(vtkCellArray *theConnectivity,
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents(1);
aCellTypesArray->Allocate(aNbElems*aCellTypesArray->GetNumberOfComponents());
+ anOutput->GetCellData()->CopyAllocate(anInput->GetCellData(),aNbElems,aNbElems/2);
vtkIdTypeArray *newFaces = 0;
vtkIdTypeArray *newFaceLocations = 0;
if(myChangeMode == eAdding){
for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
if(myCellIds.find(aCellId) != myCellIds.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
+ vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
}
}
}else{
for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
if(myCellIds.find(aCellId) == myCellIds.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
+ vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
}
}
}
for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
vtkIdType aType = anInput->GetCellType(aCellId);
if(myCellTypes.find(aType) != myCellTypes.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
+ vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
}
}
}else{
for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
vtkIdType aType = anInput->GetCellType(aCellId);
if(myCellTypes.find(aType) == myCellTypes.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
+ vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
}
}
}
vtkIdType aType = anInput->GetCellType(aCellId);
if(myCellTypes.find(aType) != myCellTypes.end()){
if(myCellIds.find(aCellId) != myCellIds.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
+ vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
}
}
}
vtkIdType aType = anInput->GetCellType(aCellId);
if(myCellTypes.find(aType) == myCellTypes.end()){
if(myCellIds.find(aCellId) == myCellIds.end()){
- InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
+ vtkIdType newId = InsertCell(anInput,aConnectivity,aCellTypesArray,newFaces,newFaceLocations,aCellId,anIdList,
myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ anOutput->GetCellData()->CopyData(anInput->GetCellData(),aCellId,newId);
}
}
}