Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VISU_I / VISU_CorbaMedConvertor.hxx
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : VISU_CorbaMedConvertor.hxx
25 //  Author : Alexey PETROV
26 //  Module : VISU
27 //  $Header$
28 //  Copyright (C) 2003  CEA/DEN, EDF R&D
29
30 #ifndef VISU_CorbaMedConvertor_HeaderFile
31 #define VISU_CorbaMedConvertor_HeaderFile
32
33 #include "VISUConfig.hh"
34 #include "VISU_Convertor_impl.hxx"
35
36 #include <string>       
37
38 namespace VISU
39 {
40   //---------------------------------------------------------------
41   struct TCMesh: virtual TMeshImpl
42   {
43     SALOME_MED::MESH_var myMesh;
44   };
45   typedef SharedPtr<TCMesh> PCMesh;
46
47
48   //---------------------------------------------------------------
49   struct TCProfile: virtual TProfileImpl
50   {};
51   typedef SharedPtr<TCProfile> PCProfile;
52
53
54   //---------------------------------------------------------------
55   struct TCSubMesh: virtual TSubMeshImpl
56   {};
57   typedef SharedPtr<TCSubMesh> PCSubMesh;
58
59
60   //---------------------------------------------------------------
61   struct TCMeshOnEntity: virtual TMeshOnEntityImpl
62   {
63     SALOME_MED::SUPPORT_var mySupport;
64     typedef std::pair<int,int> TIndexAndSize;
65     typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
66     TCellsFirstIndex myCellsFirstIndex;
67   };
68   typedef SharedPtr<TCMeshOnEntity> PCMeshOnEntity;
69   
70
71   //---------------------------------------------------------------
72   struct TCFamily: virtual TFamilyImpl
73   {
74     SALOME_MED::FAMILY_var myFamily;
75   };
76   typedef SharedPtr<TCFamily> PCFamily;
77   
78
79   //---------------------------------------------------------------
80   struct TCGroup: virtual TGroupImpl
81   {
82     SALOME_MED::GROUP_var myGroup;
83   };
84   typedef SharedPtr<TCGroup> PCGroup;
85
86
87   //---------------------------------------------------------------
88   struct TCField: virtual TFieldImpl
89   {};
90   typedef SharedPtr<TCField> PCField;
91
92
93   //---------------------------------------------------------------
94   struct TCValForTime: virtual TValForTimeImpl
95   {
96     SALOME_MED::FIELD_var myField;
97   };
98   typedef SharedPtr<TCValForTime> PCValForTime;
99
100 }
101
102
103 class VISU_MEDConvertor: public VISU_Convertor_impl{
104  protected:
105   SALOMEDS::SObject_var mySObject;
106   VISU_MEDConvertor() {};
107
108  public:
109   VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject): 
110     mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) 
111   {}
112
113   virtual
114   VISU_Convertor* 
115   Build();
116
117  protected:
118
119   VISU_Convertor* 
120   Build(SALOME_MED::MED_ptr theMED);
121   
122   VISU_Convertor* 
123   Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator);
124
125   virtual
126   int
127   LoadMeshOnEntity(VISU::PMeshImpl theMesh,
128                    VISU::PMeshOnEntityImpl theMeshOnEntity);
129   
130   virtual
131   int
132   LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
133                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
134                      VISU::PFamilyImpl theFamily);
135   
136   virtual
137   int
138   LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
139                   const VISU::TFamilySet& theFamilySet);
140
141   virtual 
142   int
143   LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
144                        VISU::PMeshOnEntityImpl theMeshOnEntity, 
145                        VISU::PFieldImpl theField, 
146                        VISU::PValForTimeImpl theValForTime);
147
148   virtual
149   int
150   LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
151                            VISU::PMeshOnEntityImpl theMeshOnEntity, 
152                            VISU::PFieldImpl theField, 
153                            VISU::PValForTimeImpl theValForTime)
154   {
155     return 0;
156   }
157
158   int 
159   LoadPoints(VISU::PCMesh theMesh) ;
160
161   int 
162   LoadPointsOnFamily(VISU::PCMesh theMesh, 
163                      VISU::PCFamily theFamily) ;
164
165   int 
166   LoadCellsOnEntity(VISU::PCMesh theMesh,
167                     VISU::PCMeshOnEntity theMeshOnEntity);
168   
169   int 
170   LoadCellsOnFamily(VISU::PCMesh theMesh,
171                     VISU::PCMeshOnEntity theMeshOnEntity, 
172                     VISU::PCFamily theFamily);
173   
174   int 
175   LoadField(VISU::PCMesh theMesh,
176             VISU::PCMeshOnEntity theMeshOnEntity,
177             VISU::PField theField, 
178             VISU::PCValForTime theValForTime);
179
180 };
181
182 class VISU_MEDFieldConvertor: public VISU_MEDConvertor
183 {
184  protected:
185   SALOME_MED::FIELD_var myField;
186
187  public:
188
189   VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : 
190     myField(SALOME_MED::FIELD::_duplicate(theField)) 
191   {}
192
193   virtual 
194   VISU_Convertor* 
195   Build();
196 };
197
198 extern "C" {
199   VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) ;
200   VISU_Convertor* CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField) ;
201 }
202
203 #endif
204