1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef MED_MESH_DRIVER_HXX
23 #define MED_MESH_DRIVER_HXX
29 #include "MEDMEM_define.hxx"
30 #include "MEDMEM_GenDriver.hxx"
32 #include "MEDMEM_STRING.hxx"
33 #include "MEDMEM_Exception.hxx"
34 #include "MEDMEM_Utilities.hxx"
40 Generic part : implement open and close methods.
49 class MEDMEM_EXPORT MED_MESH_DRIVER : public GENDRIVER
54 mutable string _meshName;
55 int _meshNum; // INUTILE ?
67 MED_MESH_DRIVER(const string & fileName,
69 MED_EN::med_mode_acces accessMode) ;
73 MED_MESH_DRIVER(const MED_MESH_DRIVER & driver) ;
78 virtual ~MED_MESH_DRIVER() ;
80 virtual void open() = 0;
81 virtual void close() = 0;
83 virtual void write( void ) const = 0 ;
84 virtual void read ( void ) = 0 ;
87 Set the name of the MESH asked in file.
89 It could be different than the name of the MESH object.
91 virtual void setMeshName(const string & meshName) ;
93 Get the name of the MESH asked in file.
95 virtual string getMeshName() const ;
98 virtual GENDRIVER * copy ( void ) const = 0 ;
104 Driver Med for MESH : Read only.
106 Implement read method.
110 class MEDMEM_EXPORT IMED_MESH_RDONLY_DRIVER : public virtual MED_MESH_DRIVER
118 IMED_MESH_RDONLY_DRIVER() ;
122 IMED_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
126 IMED_MESH_RDONLY_DRIVER(const IMED_MESH_RDONLY_DRIVER & driver) ;
128 // CREER UNE METHODE POUR LIRE LA LISTE DES MAILLAGES .....
130 Return a MEDEXCEPTION : it is the read-only driver.
132 void write( void ) const;
133 virtual void activateFacesComputation() = 0;
134 virtual void desactivateFacesComputation() = 0;
137 // virtual int getCOORDINATE() = 0 ;
138 // virtual int getCONNECTIVITY() = 0 ;
139 // virtual int getFAMILY() = 0 ;
140 // virtual int getNodalConnectivity(CONNECTIVITY * Connectivity) = 0 ;
141 int getDescendingConnectivity(CONNECTIVITY * Connectivity);
142 // virtual int getNodesFamiliesNumber(int * MEDArrayNodeFamily) = 0 ;
143 // virtual int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity) = 0 ;
144 void updateFamily() ;
145 void buildAllGroups(vector<GROUP*> & Groups, vector<FAMILY*> & Families) ;
146 // virtual void getGRID () = 0 ;
148 friend class MED_MESH_RDONLY_DRIVER;
154 Driver Med for MESH : Write only.
156 Implement write method.
160 class MEDMEM_EXPORT IMED_MESH_WRONLY_DRIVER : public virtual MED_MESH_DRIVER {
167 IMED_MESH_WRONLY_DRIVER() ;
171 IMED_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh, MED_EN::med_mode_acces access=MED_EN::WRONLY) ;
175 IMED_MESH_WRONLY_DRIVER(const IMED_MESH_WRONLY_DRIVER & driver) ;
180 virtual ~IMED_MESH_WRONLY_DRIVER() ;
183 Return a MEDEXCEPTION : it is the write-only driver.
188 // virtual int writeCoordinates () const = 0 ;
189 // virtual int writeConnectivities (MED_EN::medEntityMesh entity) const = 0 ;
190 // virtual int writeFamilyNumbers () const = 0 ;
191 // virtual int writeFamilies (vector<FAMILY*> & families) const = 0 ;
192 // virtual int writeGRID() const = 0 ;
194 friend class MED_MESH_WRONLY_DRIVER;
200 Driver Med for MESH : Read write.
201 - Use read method from MED_MESH_RDONLY_DRIVER
202 - Use write method from MED_MESH_WRONLY_DRIVER
206 class MEDMEM_EXPORT IMED_MESH_RDWR_DRIVER : public virtual IMED_MESH_RDONLY_DRIVER, public virtual IMED_MESH_WRONLY_DRIVER {
213 IMED_MESH_RDWR_DRIVER() ;
217 IMED_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh) ;
221 IMED_MESH_RDWR_DRIVER(const IMED_MESH_RDWR_DRIVER & driver) ;
226 ~IMED_MESH_RDWR_DRIVER() ;
228 friend class MED_MESH_RDWR_DRIVER;
232 class MEDMEM_EXPORT MED_MESH_RDONLY_DRIVER : public virtual IMED_MESH_RDONLY_DRIVER
235 MED_MESH_RDONLY_DRIVER();
236 MED_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh);
237 MED_MESH_RDONLY_DRIVER(const MED_MESH_RDONLY_DRIVER & driver);
238 ~MED_MESH_RDONLY_DRIVER();
239 void setMeshName(const string & meshName);
240 string getMeshName() const;
241 void write( void ) const;
242 void activateFacesComputation();
243 void desactivateFacesComputation();
247 virtual void merge ( const GENDRIVER& driver );
248 virtual void setFileName ( const string & fileName) {_concreteMeshDrv->setFileName(fileName); }
250 GENDRIVER * _concreteMeshDrv;
251 // int getCOORDINATE();
252 // int getCONNECTIVITY();
254 // int getNodalConnectivity(CONNECTIVITY * Connectivity);
255 // int getDescendingConnectivity(CONNECTIVITY * Connectivity);
256 // int getNodesFamiliesNumber(int * MEDArrayNodeFamily);
257 // int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity);
259 GENDRIVER * copy ( void ) const;
262 class MEDMEM_EXPORT MED_MESH_WRONLY_DRIVER : public virtual IMED_MESH_WRONLY_DRIVER {
264 MED_MESH_WRONLY_DRIVER();
265 MED_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh, MED_EN::med_mode_acces access=MED_EN::WRONLY);
266 MED_MESH_WRONLY_DRIVER(const MED_MESH_WRONLY_DRIVER & driver);
267 ~MED_MESH_WRONLY_DRIVER();
268 void setMeshName(const string & meshName);
269 string getMeshName() const;
271 void write( void ) const;
274 virtual void merge ( const GENDRIVER& driver );
275 virtual void setFileName ( const string & fileName) {_concreteMeshDrv->setFileName(fileName); }
277 GENDRIVER * _concreteMeshDrv;
278 // int writeCoordinates () const;
279 // int writeConnectivities (MED_EN::medEntityMesh entity) const;
280 // int writeFamilyNumbers () const;
281 // int writeFamilies (vector<FAMILY*> & families) const;
282 // int writeGRID() const;
283 GENDRIVER * copy ( void ) const;
286 class MEDMEM_EXPORT MED_MESH_RDWR_DRIVER : public IMED_MESH_RDWR_DRIVER {
288 MED_MESH_RDWR_DRIVER();
289 MED_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh);
290 MED_MESH_RDWR_DRIVER(const MED_MESH_RDWR_DRIVER & driver);
291 ~MED_MESH_RDWR_DRIVER();
292 void setMeshName(const string & meshName);
293 string getMeshName() const;
295 void write( void ) const;
296 void activateFacesComputation();
297 void desactivateFacesComputation();
300 virtual void merge ( const GENDRIVER& driver );
301 virtual void setFileName ( const string & fileName) {_concreteMeshDrv->setFileName(fileName); }
303 GENDRIVER * _concreteMeshDrv;
304 // int getCOORDINATE();
305 // int getCONNECTIVITY();
307 // int getNodalConnectivity(CONNECTIVITY * Connectivity);
308 // int getDescendingConnectivity(CONNECTIVITY * Connectivity);
309 // int getNodesFamiliesNumber(int * MEDArrayNodeFamily);
310 // int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity);
312 // int writeCoordinates () const;
313 // int writeConnectivities (MED_EN::medEntityMesh entity) const;
314 // int writeFamilyNumbers () const;
315 // int writeFamilies (vector<FAMILY*> & families) const;
316 // int writeGRID() const;
317 GENDRIVER * copy ( void ) const;
322 #endif /* MED_MESH_DRIVER_HXX */