1 // Copyright (C) 2007-2012 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
23 #ifndef PORFLOW_MESH_DRIVER_HXX
24 #define PORFLOW_MESH_DRIVER_HXX
31 #include "MEDMEM_define.hxx"
32 #include "MEDMEM_GenDriver.hxx"
33 //#include "MEDMEM_DriverTools.hxx"
35 #include "MEDMEM_STRING.hxx"
36 #include "MEDMEM_Exception.hxx"
37 #include "MEDMEM_Utilities.hxx"
44 Driver PORFLOW for MESH.
46 Generic part : implement the readopen and close methods.
57 struct _intermediateMED;
59 class MEDMEM_EXPORT PORFLOW_MESH_DRIVER : public GENDRIVER
64 // A VOIR FILE DESCRIPTEUR ? MED_FR::med_idt _medIdt;
68 // This enumeration is used to substitude static const
69 // memers data causing link errors on VC7 compiler.
72 nb_geometrie_porflow = 6,
73 nb_nodes_max = 8, // maximal number of nodes for a porflow geometrie
74 nb_nodes2_max = 4, // maximal number of nodes for a 2D porflow geometrie
75 nb_faces_max = 6 // maximal number of faces for a porflow geometrie
78 // tableau de correspondance des types géométriques de PORFLOW -> MED
79 //static const size_t nb_geometrie_porflow = 6;
80 static const MED_EN::medGeometryElement geomPORFLOWtoMED[nb_geometrie_porflow];
81 // indirection table from PORFLOW order to MED one for nodes numerotation in all PORFLOW geometries
82 //static const size_t nb_nodes_max = 8; // maximal number of nodes for a porflow geometrie
83 //static const size_t nb_nodes2_max = 4; // maximal number of nodes for a 2D porflow geometrie
84 //static const size_t nb_faces_max = 6; // maximal number of faces for a porflow geometrie
85 static const int numPORFLOWtoMED[nb_geometrie_porflow] [nb_nodes_max];
86 static const int connectivityPORFLOW[nb_geometrie_porflow][nb_faces_max][nb_nodes2_max];
87 inline static int geomMEDtoPorflow(MED_EN::medGeometryElement medGeo);
95 PORFLOW_MESH_DRIVER() ;
99 PORFLOW_MESH_DRIVER(const string & fileName,
101 MED_EN::med_mode_acces accessMode) ;
105 PORFLOW_MESH_DRIVER(const PORFLOW_MESH_DRIVER & driver) ;
110 virtual ~PORFLOW_MESH_DRIVER() ;
112 void open() throw (MEDEXCEPTION);
113 void close() throw (MEDEXCEPTION);
115 virtual void write( void ) const = 0 ;
116 virtual void read ( void ) = 0 ;
119 Set the name of the MESH asked in file.
121 It could be different than the name of the MESH object.
123 void setMeshName(const string & meshName) ;
125 Get the name of the MESH asked in file.
127 string getMeshName() const ;
130 virtual GENDRIVER * copy ( void ) const = 0 ;
135 class MEDMEM_EXPORT PORFLOW_MESH_RDONLY_DRIVER : public virtual PORFLOW_MESH_DRIVER
143 PORFLOW_MESH_RDONLY_DRIVER() ;
147 PORFLOW_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
151 PORFLOW_MESH_RDONLY_DRIVER(const PORFLOW_MESH_RDONLY_DRIVER & driver) ;
156 virtual ~PORFLOW_MESH_RDONLY_DRIVER() ;
159 Return a MEDEXCEPTION : it is the read-only driver.
161 void write( void ) const throw (MEDEXCEPTION);
163 Read MESH in the specified file.
165 void read ( void ) throw (MEDEXCEPTION);
169 GENDRIVER * copy ( void ) const ;
171 static void readPorflowCoordinateFile(const string & coorFileName,_intermediateMED & medi,const int space_dimension);
172 static void readPorflowConnectivityFile(bool hybride,const string & connecFileName,_intermediateMED & medi,std::vector<set<_maille>::iterator>& p_ma_table,int mesh_dimension);
178 Driver Med for MESH : Write only.
180 Implement write method.
184 class MEDMEM_EXPORT PORFLOW_MESH_WRONLY_DRIVER : public virtual PORFLOW_MESH_DRIVER {
191 PORFLOW_MESH_WRONLY_DRIVER() ;
195 PORFLOW_MESH_WRONLY_DRIVER(const string & fileName, GMESH * ptrMesh) ;
199 PORFLOW_MESH_WRONLY_DRIVER(const PORFLOW_MESH_WRONLY_DRIVER & driver) ;
204 virtual ~PORFLOW_MESH_WRONLY_DRIVER() ;
207 Write MESH in the specified file.
209 void write( void ) const throw (MEDEXCEPTION);
211 Return a MEDEXCEPTION : it is the write-only driver.
213 void read ( void ) throw (MEDEXCEPTION);
217 GENDRIVER * copy ( void ) const ;
223 Driver PORFLOW for MESH : Read write.
224 - Use read method from PORFLOW_MESH_RDONLY_DRIVER
225 - Use write method from PORFLOW_MESH_WRONLY_DRIVER
229 class MEDMEM_EXPORT PORFLOW_MESH_RDWR_DRIVER : public PORFLOW_MESH_RDONLY_DRIVER, public PORFLOW_MESH_WRONLY_DRIVER {
236 PORFLOW_MESH_RDWR_DRIVER() ;
240 PORFLOW_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh) ;
244 PORFLOW_MESH_RDWR_DRIVER(const PORFLOW_MESH_RDWR_DRIVER & driver) ;
249 ~PORFLOW_MESH_RDWR_DRIVER() ;
252 Write MESH in the specified file.
254 void write(void) const throw (MEDEXCEPTION);
256 Read MESH in the specified file.
258 void read (void) throw (MEDEXCEPTION);
261 GENDRIVER * copy(void) const ;
267 #endif /* PORFLOW_MESH_DRIVER_HXX */