Salome HOME
Squash kw/jira_476: new vtkMEDReader with VTK paradigm: cbr/jira_476_rebase
authorMathieu Westphal <mathieu.westphal@kitware.com>
Wed, 9 Sep 2020 13:40:21 +0000 (15:40 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Mon, 21 Jun 2021 12:52:46 +0000 (14:52 +0200)
- Missing namespace usage
- First intermediate version
- TimeKeeper first try
- Fix timestep
- cleanup
- Fix testMEDReader9
- Fixes for incorrect name
- Updating Test

src/Plugins/MEDReader/plugin/MEDReaderIO/vtkExtractGroup.cxx
src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.cxx
src/Plugins/MEDReader/plugin/MEDReaderIO/vtkMEDReader.h
src/Plugins/MEDReader/plugin/ParaViewPlugin/Resources/MEDReaderServer.xml
src/Plugins/MEDReader/plugin/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx
src/Plugins/MEDReader/plugin/Test/testMEDReader0.py
src/Plugins/MEDReader/plugin/Test/testMEDReader9.py

index a71007952fac82404f817255fa3bee5b286bab13..de611299d44f1259aa03f6b28eb160fbc8f1b306 100644 (file)
@@ -152,7 +152,7 @@ vtkDataSet *FilterFamilies(vtkSmartPointer<vtkThreshold>& thres,
   if(!da)
     return 0;
   std::string daName(da->GetName());
-  typedef MEDFileVTKTraits<mcIdType>::VtkType vtkMCIdTypeArray;
+  typedef MEDFileVTKTraits<MEDCoupling::mcIdType>::VtkType vtkMCIdTypeArray;
   vtkMCIdTypeArray *dai(vtkMCIdTypeArray::SafeDownCast(da));
   if(daName!=arrNameOfFamilyField || !dai)
     return 0;
@@ -163,7 +163,7 @@ vtkDataSet *FilterFamilies(vtkSmartPointer<vtkThreshold>& thres,
   zeSelection->SetNumberOfComponents(1);
   char *pt(new char[nbOfTuples]);
   zeSelection->SetArray(pt,nbOfTuples,0,VTK_DATA_ARRAY_DELETE);
-  const mcIdType *inPtr(dai->GetPointer(0));
+  const MEDCoupling::mcIdType *inPtr(dai->GetPointer(0));
   std::fill(pt,pt+nbOfTuples,0);
   catchAll=true; catchSmth=false;
   std::vector<bool> pt2(nbOfTuples,false);
index 65b08641314b51114d4d505933ba8b17e0c6f636..4a01e0238aebf22386b9030ab481800e968cd70d 100644 (file)
 #include "vtkGenerateVectors.h"
 #include "MEDUtilities.hxx"
 
-#include "vtkMultiBlockDataSet.h"
-#include "vtkInformation.h"
+#include "vtkCellArray.h"
+#include "vtkCellData.h"
+#include "vtkCellType.h"
 #include "vtkDataSetAttributes.h"
-#include "vtkStringArray.h"
-#include "vtkMutableDirectedGraph.h"
+#include "vtkDataArraySelection.h"
+#include "vtkDoubleArray.h"
+#include "vtkExecutive.h"
+#include "vtkInformation.h"
+#include "vtkInformationDataObjectMetaDataKey.h"
+#include "vtkInformationDoubleVectorKey.h"
+#include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
 #include "vtkInformationStringKey.h"
-//
-#include "vtkUnsignedCharArray.h"
 #include "vtkInformationVector.h"
+#include "vtkMultiBlockDataSet.h"
+#include "vtkMultiTimeStepAlgorithm.h"
+#include "vtkMutableDirectedGraph.h"
+#include "vtkObjectFactory.h"
+#include "vtkPointData.h"
+#include "vtkQuadratureSchemeDefinition.h"
 #include "vtkSmartPointer.h"
-#include "vtkVariantArray.h"
-#include "vtkExecutive.h"
 #include "vtkStreamingDemandDrivenPipeline.h"
-#include "vtkMultiTimeStepAlgorithm.h"
+#include "vtkStringArray.h"
+#include "vtkUnsignedCharArray.h"
 #include "vtkUnstructuredGrid.h"
-#include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
-#include "vtkInformationDoubleVectorKey.h"
-#include "vtkQuadratureSchemeDefinition.h"
-#include "vtkPointData.h"
-#include "vtkCellData.h"
-#include "vtkCellType.h"
-#include "vtkCellArray.h"
-#include "vtkDoubleArray.h"
-#include "vtkObjectFactory.h"
-#include "vtkInformationDataObjectMetaDataKey.h"
+#include "vtkVariantArray.h"
 
 #ifdef MEDREADER_USE_MPI
 #include "vtkMultiProcessController.h"
 #include <sstream>
 #include <algorithm>
 
-/*!
- * This class stores properties in loading state mode (pvsm) when the MED file has not been read yet.
- * The file is not read beacause FileName has not been informed yet ! So this class stores properties of vtkMEDReader instance that
- * owns it and wait the vtkMEDReader::SetFileName to apply properties afterwards.
- */
-class PropertyKeeper
-{
-public:
-  PropertyKeeper(vtkMEDReader *master):IsGVActivated(false),GVValue(0),IsCMActivated(false),CMValue(0),IsGhostActivated(false),GCGCP(1),_master(master) { }
-  void assignPropertiesIfNeeded();
-  bool arePropertiesOnTreeToSetAfter() const;
-  //
-  void pushFieldStatusEntry(const char* name, int status);
-  void pushGenerateVectorsValue(int value);
-  void pushChangeModeValue(int value);
-  void pushTimesFlagsStatusEntry(const char* name, int status);
-  void pushGhost(int value);
-protected:
-  // pool of pairs to assign in SetFieldsStatus if needed. The use case is the load using pvsm.
-  std::vector< std::pair<std::string,int> > SetFieldsStatusPairs;
-  // generate vector
-  bool IsGVActivated;
-  int GVValue;
-  // change mode
-  bool IsCMActivated;
-  int CMValue;
-  // ghost cells
-  bool IsGhostActivated;
-  int GCGCP;
-  //
-  std::vector< std::pair<std::string,int> > TimesFlagsStatusPairs;
-  vtkMEDReader *_master;
-};
-
-void PropertyKeeper::assignPropertiesIfNeeded()
-{
-  if(!this->SetFieldsStatusPairs.empty())
-    {
-      for(std::vector< std::pair<std::string,int> >::const_iterator it=this->SetFieldsStatusPairs.begin();it!=this->SetFieldsStatusPairs.end();it++)
-        _master->SetFieldsStatus((*it).first.c_str(),(*it).second);
-      this->SetFieldsStatusPairs.clear();
-    }
-  if(!this->TimesFlagsStatusPairs.empty())
-    {
-      for(std::vector< std::pair<std::string,int> >::const_iterator it=this->TimesFlagsStatusPairs.begin();it!=this->TimesFlagsStatusPairs.end();it++)
-        _master->SetTimesFlagsStatus((*it).first.c_str(),(*it).second);
-      this->TimesFlagsStatusPairs.clear();
-    }
-  if(this->IsGVActivated)
-    {
-      _master->GenerateVectors(this->GVValue);
-      this->IsGVActivated=false;
-    }
-  if(this->IsCMActivated)
-    {
-      _master->ChangeMode(this->CMValue);
-      this->IsCMActivated=false;
-    }
-  if(this->IsGhostActivated)
-    {
-      _master->GhostCellGeneratorCallForPara(this->GCGCP);
-      this->IsGhostActivated=false;
-    }
-}
-
-void PropertyKeeper::pushFieldStatusEntry(const char* name, int status)
-{
-  bool found(false);
-  for(std::vector< std::pair<std::string,int> >::const_iterator it=this->SetFieldsStatusPairs.begin();it!=this->SetFieldsStatusPairs.end() && !found;it++)
-    found=(*it).first==name;
-  if(!found)
-    this->SetFieldsStatusPairs.push_back(std::pair<std::string,int>(name,status));
-}
-
-void PropertyKeeper::pushTimesFlagsStatusEntry(const char* name, int status)
-{
-  bool found(false);
-  for(std::vector< std::pair<std::string,int> >::const_iterator it=this->TimesFlagsStatusPairs.begin();it!=this->TimesFlagsStatusPairs.end() && !found;it++)
-    found=(*it).first==name;
-  if(!found)
-    this->TimesFlagsStatusPairs.push_back(std::pair<std::string,int>(name,status));
-}
-
-void PropertyKeeper::pushGenerateVectorsValue(int value)
-{
-  this->IsGVActivated=true;
-  this->GVValue=value;
-}
-
-void PropertyKeeper::pushChangeModeValue(int value)
-{
-  this->IsCMActivated=true;
-  this->CMValue=value;
-}
-
-void PropertyKeeper::pushGhost(int value)
-{
-  this->IsGhostActivated=true;
-  this->GCGCP=value;
-}
-
-bool PropertyKeeper::arePropertiesOnTreeToSetAfter() const
-{
-  return !SetFieldsStatusPairs.empty();
-}
-
 class vtkMEDReader::vtkMEDReaderInternal
 {
 
 public:
-  vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsMEDOrSauv(true),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),PK(master),MyMTime(0),GCGCP(true),FirstCall0(2)
+  vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsMEDOrSauv(true),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),GCGCP(true)
   {
   }
 
-  bool PluginStart0()
-  {
-    return false; // TODO Useless and buggy
-    if(FirstCall0==0)
-      return false;
-    FirstCall0--;
-    return true;
-  }
-
   ~vtkMEDReaderInternal()
   {
     if(this->SIL)
@@ -191,6 +76,9 @@ public:
   }
 public:
   MEDFileFieldRepresentationTree Tree;
+  vtkNew<vtkDataArraySelection> FieldSelection;
+  vtkNew<vtkDataArraySelection> TimeFlagSelection;
+
   TimeKeeper TK;
   std::string FileName;
   //when true the file is MED file. when false it is a Sauv file
@@ -204,15 +92,7 @@ public:
   vtkMutableDirectedGraph* SIL;
   // store the lev0 id in Tree corresponding to the TIME_STEPS in the pipeline.
   int LastLev0;
-  // The property keeper is usable only in pvsm mode.
-  PropertyKeeper PK;
-  int MyMTime;
-  std::set<std::string> _wonderful_set;// this set is used by SetFieldsStatus method to detect the fact that SetFieldsStatus has been called for all items ! Great Items are not sorted ! Why ?
-  std::map<std::string,bool> _wonderful_ref;// this map stores the state before a SetFieldsStatus status.
   bool GCGCP;
-
-private:
-  unsigned char FirstCall0;
 };
 
 vtkStandardNewMacro(vtkMEDReader)
@@ -271,24 +151,11 @@ void vtkMEDReader::Reload()
   this->SetFileName(fName.c_str());
 }
 
-int vtkMEDReader::GetServerModifTime()
-{
-  if( !this->Internal )
-    return -1;
-  return this->Internal->MyMTime;
-}
-
 void vtkMEDReader::GenerateVectors(int val)
 {
   if ( !this->Internal )
     return;
   
-  if(this->Internal->FileName.empty())
-    {//pvsm mode
-      this->Internal->PK.pushGenerateVectorsValue(val);
-      return ;
-    }
-  //not pvsm mode (general case)
   bool val2((bool)val);
   if(val2!=this->Internal->GenerateVect)
     {
@@ -302,12 +169,6 @@ void vtkMEDReader::ChangeMode(int newMode)
   if ( !this->Internal )
     return;
   
-  if(this->Internal->FileName.empty())
-    {//pvsm mode
-      this->Internal->PK.pushChangeModeValue(newMode);
-      return ;
-    }
-  //not pvsm mode (general case)
   this->Internal->IsStdOrMode=newMode!=0;
   this->Modified();
 }
@@ -317,11 +178,6 @@ void vtkMEDReader::GhostCellGeneratorCallForPara(int gcgcp)
   if ( !this->Internal )
     return;
   
-  if(this->Internal->FileName.empty())
-    {//pvsm mode
-      this->Internal->PK.pushGhost(gcgcp);
-      return ;
-    }
   bool newVal(gcgcp!=0);
   if(newVal!=this->Internal->GCGCP)
     {
@@ -342,31 +198,7 @@ void vtkMEDReader::SetFileName(const char *fname)
   try
     {
       this->Internal->FileName=fname;
-      std::size_t pos(this->Internal->FileName.find_last_of('.'));
-      if(pos!=std::string::npos)
-        {
-          std::string ext(this->Internal->FileName.substr(pos));
-          if(ext.find("sauv")!=std::string::npos)
-            this->Internal->IsMEDOrSauv=false;
-        }
-      if(this->Internal->Tree.getNumberOfLeavesArrays()==0)
-        {
-          int iPart(-1),nbOfParts(-1);
-#ifdef MEDREADER_USE_MPI
-          vtkMultiProcessController *vmpc(vtkMultiProcessController::GetGlobalController());
-          if(vmpc)
-            {
-              iPart=vmpc->GetLocalProcessId();
-              nbOfParts=vmpc->GetNumberOfProcesses();
-            }
-#endif
-          this->Internal->Tree.loadMainStructureOfFile(this->Internal->FileName.c_str(),this->Internal->IsMEDOrSauv,iPart,nbOfParts);
-          if(!this->Internal->PK.arePropertiesOnTreeToSetAfter())
-            this->Internal->Tree.activateTheFirst();//This line manually initialize the status of server (this) with the remote client.
-          this->Internal->TK.setMaxNumberOfTimeSteps(this->Internal->Tree.getMaxNumberOfTimeSteps());
-        }
       this->Modified();
-      this->Internal->PK.assignPropertiesIfNeeded();
     }
   catch(INTERP_KERNEL::Exception& e)
     {
@@ -396,6 +228,65 @@ int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVect
     return 0;
   try
     {
+      // Process file meta data
+      std::size_t pos(this->Internal->FileName.find_last_of('.'));
+      if(pos!=std::string::npos)
+        {
+          std::string ext(this->Internal->FileName.substr(pos));
+          if(ext.find("sauv")!=std::string::npos)
+            this->Internal->IsMEDOrSauv=false;
+        }
+      if(this->Internal->Tree.getNumberOfLeavesArrays()==0)
+        {
+          int iPart(-1),nbOfParts(-1);
+#ifdef MEDREADER_USE_MPI
+          vtkMultiProcessController *vmpc(vtkMultiProcessController::GetGlobalController());
+          if(vmpc)
+            {
+              iPart=vmpc->GetLocalProcessId();
+              nbOfParts=vmpc->GetNumberOfProcesses();
+            }
+#endif
+          this->Internal->Tree.loadMainStructureOfFile(this->Internal->FileName.c_str(),this->Internal->IsMEDOrSauv,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);
+          }
+        }
+
+      // Time flags
+      this->Internal->TK.setMaxNumberOfTimeSteps(this->Internal->Tree.getMaxNumberOfTimeSteps());
+      auto timeFlagsArray = this->Internal->TK.getTimesFlagArray();
+      for (int idTimeFlag = 0; idTimeFlag < timeFlagsArray.size() ; idTimeFlag++)
+      {
+        std::string name = timeFlagsArray[idTimeFlag].second;
+        bool status = timeFlagsArray[idTimeFlag].first;
+        this->Internal->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();
+      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));
+        }
+        catch(INTERP_KERNEL::Exception& e)
+        {
+          // Remove the incorrect array
+          this->Internal->FieldSelection->RemoveArrayByIndex(i);
+        }
+      }
+
 //      request->Print(cout);
       vtkInformation *outInfo(outputVector->GetInformationObject(0));
       outInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkMultiBlockDataSet");
@@ -428,7 +319,25 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector ** /
   if(!this->Internal)
     return 0;
   try
-    {
+  {
+      for(int i = 0; i < this->Internal->FieldSelection->GetNumberOfArrays(); i++)
+      {
+        this->Internal->Tree.changeStatusOfAndUpdateToHaveCoherentVTKDataSet(
+          this->Internal->Tree.getIdHavingZeName(this->Internal->FieldSelection->GetArrayName(i)), 
+          this->Internal->FieldSelection->GetArraySetting(i));
+      }
+          
+      auto& timeFlagsArray = this->Internal->TK.getTimesFlagArray();
+      if (timeFlagsArray.size() != this->Internal->TimeFlagSelection->GetNumberOfArrays())
+      {
+        throw INTERP_KERNEL::Exception("Unexpected size of TimeFlagSelection");
+      }
+      for(int i = 0; i < this->Internal->TimeFlagSelection->GetNumberOfArrays(); i++)
+      {
+        timeFlagsArray[i] = std::make_pair(this->Internal->TimeFlagSelection->GetArraySetting(i), 
+          this->Internal->TimeFlagSelection->GetArrayName(i));
+      }
+
 //      request->Print(cout);
       vtkInformation *outInfo(outputVector->GetInformationObject(0));
       vtkMultiBlockDataSet *output(vtkMultiBlockDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())));
@@ -474,112 +383,74 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector ** /
   return 1;
 }
 
-void vtkMEDReader::SetFieldsStatus(const char* name, int status)
-{
-  if( !this->Internal )
-    return;
-
-  //this->Internal->_wonderful_set.insert(name);
-  if(this->Internal->FileName.empty())
-    {//pvsm mode
-      this->Internal->PK.pushFieldStatusEntry(name,status);
-      return ;
-    }
-  if(this->Internal->_wonderful_set.empty())
-    this->Internal->_wonderful_ref=this->Internal->Tree.dumpState();// start of SetFieldsStatus serie -> store ref to compare at the end of the SetFieldsStatus serie.
-  this->Internal->_wonderful_set.insert(name);
-  //not pvsm mode (general case)
-  try
-    {
-      this->Internal->Tree.changeStatusOfAndUpdateToHaveCoherentVTKDataSet(this->Internal->Tree.getIdHavingZeName(name),status);
-      if((int)this->Internal->_wonderful_set.size()==GetNumberOfFieldsTreeArrays())
-        {
-          if(this->Internal->_wonderful_ref!=this->Internal->Tree.dumpState())
-            {
-              if(!this->Internal->PluginStart0())
-                {
-                  this->Modified();
-                }
-              this->Internal->MyMTime++;
-            }
-          this->Internal->_wonderful_set.clear();
-        }
-    }
-  catch(INTERP_KERNEL::Exception& e)
-    {
-      if(!this->Internal->FileName.empty())
-        {
-          std::cerr << "vtkMEDReader::SetFieldsStatus error : " << e.what() << " *** WITH STATUS=" << status << endl;
-          return ;
-        }
-    }
-}
-
+//------------------------------------------------------------------------------
 int vtkMEDReader::GetNumberOfFieldsTreeArrays()
 {
-  if(!this->Internal)
-    return 0;
-  return this->Internal->Tree.getNumberOfLeavesArrays();
+  return this->Internal->FieldSelection->GetNumberOfArrays();
 }
 
-const char *vtkMEDReader::GetFieldsTreeArrayName(int index)
+//------------------------------------------------------------------------------
+const char* vtkMEDReader::GetFieldsTreeArrayName(int index)
 {
-  if(!this->Internal)
-    return 0;
-  return this->Internal->Tree.getNameOfC(index);
+  return this->Internal->FieldSelection->GetArrayName(index);
 }
 
-int vtkMEDReader::GetFieldsTreeArrayStatus(const char *name)
+//------------------------------------------------------------------------------
+int vtkMEDReader::GetFieldsTreeArrayStatus(const char* name)
 {
-  if(!this->Internal)
-    return -1;
-
-  int zeId(this->Internal->Tree.getIdHavingZeName(name));
-  int ret(this->Internal->Tree.getStatusOf(zeId));
-  return ret;
+  return this->Internal->FieldSelection->ArrayIsEnabled(name);
 }
 
-void vtkMEDReader::SetTimesFlagsStatus(const char *name, int status)
+//------------------------------------------------------------------------------
+void vtkMEDReader::SetFieldsStatus(const char* name, int status)
 {
-  if (!this->Internal)
-    return;
-  
-  if(this->Internal->FileName.empty())
-    {//pvsm mode
-      this->Internal->PK.pushTimesFlagsStatusEntry(name,status);
-      return ;
+  if (this->GetFieldsTreeArrayStatus(name) != status)
+  {
+    if (status)
+    {
+      this->Internal->FieldSelection->EnableArray(name);
     }
-  //not pvsm mode (general case)
-  int pos(0);
-  std::istringstream iss(name); iss >> pos;
-  this->Internal->TK.getTimesFlagArray()[pos].first=(bool)status;
-  if(pos==(int)this->Internal->TK.getTimesFlagArray().size()-1)
-    if(!this->Internal->PluginStart0())
-      {
-        this->Modified();
-        //this->Internal->TK.printSelf(std::cerr);
-      }
+    else
+    {
+      this->Internal->FieldSelection->DisableArray(name);
+    }
+    this->Modified();
+  }
 }
 
+//------------------------------------------------------------------------------
 int vtkMEDReader::GetNumberOfTimesFlagsArrays()
 {
-  if(!this->Internal)
-    return 0;
-  return (int)this->Internal->TK.getTimesFlagArray().size();
+  return this->Internal->TimeFlagSelection->GetNumberOfArrays();
 }
 
-const char *vtkMEDReader::GetTimesFlagsArrayName(int index)
+//------------------------------------------------------------------------------
+const char* vtkMEDReader::GetTimesFlagsArrayName(int index)
 {
-  return this->Internal->TK.getTimesFlagArray()[index].second.c_str();
+  return this->Internal->TimeFlagSelection->GetArrayName(index);
 }
 
-int vtkMEDReader::GetTimesFlagsArrayStatus(const char *name)
+//------------------------------------------------------------------------------
+int vtkMEDReader::GetTimesFlagsArrayStatus(const char* name)
 {
-  if(!this->Internal)
-    return -1;
-  int pos(0);
-  std::istringstream iss(name); iss >> pos;
-  return (int)this->Internal->TK.getTimesFlagArray()[pos].first;
+  return this->Internal->TimeFlagSelection->ArrayIsEnabled(name);
+}
+
+//------------------------------------------------------------------------------
+void vtkMEDReader::SetTimesFlagsStatus(const char* name, int status)
+{
+  if (this->GetTimesFlagsArrayStatus(name) != status)
+  {
+    if (status)
+    {
+      this->Internal->TimeFlagSelection->EnableArray(name);
+    }
+    else
+    {
+      this->Internal->TimeFlagSelection->DisableArray(name);
+    }
+    this->Modified();
+  }
 }
 
 void vtkMEDReader::UpdateSIL(vtkInformation* /*request*/, vtkInformation * /*info*/)
index 1f3022e86ca1e1f9c5eecbace04db3de0d009efa..d7611967fcf86449b656191fe1a68e482d7d4e37 100644 (file)
@@ -62,8 +62,6 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
   // Reload will delete the internal reader and recreate it with default properties
   virtual void Reload();
 
-  virtual int GetServerModifTime();
-  //
   virtual void GenerateVectors(int);
   virtual void ChangeMode(int);
   virtual void GhostCellGeneratorCallForPara(int);
index 9c4e031f3d469c03f646b89494162f782ce3a8da..afde62054bc553f955521ea428cfa12f2d105439 100644 (file)
         </Documentation>
       </StringVectorProperty>
 
-      <IntVectorProperty command="GetServerModifTime" information_only="1" name="ServerModifTime">
-        <SimpleIntInformationHelper />
-      </IntVectorProperty>
-
       <!-- retrieves using GetNumberOf[FieldsTree]Arrays and GetFieldsTreeArrayName the keys used by FieldsStatus -->
       <StringVectorProperty name="FieldsTreeInfo" information_only="1">
         <ArraySelectionInformationHelper attribute_name="FieldsTree" />
index 82714ab6e30b5a289abadf9e63ce9a7ced2bc7cb..9da2c2faa02865ef3ddb93bb664625ef08881131 100644 (file)
@@ -195,12 +195,15 @@ void pqMEDReaderTimesFlagsWidget::UpdateTimeSteps()
         {
         const char* leafString = prop->GetElement(i - 1);
         const char* tmp = strchr(leafString, '/');
-        size_t num = tmp - leafString;
-        char* dest = new char[num+1];
-        strncpy(dest, leafString, num);
-        dest[num] = '\0';
-        tsId = (vtkIdType)strtol(dest + 2, NULL, 10);
-        delete [] dest;
+        if (tmp)
+        {
+          size_t num = tmp - leafString;
+          char* dest = new char[num+1];
+          strncpy(dest, leafString, num);
+          dest[num] = '\0';
+          tsId = (vtkIdType)strtol(dest + 2, NULL, 10);
+          delete [] dest;
+        }
         break;
         }
       }
index 296b3b9e069133fb7a0621ec90eeb4c802d48738..6e56d4e9d2edc9651d9ede374145c99080be5bfc 100644 (file)
@@ -89,6 +89,13 @@ def test0(baseline_file):
     ################### MED write is done -> Go to MEDReader
 
     myMedReader=MEDReader(FileName=fname)
+
+    myMedReader.AllArrays = ['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.UpdatePipeline()
+    assert(myMedReader.CellData.GetNumberOfArrays()==4)
+
     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]
index 144a0ed3edfd1fc69aa37160017ecda266b884d1..111609c34033a6da147a937f2f22fb40213e0d36 100644 (file)
@@ -49,14 +49,12 @@ def test():
     ################### MED write is done -> Go to MEDReader
     myMedReader=MEDReader(FileName=fname)
     myMedReader.AllArrays=['TS0/m1/ComSup0/f1@@][@@P0']
-    #myMedReader.UpdatePipelineInformation()
     ExtractGroup1=ExtractGroup(Input=myMedReader)
-    #ExtractGroup1.UpdatePipelineInformation()
+    ExtractGroup1.UpdatePipeline()
     assert(ExtractGroup1.GetProperty("MeshName")[0]=="m1")
     myMedReader.AllArrays=['TS0/m2/ComSup0/f2@@][@@P0']
-    #myMedReader.UpdatePipeline()
     ExtractGroup2=ExtractGroup(Input=myMedReader)
-    #ExtractGroup2.UpdatePipelineInformation()
+    ExtractGroup2.UpdatePipeline()
     assert(ExtractGroup2.GetProperty("MeshName")[0]=="m2")
     
 if __name__ == "__main__":