Salome HOME
DCQ : Merge with Ecole Ete a6.
[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 extern "C"{
37 #include <med.h>
38 }  
39
40 namespace VISUMED{
41   struct TFamily{
42     SALOME_MED::FAMILY_var myFamily;
43   };
44   typedef std::map<std::string,TFamily> TFamilyMap;
45   
46   struct TField{
47     struct TValForTime{
48       SALOME_MED::FIELD_var myField;
49     };
50     typedef std::map<int,TValForTime> TValField;
51     TValField myValField;
52   };
53   typedef map<string,TField> TFieldMap;
54
55   struct TMeshOnEntity{
56     SALOME_MED::SUPPORT_var mySupport;
57     typedef pair<int,int> TIndexAndSize;
58     typedef map<int,TIndexAndSize> TCellsFirstIndex;
59     TCellsFirstIndex myCellsFirstIndex;
60     TFamilyMap myFamilyMap;
61     TFieldMap myFieldMap;
62   };
63   typedef std::map<VISU::TEntity,TMeshOnEntity> TMeshOnEntityMap;
64   
65   struct TGroup{
66     SALOME_MED::GROUP_var myGroup;
67   };
68   typedef std::map<std::string,TGroup> TGroupMap;
69
70   struct TMesh{
71     SALOME_MED::MESH_var myMesh;
72     TMeshOnEntityMap myMeshOnEntityMap;
73     TGroupMap myGroupMap;
74   };
75   typedef std::map<std::string,TMesh> TMeshMap;
76 }
77
78
79 class VISU_MEDConvertor: public VISU_Convertor_impl{
80  protected:
81   VISUMED::TMeshMap myMeshMap2;
82   SALOMEDS::SObject_var mySObject;
83   VISU_MEDConvertor() {};
84  public:
85   VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
86   virtual VISU_Convertor* Build() ;
87  protected:
88   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
89                                const string& theFamilyName = "");
90
91   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
92                               const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
93
94   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
95                               VISU::TMeshOnEntity& theMeshOnEntity, 
96                               VISU::TField& theField, 
97                               VISU::TField::TValForTime& theValForTime);
98
99   int LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName = "") ;
100
101   int LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName = "");
102
103   int LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
104                 const VISU::TField& theField, VISU::TField::TValForTime& theValForTime);
105
106 };
107
108 class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
109  protected:
110   SALOME_MED::FIELD_var myField;
111  public:
112   VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : myField(SALOME_MED::FIELD::_duplicate(theField)) {}
113   virtual VISU_Convertor* Build() ;
114 };
115
116 extern "C" {
117   VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) ;
118   VISU_Convertor* CreateMEDFieldConvertor(SALOME_MED::FIELD_ptr theField) ;
119 }
120
121 #endif
122