From 694390bf5db15a7b705d569104e3a700324acb67 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 4 Nov 2016 15:10:43 +0100 Subject: [PATCH] For MEDReader in // mode : the ghost cell generator is invoked by default --- src/Plugins/MEDReader/IO/vtkMEDReader.cxx | 38 ++++++++++++++++++++--- src/Plugins/MEDReader/IO/vtkMEDReader.h | 2 ++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 2dc9b039..1c185555 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -304,7 +304,12 @@ void vtkMEDReader::GhostCellGeneratorCallForPara(int gcgcp) this->Internal->PK.pushGhost(gcgcp); return ; } - this->Internal->GCGCP=gcgcp!=0; + bool newVal(gcgcp!=0); + if(newVal!=this->Internal->GCGCP) + { + this->Internal->GCGCP=newVal; + this->Modified(); + } } const char *vtkMEDReader::GetSeparator() @@ -413,9 +418,26 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector **in double reqTS(0.); if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP())) reqTS=outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()); +#ifndef MEDREADER_USE_MPI this->FillMultiBlockDataSetInstance(output,reqTS); +#else + if(this->Internal->GCGCP) + { + vtkSmartPointer gcg(vtkSmartPointer::New()); + { + vtkDataSet *ret(RetrieveDataSetAtTime(reqTS)); + gcg->SetInputData(ret); + ret->Delete(); + } + gcg->SetUseGlobalPointIds(true); + gcg->SetBuildIfRequired(false); + gcg->Update(); + output->SetBlock(0,gcg->GetOutput()); + } + else + this->FillMultiBlockDataSetInstance(output,reqTS); +#endif output->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),reqTS); - // Is it really needed ? TODO this->UpdateSIL(request, outInfo); } @@ -621,6 +643,15 @@ void vtkMEDReader::FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, d { if( !this->Internal ) return; + vtkDataSet *ret(RetrieveDataSetAtTime(reqTS)); + output->SetBlock(0,ret); + ret->Delete(); +} + +vtkDataSet *vtkMEDReader::RetrieveDataSetAtTime(double reqTS) +{ + if( !this->Internal ) + return 0; std::string meshName; vtkDataSet *ret(this->Internal->Tree.buildVTKInstance(this->Internal->IsStdOrMode,reqTS,meshName,this->Internal->TK)); if(this->Internal->GenerateVect) @@ -629,8 +660,7 @@ void vtkMEDReader::FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, d vtkGenerateVectors::Operate(ret->GetCellData()); vtkGenerateVectors::Operate(ret->GetFieldData()); } - output->SetBlock(0,ret); - ret->Delete(); + return ret; } void vtkMEDReader::PrintSelf(ostream& os, vtkIndent indent) diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.h b/src/Plugins/MEDReader/IO/vtkMEDReader.h index b48a9164..db9b842f 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.h +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.h @@ -25,6 +25,7 @@ #include "vtkMultiBlockDataSetAlgorithm.h" +class vtkDataSet; class vtkMutableDirectedGraph; class vtkInformationDataObjectMetaDataKey; @@ -78,6 +79,7 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm void UpdateSIL(vtkInformation *request, vtkInformation *info); virtual double PublishTimeStepsIfNeeded(vtkInformation*, bool& isUpdated); virtual void FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS); + vtkDataSet *RetrieveDataSetAtTime(double reqTS); private: //BTX //ETX -- 2.39.2