Salome HOME
Make the vtkMEDReader::META_DATA info key accessible from the outside without dependa...
[modules/paravis.git] / src / Plugins / MEDReader / IO / MEDFileFieldRepresentationTree.hxx
index 4d7dc92c8dd2e9d385f680d91e9e2adcfacce565..6e9cfa9dce28bd506bab206e899fdae4413795e2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2010-2016  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
 
 #include "MEDFileMesh.hxx"
 #include "MEDFileField.hxx"
+#include "MEDLoaderForPV.h"
 
 #include "vtkType.h"
 
 #include <vector>
+#include <map>
 
 class vtkQuadratureSchemeDefinition;
 class vtkMutableDirectedGraph;
@@ -59,7 +61,7 @@ private:
   mutable std::vector< std::vector< std::pair< vtkQuadratureSchemeDefinition *, unsigned char > > > _defs;
 };
 
-class MEDFileFieldRepresentationLeavesArrays : public ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS>
+class MEDLOADERFORPV_EXPORT MEDFileFieldRepresentationLeavesArrays : public ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS>
 {
 public:
   MEDFileFieldRepresentationLeavesArrays();
@@ -67,10 +69,12 @@ public:
   MEDFileFieldRepresentationLeavesArrays& operator=(const MEDFileFieldRepresentationLeavesArrays& other);
   int getId() const;
   void setId(int& id) const;
-  void feedSIL(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, const std::string& tsName, const std::string& meshName, const std::string& comSupStr, std::vector<std::string>& names) const;
+  void feedSIL(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector<std::string>& names) const;
+  void computeFullNameInLeaves(const std::string& tsName, const std::string& meshName, const std::string& comSupStr) const;
   bool getStatus() const;
   bool setStatus(bool status) const;
   std::string getZeName() const;
+  const char *getZeNameC() const;
   void appendFields(const MEDTimeReq *tr, const ParaMEDMEM::MEDFileFieldGlobsReal *globs, const ParaMEDMEM::MEDMeshMultiLev *mml, const ParaMEDMEM::MEDFileMeshStruct *mst, vtkDataSet *ds) const;
   void appendELGAIfAny(vtkDataSet *ds) const;
 public:
@@ -89,7 +93,7 @@ private:
   ELGACmp _elga_cmp;
 };
 
-class MEDFileFieldRepresentationLeaves
+class MEDLOADERFORPV_EXPORT MEDFileFieldRepresentationLeaves
 {
 public:
   MEDFileFieldRepresentationLeaves();
@@ -101,9 +105,11 @@ public:
   std::string getMeshName() const;
   int getNumberOfArrays() const;
   int getNumberOfTS() const;
-  void feedSIL(const ParaMEDMEM::MEDFileMeshes *ms, vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, const std::string& tsName, const std::string& meshName, const std::string& compSupStr, std::vector<std::string>& names) const;
+  void feedSIL(const ParaMEDMEM::MEDFileMeshes *ms, const std::string& meshName, vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector<std::string>& names) const;
+  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;
@@ -123,16 +129,18 @@ private:
   mutable vtkDataSet *_cached_ds;
 };
 
-class MEDFileFieldRepresentationTree
+class MEDLOADERFORPV_EXPORT MEDFileFieldRepresentationTree
 {
 public:
   MEDFileFieldRepresentationTree();
   int getNumberOfLeavesArrays() const;
   void assignIds() const;
   void activateTheFirst() const;
+  void computeFullNameInLeaves() const;
   void feedSIL(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector<std::string>& names) const;
   std::string feedSILForFamsAndGrps(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector<std::string>& names) const;
   std::string getNameOf(int id) const;
+  const char *getNameOfC(int id) const;
   bool getStatusOf(int id) const;
   int getIdHavingZeName(const char *name) const;
   bool changeStatusOfAndUpdateToHaveCoherentVTKDataSet(int id, bool status) const;
@@ -142,11 +150,13 @@ 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);
+  void loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts);
   void removeEmptyLeaves();
   // static methods
   static bool IsFieldMeshRegardingInfo(const std::vector<std::string>& compInfos);
+  static std::string PostProcessFieldName(const std::string& fullFieldName);
 public:
   static const char ROOT_OF_GRPS_IN_TREE[];
   static const char ROOT_OF_FAM_IDS_IN_TREE[];
@@ -156,6 +166,8 @@ private:
   const MEDFileFieldRepresentationLeaves& getTheSingleActivated(int& lev0, int& lev1, int& lev2) const;
   static ParaMEDMEM::MEDFileFields *BuildFieldFromMeshes(const ParaMEDMEM::MEDFileMeshes *ms);
   static void AppendFieldFromMeshes(const ParaMEDMEM::MEDFileMeshes *ms, ParaMEDMEM::MEDFileFields *ret);
+  static std::string BuildAUniqueArrayNameForMesh(const std::string& meshName, const ParaMEDMEM::MEDFileFields *ret);
+  static std::vector<std::string> SplitFieldNameIntoParts(const std::string& fullFieldName, char sep);
 private:
   // 1st : timesteps, 2nd : meshName, 3rd : common support
   std::vector< std::vector< std::vector< MEDFileFieldRepresentationLeaves > > > _data_structure;
@@ -163,7 +175,7 @@ private:
   ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDFileFields> _fields;
 };
 
-class TimeKeeper
+class MEDLOADERFORPV_EXPORT TimeKeeper
 {
 public:
   TimeKeeper(int policy);