Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ENSIGHT_MESH_DRIVER_HXX
00024 #define ENSIGHT_MESH_DRIVER_HXX
00025
00026 #include "MEDMEM_define.hxx"
00027 #include "MEDMEM_Exception.hxx"
00028 #include "MEDMEM_EnsightUtils.hxx"
00029
00030 #include <fstream>
00031
00032 namespace MEDMEM {
00033
00034 class GMESH;
00035 class SUPPORT;
00036
00037
00043
00044
00045 class MEDMEM_EXPORT ENSIGHT_MESH_DRIVER : public MEDMEM_ENSIGHT::_CaseFileDriver_User
00046 {
00047 protected:
00048
00049 GMESH * _ptrMesh;
00050 std::string _meshName;
00051
00052 virtual void openConst(bool checkDataFile=false) const;
00053
00054 public :
00055 ENSIGHT_MESH_DRIVER() ;
00056 ENSIGHT_MESH_DRIVER(const std::string & fileName, GMESH * ptrMesh) ;
00057 ENSIGHT_MESH_DRIVER(const std::string & fileName, GMESH * ptrMesh,
00058 MED_EN::med_mode_acces accessMode);
00059 ENSIGHT_MESH_DRIVER(const ENSIGHT_MESH_DRIVER & driver) ;
00060 virtual ~ENSIGHT_MESH_DRIVER() ;
00061
00062 void open();
00063 void close();
00064
00065 virtual void setMeshName(const string & meshName);
00066 virtual std::string getMeshName() const;
00067
00068 GMESH* getMesh() { return _ptrMesh; }
00069 };
00070
00071
00075
00076
00077 class MEDMEM_EXPORT ENSIGHT_MESH_RDONLY_DRIVER : public virtual ENSIGHT_MESH_DRIVER
00078 {
00079 public :
00081 ENSIGHT_MESH_RDONLY_DRIVER(const std::string & fileName, MESH * ptrMesh, int index=1);
00082
00083 ENSIGHT_MESH_RDONLY_DRIVER();
00084 ENSIGHT_MESH_RDONLY_DRIVER(const ENSIGHT_MESH_RDONLY_DRIVER & driver);
00085 virtual ~ENSIGHT_MESH_RDONLY_DRIVER();
00086 virtual GENDRIVER * copy ( void ) const;
00087 virtual void merge ( const GENDRIVER& driver );
00088 virtual void write ( void ) const throw (MEDEXCEPTION) ;
00089 virtual void read ( void ) throw (MEDEXCEPTION);
00090
00092 static int countParts(const std::string& geomFileName,
00093 const bool isSingleFileMode);
00094
00095 static GROUP* makeGroup( MEDMEM::_groupe & interGroup,
00096 MEDMEM_ENSIGHT::_InterMed & imed);
00097
00098 private:
00099
00100 void readGoldASCII (MEDMEM_ENSIGHT::_InterMed & imed);
00101 void readGoldBinary(MEDMEM_ENSIGHT::_InterMed & imed);
00102 void read6ASCII (MEDMEM_ENSIGHT::_InterMed & imed);
00103 void read6Binary (MEDMEM_ENSIGHT::_InterMed & imed);
00104
00105 static int countPartsBinary(MEDMEM_ENSIGHT::_BinaryFileReader& fileReader,
00106 const bool isSingleFileMode);
00107
00108 bool _isMadeByMed;
00109 int _indexInCaseFile;
00110 };
00111
00112
00119
00120
00121 class MEDMEM_EXPORT ENSIGHT_MESH_WRONLY_DRIVER : public virtual ENSIGHT_MESH_DRIVER
00122 {
00123 public :
00125
00126 ENSIGHT_MESH_WRONLY_DRIVER(const std::string & fileName,
00127 const GMESH * ptrMesh,
00128 bool append=false);
00129
00130 ENSIGHT_MESH_WRONLY_DRIVER();
00131 ENSIGHT_MESH_WRONLY_DRIVER(const ENSIGHT_MESH_WRONLY_DRIVER & driver);
00132 virtual ~ENSIGHT_MESH_WRONLY_DRIVER();
00133 GENDRIVER * copy ( void ) const;
00134 void write ( void ) const throw (MEDEXCEPTION) ;
00135 void read ( void ) throw (MEDEXCEPTION) ;
00136
00137 int nbPartsToWrite() const;
00138
00139 private:
00140
00141 void writePart6Binary (MEDMEM_ENSIGHT::_BinaryFileWriter& file, const SUPPORT* support) const;
00142 void writePartGoldBinary(MEDMEM_ENSIGHT::_BinaryFileWriter& file, const SUPPORT* support) const;
00143 void writePart6ASCII (std::ofstream& fileStream, const SUPPORT* support) const;
00144 void writePartGoldASCII (std::ofstream& fileStream, const SUPPORT* support) const;
00145
00146 bool _append;
00147 };
00148
00149 }
00150
00151 #endif
00152