]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_MedMeshDriver21.hxx
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_MedMeshDriver21.hxx
1 #ifndef MED_MESH_DRIVER21_HXX
2 #define MED_MESH_DRIVER21_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_DRIVER21 : public virtual MED_MESH_DRIVER
23 {
24 protected:
25
26   med_2_1::med_idt        _medIdt;
27   
28 public :
29
30   // all MED cell type
31   static const med_2_1::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_DRIVER21() ;
39  /*!
40     Constructor.
41   */
42   MED_MESH_DRIVER21(const string & fileName,  
43                     MESH * ptrMesh, 
44                     MED_EN::med_mode_acces accessMode) ;
45   /*!
46     Copy constructor.
47   */
48   MED_MESH_DRIVER21(const MED_MESH_DRIVER21 & driver) ;
49
50   /*!
51     Destructor.
52   */
53   virtual ~MED_MESH_DRIVER21() ;
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_DRIVER21 : public virtual IMED_MESH_RDONLY_DRIVER , public virtual MED_MESH_DRIVER21
68 {
69  
70 public :
71   
72   /*!
73     Constructor.
74   */
75   MED_MESH_RDONLY_DRIVER21() ;
76   /*!
77     Constructor.
78   */
79   MED_MESH_RDONLY_DRIVER21(const string & fileName, MESH * ptrMesh) ;
80   /*!
81     Copy constructor.
82   */
83   MED_MESH_RDONLY_DRIVER21(const MED_MESH_RDONLY_DRIVER21 & driver) ;
84
85   /*!
86     Destructor.
87   */
88   virtual ~MED_MESH_RDONLY_DRIVER21() ;
89   void read(void);
90 private:
91   int getCOORDINATE();
92   int getCONNECTIVITY();
93   int getFAMILY();
94   int getNodalConnectivity(CONNECTIVITY * Connectivity) ;
95   int getNodesFamiliesNumber(int * MEDArrayNodeFamily) ;
96   int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity) ;
97   void getGRID ();
98
99   GENDRIVER * copy ( void ) const ;
100
101 };
102
103 /*!
104
105   Driver Med for MESH : Write only.
106
107   Implement write method.
108
109 */
110
111 class MED_MESH_WRONLY_DRIVER21 : public virtual IMED_MESH_WRONLY_DRIVER, public virtual MED_MESH_DRIVER21 {
112   
113 public :
114   
115   /*!
116     Constructor.
117   */
118   MED_MESH_WRONLY_DRIVER21() ;
119   /*!
120     Constructor.
121   */
122   MED_MESH_WRONLY_DRIVER21(const string & fileName, MESH * ptrMesh) ;
123   /*!
124     Copy constructor.
125   */
126   MED_MESH_WRONLY_DRIVER21(const MED_MESH_WRONLY_DRIVER21 & driver) ;
127
128   /*!
129     Destructor.
130   */
131   virtual ~MED_MESH_WRONLY_DRIVER21() ;
132
133   /*!
134     Write MESH in the specified file.
135   */
136   void write( void ) const;
137
138 private:
139   int writeCoordinates    ()                           const;
140   int writeConnectivities (MED_EN::medEntityMesh entity)       const;
141   int writeFamilyNumbers  ()                           const;
142   int writeFamilies       (vector<FAMILY*> & families) const;
143   int writeGRID() const;
144
145   GENDRIVER * copy ( void ) const ;
146 };
147
148
149 /*!
150
151   Driver Med for MESH : Read write.
152   - Use read method from MED_MESH_RDONLY_DRIVER
153   - Use write method from MED_MESH_WRONLY_DRIVER
154
155 */
156
157 class MED_MESH_RDWR_DRIVER21 : public IMED_MESH_RDWR_DRIVER, public MED_MESH_RDONLY_DRIVER21, public MED_MESH_WRONLY_DRIVER21 {
158
159 public :
160
161   /*!
162     Constructor.
163   */
164   MED_MESH_RDWR_DRIVER21() ;
165   /*!
166     Constructor.
167   */
168   MED_MESH_RDWR_DRIVER21(const string & fileName, MESH * ptrMesh) ;
169   /*!
170     Copy constructor.
171   */
172   MED_MESH_RDWR_DRIVER21(const MED_MESH_RDWR_DRIVER21 & driver) ;
173
174   /*!
175     Destructor.
176   */
177   ~MED_MESH_RDWR_DRIVER21() ;
178
179   /*!
180     Write MESH in the specified file.
181   */
182   void write(void) const;
183   /*!
184     Read MESH in the specified file.
185   */
186   void read (void);
187
188 private:
189   GENDRIVER * copy(void) const ;
190
191 };
192 };
193
194 #endif /* MED_MESH_DRIVER21_HXX */