Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISU_I / VISU_CorbaMedConvertor.hxx
index 6c87c6ee3c1316288b2eab2de735b0e52d52741e..6b7c94107ae077047bfd960a113b1fcc7ed26f90 100644 (file)
@@ -1,8 +1,31 @@
-// File:       VISU_CorbaMedConvertor.hxx
-// Created:    Fri Jan 10 12:02:49 2003
-// Author:     Alexey PETROV
-//             <apo@ivanox.nnov.matra-dtv.fr>
-
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  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. 
+// 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VISU_CorbaMedConvertor.hxx
+//  Author : Alexey PETROV
+//  Module : VISU
+//  $Header$
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
 
 #ifndef VISU_CorbaMedConvertor_HeaderFile
 #define VISU_CorbaMedConvertor_HeaderFile
 #include "VISUConfig.hh"
 #include "VISU_Convertor_impl.hxx"
 
-extern "C"{
-#include <med.h>
-}  
-
+#include <string>      
 
-class VISU_MEDConvertor: public VISU_Convertor_impl{
- protected:
-  /*
-  struct TFamily{
-    SALOME_MED::FAMILY_var myFamily;
-    int myId;
-    string myName;
-    VISU::TEntity myEntity;
-    TBindGroups myGroups;
-    TSubMesh mySubMesh;
-  };
-  typedef std::map<std::string,TFamily> TFamilyMap;
+namespace VISU{
 
-  struct TField{
-    SALOME_MED::FIELD_var myField;
-    int myId;
-    string myName;
-    VISU::TEntity myEntity;
-    string myMeshName;
-    int myNbComp;
-    typedef std::pair<double,std::string> TTime;
-    struct TValForTime{
-      int myId;
-      TTime myTime;
-    };
-    typedef std::map<int,TValForTime> TValField;
-    TValField myValField;
-    void ShallowCopy(const TField& aField);
+  struct TCMesh: TMeshImpl{
+    SALOME_MED::MESH_var myMesh;
   };
-  typedef map<string,TField> TFieldMap;
+  typedef shared_ptr<TCMesh> PCMesh;
 
-  struct TMeshOnEntity{
+  struct TCMeshOnEntity: TMeshOnEntityImpl{
     SALOME_MED::SUPPORT_var mySupport;
-    string myMeshName;
-    VISU::TEntity myEntity;
-    TFamilyMap myFamilyMap;
-    TFieldMap myFieldMap;
+    typedef std::pair<int,int> TIndexAndSize;
+    typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
+    TCellsFirstIndex myCellsFirstIndex;
+  };
+  typedef shared_ptr<TCMeshOnEntity> PCMeshOnEntity;
+  
+  struct TCFamily: TFamilyImpl{
+    SALOME_MED::FAMILY_var myFamily;
+  };
+  typedef shared_ptr<TCFamily> PCFamily;
+  
+  struct TCGroup: TGroupImpl{
+    SALOME_MED::GROUP_var myGroup;
   };
-  typedef std::map<TEntity,TMeshOnEntity> TMeshOnEntityMap;
-  const TFamily* GetFamily(const VISU::TMeshOnEntity& theMeshOnEntity, 
-                    const string& theFamilyName)
-    throw(std::runtime_error&); 
-  TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, 
-                    const string& theFamilyName)
-    throw(std::runtime_error&); 
-
-  typedef std::pair<std::string,TEntity> TFamilyAndEntity;
-  typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
-  struct TGroup{
-    TVTKReader myStorage;
-    string myName;
-    string myMeshName;
-    TFamilyAndEntitySet myFamilyAndEntitySet;
+  typedef shared_ptr<TCGroup> PCGroup;
+
+  struct TCField: TFieldImpl{
   };
-  typedef std::map<std::string,TGroup> TGroupMap;
-
-  struct TMesh{
-    int myDim;
-    string myName;
-    typedef vector<float> TPointsCoord;
-    TPointsCoord myPointsCoord;
-    TMeshOnEntityMap myMeshOnEntityMap;
-    TGroupMap myGroupMap;
-    void CreateMeshOnNodes();
-    const TField* GetField(const string& theFieldName) const;
+  typedef shared_ptr<TCField> PCField;
+
+  struct TCValForTime: TValForTimeImpl{
+    SALOME_MED::FIELD_var myField;
   };
-  typedef std::map<std::string,TMesh> TMeshMap;
-  */
+  typedef shared_ptr<TCValForTime> PCValForTime;
+
+}
+
+
+class VISU_MEDConvertor: public VISU_Convertor_impl{
+ protected:
   SALOMEDS::SObject_var mySObject;
+  VISU_MEDConvertor() {};
+
  public:
-  void SetMedField(SALOME_MED::FIELD_ptr theMedField);
-  virtual VISU_Convertor* Build() throw (std::runtime_error&);
- protected:
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
-                              const string& theFamilyName = "")
-    throw (std::runtime_error&) {return 1;}
-  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
-                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
-    throw (std::runtime_error&) {return 1;}
-  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                             VISU::TMeshOnEntity& theMeshOnEntity, 
-                             VISU::TField& theField, 
-                             VISU::TField::TValForTime& theValForTime)
-    throw (std::runtime_error&) {return 1;}
-};
+  VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
+  virtual VISU_Convertor* Build();
 
-class VISU_MedMeshConvertor: public VISU_Convertor_impl{
-protected:
-  SALOME_MED::MESH_var myMedMesh;
-public:
-  void SetMedMesh(SALOME_MED::MESH_ptr theMedMesh);
-  virtual VISU_Convertor* Build() throw (std::runtime_error&);
  protected:
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
-                              const string& theFamilyName = "")
-    throw (std::runtime_error&) {return 1;}
-  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
-                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
-    throw (std::runtime_error&) {return 1;}
-  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                             VISU::TMeshOnEntity& theMeshOnEntity, 
-                             VISU::TField& theField, 
-                             VISU::TField::TValForTime& theValForTime)
-    throw (std::runtime_error&) {return 1;}
-};
 
-class VISU_CorbaMedConvertor: public VISU_MedMeshConvertor{
-protected:
-  SALOME_MED::FIELD_var myMedField;
-public:
-  void SetMedField(SALOME_MED::FIELD_ptr theMedField);
-  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+  VISU_Convertor* Build(SALOME_MED::MED_ptr theMED);
+  VISU_Convertor* Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator);
+
+  virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                              const std::string& theFamilyName = "");
+
+  virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
+
+  virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
+                             VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                             VISU::PFieldImpl theField, 
+                             VISU::PValForTimeImpl theValForTime);
+
+  int LoadPoints(VISU::PCMesh theMesh,
+                const std::string& theFamilyName = "") ;
+
+  int LoadCellsOnEntity(VISU::PCMesh theMesh,
+                       VISU::PCMeshOnEntity theMeshOnEntity, 
+                       const std::string& theFamilyName = "");
+  
+  int LoadField(VISU::PCMesh theMesh,
+               VISU::PCMeshOnEntity theMeshOnEntity,
+               VISU::PField theField, 
+               VISU::PCValForTime theValForTime);
+
 };
 
-class VISU_CorbaMedSupportConvertor: public VISU_Convertor_impl{
-protected:
-  SALOME_MED::SUPPORT_var mySupport;
-  SALOME_MED::MESH_var myMedMesh;
-public:
-  void SetSupport(SALOME_MED::SUPPORT_ptr theSupport);
-  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
  protected:
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
-                              const string& theFamilyName = "")
-    throw (std::runtime_error&) {return 1;}
-  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
-                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
-    throw (std::runtime_error&) {return 1;}
-  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                             VISU::TMeshOnEntity& theMeshOnEntity, 
-                             VISU::TField& theField, 
-                             VISU::TField::TValForTime& theValForTime)
-    throw (std::runtime_error&) {return 1;}
+  SALOME_MED::FIELD_var myField;
+ public:
+  VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : 
+    myField(SALOME_MED::FIELD::_duplicate(theField)) 
+  {}
+  virtual VISU_Convertor* Build() ;
 };
 
+extern "C" {
+  VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) ;
+  VISU_Convertor* CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField) ;
+}
+
 #endif
+