]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
For MEDReader in // mode : the ghost cell generator is invoked by default
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 4 Nov 2016 14:10:43 +0000 (15:10 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 4 Nov 2016 14:10:43 +0000 (15:10 +0100)
src/Plugins/MEDReader/IO/vtkMEDReader.cxx
src/Plugins/MEDReader/IO/vtkMEDReader.h

index 2dc9b039b5236b1fce18b1bc023279887ea4a662..1c185555daec75aa268eac53472f8c59eb776550 100644 (file)
@@ -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<vtkPUnstructuredGridGhostCellsGenerator> gcg(vtkSmartPointer<vtkPUnstructuredGridGhostCellsGenerator>::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)
index b48a91640de5b05eb4c9612ea3749f4a83a7201a..db9b842fb739b038f3468a8ade5efcca8a5b0020 100644 (file)
@@ -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