]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
First try.
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 13 May 2015 07:09:44 +0000 (09:09 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 13 May 2015 07:09:44 +0000 (09:09 +0200)
src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx
src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx
src/Plugins/MEDReader/IO/vtkMEDReader.cxx

index 32738af7b7e015f048904176bea1bc9e30b4f732..b3512390494ebdf34402d64cd8e12af539acb7d1 100644 (file)
@@ -535,6 +535,12 @@ bool MEDFileFieldRepresentationLeaves::containZeName(const char *name, int& id)
   return false;
 }
 
+void MEDFileFieldRepresentationLeaves::dumpState(std::map<std::string,bool>& status) const
+{
+  for(std::vector<MEDFileFieldRepresentationLeavesArrays>::const_iterator it=_arrays.begin();it!=_arrays.end();it++)
+    status[(*it).getZeName()]=(*it).getStatus();
+}
+
 bool MEDFileFieldRepresentationLeaves::isActivated() const
 {
   for(std::vector<MEDFileFieldRepresentationLeavesArrays>::const_iterator it=_arrays.begin();it!=_arrays.end();it++)
@@ -1393,6 +1399,16 @@ void MEDFileFieldRepresentationTree::printMySelf(std::ostream& os) const
     os << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" << std::endl;
 }
 
+std::map<std::string,bool> MEDFileFieldRepresentationTree::dumpState() const
+{
+  std::map<std::string,bool> ret;
+  for(std::vector< std::vector< std::vector< MEDFileFieldRepresentationLeaves > > >::const_iterator it0=_data_structure.begin();it0!=_data_structure.end();it0++)
+    for(std::vector< std::vector< MEDFileFieldRepresentationLeaves > >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+      for(std::vector< MEDFileFieldRepresentationLeaves >::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
+        (*it2).dumpState(ret);
+  return ret;
+}
+
 void MEDFileFieldRepresentationTree::AppendFieldFromMeshes(const ParaMEDMEM::MEDFileMeshes *ms, ParaMEDMEM::MEDFileFields *ret)
 {
   if(!ret)
index 00a2623a60126c4d7d1efabe775aa423bc07a108..922ceb6af8e2687aa653b4a2673f11bd6ce82d75 100644 (file)
@@ -28,6 +28,7 @@
 #include "vtkType.h"
 
 #include <vector>
+#include <map>
 
 class vtkQuadratureSchemeDefinition;
 class vtkMutableDirectedGraph;
@@ -108,6 +109,7 @@ public:
   void computeFullNameInLeaves(const std::string& tsName, const std::string& meshName, const std::string& comSupStr) const;
   bool containId(int id) const;
   bool containZeName(const char *name, int& id) const;
+  void dumpState(std::map<std::string,bool>& status) const;
   bool isActivated() const;
   void printMySelf(std::ostream& os) const;
   void activateAllArrays() const;
@@ -148,6 +150,7 @@ public:
   std::vector<double> getTimeSteps(int& lev0, const TimeKeeper& tk) const;
   vtkDataSet *buildVTKInstance(bool isStdOrMode, double timeReq, std::string& meshName, const TimeKeeper& tk) const;
   void printMySelf(std::ostream& os) const;
+  std::map<std::string,bool> dumpState() const;
   //non const methods
   void loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts);
   void removeEmptyLeaves();
index 0dca27f6632c39e7400d36212368977d7251a12b..d2eb1025ce8e0fa407b773a4859c9e873e5edd38 100644 (file)
@@ -50,6 +50,7 @@
 
 #include "MEDFileFieldRepresentationTree.hxx"
 
+#include <map>
 #include <string>
 #include <vector>
 #include <sstream>
@@ -185,7 +186,8 @@ public:
   // 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 !
+  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.
 private:
   unsigned char FirstCall0;
 };
@@ -366,6 +368,8 @@ void vtkMEDReader::SetFieldsStatus(const char* name, int status)
       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
@@ -373,11 +377,14 @@ void vtkMEDReader::SetFieldsStatus(const char* name, int status)
       this->Internal->Tree.changeStatusOfAndUpdateToHaveCoherentVTKDataSet(this->Internal->Tree.getIdHavingZeName(name),status);
       if(this->Internal->_wonderful_set.size()==GetNumberOfFieldsTreeArrays())
         {
-          if(!this->Internal->PluginStart0())
+          if(this->Internal->_wonderful_ref!=this->Internal->Tree.dumpState())
             {
-              this->Modified();
+              if(!this->Internal->PluginStart0())
+                {
+                  this->Modified();
+                }
+              this->Internal->MyMTime++;
             }
-          this->Internal->MyMTime++;
           this->Internal->_wonderful_set.clear();
         }
     }