src/MEDMEM/MEDMEM_MedMeshDriver.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00002 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00003 // 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either 
00007 // version 2.1 of the License.
00008 // 
00009 // This library is distributed in the hope that it will be useful 
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00012 // Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public  
00015 // License along with this library; if not, write to the Free Software 
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 //
00018 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 //
00020 #ifndef MED_MESH_DRIVER_HXX
00021 #define MED_MESH_DRIVER_HXX
00022 
00023 #include <string>
00024 #include <vector>
00025 #include "MEDMEM_define.hxx"
00026 #include "MEDMEM_GenDriver.hxx"
00027 
00028 #include "MEDMEM_STRING.hxx"
00029 #include "MEDMEM_Exception.hxx"
00030 #include "MEDMEM_Utilities.hxx"
00031 
00040 namespace MEDMEM {
00041 class MESH;
00042 class FAMILY;
00043 class GROUP;
00044 class CONNECTIVITY;
00045 class MED_MESH_DRIVER : public GENDRIVER
00046 {
00047 protected:
00048 
00049   MESH *         _ptrMesh;
00050   mutable string _meshName;
00051   int            _meshNum;     // INUTILE ?
00052 
00053 
00054 public :
00055 
00059   MED_MESH_DRIVER() ;
00063   MED_MESH_DRIVER(const string & fileName,
00064             MESH * ptrMesh,
00065             MED_EN::med_mode_acces accessMode) ;
00069   MED_MESH_DRIVER(const MED_MESH_DRIVER & driver) ;
00070 
00074   virtual ~MED_MESH_DRIVER() ;
00075 
00076   virtual void open() = 0;
00077   virtual void close() = 0;
00078 
00079   virtual void write( void ) const = 0 ;
00080   virtual void read ( void ) = 0 ;
00081 
00087   virtual void   setMeshName(const string & meshName) ;
00091   virtual string getMeshName() const ;
00092 
00093 public:
00094   virtual GENDRIVER * copy ( void ) const = 0 ;
00095 
00096 };
00097 
00106   class IMED_MESH_RDONLY_DRIVER : public virtual MED_MESH_DRIVER
00107 {
00108  
00109 public :
00110   
00114   IMED_MESH_RDONLY_DRIVER() ;
00118   IMED_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
00122   IMED_MESH_RDONLY_DRIVER(const IMED_MESH_RDONLY_DRIVER & driver) ;
00123   
00124   // CREER UNE METHODE POUR LIRE LA LISTE DES MAILLAGES .....
00128   void write( void ) const;
00129 
00130 protected:
00131 //   virtual int getCOORDINATE() = 0 ;
00132 //   virtual int getCONNECTIVITY() = 0 ;
00133 //   virtual int getFAMILY() = 0 ;
00134 //   virtual int getNodalConnectivity(CONNECTIVITY * Connectivity) = 0 ;
00135   int getDescendingConnectivity(CONNECTIVITY * Connectivity);
00136 //   virtual int getNodesFamiliesNumber(int * MEDArrayNodeFamily) = 0 ;
00137 //   virtual int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity) = 0 ;
00138   void updateFamily() ;
00139   void buildAllGroups(vector<GROUP*> & Groups, vector<FAMILY*> & Families) ;
00140 //   virtual void getGRID () = 0 ;
00141 
00142   friend class MED_MESH_RDONLY_DRIVER;
00143 
00144 };
00145 
00154 class IMED_MESH_WRONLY_DRIVER : public virtual MED_MESH_DRIVER {
00155   
00156 public :
00157   
00161   IMED_MESH_WRONLY_DRIVER() ;
00165   IMED_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
00169   IMED_MESH_WRONLY_DRIVER(const IMED_MESH_WRONLY_DRIVER & driver) ;
00170 
00174   virtual ~IMED_MESH_WRONLY_DRIVER() ;
00175 
00179   void read ( void );
00180 
00181 // protected:
00182 //   virtual int writeCoordinates    ()                           const = 0 ;
00183 //   virtual int writeConnectivities (MED_EN::medEntityMesh entity)       const = 0 ;
00184 //   virtual int writeFamilyNumbers  ()                           const = 0 ;
00185 //   virtual int writeFamilies       (vector<FAMILY*> & families) const = 0 ;
00186 //   virtual int writeGRID() const = 0 ;
00187 
00188   friend class MED_MESH_WRONLY_DRIVER;
00189 };
00190 
00191 
00200 class IMED_MESH_RDWR_DRIVER : public virtual IMED_MESH_RDONLY_DRIVER, public virtual IMED_MESH_WRONLY_DRIVER {
00201 
00202 public :
00203 
00207   IMED_MESH_RDWR_DRIVER() ;
00211   IMED_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh) ;
00215   IMED_MESH_RDWR_DRIVER(const IMED_MESH_RDWR_DRIVER & driver) ;
00216 
00220   ~IMED_MESH_RDWR_DRIVER() ;
00221 
00222   friend class MED_MESH_RDWR_DRIVER;
00223 
00224 };
00225 
00226 class MED_MESH_RDONLY_DRIVER : public virtual IMED_MESH_RDONLY_DRIVER
00227 {
00228 public:
00229   MED_MESH_RDONLY_DRIVER();
00230   MED_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh);
00231   MED_MESH_RDONLY_DRIVER(const MED_MESH_RDONLY_DRIVER & driver);
00232   ~MED_MESH_RDONLY_DRIVER();
00233   void   setMeshName(const string & meshName);
00234   string getMeshName() const;
00235   void write( void ) const;
00236   void read ( void );
00237   void open();
00238   void close();
00239 protected:
00240   GENDRIVER * _concreteMeshDrv;
00241 //   int getCOORDINATE();
00242 //   int getCONNECTIVITY();
00243 //   int getFAMILY();
00244 //   int getNodalConnectivity(CONNECTIVITY * Connectivity);
00245 //   int getDescendingConnectivity(CONNECTIVITY * Connectivity);
00246 //   int getNodesFamiliesNumber(int * MEDArrayNodeFamily);
00247 //   int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity);
00248 //   void getGRID ();
00249   GENDRIVER * copy ( void ) const;
00250 };
00251 
00252 class MED_MESH_WRONLY_DRIVER : public virtual IMED_MESH_WRONLY_DRIVER {
00253 public :
00254   MED_MESH_WRONLY_DRIVER();
00255   MED_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh);
00256   MED_MESH_WRONLY_DRIVER(const MED_MESH_WRONLY_DRIVER & driver);
00257   ~MED_MESH_WRONLY_DRIVER();
00258   void   setMeshName(const string & meshName);
00259   string getMeshName() const;
00260   void read ( void );
00261   void write( void ) const;
00262   void open();
00263   void close();
00264 protected:
00265   GENDRIVER * _concreteMeshDrv;
00266 //   int writeCoordinates    ()                           const;
00267 //   int writeConnectivities (MED_EN::medEntityMesh entity)       const;
00268 //   int writeFamilyNumbers  ()                           const;
00269 //   int writeFamilies       (vector<FAMILY*> & families) const;
00270 //   int writeGRID() const;
00271   GENDRIVER * copy ( void ) const;
00272 };
00273 
00274 class MED_MESH_RDWR_DRIVER : public IMED_MESH_RDWR_DRIVER {
00275 public :
00276   MED_MESH_RDWR_DRIVER();
00277   MED_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh);
00278   MED_MESH_RDWR_DRIVER(const MED_MESH_RDWR_DRIVER & driver);
00279   ~MED_MESH_RDWR_DRIVER();
00280   void   setMeshName(const string & meshName);
00281   string getMeshName() const;
00282   void read ( void );
00283   void write( void ) const;
00284   void open();
00285   void close();
00286 protected:
00287   GENDRIVER * _concreteMeshDrv;
00288 //   int getCOORDINATE();
00289 //   int getCONNECTIVITY();
00290 //   int getFAMILY();
00291 //   int getNodalConnectivity(CONNECTIVITY * Connectivity);
00292 //   int getDescendingConnectivity(CONNECTIVITY * Connectivity);
00293 //   int getNodesFamiliesNumber(int * MEDArrayNodeFamily);
00294 //   int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity);
00295 //   void getGRID ();
00296 //   int writeCoordinates    ()                           const;
00297 //   int writeConnectivities (MED_EN::medEntityMesh entity)       const;
00298 //   int writeFamilyNumbers  ()                           const;
00299 //   int writeFamilies       (vector<FAMILY*> & families) const;
00300 //   int writeGRID() const;
00301   GENDRIVER * copy ( void ) const;
00302 };
00303 
00304 };
00305 
00306 #endif /* MED_MESH_DRIVER_HXX */