Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISU_I / VISU_CorbaMedConvertor.hxx
index 4fb887ff9f96523e6ebf8df84866da2fa2016404..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>      
 
-namespace VISUMED{
-  struct TFamily{
-    SALOME_MED::FAMILY_var myFamily;
-  };
-  typedef std::map<std::string,TFamily> TFamilyMap;
-  
-  struct TField{
-    struct TValForTime{
-      SALOME_MED::FIELD_var myField;
-    };
-    typedef std::map<int,TValForTime> TValField;
-    TValField myValField;
+namespace VISU{
+
+  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;
-    typedef pair<int,int> TIndexAndSize;
-    typedef map<int,TIndexAndSize> TCellsFirstIndex;
+    typedef std::pair<int,int> TIndexAndSize;
+    typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
     TCellsFirstIndex myCellsFirstIndex;
-    TFamilyMap myFamilyMap;
-    TFieldMap myFieldMap;
   };
-  typedef std::map<VISU::TEntity,TMeshOnEntity> TMeshOnEntityMap;
+  typedef shared_ptr<TCMeshOnEntity> PCMeshOnEntity;
   
-  struct TGroup{
+  struct TCFamily: TFamilyImpl{
+    SALOME_MED::FAMILY_var myFamily;
+  };
+  typedef shared_ptr<TCFamily> PCFamily;
+  
+  struct TCGroup: TGroupImpl{
     SALOME_MED::GROUP_var myGroup;
   };
-  typedef std::map<std::string,TGroup> TGroupMap;
+  typedef shared_ptr<TCGroup> PCGroup;
 
-  struct TMesh{
-    SALOME_MED::MESH_var myMesh;
-    TMeshOnEntityMap myMeshOnEntityMap;
-    TGroupMap myGroupMap;
+  struct TCField: TFieldImpl{
+  };
+  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:
-  VISUMED::TMeshMap myMeshMap2;
   SALOMEDS::SObject_var mySObject;
-  SALOMEDS::Study_var myStudy;
+  VISU_MEDConvertor() {};
+
  public:
   VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
-  virtual VISU_Convertor* Build() throw (std::runtime_error&);
+  virtual VISU_Convertor* Build();
+
  protected:
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
-                              const 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(VISU::TMesh& theMesh, const string& theFamilyName = "") 
-    throw (std::runtime_error&);
-  int LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName = "")
-    throw (std::runtime_error&);
-  int LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
-               const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
-    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);
+
 };
 
-extern "C"
-  VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) throw(std::runtime_error&);
+class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
+ protected:
+  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