Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / CONVERTOR / VISU_MedConvertor.hxx
index 742b085207776ffbd5e2dca054ac4493d4521c05..0ce3377aa8bda5b49b3ef9a46e3ea43c6ef4dba2 100644 (file)
 
 #include "VISU_Convertor_impl.hxx"
 
-extern "C"{
-#include <med.h>
-}  
+#include "MED_Common.hxx"
+#include "MED_Structures.hxx"
 
-class VISU_MedConvertor: public VISU_Convertor_impl{
+#include <boost/thread/mutex.hpp>
+#include <qfileinfo.h>
+
+namespace VISU
+{
+  typedef TVector<TName> TNames;
+
+  //---------------------------------------------------------------
+  class TMEDNamedPointCoords: public virtual TNamedPointCoords
+  {
+    MED::PNodeInfo myNodeInfo;
+    TNames myPointNames;
+  public:
+    void
+    Init(vtkIdType theNbPoints,
+        vtkIdType theDim,
+        const MED::PNodeInfo& theNodeInfo);
+
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const;
+  };
+  typedef SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
+
+
+  //---------------------------------------------------------------
+  struct TMEDMesh: virtual TMeshImpl
+  {
+    MED::PMeshInfo myMeshInfo;
+    MED::TEntityInfo myEntityInfo;
+  };
+  typedef SharedPtr<TMEDMesh> PMEDMesh;
+
+
+  //---------------------------------------------------------------
+  struct TMEDSubProfile: virtual TSubProfileImpl
+  {
+    MED::EGeometrieElement myMGeom;
+
+    TMEDSubProfile():
+      myIsElemNum(MED::eFAUX)
+    {}
+
+    MED::EBooleen myIsElemNum;
+    MED::TElemNum myElemNum;
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+  };
+  typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;
+
+
+  //---------------------------------------------------------------
+  struct TMEDProfile: virtual TProfileImpl
+  {};
+  typedef SharedPtr<TMEDProfile> PMEDProfile;
+
+
+  //---------------------------------------------------------------
+  struct TMEDGauss: virtual TGaussImpl
+  {
+    MED::PGaussInfo myGaussInfo;
+
+    //! To define a way to implement more detail comparision of the TGaussSubMesh instances
+    virtual
+    void
+    LessThan(const PGaussImpl& theGauss,
+            bool& theResult) const;
+  };
+  typedef SharedPtr<TMEDGauss> PMEDGauss;
+
+
+  //---------------------------------------------------------------
+  struct TMEDGaussSubMesh: virtual TGaussSubMeshImpl
+  {
+    TMEDGaussSubMesh():
+      myIsElemNum(MED::eFAUX)
+    {}
+
+    MED::EBooleen myIsElemNum;
+    MED::TElemNum myElemNum;
+
+    virtual
+    TGaussPointID
+    GetObjID(vtkIdType theID,
+            vtkIdType theStartID) const;
+  };
+  typedef SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
+
+
+  //---------------------------------------------------------------
+  struct TMEDGaussMesh: virtual TGaussMeshImpl
+  {};
+  typedef SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
+
+
+  //---------------------------------------------------------------
+  struct TMEDSubMesh: virtual TSubMeshImpl
+  {
+    TMEDSubMesh():
+      myIsElemNum(MED::eFAUX)
+    {}
+
+    MED::EBooleen myIsElemNum;
+    MED::TElemNum myElemNum;
+    MED::PElemInfo myElemInfo;
+
+    void
+    Init(const MED::PElemInfo& theElemInfo);
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
+  };
+  typedef SharedPtr<TMEDSubMesh> PMEDSubMesh;
+
+
+  //---------------------------------------------------------------
+  typedef std::map<vtkIdType,vtkIdType> TFamilyID2CellsSize;
+
+  struct TMEDMeshOnEntity: virtual TMeshOnEntityImpl
+  {
+    TFamilyID2CellsSize myFamilyID2CellsSize;
+    MED::TGeom2Size myGeom2Size;
+  };
+  typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
+
+
+  //---------------------------------------------------------------
+  struct TMEDFamily: virtual TFamilyImpl
+  {};
+  typedef SharedPtr<TMEDFamily> PMEDFamily;
+  
+
+  //---------------------------------------------------------------
+  struct TMEDGroup: virtual TGroupImpl
+  {};
+  typedef SharedPtr<TMEDGroup> PMEDGroup;
+
+
+  //---------------------------------------------------------------
+  struct TMEDField: virtual TFieldImpl
+  {};
+  typedef SharedPtr<TMEDField> PMEDField;
+
+
+  //---------------------------------------------------------------
+  struct TMEDValForTime: virtual TValForTimeImpl
+  {};
+  typedef SharedPtr<TMEDValForTime> PMEDValForTime;
+
+}
+
+class VISU_MedConvertor: public VISU_Convertor_impl
+{  
   VISU_MedConvertor();
   VISU_MedConvertor(const VISU_MedConvertor&);
+  
+  bool myIsEntitiesDone;
+  bool myIsFieldsDone;
+  bool myIsGroupsDone;
+  bool myIsMinMaxDone;
+
 public:
-  VISU_MedConvertor(const std::string& theFileName) throw (std::runtime_error&);
-  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+  VISU_MedConvertor(const std::string& theFileName);
+
+  virtual
+  VISU_Convertor* 
+  BuildEntities();
+
+  virtual
+  VISU_Convertor* 
+  BuildFields();
+
+  virtual
+  VISU_Convertor* 
+  BuildMinMax();
+
+  virtual
+  VISU_Convertor* 
+  BuildGroups();
+
 protected:
   QFileInfo myFileInfo;
 
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
-                              const std::string& theFamilyName = "")
-    throw (std::runtime_error&);
-  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
-                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
-    throw (std::runtime_error&);
-  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                             VISU::TMeshOnEntity& theMeshOnEntity, 
-                             VISU::TField& theField, 
-                             VISU::TField::TValForTime& theValForTime)
-    throw (std::runtime_error&);
-
-  int LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, 
-                const std::string& theFamilyName = "") 
-    throw (std::runtime_error&);
-  int LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity& theMeshOnEntity,
-                       const std::string& theFamilyName = "")
-    throw (std::runtime_error&);
-  int LoadField(const med_idt& fid, const VISU::TMeshOnEntity& theMeshOnEntity,
-               const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
-    throw (std::runtime_error&);
+  virtual
+  int
+  LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity);
+  
+  virtual
+  int
+  LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily);
+
+  virtual
+  int
+  LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                 const VISU::TFamilySet& theFamilySet);
+  
+  virtual
+  int
+  LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
+                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                      VISU::PFieldImpl theField, 
+                      VISU::PValForTimeImpl theValForTime);
+  
+  virtual 
+  int
+  LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
+                          VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                          VISU::PFieldImpl theField, 
+                          VISU::PValForTimeImpl theValForTime);
+
+  int
+  LoadPoints(const MED::PWrapper& theMed,
+            const VISU::PMEDMesh theMesh);
+  
+  int
+  LoadPointsOnFamily(const MED::PWrapper& theMed,
+                    const VISU::PMEDMesh theMesh, 
+                    const VISU::PMEDFamily theFamily);
+  
+  int
+  LoadCellsOnEntity(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity);
+  
+  int
+  LoadCellsOnFamily(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity,
+                   const VISU::PMEDFamily theFamily);
+  
+  int
+  LoadValForTimeOnMesh(const MED::PWrapper& theMed,
+                      VISU::PMEDMesh theMesh,
+                      VISU::PMEDMeshOnEntity theMeshOnEntity,
+                      VISU::PMEDField theField, 
+                      VISU::PMEDValForTime theValForTime);
+  
+  int
+  LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
+                          VISU::PMEDMesh theMesh,
+                          VISU::PMEDMeshOnEntity theMeshOnEntity,
+                          VISU::PMEDField theField, 
+                          VISU::PMEDValForTime theValForTime);
 };
 
 #endif