X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPlugins%2FMEDReader%2FIO%2FvtkELNOMeshFilter.cxx;h=62aa3e6e4ebd3058c1ecf34b1392359fa6c65a84;hb=0aca9e62c928f151af43789b5fd908a774758922;hp=1eb4c7ab056d6b2ec824295e1fe814848c16a678;hpb=4b015556d5938cc157ae97bdc018d08367c0729a;p=modules%2Fparavis.git diff --git a/src/Plugins/MEDReader/IO/vtkELNOMeshFilter.cxx b/src/Plugins/MEDReader/IO/vtkELNOMeshFilter.cxx index 1eb4c7ab..62aa3e6e 100644 --- a/src/Plugins/MEDReader/IO/vtkELNOMeshFilter.cxx +++ b/src/Plugins/MEDReader/IO/vtkELNOMeshFilter.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2010-2014 CEA/DEN, EDF R&D +// Copyright (C) 2010-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ vtkStandardNewMacro(vtkELNOMeshFilter); -vtkELNOMeshFilter::vtkELNOMeshFilter() +vtkELNOMeshFilter::vtkELNOMeshFilter():ShrinkFactor(0.9999) { } @@ -71,7 +71,7 @@ int vtkELNOMeshFilter::RequestData(vtkInformation *request, usgInClone->ShallowCopy(usgIn); vtkSmartPointer shrink(vtkSmartPointer::New()); shrink->SetInputData(usgInClone); - shrink->SetShrinkFactor(0.9999); + shrink->SetShrinkFactor(this->ShrinkFactor); shrink->Update(); vtkUnstructuredGrid *shrinked(shrink->GetOutput()); usgInClone->Delete(); @@ -108,7 +108,7 @@ int vtkELNOMeshFilter::RequestData(vtkInformation *request, for(int index = 0; index < fielddata->GetNumberOfArrays(); index++) { vtkDataArray *data(fielddata->GetArray(index)); - vtkQuadratureSchemeDefinition **dict(0); + vtkQuadratureSchemeDefinition **dict = 0; vtkInformationQuadratureSchemeDefinitionVectorKey *key(vtkQuadratureSchemeDefinition::DICTIONARY()); if(key->Has(data->GetInformation())) { @@ -117,18 +117,23 @@ int vtkELNOMeshFilter::RequestData(vtkInformation *request, key->GetRange(data->GetInformation(),dict,0,0,dictSize); } if(data == NULL) - continue; + { + delete [] dict; + continue; + } vtkInformation *info(data->GetInformation()); - const char *arrayOffsetName = info->Get(vtkQuadratureSchemeDefinition::QUADRATURE_OFFSET_ARRAY_NAME()); - - bool isELGA(false); + const char *arrayOffsetName(info->Get(vtkQuadratureSchemeDefinition::QUADRATURE_OFFSET_ARRAY_NAME())); + vtkIdTypeArray *offData(0); + bool isELGA(false),isELNO(false); if(arrayOffsetName) { vtkFieldData *cellData(usgIn->GetCellData()); - vtkDataArray *offData(cellData->GetArray(arrayOffsetName)); - isELGA=offData->GetInformation()->Get(MEDUtilities::ELGA())==1; + vtkDataArray *offDataTmp(cellData->GetArray(arrayOffsetName)); + isELGA=offDataTmp->GetInformation()->Get(MEDUtilities::ELGA())==1; + isELNO=offDataTmp->GetInformation()->Get(MEDUtilities::ELNO())==1; + offData=dynamic_cast(offDataTmp); } if(arrayOffsetName == NULL || isELGA) @@ -137,43 +142,64 @@ int vtkELNOMeshFilter::RequestData(vtkInformation *request, usgOut->GetPointData()->AddArray(data); else shrinked->GetFieldData()->AddArray(data); + delete [] dict; continue; } else { - vtkDataArray* newArray = data->NewInstance(); + vtkDataArray *newArray(data->NewInstance()); newArray->SetName(data->GetName()); usgOut->GetPointData()->AddArray(newArray); newArray->SetNumberOfComponents(data->GetNumberOfComponents()); newArray->SetNumberOfTuples(usgOut->GetNumberOfPoints()); newArray->CopyComponentNames(data); newArray->Delete(); - vtkIdList *ids(vtkIdList::New()); - vtkIdType offset(0); - for(vtkIdType cellId = 0; cellId < ncell; cellId++) + if(isELGA) { - int cellType = shrinked->GetCellType(cellId); - shrinked->GetCellPoints(cellId, ids); - for(int id = 0; id < dict[cellType]->GetNumberOfQuadraturePoints(); id++) + vtkIdList *ids(vtkIdList::New()); + vtkIdType offset(0); + for(vtkIdType cellId=0;cellIdGetShapeFunctionWeights(id); - int j; - for(j = 0; j < dict[cellType]->GetNumberOfNodes(); j++) + int cellType(shrinked->GetCellType(cellId)); + shrinked->GetCellPoints(cellId, ids); + for(int id = 0; id < dict[cellType]->GetNumberOfQuadraturePoints(); id++) { - if(w[j] == 1.0) - break; + const double * w = dict[cellType]->GetShapeFunctionWeights(id); + int j; + for(j = 0; j < dict[cellType]->GetNumberOfNodes(); j++) + { + if(w[j] == 1.0) + break; + } + if(j == dict[cellType]->GetNumberOfNodes()) + { + j = id; + } + newArray->SetTuple(ids->GetId(id), offset + j, data); } - if(j == dict[cellType]->GetNumberOfNodes()) - { - j = id; - } - newArray->SetTuple(ids->GetId(id), offset + j, data); + vtkCell *cell(usgIn->GetCell(cellId)); + vtkIdType nbptsInCell(cell->GetNumberOfPoints()); + offset+=nbptsInCell; } - vtkCell *cell(usgIn->GetCell(cellId)); - vtkIdType nbptsInCell(cell->GetNumberOfPoints()); - offset+=nbptsInCell; + ids->FastDelete(); + } + else if(offData && isELNO) + { + vtkIdType *offsetPtr(offData->GetPointer(0)); + vtkIdType zeId(0); + for(vtkIdType cellId=0;cellIdGetCell(cellId)); + vtkIdType nbPoints(cell->GetNumberOfPoints()),offset(offsetPtr[cellId]); + for(vtkIdType j=0;jSetTuple(zeId,offsetPtr[cellId]+j,data); + } + } + else + { + delete [] dict; + continue ; } - ids->FastDelete(); } delete [] dict; }