]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_CorbaMedConvertor.hxx
Salome HOME
NRI : Merge from V1_2.
[modules/visu.git] / src / VISU_I / VISU_CorbaMedConvertor.hxx
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : VISU_CorbaMedConvertor.hxx
6 //  Author : Alexey PETROV
7 //  Module : VISU
8
9 #ifndef VISU_CorbaMedConvertor_HeaderFile
10 #define VISU_CorbaMedConvertor_HeaderFile
11
12 #include "VISUConfig.hh"
13 #include "VISU_Convertor_impl.hxx"
14
15 extern "C"{
16 #include <med.h>
17 }  
18
19
20 namespace VISUMED{
21   struct TFamily{
22     SALOME_MED::FAMILY_var myFamily;
23   };
24   typedef std::map<std::string,TFamily> TFamilyMap;
25   
26   struct TField{
27     struct TValForTime{
28       SALOME_MED::FIELD_var myField;
29     };
30     typedef std::map<int,TValForTime> TValField;
31     TValField myValField;
32   };
33   typedef map<string,TField> TFieldMap;
34
35   struct TMeshOnEntity{
36     SALOME_MED::SUPPORT_var mySupport;
37     typedef pair<int,int> TIndexAndSize;
38     typedef map<int,TIndexAndSize> TCellsFirstIndex;
39     TCellsFirstIndex myCellsFirstIndex;
40     TFamilyMap myFamilyMap;
41     TFieldMap myFieldMap;
42   };
43   typedef std::map<VISU::TEntity,TMeshOnEntity> TMeshOnEntityMap;
44   
45   struct TGroup{
46     SALOME_MED::GROUP_var myGroup;
47   };
48   typedef std::map<std::string,TGroup> TGroupMap;
49
50   struct TMesh{
51     SALOME_MED::MESH_var myMesh;
52     TMeshOnEntityMap myMeshOnEntityMap;
53     TGroupMap myGroupMap;
54   };
55   typedef std::map<std::string,TMesh> TMeshMap;
56 }
57
58
59 class VISU_MEDConvertor: public VISU_Convertor_impl{
60  protected:
61   VISUMED::TMeshMap myMeshMap2;
62   SALOMEDS::SObject_var mySObject;
63   VISU_MEDConvertor() {};
64  public:
65   VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
66   virtual VISU_Convertor* Build() throw (std::runtime_error&);
67  protected:
68   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
69                                const string& theFamilyName = "")
70     throw (std::runtime_error&);
71   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
72                               const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
73     throw (std::runtime_error&);
74   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
75                               VISU::TMeshOnEntity& theMeshOnEntity, 
76                               VISU::TField& theField, 
77                               VISU::TField::TValForTime& theValForTime)
78     throw (std::runtime_error&);
79   int LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName = "") 
80     throw (std::runtime_error&);
81   int LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName = "")
82     throw (std::runtime_error&);
83   int LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
84                 const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
85     throw (std::runtime_error&);
86 };
87
88 class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
89  protected:
90   SALOME_MED::FIELD_var myField;
91  public:
92   VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : myField(SALOME_MED::FIELD::_duplicate(theField)) {}
93   virtual VISU_Convertor* Build() throw (std::runtime_error&);
94 };
95
96 extern "C" {
97   VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) throw(std::runtime_error&);
98   VISU_Convertor* CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField) throw(std::runtime_error&);
99 }
100
101 #endif