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 MED_MESH_DRIVER_HXX
24 #define MED_MESH_DRIVER_HXX
30 #include "MEDMEM_define.hxx"
31 #include "MEDMEM_GenDriver.hxx"
33 #include "MEDMEM_STRING.hxx"
34 #include "MEDMEM_Exception.hxx"
35 #include "MEDMEM_Utilities.hxx"
41 Generic part : implement open and close methods.
50 class MEDMEM_EXPORT MED_MESH_DRIVER : public GENDRIVER
55 mutable std::string _meshName;
56 med_2_3::med_idt _medIdt ;
63 static const med_2_3::med_geometry_type all_cell_type[MED_N_CELL_GEO_FIXED_CON];
65 static const char * const all_cell_type_tab [MED_N_CELL_GEO_FIXED_CON];
74 MED_MESH_DRIVER(const std::string & fileName,
76 MED_EN::med_mode_acces accessMode) ;
80 MED_MESH_DRIVER(const MED_MESH_DRIVER & driver) ;
85 virtual ~MED_MESH_DRIVER() ;
90 virtual void write( void ) const = 0 ;
91 virtual void read ( void ) = 0 ;
94 Set the name of the MESH asked in file.
96 It could be different than the name of the MESH object.
98 virtual void setMeshName(const std::string & meshName) ;
100 Get the name of the MESH asked in file.
102 virtual std::string getMeshName() const ;
105 virtual GENDRIVER * copy ( void ) const = 0 ;
111 Driver Med for MESH : Read only.
113 Implement read method.
117 class MEDMEM_EXPORT MED_MESH_RDONLY_DRIVER : public virtual MED_MESH_DRIVER
125 MED_MESH_RDONLY_DRIVER() ;
129 MED_MESH_RDONLY_DRIVER(const std::string & fileName, GMESH * ptrMesh) ;
133 MED_MESH_RDONLY_DRIVER(const MED_MESH_RDONLY_DRIVER & driver) ;
137 virtual ~MED_MESH_RDONLY_DRIVER() ;
140 Return a MEDEXCEPTION : it is the read-only driver.
142 void write( void ) const;
144 Read MESH in the specified file.
148 * This method activate global faces computation from SCRATCH if a family on FACE exists in the MED file.
149 * This implies a complete renumbering of FACES. This is the default behaviour of this driver.
151 void activateFacesComputation() { _computeFaces=true; }
153 * This method desactivate global face computation.
154 * That is to say that FACES described in file are supposed to
155 * be correct and complete. The consequence is that reading is much faster. Use with care !
157 void desactivateFacesComputation() { _computeFaces=false; }
160 int getDescendingConnectivity(CONNECTIVITY * Connectivity);
161 void updateFamily() ;
162 void buildAllGroups(std::vector<GROUP*> & Groups, std::vector<FAMILY*> & Families) ;
166 int getCONNECTIVITY();
168 int getNodalConnectivity(CONNECTIVITY * Connectivity) ;
169 int getNodesFamiliesNumber(int * MEDArrayNodeFamily) ;
170 int getCellsFamiliesNumber(int** Arrays, /*CONNECTIVITY* Connectivity, */MED_EN::medEntityMesh entity) ;
173 GENDRIVER * copy ( void ) const ;
174 virtual void merge ( const GENDRIVER& driver );
182 Driver Med for MESH : Write only.
184 Implement write method.
188 class MEDMEM_EXPORT MED_MESH_WRONLY_DRIVER : public virtual MED_MESH_DRIVER
195 MED_MESH_WRONLY_DRIVER() ;
199 MED_MESH_WRONLY_DRIVER(const std::string & fileName,
201 MED_EN::med_mode_acces access=MED_EN::WRONLY) ;
205 MED_MESH_WRONLY_DRIVER(const MED_MESH_WRONLY_DRIVER & driver) ;
210 virtual ~MED_MESH_WRONLY_DRIVER() ;
213 Return a MEDEXCEPTION : it is the write-only driver.
218 Write MESH in the specified file.
220 void write( void ) const;
223 int writeCoordinates () const;
224 int writeConnectivities (MED_EN::medEntityMesh entity) const;
225 void groupFamilyConverter(const std::vector<GROUP*>& groups,
226 std::vector<FAMILY*>& families) const;
227 int writeFamilyNumbers () const;
228 int writeFamilies (std::vector<FAMILY*> & families) const;
229 int writeGRID() const;
231 GENDRIVER * copy ( void ) const ;
237 Driver Med for MESH : Read write.
238 - Use read method from MED_MESH_RDONLY_DRIVER
239 - Use write method from MED_MESH_WRONLY_DRIVER
243 class MEDMEM_EXPORT MED_MESH_RDWR_DRIVER : public virtual MED_MESH_RDONLY_DRIVER, public virtual MED_MESH_WRONLY_DRIVER {
250 MED_MESH_RDWR_DRIVER() ;
254 MED_MESH_RDWR_DRIVER(const std::string & fileName, GMESH * ptrMesh) ;
258 MED_MESH_RDWR_DRIVER(const MED_MESH_RDWR_DRIVER & driver) ;
263 ~MED_MESH_RDWR_DRIVER() ;
266 Write MESH in the specified file.
268 void write(void) const;
270 Read MESH in the specified file.
275 GENDRIVER * copy(void) const ;
281 #endif /* MED_MESH_DRIVER_HXX */