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 PORFLOW_MESH_DRIVER_HXX
23 #define PORFLOW_MESH_DRIVER_HXX
30 #include "MEDMEM_define.hxx"
31 #include "MEDMEM_GenDriver.hxx"
32 //#include "MEDMEM_DriverTools.hxx"
34 #include "MEDMEM_STRING.hxx"
35 #include "MEDMEM_Exception.hxx"
36 #include "MEDMEM_Utilities.hxx"
43 Driver PORFLOW for MESH.
45 Generic part : implement the readopen and close methods.
55 struct _intermediateMED;
57 class MEDMEM_EXPORT PORFLOW_MESH_DRIVER : public GENDRIVER
62 // A VOIR FILE DESCRIPTEUR ? MED_FR::med_idt _medIdt;
66 // This enumeration is used to substitude static const
67 // memers data causing link errors on VC7 compiler.
70 nb_geometrie_porflow = 6,
71 nb_nodes_max = 8, // maximal number of nodes for a porflow geometrie
72 nb_nodes2_max = 4, // maximal number of nodes for a 2D porflow geometrie
73 nb_faces_max = 6 // maximal number of faces for a porflow geometrie
76 // tableau de correspondance des types géométriques de PORFLOW -> MED
77 //static const size_t nb_geometrie_porflow = 6;
78 static const MED_EN::medGeometryElement geomPORFLOWtoMED[nb_geometrie_porflow];
79 // indirection table from PORFLOW order to MED one for nodes numerotation in all PORFLOW geometries
80 //static const size_t nb_nodes_max = 8; // maximal number of nodes for a porflow geometrie
81 //static const size_t nb_nodes2_max = 4; // maximal number of nodes for a 2D porflow geometrie
82 //static const size_t nb_faces_max = 6; // maximal number of faces for a porflow geometrie
83 static const int numPORFLOWtoMED[nb_geometrie_porflow] [nb_nodes_max];
84 static const int connectivityPORFLOW[nb_geometrie_porflow][nb_faces_max][nb_nodes2_max];
85 inline static int geomMEDtoPorflow(MED_EN::medGeometryElement medGeo);
93 PORFLOW_MESH_DRIVER() ;
97 PORFLOW_MESH_DRIVER(const string & fileName,
99 MED_EN::med_mode_acces accessMode) ;
103 PORFLOW_MESH_DRIVER(const PORFLOW_MESH_DRIVER & driver) ;
108 virtual ~PORFLOW_MESH_DRIVER() ;
110 void open() throw (MEDEXCEPTION);
111 void close() throw (MEDEXCEPTION);
113 virtual void write( void ) const = 0 ;
114 virtual void read ( void ) = 0 ;
117 Set the name of the MESH asked in file.
119 It could be different than the name of the MESH object.
121 void setMeshName(const string & meshName) ;
123 Get the name of the MESH asked in file.
125 string getMeshName() const ;
128 virtual GENDRIVER * copy ( void ) const = 0 ;
133 class MEDMEM_EXPORT PORFLOW_MESH_RDONLY_DRIVER : public virtual PORFLOW_MESH_DRIVER
141 PORFLOW_MESH_RDONLY_DRIVER() ;
145 PORFLOW_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
149 PORFLOW_MESH_RDONLY_DRIVER(const PORFLOW_MESH_RDONLY_DRIVER & driver) ;
154 virtual ~PORFLOW_MESH_RDONLY_DRIVER() ;
157 Return a MEDEXCEPTION : it is the read-only driver.
159 void write( void ) const throw (MEDEXCEPTION);
161 Read MESH in the specified file.
163 void read ( void ) throw (MEDEXCEPTION);
167 GENDRIVER * copy ( void ) const ;
169 static void readPorflowCoordinateFile(const string & coorFileName,_intermediateMED & medi,const int space_dimension);
170 static void readPorflowConnectivityFile(bool hybride,const string & connecFileName,_intermediateMED & medi,std::vector<set<_maille>::iterator>& p_ma_table,int mesh_dimension);
176 Driver Med for MESH : Write only.
178 Implement write method.
182 class MEDMEM_EXPORT PORFLOW_MESH_WRONLY_DRIVER : public virtual PORFLOW_MESH_DRIVER {
189 PORFLOW_MESH_WRONLY_DRIVER() ;
193 PORFLOW_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
197 PORFLOW_MESH_WRONLY_DRIVER(const PORFLOW_MESH_WRONLY_DRIVER & driver) ;
202 virtual ~PORFLOW_MESH_WRONLY_DRIVER() ;
205 Write MESH in the specified file.
207 void write( void ) const throw (MEDEXCEPTION);
209 Return a MEDEXCEPTION : it is the write-only driver.
211 void read ( void ) throw (MEDEXCEPTION);
215 GENDRIVER * copy ( void ) const ;
221 Driver PORFLOW for MESH : Read write.
222 - Use read method from PORFLOW_MESH_RDONLY_DRIVER
223 - Use write method from PORFLOW_MESH_WRONLY_DRIVER
227 class MEDMEM_EXPORT PORFLOW_MESH_RDWR_DRIVER : public PORFLOW_MESH_RDONLY_DRIVER, public PORFLOW_MESH_WRONLY_DRIVER {
234 PORFLOW_MESH_RDWR_DRIVER() ;
238 PORFLOW_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh) ;
242 PORFLOW_MESH_RDWR_DRIVER(const PORFLOW_MESH_RDWR_DRIVER & driver) ;
247 ~PORFLOW_MESH_RDWR_DRIVER() ;
250 Write MESH in the specified file.
252 void write(void) const throw (MEDEXCEPTION);
254 Read MESH in the specified file.
256 void read (void) throw (MEDEXCEPTION);
259 GENDRIVER * copy(void) const ;
265 #endif /* PORFLOW_MESH_DRIVER_HXX */