1 #ifndef PORFLOW_MESH_DRIVER_HXX
2 #define PORFLOW_MESH_DRIVER_HXX
7 #include "MEDMEM_define.hxx"
8 #include "MEDMEM_GenDriver.hxx"
9 #include "MEDMEM_DriverTools.hxx"
11 #include "MEDMEM_STRING.hxx"
12 #include "MEDMEM_Exception.hxx"
13 #include "utilities.h"
17 Driver PORFLOW for MESH.
19 Generic part : implement the readopen and close methods.
29 class PORFLOW_MESH_DRIVER : public GENDRIVER
34 // A VOIR FILE DESCRIPTEUR ? MED_FR::med_idt _medIdt;
38 // tableau de correspondance des types géométriques de PORFLOW -> MED
39 static const size_t nb_geometrie_porflow = 6;
40 static const MED_EN::medGeometryElement geomPORFLOWtoMED[nb_geometrie_porflow];
41 // indirection table from PORFLOW order to MED one for nodes numerotation in all PORFLOW geometries
42 static const size_t nb_nodes_max = 8; // maximal number of nodes for a porflow geometrie
43 static const size_t nb_nodes2_max = 4; // maximal number of nodes for a 2D porflow geometrie
44 static const size_t nb_faces_max = 6; // maximal number of faces for a porflow geometrie
45 static const int numPORFLOWtoMED[nb_geometrie_porflow] [nb_nodes_max];
46 static const int connectivityPORFLOW[nb_geometrie_porflow][nb_faces_max][nb_nodes2_max];
47 inline static int geomMEDtoPorflow(MED_EN::medGeometryElement medGeo);
55 PORFLOW_MESH_DRIVER() ;
59 PORFLOW_MESH_DRIVER(const string & fileName,
61 MED_EN::med_mode_acces accessMode) ;
65 PORFLOW_MESH_DRIVER(const PORFLOW_MESH_DRIVER & driver) ;
70 virtual ~PORFLOW_MESH_DRIVER() ;
72 void open() throw (MEDEXCEPTION);
73 void close() throw (MEDEXCEPTION);
75 virtual void write( void ) const = 0 ;
76 virtual void read ( void ) = 0 ;
79 Set the name of the MESH asked in file.
81 It could be different than the name of the MESH object.
83 void setMeshName(const string & meshName) ;
85 Get the name of the MESH asked in file.
87 string getMeshName() const ;
90 virtual GENDRIVER * copy ( void ) const = 0 ;
95 class PORFLOW_MESH_RDONLY_DRIVER : public virtual PORFLOW_MESH_DRIVER
103 PORFLOW_MESH_RDONLY_DRIVER() ;
107 PORFLOW_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
111 PORFLOW_MESH_RDONLY_DRIVER(const PORFLOW_MESH_RDONLY_DRIVER & driver) ;
116 virtual ~PORFLOW_MESH_RDONLY_DRIVER() ;
119 Return a MEDEXCEPTION : it is the read-only driver.
121 void write( void ) const throw (MEDEXCEPTION);
123 Read MESH in the specified file.
125 void read ( void ) throw (MEDEXCEPTION);
129 GENDRIVER * copy ( void ) const ;
131 static void readPorflowCoordinateFile(const string & coorFileName,_intermediateMED & medi,const int space_dimension);
132 static void readPorflowConnectivityFile(bool hybride,const string & connecFileName,_intermediateMED & medi,std::vector<set<_maille>::iterator>& p_ma_table,int mesh_dimension);
138 Driver Med for MESH : Write only.
140 Implement write method.
144 class PORFLOW_MESH_WRONLY_DRIVER : public virtual PORFLOW_MESH_DRIVER {
151 PORFLOW_MESH_WRONLY_DRIVER() ;
155 PORFLOW_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
159 PORFLOW_MESH_WRONLY_DRIVER(const PORFLOW_MESH_WRONLY_DRIVER & driver) ;
164 virtual ~PORFLOW_MESH_WRONLY_DRIVER() ;
167 Write MESH in the specified file.
169 void write( void ) const throw (MEDEXCEPTION);
171 Return a MEDEXCEPTION : it is the write-only driver.
173 void read ( void ) throw (MEDEXCEPTION);
177 GENDRIVER * copy ( void ) const ;
183 Driver PORFLOW for MESH : Read write.
184 - Use read method from PORFLOW_MESH_RDONLY_DRIVER
185 - Use write method from PORFLOW_MESH_WRONLY_DRIVER
189 class PORFLOW_MESH_RDWR_DRIVER : public PORFLOW_MESH_RDONLY_DRIVER, public PORFLOW_MESH_WRONLY_DRIVER {
196 PORFLOW_MESH_RDWR_DRIVER() ;
200 PORFLOW_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh) ;
204 PORFLOW_MESH_RDWR_DRIVER(const PORFLOW_MESH_RDWR_DRIVER & driver) ;
209 ~PORFLOW_MESH_RDWR_DRIVER() ;
212 Write MESH in the specified file.
214 void write(void) const throw (MEDEXCEPTION);
216 Read MESH in the specified file.
218 void read (void) throw (MEDEXCEPTION);
221 GENDRIVER * copy(void) const ;
227 #endif /* PORFLOW_MESH_DRIVER_HXX */