]> 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 class VISU_MEDConvertor: public VISU_Convertor_impl{
21  protected:
22   /*
23   struct TFamily{
24     SALOME_MED::FAMILY_var myFamily;
25     int myId;
26     string myName;
27     VISU::TEntity myEntity;
28     TBindGroups myGroups;
29     TSubMesh mySubMesh;
30   };
31   typedef std::map<std::string,TFamily> TFamilyMap;
32
33   struct TField{
34     SALOME_MED::FIELD_var myField;
35     int myId;
36     string myName;
37     VISU::TEntity myEntity;
38     string myMeshName;
39     int myNbComp;
40     typedef std::pair<double,std::string> TTime;
41     struct TValForTime{
42       int myId;
43       TTime myTime;
44     };
45     typedef std::map<int,TValForTime> TValField;
46     TValField myValField;
47     void ShallowCopy(const TField& aField);
48   };
49   typedef map<string,TField> TFieldMap;
50
51   struct TMeshOnEntity{
52     SALOME_MED::SUPPORT_var mySupport;
53     string myMeshName;
54     VISU::TEntity myEntity;
55     TFamilyMap myFamilyMap;
56     TFieldMap myFieldMap;
57   };
58   typedef std::map<TEntity,TMeshOnEntity> TMeshOnEntityMap;
59   const TFamily* GetFamily(const VISU::TMeshOnEntity& theMeshOnEntity, 
60                      const string& theFamilyName)
61     throw(std::runtime_error&); 
62   TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, 
63                      const string& theFamilyName)
64     throw(std::runtime_error&); 
65
66   typedef std::pair<std::string,TEntity> TFamilyAndEntity;
67   typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
68   struct TGroup{
69     TVTKReader myStorage;
70     string myName;
71     string myMeshName;
72     TFamilyAndEntitySet myFamilyAndEntitySet;
73   };
74   typedef std::map<std::string,TGroup> TGroupMap;
75
76   struct TMesh{
77     int myDim;
78     string myName;
79     typedef vector<float> TPointsCoord;
80     TPointsCoord myPointsCoord;
81     TMeshOnEntityMap myMeshOnEntityMap;
82     TGroupMap myGroupMap;
83     void CreateMeshOnNodes();
84     const TField* GetField(const string& theFieldName) const;
85   };
86   typedef std::map<std::string,TMesh> TMeshMap;
87   */
88   SALOMEDS::SObject_var mySObject;
89  public:
90   void SetMedField(SALOME_MED::FIELD_ptr theMedField);
91   virtual VISU_Convertor* Build() throw (std::runtime_error&);
92  protected:
93   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
94                                const string& theFamilyName = "")
95     throw (std::runtime_error&) {return 1;}
96   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
97                               const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
98     throw (std::runtime_error&) {return 1;}
99   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
100                               VISU::TMeshOnEntity& theMeshOnEntity, 
101                               VISU::TField& theField, 
102                               VISU::TField::TValForTime& theValForTime)
103     throw (std::runtime_error&) {return 1;}
104 };
105
106 class VISU_MedMeshConvertor: public VISU_Convertor_impl{
107 protected:
108   SALOME_MED::MESH_var myMedMesh;
109 public:
110   void SetMedMesh(SALOME_MED::MESH_ptr theMedMesh);
111   virtual VISU_Convertor* Build() throw (std::runtime_error&);
112  protected:
113   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
114                                const string& theFamilyName = "")
115     throw (std::runtime_error&) {return 1;}
116   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
117                               const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
118     throw (std::runtime_error&) {return 1;}
119   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
120                               VISU::TMeshOnEntity& theMeshOnEntity, 
121                               VISU::TField& theField, 
122                               VISU::TField::TValForTime& theValForTime)
123     throw (std::runtime_error&) {return 1;}
124 };
125
126 class VISU_MEDConvertor: public VISU_Convertor_impl{
127  protected:
128   VISUMED::TMeshMap myMeshMap2;
129   SALOMEDS::SObject_var mySObject;
130   VISU_MEDConvertor() {};
131  public:
132   VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
133   virtual VISU_Convertor* Build() throw (std::runtime_error&);
134  protected:
135   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
136                                const string& theFamilyName = "")
137     throw (std::runtime_error&) {return 1;}
138   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
139                               const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
140     throw (std::runtime_error&) {return 1;}
141   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
142                               VISU::TMeshOnEntity& theMeshOnEntity, 
143                               VISU::TField& theField, 
144                               VISU::TField::TValForTime& theValForTime)
145     throw (std::runtime_error&) {return 1;}
146 };
147
148 class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
149  protected:
150   SALOME_MED::FIELD_var myField;
151  public:
152   VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : myField(SALOME_MED::FIELD::_duplicate(theField)) {}
153   virtual VISU_Convertor* Build() throw (std::runtime_error&);
154 };
155
156 extern "C" {
157   VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) throw(std::runtime_error&);
158   VISU_Convertor* CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField) throw(std::runtime_error&);
159 }
160
161 #endif