]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
[EDF24817] : MEDReader deal with file series considered as Spatial aggragation not...
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 12 Oct 2022 15:58:59 +0000 (17:58 +0200)
committerAnthony GEAY <anthony.geay@edf.fr>
Fri, 14 Oct 2022 09:00:39 +0000 (11:00 +0200)
29 files changed:
src/Plugins/MEDReader/plugin/MEDReaderIO/CMakeLists.txt
src/Plugins/MEDReader/plugin/MEDReaderIO/vtk.module [changed mode: 0644->0755]
src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.cxx [new file with mode: 0644]
src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.h [new file with mode: 0755]
src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.cxx [changed mode: 0644->0755]
src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.h [changed mode: 0644->0755]
src/Plugins/MEDReader/plugin/ParaViewPlugin/Resources/MEDReaderServer.xml
src/Plugins/MEDReader/plugin/Test/TestDataAnalysis.py
src/Plugins/MEDReader/plugin/Test/testMEDReader0.py
src/Plugins/MEDReader/plugin/Test/testMEDReader10.py
src/Plugins/MEDReader/plugin/Test/testMEDReader13.py
src/Plugins/MEDReader/plugin/Test/testMEDReader14.py
src/Plugins/MEDReader/plugin/Test/testMEDReader15.py
src/Plugins/MEDReader/plugin/Test/testMEDReader16.py
src/Plugins/MEDReader/plugin/Test/testMEDReader17.py
src/Plugins/MEDReader/plugin/Test/testMEDReader18.py
src/Plugins/MEDReader/plugin/Test/testMEDReader19.py
src/Plugins/MEDReader/plugin/Test/testMEDReader2.py
src/Plugins/MEDReader/plugin/Test/testMEDReader20.py
src/Plugins/MEDReader/plugin/Test/testMEDReader21.py
src/Plugins/MEDReader/plugin/Test/testMEDReader22.py
src/Plugins/MEDReader/plugin/Test/testMEDReader23.py
src/Plugins/MEDReader/plugin/Test/testMEDReader24.py
src/Plugins/MEDReader/plugin/Test/testMEDReader3.py
src/Plugins/MEDReader/plugin/Test/testMEDReader4.py
src/Plugins/MEDReader/plugin/Test/testMEDReader6.py
src/Plugins/MEDReader/plugin/Test/testMEDReader7.py
src/Plugins/MEDReader/plugin/Test/testMEDReader8.py
src/Plugins/MEDReader/plugin/Test/testMEDReader9.py

index f42fda2954b0de06cc1654bcb2a50d407f7493b0..00b3baf1039e55bcdc7eb4a87a6b400af93017ef 100644 (file)
@@ -29,6 +29,7 @@ set(classes
   vtkGroupAsMultiBlock
   vtkGroupsNames
   vtkUgSelectCellIds
+  vtkFileSeriesGroupReader
 )
 
 vtk_module_add_module(MEDReaderIO
old mode 100644 (file)
new mode 100755 (executable)
index 6072a2b..f2b5567
@@ -5,7 +5,11 @@ DEPENDS
   VTK::FiltersExtraction
   VTK::IOLegacy
   ParaView::RemotingCore
+  ParaView::VTKExtensionsIOCore
 PRIVATE_DEPENDS
   VTK::IOLegacy
   ParaView::VTKExtensionsFiltersRendering
+  ParaView::VTKExtensionsFiltersGeneral
   ParaView::VTKExtensionsMisc
+OPTIONAL_DEPENDS
+  VTK::FiltersParallelGeometry
diff --git a/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.cxx b/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.cxx
new file mode 100644 (file)
index 0000000..dbea2e4
--- /dev/null
@@ -0,0 +1,205 @@
+// Copyright (C) 2022  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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "vtkFileSeriesGroupReader.h"
+
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkMultiBlockDataSet.h>
+#include <vtkMultiProcessController.h>
+#include <vtkObjectFactory.h>
+#include <vtkSmartPointer.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+
+#include "vtkMEDReader.h"
+
+#include <vector>
+#include <string>
+
+vtkStandardNewMacro(vtkFileSeriesGroupReader);
+
+//=============================================================================
+struct vtkFileSeriesGroupReaderInternals
+{
+  std::vector<std::string> FileNames;
+};
+
+//=============================================================================
+vtkFileSeriesGroupReader::vtkFileSeriesGroupReader()
+  : Internals(new vtkFileSeriesGroupReaderInternals())
+{
+  this->SetNumberOfInputPorts(0);
+  this->SetNumberOfOutputPorts(1);
+}
+
+//-----------------------------------------------------------------------------
+vtkFileSeriesGroupReader::~vtkFileSeriesGroupReader() = default;
+
+//----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::AddFileName(const char* name)
+{
+  // Make sure the reader always has a filename set
+  this->ReaderSetFileName(name);
+
+  this->AddFileNameInternal(name);
+  this->Modified();
+}
+
+//----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::RemoveAllFileNames()
+{
+  this->RemoveAllFileNamesInternal();
+  this->Modified();
+}
+
+//----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::RemoveAllFileNamesInternal()
+{
+  this->Internals->FileNames.clear();
+}
+
+//----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::AddFileNameInternal(const char* name)
+{
+  this->Internals->FileNames.emplace_back(name);
+}
+
+//----------------------------------------------------------------------------
+unsigned int vtkFileSeriesGroupReader::GetNumberOfFileNames()
+{
+  return static_cast<unsigned int>(this->Internals->FileNames.size());
+}
+
+//----------------------------------------------------------------------------
+const char* vtkFileSeriesGroupReader::GetFileName(unsigned int idx)
+{
+  if (idx >= this->Internals->FileNames.size())
+  {
+    return nullptr;
+  }
+  return this->Internals->FileNames[idx].c_str();
+}
+
+//----------------------------------------------------------------------------
+int vtkFileSeriesGroupReader::CanReadFile(const char* filename)
+{
+  if (!this->Reader)
+  {
+    return 0;
+  }
+
+  return this->ReaderCanReadFile(filename);
+}
+
+//----------------------------------------------------------------------------
+int vtkFileSeriesGroupReader::RequestInformation(
+  vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
+{
+  return this->Reader->ProcessRequest(request, inputVector, outputVector);
+}
+
+//----------------------------------------------------------------------------
+int vtkFileSeriesGroupReader::RequestData(vtkInformation* vtkNotUsed(request),
+  vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
+{
+  auto output = vtkMultiBlockDataSet::GetData(outputVector, 0);
+  unsigned int nBlock = this->GetNumberOfFileNames();
+  output->SetNumberOfBlocks(nBlock);
+
+  vtkInformation* info = outputVector->GetInformationObject(0);
+  double time = info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
+
+  vtkMultiProcessController *vmpc(vtkMultiProcessController::GetGlobalController());
+  unsigned int iProc = vmpc ? vmpc->GetLocalProcessId() : 0;
+  unsigned int nProc = vmpc ? vmpc->GetNumberOfProcesses() : 1;
+
+  // Simple case, one file/block per proc
+  if (nBlock == 1 || (nBlock <= nProc && iProc < nBlock))
+  {
+    // Distribute in MEDReader only when reading a single file in a single block
+    iProc = nBlock == 1 ? 0 : iProc;
+    vtkMEDReader::SafeDownCast(this->Reader)->SetDistributeWithMPI(nBlock == 1);
+
+    this->ReaderSetFileName(this->GetFileName(iProc));
+
+    // Needed only when reading a different file on each proc
+    if (nBlock != 1)
+    {
+      vtkMEDReader::SafeDownCast(this->Reader)->ReloadInternals();
+      this->Reader->UpdateInformation();
+    }
+
+    this->Reader->UpdateTimeStep(time);
+    vtkDataObject* outputReader = vtkMultiBlockDataSet::SafeDownCast(this->Reader->GetOutputDataObject(0))->GetBlock(0);
+    output->SetBlock(iProc, outputReader);
+  }
+  else
+  {
+    // Multiple files/block per proc
+    unsigned int nFiles = nBlock / nProc;
+    unsigned int offFile = iProc * nFiles;
+    unsigned int supFiles = nBlock % nProc;
+
+    // Last proc handle remaining files/block
+    if (iProc + 1 == nProc)
+    {
+      nFiles += supFiles;
+    }
+
+    for (unsigned int i = 0; i < nFiles; i++)
+    {
+      this->ReaderSetFileName(this->GetFileName(i + offFile));
+      vtkMEDReader::SafeDownCast(this->Reader)->SetDistributeWithMPI(false);
+      vtkMEDReader::SafeDownCast(this->Reader)->ReloadInternals();
+      this->Reader->UpdateInformation();
+      this->Reader->UpdateTimeStep(time);
+      vtkDataObject* outputReader = vtkMultiBlockDataSet::SafeDownCast(this->Reader->GetOutputDataObject(0))->GetBlock(0);
+      if (i + 1 == nFiles)
+      {
+       // Last reader, just use the reader output directly
+        output->SetBlock(i + offFile, outputReader);
+      }
+      else
+      {
+       // Need to deep copy as the reader will be reused
+        vtkSmartPointer<vtkDataObject> outputLeaf = vtkSmartPointer<vtkDataObject>::Take(outputReader->NewInstance());
+        outputLeaf->DeepCopy(outputReader);
+        output->SetBlock(i + offFile, outputLeaf);
+      }
+    }
+  }
+  return 1;
+}
+
+//------------------------------------------------------------------------------
+int vtkFileSeriesGroupReader::FillOutputPortInformation(
+  int vtkNotUsed(port), vtkInformation* info)
+{
+  info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet");
+  return 1;
+}
+
+//-----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::PrintSelf(ostream& os, vtkIndent indent)
+{
+  this->Superclass::PrintSelf(os, indent);
+
+  os << indent << "MetaFileName: " << (this->_MetaFileName ? this->_MetaFileName : "(none)")
+     << endl;
+}
diff --git a/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.h b/src/Plugins/MEDReader/plugin/MEDReaderIO/vtkFileSeriesGroupReader.h
new file mode 100755 (executable)
index 0000000..fbcb630
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (C) 2022  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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef vtkFileSeriesGroupReader_h
+#define vtkFileSeriesGroupReader_h
+
+#include "vtkMetaReader.h"
+
+#include <memory>
+
+struct vtkFileSeriesGroupReaderInternals;
+
+class VTK_EXPORT vtkFileSeriesGroupReader : public vtkMetaReader
+{
+public:
+  static vtkFileSeriesGroupReader* New();
+  vtkTypeMacro(vtkFileSeriesGroupReader, vtkMetaReader);
+  void PrintSelf(ostream& os, vtkIndent indent) override;
+
+  /**
+   * CanReadFile is forwarded to the internal reader if it supports it.
+   */
+  virtual int CanReadFile(const char* filename);
+
+  /**
+   * Adds names of files to be read. The files are read in the order
+   * they are added.
+   */
+  virtual void AddFileName(const char* fname);
+
+  /**
+   * Remove all file names.
+   */
+  virtual void RemoveAllFileNames();
+
+  /**
+   * Returns the number of file names added by AddFileName.
+   */
+  virtual unsigned int GetNumberOfFileNames();
+
+  /**
+   * Returns the name of a file with index idx.
+   */
+  virtual const char* GetFileName(unsigned int idx);
+
+protected:
+  vtkFileSeriesGroupReader();
+  ~vtkFileSeriesGroupReader() override;
+
+  /**
+   * Add/Remove filenames without changing the MTime.
+   */
+  void RemoveAllFileNamesInternal();
+  void AddFileNameInternal(const char*);
+
+  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
+  int RequestData(vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector, vtkInformationVector* outputVector);
+  int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info);
+
+private:
+  vtkFileSeriesGroupReader(const vtkFileSeriesGroupReader&) = delete;
+  void operator=(const vtkFileSeriesGroupReader&) = delete;
+
+  std::unique_ptr<vtkFileSeriesGroupReaderInternals> Internals;
+};
+
+#endif
old mode 100644 (file)
new mode 100755 (executable)
index 2fba48c..13fb3a1
@@ -65,7 +65,7 @@ class vtkMEDReader::vtkMEDReaderInternal
 {
 
 public:
-  vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),GCGCP(true)
+  vtkMEDReaderInternal(vtkMEDReader *master):TK(0),SIL(0),LastLev0(-1)
   {
   }
 
@@ -76,21 +76,13 @@ public:
   }
 public:
   MEDFileFieldRepresentationTree Tree;
-  vtkNew<vtkDataArraySelection> FieldSelection;
-  vtkNew<vtkDataArraySelection> TimeFlagSelection;
-
   TimeKeeper TK;
-  std::string FileName;
-  //when false -> std, true -> mode. By default std (false).
-  bool IsStdOrMode;
-  //when false -> do nothing. When true cut off or extend to nbOfCompo=3 vector arrays.
-  bool GenerateVect;
+
   std::string DftMeshName;
   // Store the vtkMutableDirectedGraph that represents links between family, groups and cell types
   vtkMutableDirectedGraph* SIL;
   // store the lev0 id in Tree corresponding to the TIME_STEPS in the pipeline.
   int LastLev0;
-  bool GCGCP;
 };
 
 vtkStandardNewMacro(vtkMEDReader)
@@ -99,7 +91,7 @@ vtkStandardNewMacro(vtkMEDReader)
 // start of overload of vtkInformationKeyMacro
 static vtkInformationDataObjectMetaDataKey *vtkMEDReader_META_DATA=new vtkInformationDataObjectMetaDataKey("META_DATA","vtkMEDReader");
 
-vtkInformationDataObjectMetaDataKey *vtkMEDReader::META_DATA()  
+vtkInformationDataObjectMetaDataKey *vtkMEDReader::META_DATA()
 {
   static const char ZE_KEY[]="vtkMEDReader::META_DATA";
   vtkInformationDataObjectMetaDataKey *ret(vtkMEDReader_META_DATA);
@@ -114,7 +106,7 @@ vtkInformationDataObjectMetaDataKey *vtkMEDReader::META_DATA()
 
 static vtkInformationGaussDoubleVectorKey *vtkMEDReader_GAUSS_DATA=new vtkInformationGaussDoubleVectorKey("GAUSS_DATA","vtkMEDReader");
 
-vtkInformationGaussDoubleVectorKey *vtkMEDReader::GAUSS_DATA()  
+vtkInformationGaussDoubleVectorKey *vtkMEDReader::GAUSS_DATA()
 {
   static const char ZE_KEY[]="vtkMEDReader::GAUSS_DATA";
   vtkInformationGaussDoubleVectorKey *ret(vtkMEDReader_GAUSS_DATA);
@@ -143,21 +135,30 @@ vtkMEDReader::~vtkMEDReader()
 
 void vtkMEDReader::Reload()
 {
-  std::string fName((const char *)this->GetFileName());
+  this->ReloadInternals();
+  this->IsStdOrMode = false;
+  this->GenerateVect = false;
+  this->GCGCP = true;
+  this->FieldSelection->RemoveAllArrays();
+  this->TimeFlagSelection->RemoveAllArrays();
+  this->Modified();
+}
+void vtkMEDReader::ReloadInternals()
+{
   delete this->Internal;
   this->Internal=new vtkMEDReaderInternal(this);
-  this->SetFileName(fName.c_str());
+  this->Modified();
 }
 
 void vtkMEDReader::GenerateVectors(int val)
 {
   if ( !this->Internal )
     return;
-  
+
   bool val2((bool)val);
-  if(val2!=this->Internal->GenerateVect)
+  if(val2!=this->GenerateVect)
     {
-      this->Internal->GenerateVect=val2;
+      this->GenerateVect=val2;
       this->Modified();
     }
 }
@@ -166,8 +167,8 @@ void vtkMEDReader::ChangeMode(int newMode)
 {
   if ( !this->Internal )
     return;
-  
-  this->Internal->IsStdOrMode=newMode!=0;
+
+  this->IsStdOrMode=newMode!=0;
   this->Modified();
 }
 
@@ -175,11 +176,11 @@ void vtkMEDReader::GhostCellGeneratorCallForPara(int gcgcp)
 {
   if ( !this->Internal )
     return;
-  
+
   bool newVal(gcgcp!=0);
-  if(newVal!=this->Internal->GCGCP)
+  if(newVal!=this->GCGCP)
     {
-      this->Internal->GCGCP=newVal;
+      this->GCGCP=newVal;
       this->Modified();
     }
 }
@@ -195,7 +196,7 @@ void vtkMEDReader::SetFileName(const char *fname)
     return;
   try
     {
-      this->Internal->FileName=fname;
+      this->FileName=fname;
       this->Modified();
     }
   catch(INTERP_KERNEL::Exception& e)
@@ -216,7 +217,7 @@ char *vtkMEDReader::GetFileName()
 {
   if (!this->Internal)
     return 0;
-  return const_cast<char *>(this->Internal->FileName.c_str());
+  return const_cast<char *>(this->FileName.c_str());
 }
 
 int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVector ** /*inputVector*/, vtkInformationVector *outputVector)
@@ -231,22 +232,25 @@ int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVect
         {
           int iPart(-1),nbOfParts(-1);
 #ifdef MEDREADER_USE_MPI
-          vtkMultiProcessController *vmpc(vtkMultiProcessController::GetGlobalController());
-          if(vmpc)
+          if (this->DistributeWithMPI)
+          {
+            vtkMultiProcessController *vmpc(vtkMultiProcessController::GetGlobalController());
+            if(vmpc)
             {
               iPart=vmpc->GetLocalProcessId();
               nbOfParts=vmpc->GetNumberOfProcesses();
             }
+          }
 #endif
-          this->Internal->Tree.loadMainStructureOfFile(this->Internal->FileName.c_str(),iPart,nbOfParts);
-          
+          this->Internal->Tree.loadMainStructureOfFile(this->FileName.c_str(),iPart,nbOfParts);
+
           // Leaves
           this->Internal->Tree.activateTheFirst();//This line manually initialize the status of server (this) with the remote client.
           for (int idLeaveArray = 0; idLeaveArray < this->Internal->Tree.getNumberOfLeavesArrays(); idLeaveArray++)
           {
             std::string name = this->Internal->Tree.getNameOf(idLeaveArray);
             bool status = this->Internal->Tree.getStatusOf(idLeaveArray);
-            this->Internal->FieldSelection->AddArray(name.c_str(), status);
+            this->FieldSelection->AddArray(name.c_str(), status);
           }
         }
 
@@ -257,24 +261,24 @@ int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVect
       {
         std::string name = timeFlagsArray[idTimeFlag].second;
         bool status = timeFlagsArray[idTimeFlag].first;
-        this->Internal->TimeFlagSelection->AddArray(name.c_str(), status);
+        this->TimeFlagSelection->AddArray(name.c_str(), status);
       }
 
       // Make sure internal model are synchronized
       /// So the SIL is up to date
-      int nArrays = this->Internal->FieldSelection->GetNumberOfArrays();
+      int nArrays = this->FieldSelection->GetNumberOfArrays();
       for(int i = nArrays - 1; i >= 0; i--)
       {
         try
         {
         this->Internal->Tree.changeStatusOfAndUpdateToHaveCoherentVTKDataSet(
-          this->Internal->Tree.getIdHavingZeName(this->Internal->FieldSelection->GetArrayName(i)),
-          this->Internal->FieldSelection->GetArraySetting(i));
+          this->Internal->Tree.getIdHavingZeName(this->FieldSelection->GetArrayName(i)),
+          this->FieldSelection->GetArraySetting(i));
         }
         catch(INTERP_KERNEL::Exception& e)
         {
           // Remove the incorrect array
-          this->Internal->FieldSelection->RemoveArrayByIndex(i);
+          this->FieldSelection->RemoveArrayByIndex(i);
         }
       }
 
@@ -311,22 +315,22 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector ** /
     return 0;
   try
   {
-      for(int i = 0; i < this->Internal->FieldSelection->GetNumberOfArrays(); i++)
+      for(int i = 0; i < this->FieldSelection->GetNumberOfArrays(); i++)
       {
         this->Internal->Tree.changeStatusOfAndUpdateToHaveCoherentVTKDataSet(
-          this->Internal->Tree.getIdHavingZeName(this->Internal->FieldSelection->GetArrayName(i)), 
-          this->Internal->FieldSelection->GetArraySetting(i));
+          this->Internal->Tree.getIdHavingZeName(this->FieldSelection->GetArrayName(i)),
+          this->FieldSelection->GetArraySetting(i));
       }
-          
+
       auto& timeFlagsArray = this->Internal->TK.getTimesFlagArray();
-      if (timeFlagsArray.size() != this->Internal->TimeFlagSelection->GetNumberOfArrays())
+      if (timeFlagsArray.size() != this->TimeFlagSelection->GetNumberOfArrays())
       {
         throw INTERP_KERNEL::Exception("Unexpected size of TimeFlagSelection");
       }
-      for(int i = 0; i < this->Internal->TimeFlagSelection->GetNumberOfArrays(); i++)
+      for(int i = 0; i < this->TimeFlagSelection->GetNumberOfArrays(); i++)
       {
-        timeFlagsArray[i] = std::make_pair(this->Internal->TimeFlagSelection->GetArraySetting(i), 
-          this->Internal->TimeFlagSelection->GetArrayName(i));
+        timeFlagsArray[i] = std::make_pair(this->TimeFlagSelection->GetArraySetting(i),
+          this->TimeFlagSelection->GetArrayName(i));
       }
 
 //      request->Print(cout);
@@ -340,26 +344,22 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector ** /
 #ifndef MEDREADER_USE_MPI
       this->FillMultiBlockDataSetInstance(output,reqTS,&ti);
 #else
-      int nbParts(0);
-      vtkMultiProcessController *vmpc(vtkMultiProcessController::GetGlobalController());
-      if( vmpc )
-        nbParts = vmpc->GetNumberOfProcesses();
-      if(this->Internal->GCGCP && nbParts>1)
-      {
-        vtkSmartPointer<vtkGhostCellsGenerator> gcg(vtkSmartPointer<vtkGhostCellsGenerator>::New());
-        {
-          vtkDataSet *ret(RetrieveDataSetAtTime(reqTS,&ti));
-          gcg->SetInputData(ret);
-          ret->Delete();
-        }
-        // To be checked
-        // gcg->SetUseGlobalPointIds(true);
-        gcg->SetBuildIfRequired(false);
-        gcg->Update();
-        output->SetBlock(0,gcg->GetOutput());
-      }
+      if (this->DistributeWithMPI && this->GCGCP)
+       {
+         vtkSmartPointer<vtkGhostCellsGenerator> gcg(vtkSmartPointer<vtkGhostCellsGenerator>::New());
+         {
+           vtkDataSet *ret(RetrieveDataSetAtTime(reqTS,&ti));
+           gcg->SetInputData(ret);
+           ret->Delete();
+         }
+          // To be checked
+         // gcg->SetUseGlobalPointIds(true);
+         gcg->SetBuildIfRequired(false);
+         gcg->Update();
+         output->SetBlock(0,gcg->GetOutput());
+       }
       else
-        this->FillMultiBlockDataSetInstance(output,reqTS,&ti);
+       this->FillMultiBlockDataSetInstance(output,reqTS,&ti);
 #endif
       if(!ti.empty())
         {
@@ -382,19 +382,19 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector ** /
 //------------------------------------------------------------------------------
 int vtkMEDReader::GetNumberOfFieldsTreeArrays()
 {
-  return this->Internal->FieldSelection->GetNumberOfArrays();
+  return this->FieldSelection->GetNumberOfArrays();
 }
 
 //------------------------------------------------------------------------------
 const char* vtkMEDReader::GetFieldsTreeArrayName(int index)
 {
-  return this->Internal->FieldSelection->GetArrayName(index);
+  return this->FieldSelection->GetArrayName(index);
 }
 
 //------------------------------------------------------------------------------
 int vtkMEDReader::GetFieldsTreeArrayStatus(const char* name)
 {
-  return this->Internal->FieldSelection->ArrayIsEnabled(name);
+  return this->FieldSelection->ArrayIsEnabled(name);
 }
 
 //------------------------------------------------------------------------------
@@ -404,11 +404,11 @@ void vtkMEDReader::SetFieldsStatus(const char* name, int status)
   {
     if (status)
     {
-      this->Internal->FieldSelection->EnableArray(name);
+      this->FieldSelection->EnableArray(name);
     }
     else
     {
-      this->Internal->FieldSelection->DisableArray(name);
+      this->FieldSelection->DisableArray(name);
     }
     this->Modified();
   }
@@ -417,19 +417,19 @@ void vtkMEDReader::SetFieldsStatus(const char* name, int status)
 //------------------------------------------------------------------------------
 int vtkMEDReader::GetNumberOfTimesFlagsArrays()
 {
-  return this->Internal->TimeFlagSelection->GetNumberOfArrays();
+  return this->TimeFlagSelection->GetNumberOfArrays();
 }
 
 //------------------------------------------------------------------------------
 const char* vtkMEDReader::GetTimesFlagsArrayName(int index)
 {
-  return this->Internal->TimeFlagSelection->GetArrayName(index);
+  return this->TimeFlagSelection->GetArrayName(index);
 }
 
 //------------------------------------------------------------------------------
 int vtkMEDReader::GetTimesFlagsArrayStatus(const char* name)
 {
-  return this->Internal->TimeFlagSelection->ArrayIsEnabled(name);
+  return this->TimeFlagSelection->ArrayIsEnabled(name);
 }
 
 //------------------------------------------------------------------------------
@@ -439,11 +439,11 @@ void vtkMEDReader::SetTimesFlagsStatus(const char* name, int status)
   {
     if (status)
     {
-      this->Internal->TimeFlagSelection->EnableArray(name);
+      this->TimeFlagSelection->EnableArray(name);
     }
     else
     {
-      this->Internal->TimeFlagSelection->DisableArray(name);
+      this->TimeFlagSelection->DisableArray(name);
     }
     this->Modified();
   }
@@ -513,7 +513,7 @@ double vtkMEDReader::PublishTimeStepsIfNeeded(vtkInformation *outInfo, bool& isU
 
   int lev0(-1);
   std::vector<double> tsteps;
-  if(!this->Internal->IsStdOrMode)
+  if(!this->IsStdOrMode)
     tsteps=this->Internal->Tree.getTimeSteps(lev0,this->Internal->TK);
   else
     { tsteps.resize(1); tsteps[0]=0.; }
@@ -545,8 +545,8 @@ vtkDataSet *vtkMEDReader::RetrieveDataSetAtTime(double reqTS, ExportedTinyInfo *
   if( !this->Internal )
     return 0;
   std::string meshName;
-  vtkDataSet *ret(this->Internal->Tree.buildVTKInstance(this->Internal->IsStdOrMode,reqTS,meshName,this->Internal->TK,internalInfo));
-  if(this->Internal->GenerateVect)
+  vtkDataSet *ret(this->Internal->Tree.buildVTKInstance(this->IsStdOrMode,reqTS,meshName,this->Internal->TK,internalInfo));
+  if(this->GenerateVect)
     {
       vtkGenerateVectors::Operate(ret->GetPointData());
       vtkGenerateVectors::Operate(ret->GetCellData());
old mode 100644 (file)
new mode 100755 (executable)
index 40d3a4a..3d76bee
@@ -25,7 +25,9 @@
 
 #include "vtkMultiBlockDataSetAlgorithm.h"
 #include "vtkInformationGaussDoubleVectorKey.h"
+#include "vtkNew.h"
 
+class vtkDataArraySelection;
 class vtkDataSet;
 class vtkMutableDirectedGraph;
 class vtkInformationDataObjectMetaDataKey;
@@ -60,8 +62,13 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
 
   // Description
   // Reload will delete the internal reader and recreate it with default properties
+  // As well as reset public properties to their default values, except for the FileName
   virtual void Reload();
 
+  // Description
+  // ReloadInternals will delete the internal reader and recreate it
+  virtual void ReloadInternals();
+
   virtual void GenerateVectors(int);
   virtual void ChangeMode(int);
   virtual void GhostCellGeneratorCallForPara(int);
@@ -72,6 +79,12 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
   static vtkInformationDataObjectMetaDataKey* META_DATA();
   static vtkInformationGaussDoubleVectorKey* GAUSS_DATA();
 
+  // Description
+  // Control if MPI should be used for distribution when using a distributed server
+  // Only has an effect if MEDREADER_USE_MPI is defined.
+  vtkSetMacro(DistributeWithMPI, bool);
+  vtkGetMacro(DistributeWithMPI, bool);
+
  protected:
   vtkMEDReader();
   virtual ~vtkMEDReader();
@@ -88,6 +101,16 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
 
   class vtkMEDReaderInternal;
   vtkMEDReaderInternal* Internal;
+
+  vtkNew<vtkDataArraySelection> FieldSelection;
+  vtkNew<vtkDataArraySelection> TimeFlagSelection;
+  std::string FileName;
+  //when false -> std, true -> mode. By default std (false).
+  bool IsStdOrMode = false;
+  //when false -> do nothing. When true cut off or extend to nbOfCompo=3 vector arrays.
+  bool GenerateVect = false;
+  bool GCGCP = true;
+  bool DistributeWithMPI = true;
 };
 
 #endif //__vtkMEDReader_h_
index 346d0e80fd801a0cd3a6c70640cebe531226de87..b1522a2dc076ab102337a0a4c552085b264bcf4d 100644 (file)
@@ -1,6 +1,6 @@
 <ServerManagerConfiguration>
-  <ProxyGroup name="sources">
-    <SourceProxy name="MEDReader" class="vtkMEDReader" label="MED Reader">
+  <ProxyGroup name="internal_sources">
+    <SourceProxy name="MEDReaderInternal" class="vtkMEDReader">
 
       <Hints>
        <ReaderFactory extensions="med rmed"
 
    </SourceProxy>
   </ProxyGroup>
+  <ProxyGroup name="sources">
+
+   <SourceProxy class="vtkFileSeriesGroupReader"
+                 file_name_method="SetFileName"
+                 label="MED Reader"
+                 name="MEDReader"
+                 si_class="vtkSIMetaReaderProxy">
+      <SubProxy>
+        <Proxy name="Reader"
+               proxygroup="internal_sources"
+               proxyname="MEDReaderInternal"></Proxy>
+        <ExposedProperties>
+          <Property name="Reload" />
+          <Property name="FieldsTreeInfo" />
+          <Property name="FieldsStatus" />
+          <Property name="VectorsProperty" />
+          <Property name="Separator" />
+          <Property name="TimeModeProperty" />
+          <Property name="TimesFlagsInfo" />
+          <Property name="TimesFlagsStatus" />
+          <Property name="GhostCellGeneratorCallForPara" />
+        </ExposedProperties>
+      </SubProxy>
+      <StringVectorProperty animateable="0"
+                            clean_command="RemoveAllFileNames"
+                            command="AddFileName"
+                            name="FileNames"
+                            number_of_elements="0"
+                            panel_visibility="never"
+                            repeat_command="1">
+        <FileListDomain name="files" />
+        <Documentation>The list of files to be read by the 
+        reader.</Documentation>
+      </StringVectorProperty>
+      <DoubleVectorProperty
+          information_only="1"
+          name="TimestepValues"
+          repeatable="1">
+        <TimeStepsInformationHelper />
+      </DoubleVectorProperty>
+
+      <Hints>
+             <ReaderFactory extensions="med rmed"
+                                  file_description="MED Files">
+        </ReaderFactory>
+      </Hints>
+   </SourceProxy>
+  </ProxyGroup>
 
   <ProxyGroup name="filters">
     <SourceProxy name="ExtractGroup" class="vtkExtractGroup" label="Extract Group">
index 8877886977e5e6d4626848a2e1ab73c1ce366605..9b73133b72b8b8054f76adbbd7b74a353afcbaa9 100644 (file)
@@ -41,7 +41,7 @@ ROSETTE = True
 
 print ("**** Importing MED file")
 
-myResult0 = MEDReader(FileName=MEDFILE)
+myResult0 = MEDReader(FileNames=[MEDFILE])
 if myResult0 is None : raise "Erreur de fichier MED"
 
 # Imposition GenerateVectors à faire
index cf10cf4680f706a174538fa6885005a9e64361e1..0428411976e0dd12d1043c9efd80ff1ed809902b 100644 (file)
@@ -88,20 +88,20 @@ def test0(baseline_file):
     fname = GenerateCase()
     ################### MED write is done -> Go to MEDReader
 
-    myMedReader=MEDReader(FileName=fname)
+    myMedReader=MEDReader(FileNames=[fname])
 
-    myMedReader.AllArrays = ['TS0/mesh/ComSup0/SolutionDEPL@@][@@P1', 'NotAValidName']
+    myMedReader.FieldsStatus = ['TS0/mesh/ComSup0/SolutionDEPL@@][@@P1', 'NotAValidName']
     myMedReader.UpdatePipeline()
-    myMedReader.AllArrays = ['TS0/mesh/ComSup0/SolutionDEPL@@][@@P1', 'TS0/mesh/ComSup0/SolutionSIEF_ELGA@@][@@GAUSS', 'TS0/mesh/ComSup0/SolutionSIEQ_ELNO@@][@@GSSNE', 'TS0/mesh/ComSup0/mesh@@][@@P0']
+    myMedReader.FieldsStatus = ['TS0/mesh/ComSup0/SolutionDEPL@@][@@P1', 'TS0/mesh/ComSup0/SolutionSIEF_ELGA@@][@@GAUSS', 'TS0/mesh/ComSup0/SolutionSIEQ_ELNO@@][@@GSSNE', 'TS0/mesh/ComSup0/mesh@@][@@P0']
     myMedReader.UpdatePipeline()
-    assert(myMedReader.CellData.GetNumberOfArrays()==4)
+    assert(myMedReader.CellData.GetNumberOfArrays()==5) # vtkGhostType
 
     keys=myMedReader.GetProperty("FieldsTreeInfo")[::2]
     # list all the names of arrays that can be seen (including their spatial discretization)
     arr_name_with_dis=[elt.split("/")[-1] for elt in keys]
     # list all the names of arrays (Equal to those in the MED File)
     arr_name=[elt.split(myMedReader.GetProperty("Separator").GetData())[0] for elt in arr_name_with_dis]
-    myMedReader.AllArrays=keys
+    myMedReader.FieldsStatus=keys
 
     if '-D' not in sys.argv:
         RenderView1 = GetRenderView()
index e87b54294ea2a89a5422799a3638251c3a8f9f95..5d9fcb6e622c7e82bf2049e9ecfef983e14ca42e 100644 (file)
@@ -63,14 +63,14 @@ def GenerateCase():
 def test(baseline_file):
   fname = GenerateCase()
   ################### MED write is done -> Go to MEDReader
-  myMedReader=MEDReader(FileName=fname)
+  myMedReader=MEDReader(FileNames=[fname])
   keys=myMedReader.GetProperty("FieldsTreeInfo")[::2]
   # list all the names of arrays that can be seen (including their spatial discretization)
   arr_name_with_dis=[elt.split("/")[-1] for elt in keys]
   # list all the names of arrays (Equal to those in the MED File)
   arr_name=[elt.split(myMedReader.GetProperty("Separator").GetData())[0] for elt in arr_name_with_dis]
-  myMedReader.AllArrays=keys
-  myMedReader.GenerateVectors=1
+  myMedReader.FieldsStatus=keys
+  myMedReader.VectorsProperty=1
 
   if '-D' not in sys.argv:
     RenderView1=GetRenderView()
@@ -89,7 +89,8 @@ def test(baseline_file):
     wbv=WarpByVector(Input=myMedReader)
     wbv.ScaleFactor=0.1
     wbv.Vectors=['POINTS','f3NbComp4_Vector']
-    assert(list(wbv.PointData.keys())==['f0NbComp1','f1NbComp2','f1NbComp2_Vector','f2NbComp3','f3NbComp4','f3NbComp4_Vector'])
+    print( list(wbv.PointData.keys()) )
+    assert(list(wbv.PointData.keys())==['f0NbComp1','f1NbComp2','f1NbComp2_Vector','f2NbComp3','f3NbComp4','f3NbComp4_Vector','vtkGhostType'])
     #
     DataRepresentation2 = Show()
     DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483]
index 0fbc7015fa2347faa57c21af1fcb57dd28967090..9285d5e9f20e71e6babb174bce5eaf1017b67572 100644 (file)
@@ -47,10 +47,10 @@ def GenerateCase():
 def test(baseline_file):
   fname = GenerateCase()
   ################### MED write is done -> Go to MEDReader
-  testMEDReader13_med = MEDReader( FileName=fname )
+  testMEDReader13_med = MEDReader( FileNames=[fname] )
 
-  testMEDReader13_med.GenerateVectors = 1
-  testMEDReader13_med.AllArrays = ['TS0/mesh/ComSup0/fieldELNO@@][@@GSSNE']
+  testMEDReader13_med.VectorsProperty = 1
+  testMEDReader13_med.FieldsStatus = ['TS0/mesh/ComSup0/fieldELNO@@][@@GSSNE']
 
   if '-D' not in sys.argv:
     RenderView1 = GetRenderView()
index 1c2fe502fee1a08d61dde8032f036edeff4b81f8..7bc42ffcc5d323215bc57e20df6b45e1230d820b 100644 (file)
@@ -131,15 +131,15 @@ def GenerateCase():
 @WriteInTmpDir
 def test(baseline_file):
     fname = GenerateCase()
-    reader=MEDReader(FileName=fname)
+    reader=MEDReader(FileNames=[fname])
     ExpectedEntries=['TS0/Mesh/ComSup0/zeField0_MM0@@][@@GAUSS', 'TS0/Mesh/ComSup1/zeField0_MM1@@][@@GAUSS', 'TS0/Mesh/ComSup2/zeField0_MM2@@][@@GAUSS', 'TS0/Mesh/ComSup2/zeField1_MM0@@][@@GAUSS', 'TS0/Mesh/ComSup3/zeField1_MM1@@][@@GAUSS', 'TS0/Mesh/ComSup4/zeField2@@][@@P1', 'TS1/Mesh/ComSup0/Mesh@@][@@P0']
     assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries)
 
     if '-D' not in sys.argv:
         renderView1=GetActiveViewOrCreate('RenderView')
         for entry in [[ExpectedEntries[0]],[ExpectedEntries[1]],[ExpectedEntries[2],ExpectedEntries[3]],[ExpectedEntries[4]]]:
-            reader=MEDReader(FileName=fname)
-            reader.AllArrays=entry
+            reader=MEDReader(FileNames=[fname])
+            reader.FieldsStatus=entry
             gaussPoints=ELGAfieldToPointGaussian(Input=reader)
             gaussPoints.SelectSourceArray=['CELLS', 'ELGA@0']
             Show(gaussPoints,renderView1)
@@ -147,8 +147,8 @@ def test(baseline_file):
 
         #
 
-        readerNodeField=MEDReader(FileName=fname)
-        readerNodeField.AllArrays=[ExpectedEntries[5]]
+        readerNodeField=MEDReader(FileNames=[fname])
+        readerNodeField.FieldsStatus=[ExpectedEntries[5]]
         nodeFieldDisplay=Show(readerNodeField,renderView1)
         ColorBy(nodeFieldDisplay,('POINTS','zeField2'))
         nodeFieldDisplay.RescaleTransferFunctionToDataRange(True)
index 7aa2a922934c58aaa8d2e88900abee4ed831d928..33fb7d1079a8b684d2f720c18815ea7c5cc516bd 100644 (file)
@@ -51,7 +51,7 @@ def GenerateCase():
 @WriteInTmpDir
 def test(baseline_file):
   fname = GenerateCase()
-  reader=MEDReader(FileName=fname)
+  reader=MEDReader(FileNames=[fname])
   ExpectedEntries=['TS0/zeName/ComSup0/zeName@@][@@P1','TS0/zeName/ComSup0/MESH@zeName@@][@@P1']
   assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries)
 
index 906bdf241f3cb96e3bb1edb3fb2f20647d944a8d..a497dadf3204948a710d665c0e72d2617ec03a61 100644 (file)
@@ -51,10 +51,10 @@ def GenerateCase():
 def test():
     fname,arr2 = GenerateCase()
     #
-    reader=MEDReader(FileName=fname)
+    reader=MEDReader(FileNames=[fname])
     ExpectedEntries=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE','TS1/Mesh/ComSup0/Mesh@@][@@P0']
     assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries)
-    reader.AllArrays=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE']
+    reader.FieldsStatus=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE']
     ExtractGroup1 = ExtractGroup(Input=reader)
     #ExtractGroup1.UpdatePipelineInformation()
     ExtractGroup1.AllGroups=["GRP_grp1"]
index 58e533c74b5ccae006fe432da681fab6d518b1ab..d964583b2af8f5b69cc563cdce22f23dff7fddb5 100644 (file)
@@ -50,10 +50,10 @@ def GenerateCase():
 def test():
     fname = GenerateCase()
     #
-    reader=MEDReader(FileName=fname)
+    reader=MEDReader(FileNames=[fname])
     ExpectedEntries=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE','TS1/Mesh/ComSup0/Mesh@@][@@P0']
     assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries)
-    reader.AllArrays=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE']
+    reader.FieldsStatus=['TS0/Mesh/ComSup0/MyField@@][@@GSSNE']
     ExtractGroup1 = ExtractGroup(Input=reader)
     #ExtractGroup1.UpdatePipelineInformation()
     ExtractGroup1.AllGroups=["GRP_grp1"]
index 8154814844d40aad42cfeabc70944ed62f978bfb..58839809483220387911e3cf6ffbd58511a8158d 100644 (file)
@@ -48,8 +48,8 @@ def GenerateCase():
 @WriteInTmpDir
 def test():
   fname = GenerateCase()
-  reader=MEDReader(FileName=fname)
-  reader.AllArrays=['TS0/mesh/ComSup0/mesh@@][@@P0']
+  reader=MEDReader(FileNames=[fname])
+  reader.FieldsStatus=['TS0/mesh/ComSup0/mesh@@][@@P0']
   ExtractGroup1 = ExtractGroup(Input=reader)
   ExtractGroup1.AllGroups=["GRP_grp0","GRP_grp1"]
   #ExtractGroup1.UpdatePipelineInformation()
index f0246d404c332bdb40c925fba920cb07b2cc7a69..7003e439a0656c86e6cb750400ddef33e264cccc 100644 (file)
@@ -55,11 +55,11 @@ def GenerateCase():
 def test(baseline_file):
     fname = GenerateCase()
     # create a new 'MED Reader'
-    testMEDReader19med = MEDReader(FileName=fname)
-    testMEDReader19med.AllArrays = ['TS0/mesh/ComSup0/mesh@@][@@P0']
-    testMEDReader19med.AllTimeSteps = ['0000']
+    testMEDReader19med = MEDReader(FileNames=[fname])
+    testMEDReader19med.FieldsStatus = ['TS0/mesh/ComSup0/mesh@@][@@P0']
+    testMEDReader19med.TimesFlagsStatus = ['0000']
     # Properties modified on testMEDReader19med
-    testMEDReader19med.AllArrays = ['TS0/mesh/ComSup0/mesh@@][@@P0']
+    testMEDReader19med.FieldsStatus = ['TS0/mesh/ComSup0/mesh@@][@@P0']
 
     if '-D' not in sys.argv:
         # get active view
index fd9ac4994ee963a0c767474922b193684b3dbfb8..b52709dbca7536595d2c9800a2ebb525c968f151 100644 (file)
@@ -62,10 +62,10 @@ def GenerateCase():
 def test(baseline_file):
   fname = GenerateCase()
   ################### MED write is done -> Go to MEDReader
-  testMEDReader1=MEDReader(FileName=fname,registrationName='testMEDReader2.med')
-  testMEDReader1.AllArrays=['TS0/mesh/ComSup0/ACellField@@][@@P0']
-  testMEDReader2=MEDReader(FileName=fname,registrationName='testMEDReader2_bis.med')
-  testMEDReader2.AllArrays=['TS0/mesh/ComSup1/mesh@@][@@P0']
+  testMEDReader1=MEDReader(FileNames=[fname],registrationName='testMEDReader2.med')
+  testMEDReader1.FieldsStatus=['TS0/mesh/ComSup0/ACellField@@][@@P0']
+  testMEDReader2=MEDReader(FileNames=[fname],registrationName='testMEDReader2_bis.med')
+  testMEDReader2.FieldsStatus=['TS0/mesh/ComSup1/mesh@@][@@P0']
   GroupDatasets1=GroupDatasets(Input=[testMEDReader1,testMEDReader2])
   #GroupDatasets1.BlockNames = ['testMEDReader2.med', 'testMEDReader2_bis.med']
 
index 2e399fbdd98efd36b53431713095d744eb0c3847..d28b5f7ba886805fc11496f641f57ccc5a4be302 100644 (file)
@@ -74,9 +74,9 @@ def test(baseline_file):
     fname = GenerateCase()
     #####################
     # create a new 'MED Reader'
-    testMEDReader20med = MEDReader(FileName=fname)
-    testMEDReader20med.AllArrays = ['TS0/mesh/ComSup0/Field@@][@@P0']
-    testMEDReader20med.AllTimeSteps = ['0000', '0001', '0002', '0003', '0004']
+    testMEDReader20med = MEDReader(FileNames=[fname])
+    testMEDReader20med.FieldsStatus = ['TS0/mesh/ComSup0/Field@@][@@P0']
+    testMEDReader20med.TimesFlagsStatus = ['0000', '0001', '0002', '0003', '0004']
 
     # get animation scene
     animationScene1 = GetAnimationScene()
index a9bf46405c103a45277bc1ee42a2143ea743050c..6dc53a5f3d91c2f04cad7668ab92a24f3a4516c1 100644 (file)
@@ -48,9 +48,9 @@ def GenerateCase():
 def test(baseline_file):
   fname, meshName, fieldName = GenerateCase()
   ########
-  testTotomed = MEDReader(FileName=fname)
-  testTotomed.AllArrays = ['TS0/%s/ComSup0/%s@@][@@GSSNE'%(meshName,fieldName)]
-  testTotomed.AllTimeSteps = ['0000']
+  testTotomed = MEDReader(FileNames=[fname])
+  testTotomed.FieldsStatus = ['TS0/%s/ComSup0/%s@@][@@GSSNE'%(meshName,fieldName)]
+  testTotomed.TimesFlagsStatus = ['0000']
 
   if '-D' not in sys.argv:
     # get active view
index 77964463c0c4a0ae8aa5425b6db0f5354425e373..d3ea9855b3cb3dc7077f981b26da2efeeafceae9 100644 (file)
@@ -66,9 +66,9 @@ def generateCase(fname):
 def test():
     fname = "testMEDReader22.med"
     f,f2,grp_BottomLeft,grp_BottomRight,grp_TopLeft,grp_TopRight = generateCase(fname)
-    reader = MEDReader(FileName=fname)
-    reader.AllArrays = ['TS0/mesh/ComSup0/field@@][@@P0','TS0/mesh/ComSup0/field2@@][@@P1','TS0/mesh/ComSup0/mesh@@][@@P0']
-    reader.AllTimeSteps = ['0000']
+    reader = MEDReader(FileNames=[fname])
+    reader.FieldsStatus = ['TS0/mesh/ComSup0/field@@][@@P0','TS0/mesh/ComSup0/field2@@][@@P1','TS0/mesh/ComSup0/mesh@@][@@P0']
+    reader.TimesFlagsStatus = ['0000']
 
     groupsNames = GroupsNames(Input=reader)
     groupsNames.UpdatePipeline()
@@ -88,7 +88,7 @@ def test():
     ds_bl = blocks.GetBlock(0)
     MyAssert(ds_bl.GetNumberOfCells()==4)
     bl_ref_conn = np.array([ 1,  0,  6,  7,  2,  1,  7,  8,  7,  6, 12, 13,  8,  7, 13, 14],dtype=np.int32)
-    MyAssert(ds_bl.GetCellData().GetNumberOfArrays() == 3 )# 3 for field, mesh and FamilyIdCell
+    MyAssert(ds_bl.GetCellData().GetNumberOfArrays() == 4 )# 3 for field, mesh and FamilyIdCell +1 for vtkGhostType
     MyAssert(np.all( bl_ref_conn == numpy_support.vtk_to_numpy( ds_bl.GetCells().GetConnectivityArray() )) )
     MyAssert( mc.DataArrayDouble(numpy_support.vtk_to_numpy( ds_bl.GetCellData().GetArray("field") )).isEqual(f.getArray()[grp_BottomLeft],1e-12) )
     # test of bottom right
@@ -111,7 +111,7 @@ def test():
     MyAssert( mc.DataArrayDouble(numpy_support.vtk_to_numpy( ds_tr.GetCellData().GetArray("field") )).isEqual(f.getArray()[grp_TopRight],1e-12) )
     #
     for ds in [ds_bl,ds_br,ds_tl,ds_tr]:
-        MyAssert(ds.GetPointData().GetNumberOfArrays() == 1 )# 1 for field2
+        MyAssert(ds.GetPointData().GetNumberOfArrays() == 2 )# 1 for field2 + vtkGhostType
         MyAssert(ds.GetNumberOfPoints()==36) # for performance reasons all blocks share the same input coordinates
         MyAssert(mc.DataArrayDouble( numpy_support.vtk_to_numpy( ds.GetPointData().GetArray("field2") ) ).isEqual(f2.getArray(),1e-12) )
 
index d3cf0f7a960108c40efbc36581940b094b66e1b2..95b4f02e55d99290ce3e3057b2151e14ff61edc5 100644 (file)
@@ -45,11 +45,11 @@ def generateCase(fname,globalNodeIds,coordinates):
   mm.write(fname,2)
 
 generateCase(fname,ids,coo)
-myMedReader = MEDReader(registrationName = fname, FileName = fname)
-myMedReader.AllArrays = ['TS0/mesh/ComSup0/mesh@@][@@P0']
+myMedReader = MEDReader(registrationName = fname, FileNames = [fname])
+myMedReader.FieldsStatus = ['TS0/mesh/ComSup0/mesh@@][@@P0']
 myMedReader.UpdatePipeline()
 # first important testing here
-MyAssert(   [myMedReader.PointData.GetArray(i).GetName() for i in range(myMedReader.PointData.GetNumberOfArrays())] == ['GlobalNodeIds']    )
+MyAssert(   [myMedReader.PointData.GetArray(i).GetName() for i in range(myMedReader.PointData.GetNumberOfArrays())] == ['GlobalNodeIds','vtkGhostType']    )
 ReadUnstructuredGrid = servermanager.Fetch(myMedReader).GetBlock(0)
 numpy_support.vtk_to_numpy( ReadUnstructuredGrid.GetPointData().GetArray('GlobalNodeIds') )
 # check match of coordinates written in testMEDReader23.med file and its representation
index 857603fccf46a6699540b1996716945bea97b57f..f0d101944b8d290ce3d6527f364230eb1b35ec91 100644 (file)
@@ -137,12 +137,12 @@ fs.write(fname,0)
 
 from paraview.simple import *
 
-testMEDReader24_med = MEDReader( FileName=fname )
-testMEDReader24_med.AllArrays = ['TS0/Maillage_THYC/ComSup0/ENERGIE RECUE@@][@@P0', 'TS0/Maillage_THYC/ComSup0/ENTHALPIE@@][@@P0', 'TS0/Maillage_THYC/ComSup0/PRESSION@@][@@P0', 'TS0/Maillage_THYC/ComSup0/TEMPERATURE@@][@@P0']
+testMEDReader24_med = MEDReader( FileNames=[fname] )
+testMEDReader24_med.FieldsStatus = ['TS0/Maillage_THYC/ComSup0/ENERGIE RECUE@@][@@P0', 'TS0/Maillage_THYC/ComSup0/ENTHALPIE@@][@@P0', 'TS0/Maillage_THYC/ComSup0/PRESSION@@][@@P0', 'TS0/Maillage_THYC/ComSup0/TEMPERATURE@@][@@P0']
 testMEDReader24_med.UpdatePipeline()
 ds0 = servermanager.Fetch(testMEDReader24_med).GetBlock(0)
 assert( ds0.GetNumberOfCells() == 224 )
-testMEDReader24_med.AllArrays = ['TS2/Maillage_THYC/ComSup0/Maillage_THYC@@][@@P0'] # test  is here. A rectilinear dataset is expected here
+testMEDReader24_med.FieldsStatus = ['TS2/Maillage_THYC/ComSup0/Maillage_THYC@@][@@P0'] # test  is here. A rectilinear dataset is expected here
 testMEDReader24_med.UpdatePipeline()
 ds0 = servermanager.Fetch(testMEDReader24_med).GetBlock(0)
 assert( ds0.GetNumberOfCells() == 256 ) # test is here 0 means problem in the management of rectilineargrid into MEDReader
index b1bb65ca834ecd9dafdb70639564bd1fd5c613c6..66631c1a444ea049630b996eee590db689392b23 100644 (file)
@@ -94,8 +94,8 @@ def test(baseline_file):
   AnimationScene1.AnimationTime = 1.0
   AnimationScene1.StartTime = 1.0
 
-  testMEDReader3=MEDReader(FileName=fname)
-  testMEDReader3.AllArrays=['TS0/mesh/ComSup0/ANodeField@@][@@P1']
+  testMEDReader3=MEDReader(FileNames=[fname])
+  testMEDReader3.FieldsStatus=['TS0/mesh/ComSup0/ANodeField@@][@@P1']
 
   assert(list(testMEDReader3.TimestepValues)==[1.,2.,3.,4.,5.]) ## <- the test is here - double time steps are too big use dt.
 
index 2124a0047d13b70a73454ad987d233d2d4ad88fb..59da6cfde467ed5068712284967d2578da331d9c 100644 (file)
@@ -71,9 +71,9 @@ def test(baseline_file):
 ################### MED write is done -> Go to MEDReader
   fname = GenerateCase()
 
-  testMEDReader4_med=MEDReader(FileName=fname)
+  testMEDReader4_med=MEDReader(FileNames=[fname])
 
-  testMEDReader4_med.AllArrays=['TS0/mesh/ComSup0/f0NoPfl@@][@@P1','TS0/mesh/ComSup0/mesh@@][@@P1']
+  testMEDReader4_med.FieldsStatus=['TS0/mesh/ComSup0/f0NoPfl@@][@@P1','TS0/mesh/ComSup0/mesh@@][@@P1']
   #testMEDReader4_med.AllTimeSteps=['0000']
 
   Glyph1=Glyph(Input=testMEDReader4_med,GlyphType='Sphere')
index e0212f79c7dd1a0050af013e2cd1cf05c66aefdf..261b2029c8c676ec1e58250401c7d0d920b240f5 100644 (file)
@@ -65,9 +65,9 @@ def test(baseline_file):
     fname = GenerateCase()
     ################### MED write is done -> Go to MEDReader
 
-    myMedReader=MEDReader(FileName=fname)
-    myMedReader.AllArrays = ['TS0/mesh/ComSup0/fGauss@@][@@GAUSS']
-    myMedReader.AllTimeSteps = ['0000']
+    myMedReader=MEDReader(FileNames=[fname])
+    myMedReader.FieldsStatus = ['TS0/mesh/ComSup0/fGauss@@][@@GAUSS']
+    myMedReader.TimesFlagsStatus = ['0000']
 
     ExtractGroup1 = ExtractGroup(Input=myMedReader)
     ExtractGroup1.UpdatePipelineInformation()
index 35fbf6425f3f64890544d8f91f21bf9664dba507..9b3abd1762956bdd4ff01b10a643e1c5f4dc14a2 100644 (file)
@@ -75,8 +75,8 @@ def GenerateCase():
 def test(baseline_file):
     fname = GenerateCase()
     ################### MED write is done -> Go to MEDReader
-    myMedReader=MEDReader(FileName=fname)
-    myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1']
+    myMedReader=MEDReader(FileNames=[fname])
+    myMedReader.FieldsStatus = ['TS0/mesh/ComSup0/fNode@@][@@P1']
     assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.])
 
     if '-D' not in sys.argv:
index 49a8cfb025789c031b4aa69e9a3495fe7a733d85..b78da6f88299eab606db4778e3027bc06a3bdcb8 100644 (file)
@@ -74,8 +74,8 @@ def test(baseline_file):
     fname = GenerateCase()
     ################### MED write is done -> Go to MEDReader
 
-    myMedReader=MEDReader(FileName=fname)
-    myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1']
+    myMedReader=MEDReader(FileNames=[fname])
+    myMedReader.FieldsStatus = ['TS0/mesh/ComSup0/fNode@@][@@P1']
     assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.])
     myMedReader.UpdatePipeline()
 
index 1c7c49567d7291d6e9b0aac5936256608100da55..6bc16c94e32feac4b5e3c9fd762a608620cd679c 100644 (file)
@@ -47,12 +47,12 @@ def GenerateCase():
 def test():
     fname = GenerateCase()
     ################### MED write is done -> Go to MEDReader
-    myMedReader=MEDReader(FileName=fname)
-    myMedReader.AllArrays=['TS0/m1/ComSup0/f1@@][@@P0']
+    myMedReader=MEDReader(FileNames=[fname])
+    myMedReader.FieldsStatus=['TS0/m1/ComSup0/f1@@][@@P0']
     ExtractGroup1=ExtractGroup(Input=myMedReader)
     ExtractGroup1.UpdatePipeline()
     assert(ExtractGroup1.GetProperty("MeshName")[0]=="m1")
-    myMedReader.AllArrays=['TS0/m2/ComSup0/f2@@][@@P0']
+    myMedReader.FieldsStatus=['TS0/m2/ComSup0/f2@@][@@P0']
     ExtractGroup2=ExtractGroup(Input=myMedReader)
     ExtractGroup2.UpdatePipeline()
     assert(ExtractGroup2.GetProperty("MeshName")[0]=="m2")