+ //// bug EDF 8407 PARAVIS - mantis 22610
+ vtkFieldData *fielddata(usgIn->GetFieldData());
+ for(int index=0;index<fielddata->GetNumberOfArrays();index++)
+ {
+ vtkDataArray *data(fielddata->GetArray(index));
+ vtkInformation *info(data->GetInformation());
+ const char *arrayOffsetName(info->Get(vtkQuadratureSchemeDefinition::QUADRATURE_OFFSET_ARRAY_NAME()));
+ vtkIdTypeArray *offData(0);
+ bool isELNO(false);
+ if(arrayOffsetName)
+ {
+ vtkCellData *cellData(usgIn->GetCellData());
+ vtkDataArray *offDataTmp(cellData->GetArray(arrayOffsetName));
+ isELNO=offDataTmp->GetInformation()->Get(MEDUtilities::ELNO())==1;
+ offData=dynamic_cast<vtkIdTypeArray *>(offDataTmp);
+ }
+ if(isELNO && offData)
+ {
+ vtkIdType nbCellsInput(usgIn->GetNumberOfCells());
+ if(nbCellsInput==0)
+ continue ;//no cells -> no fields
+ // First trying to detected if we are in the special case where data can be used directly. To detect that look at offData. If offData.front()==0 && offData->back()+NbOfNodesInLastCell==data->GetNumberOfTuples() OK.
+ vtkCell *cell(usgIn->GetCell(nbCellsInput-1));
+ bool statement0(offData->GetTuple1(0)==0);
+ bool statement1(offData->GetTuple1(nbCellsInput-1)+cell->GetNumberOfPoints()==data->GetNumberOfTuples());
+ if(statement0 && statement1)
+ pdOut->GetPointData()->AddArray(data);//We are lucky ! No extraction needed.
+ else
+ {//not lucky ! Extract values from data. A previous threshold has been done... Bug EDF8662
+ vtkDataArray *newArray(data->NewInstance());
+ newArray->SetName(data->GetName());
+ pdOut->GetPointData()->AddArray(newArray);
+ newArray->SetNumberOfComponents(data->GetNumberOfComponents());
+ newArray->SetNumberOfTuples(pdOut->GetNumberOfPoints());
+ newArray->CopyComponentNames(data);
+ newArray->Delete();
+ vtkIdType *offsetPtr(offData->GetPointer(0));
+ vtkIdType zeId(0);
+ for(vtkIdType cellId=0;cellId<nbCellsInput;cellId++)
+ {
+ vtkCell *cell(usgIn->GetCell(cellId));
+ vtkIdType nbPoints(cell->GetNumberOfPoints()),offset(offsetPtr[cellId]);
+ for(vtkIdType j=0;j<nbPoints;j++,zeId++)
+ newArray->SetTuple(zeId,offsetPtr[cellId]+j,data);
+ }
+ }
+ }
+ }
+ AttachCellFieldsOn(usgIn,pdOut->GetCellData(),pdOut->GetNumberOfCells());