1 // MED MEDMEM : MED files in memory
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : MEDMEM_MedMeshDriver.hxx
27 #ifndef MED_MESH_DRIVER_HXX
28 #define MED_MESH_DRIVER_HXX
32 #include "MEDMEM_define.hxx"
33 #include "MEDMEM_GenDriver.hxx"
35 #include "MEDMEM_STRING.hxx"
36 #include "MEDMEM_Exception.hxx"
37 #include "utilities.h"
48 Generic part : implement open and close methods.
52 class MED_MESH_DRIVER : public GENDRIVER
57 MED_FR::med_idt _medIdt;
58 string _meshName; // const ?
59 int _meshNum; // INUTILE ?
64 static const MED_FR::med_geometrie_element all_cell_type[MED_NBR_GEOMETRIE_MAILLE];
66 static const char * const all_cell_type_tab [MED_NBR_GEOMETRIE_MAILLE];
75 MED_MESH_DRIVER(const string & fileName,
77 med_mode_acces accessMode) ;
81 MED_MESH_DRIVER(const MED_MESH_DRIVER & driver) ;
86 virtual ~MED_MESH_DRIVER() ;
88 void open() throw (MEDEXCEPTION);
89 void close() throw (MEDEXCEPTION);
91 virtual void write( void ) const = 0 ;
92 virtual void read ( void ) = 0 ;
95 Set the name of the MESH asked in file.
97 It could be different than the name of the MESH object.
99 void setMeshName(const string & meshName) ;
101 Get the name of the MESH asked in file.
103 string getMeshName() const ;
106 virtual GENDRIVER * copy ( void ) const = 0 ;
112 Driver Med for MESH : Read only.
114 Implement read method.
118 class MED_MESH_RDONLY_DRIVER : public virtual MED_MESH_DRIVER
126 MED_MESH_RDONLY_DRIVER() ;
130 MED_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
134 MED_MESH_RDONLY_DRIVER(const MED_MESH_RDONLY_DRIVER & driver) ;
139 virtual ~MED_MESH_RDONLY_DRIVER() ;
141 // CREER UNE METHODE POUR LIRE LA LISTE DES MAILLAGES .....
144 Return a MEDEXCEPTION : it is the read-only driver.
146 void write( void ) const throw (MEDEXCEPTION);
148 Read MESH in the specified file.
150 void read ( void ) throw (MEDEXCEPTION);
154 int getCONNECTIVITY();
156 int getNodalConnectivity(CONNECTIVITY * Connectivity) ;
157 int getDescendingConnectivity(CONNECTIVITY * Connectivity) ;
158 int getNodesFamiliesNumber(int * MEDArrayNodeFamily) ;
159 int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity) ;
160 void updateFamily() ;
161 void buildAllGroups(vector<GROUP*> & Groups, vector<FAMILY*> & Families) ;
164 GENDRIVER * copy ( void ) const ;
170 Driver Med for MESH : Write only.
172 Implement write method.
176 class MED_MESH_WRONLY_DRIVER : public virtual MED_MESH_DRIVER {
183 MED_MESH_WRONLY_DRIVER() ;
187 MED_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
191 MED_MESH_WRONLY_DRIVER(const MED_MESH_WRONLY_DRIVER & driver) ;
196 virtual ~MED_MESH_WRONLY_DRIVER() ;
199 Write MESH in the specified file.
201 void write( void ) const throw (MEDEXCEPTION);
203 Return a MEDEXCEPTION : it is the write-only driver.
205 void read ( void ) throw (MEDEXCEPTION);
208 int writeCoordinates () const;
209 int writeConnectivities (medEntityMesh entity) const;
210 int writeFamilyNumbers () const;
211 int writeFamilies (vector<FAMILY*> & families) const;
212 int writeGRID() const;
214 GENDRIVER * copy ( void ) const ;
220 Driver Med for MESH : Read write.
221 - Use read method from MED_MESH_RDONLY_DRIVER
222 - Use write method from MED_MESH_WRONLY_DRIVER
226 class MED_MESH_RDWR_DRIVER : public MED_MESH_RDONLY_DRIVER, public MED_MESH_WRONLY_DRIVER {
233 MED_MESH_RDWR_DRIVER() ;
237 MED_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh) ;
241 MED_MESH_RDWR_DRIVER(const MED_MESH_RDWR_DRIVER & driver) ;
246 ~MED_MESH_RDWR_DRIVER() ;
249 Write MESH in the specified file.
251 void write(void) const throw (MEDEXCEPTION);
253 Read MESH in the specified file.
255 void read (void) throw (MEDEXCEPTION);
258 GENDRIVER * copy(void) const ;
262 #endif /* MED_MESH_DRIVER_HXX */