Salome HOME
update after merging trhe branches CEA_V3_0_x, OCC_V3_1_0_a1_x, and the main
[modules/med.git] / src / MEDMEM / MEDMEM_MedMeshDriver22.hxx
1 #ifndef MED_MESH_DRIVER22_HXX
2 #define MED_MESH_DRIVER22_HXX
3
4 #include "MEDMEM_MedMeshDriver.hxx"
5 #include "MEDMEM_define.hxx"
6 #include "MEDMEM_Compatibility21_22.hxx"
7
8 /*!
9
10   Driver Med for MESH.
11
12   Generic part : implement open and close methods.
13
14 */
15
16 namespace MEDMEM {
17 class MESH;
18 class FAMILY;
19 class GROUP;
20 class CONNECTIVITY;
21
22 class MED_MESH_DRIVER22 : public virtual MED_MESH_DRIVER
23 {
24 protected:
25   
26   med_2_2::med_idt  _medIdt ;
27   
28 public :
29
30   // all MED cell type
31   static const med_2_2::med_geometrie_element all_cell_type[MED_NBR_GEOMETRIE_MAILLE];
32   
33   static const char * const all_cell_type_tab [MED_NBR_GEOMETRIE_MAILLE];
34
35   /*!
36     Constructor.
37   */
38   MED_MESH_DRIVER22() ;
39   /*!
40     Constructor.
41   */
42   MED_MESH_DRIVER22(const string & fileName,  
43                     MESH * ptrMesh, 
44                     MED_EN::med_mode_acces accessMode) ;
45   /*!
46     Copy constructor.
47   */
48   MED_MESH_DRIVER22(const MED_MESH_DRIVER22 & driver) ;
49
50   /*!
51     Destructor.
52   */
53   virtual ~MED_MESH_DRIVER22() ;
54
55   void open();
56   void close();
57 };
58
59 /*!
60
61   Driver Med for MESH : Read only.
62
63   Implement read method.
64
65 */
66
67 class MED_MESH_RDONLY_DRIVER22 : public virtual IMED_MESH_RDONLY_DRIVER, public virtual MED_MESH_DRIVER22
68 {
69  
70 public :
71   
72   /*!
73     Constructor.
74   */
75   MED_MESH_RDONLY_DRIVER22() ;
76   /*!
77     Constructor.
78   */
79   MED_MESH_RDONLY_DRIVER22(const string & fileName, MESH * ptrMesh) ;
80   /*!
81     Copy constructor.
82   */
83   MED_MESH_RDONLY_DRIVER22(const MED_MESH_RDONLY_DRIVER22 & driver) ;
84
85   /*!
86     Destructor.
87   */
88   virtual ~MED_MESH_RDONLY_DRIVER22() ;
89   
90   /*!
91     Read MESH in the specified file.
92   */
93   void read ( void );
94
95 private:
96   int getCOORDINATE();
97   int getCONNECTIVITY();
98   int getFAMILY();
99   int getNodalConnectivity(CONNECTIVITY * Connectivity) ;
100   int getNodesFamiliesNumber(int * MEDArrayNodeFamily) ;
101   int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity) ;
102   void getGRID ();
103
104   GENDRIVER * copy ( void ) const ;
105
106 };
107
108 /*!
109
110   Driver Med for MESH : Write only.
111
112   Implement write method.
113
114 */
115
116 class MED_MESH_WRONLY_DRIVER22 : public virtual IMED_MESH_WRONLY_DRIVER, public virtual MED_MESH_DRIVER22 {
117   
118 public :
119   
120   /*!
121     Constructor.
122   */
123   MED_MESH_WRONLY_DRIVER22() ;
124   /*!
125     Constructor.
126   */
127   MED_MESH_WRONLY_DRIVER22(const string & fileName, MESH * ptrMesh) ;
128   /*!
129     Copy constructor.
130   */
131   MED_MESH_WRONLY_DRIVER22(const MED_MESH_WRONLY_DRIVER22 & driver) ;
132
133   /*!
134     Destructor.
135   */
136   virtual ~MED_MESH_WRONLY_DRIVER22() ;
137
138   /*!
139     Write MESH in the specified file.
140   */
141   void write( void ) const;
142
143 private:
144   int writeCoordinates    ()                           const;
145   int writeConnectivities (MED_EN::medEntityMesh entity)       const;
146   int writeFamilyNumbers  ()                           const;
147   int writeFamilies       (vector<FAMILY*> & families) const;
148   int writeGRID() const;
149
150   GENDRIVER * copy ( void ) const ;
151 };
152
153
154 /*!
155
156   Driver Med for MESH : Read write.
157   - Use read method from MED_MESH_RDONLY_DRIVER
158   - Use write method from MED_MESH_WRONLY_DRIVER
159
160 */
161
162 class MED_MESH_RDWR_DRIVER22 : public IMED_MESH_RDWR_DRIVER, public MED_MESH_RDONLY_DRIVER22, public MED_MESH_WRONLY_DRIVER22 {
163
164 public :
165
166   /*!
167     Constructor.
168   */
169   MED_MESH_RDWR_DRIVER22() ;
170   /*!
171     Constructor.
172   */
173   MED_MESH_RDWR_DRIVER22(const string & fileName, MESH * ptrMesh) ;
174   /*!
175     Copy constructor.
176   */
177   MED_MESH_RDWR_DRIVER22(const MED_MESH_RDWR_DRIVER22 & driver) ;
178
179   /*!
180     Destructor.
181   */
182   ~MED_MESH_RDWR_DRIVER22() ;
183
184   /*!
185     Write MESH in the specified file.
186   */
187   void write(void) const;
188   /*!
189     Read MESH in the specified file.
190   */
191   void read (void);
192
193 private:
194   GENDRIVER * copy(void) const ;
195
196 };
197 };
198
199 #endif /* MED_MESH_DRIVER22_HXX */