Back to index

salome-med  6.5.0
MEDMEM_EnsightFieldDriver.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef ENSIGHT_FIELD_DRIVER_HXX
00024 #define ENSIGHT_FIELD_DRIVER_HXX
00025 
00026 #include <string>
00027 
00028 #include "MEDMEM_EnsightUtils.hxx"
00029 
00030 // ==========================================================================================
00034 // ==========================================================================================
00035 
00036 namespace MEDMEM {
00037 
00038 class MEDMEM_EXPORT ENSIGHT_FIELD_DRIVER : public MEDMEM_ENSIGHT::_CaseFileDriver_User
00039 {
00040 protected:
00041   FIELD_ *    _ptrField;
00042   std::string _fieldName;
00043   std::string _constantValue;
00044 
00045   void openConst(bool checkDataFile=false) const throw (MEDEXCEPTION);
00046 
00047 public :
00048 
00052   ENSIGHT_FIELD_DRIVER();
00053   ENSIGHT_FIELD_DRIVER(const std::string &    fileName,
00054                        FIELD_ *               ptrField,
00055                        MED_EN::med_mode_acces accessMode);
00059   ENSIGHT_FIELD_DRIVER(const ENSIGHT_FIELD_DRIVER & fieldDriver);
00060   virtual void merge ( const GENDRIVER& driver );
00064   virtual ~ENSIGHT_FIELD_DRIVER();
00065 
00071   virtual void setFieldName(const std::string & fieldName) throw (MEDEXCEPTION);
00072 
00076   virtual std::string getFieldName() const { return _fieldName; }
00077 
00078   virtual void open() throw (MEDEXCEPTION) { openConst(); }
00079 
00080   virtual void close() {}
00081 
00082   FIELD_* getField() { return _ptrField; }
00083 
00084   void setConstantValue(const std::string& value) { _constantValue = value; }
00085 
00086   const std::string& getConstantValue() const { return _constantValue; }
00087 
00088 };
00089 
00090 // ==========================================================================================
00091 
00092 class MEDMEM_EXPORT ENSIGHT_FIELD_RDONLY_DRIVER : public ENSIGHT_FIELD_DRIVER
00093 {
00094 public :
00095   
00100   ENSIGHT_FIELD_RDONLY_DRIVER(const string & fileName, FIELD_ * ptrField, int step=1);
00101 
00102   ENSIGHT_FIELD_RDONLY_DRIVER();
00103   ENSIGHT_FIELD_RDONLY_DRIVER(const ENSIGHT_FIELD_RDONLY_DRIVER & fieldDriver);
00104   ~ENSIGHT_FIELD_RDONLY_DRIVER();
00105   virtual GENDRIVER * copy ( void ) const ;
00106   virtual void merge ( const GENDRIVER& driver );
00107 
00111   void read ( void ) throw (MEDEXCEPTION);
00112 
00116   void write( void ) const throw (MEDEXCEPTION) ;
00117 
00118 private:
00119 
00120   void readGoldASCII ();
00121   void readGoldBinary();
00122   void read6ASCII    ();
00123   void read6Binary   ();
00124 
00125   void skipTimeStamp(MEDMEM_ENSIGHT::_BinaryFileReader& fileReader);
00126 
00127   int _fieldStep;
00128 };
00129 
00130 // ==========================================================================================
00131 
00132 class MEDMEM_EXPORT ENSIGHT_FIELD_WRONLY_DRIVER : public ENSIGHT_FIELD_DRIVER
00133 {
00134 public :
00135   
00139   ENSIGHT_FIELD_WRONLY_DRIVER(const string & fileName, const FIELD_ * ptrField);
00140 
00141   ENSIGHT_FIELD_WRONLY_DRIVER();
00142   ENSIGHT_FIELD_WRONLY_DRIVER(const ENSIGHT_FIELD_WRONLY_DRIVER & fieldDriver);
00143   ~ENSIGHT_FIELD_WRONLY_DRIVER();
00144   GENDRIVER * copy ( void ) const ;
00145 
00149   void read ( void ) throw (MEDEXCEPTION) ;
00150 
00155   void write( void ) const throw (MEDEXCEPTION) ;
00156 
00157 };
00158 
00159 }//End namespace MEDMEM
00160 
00161 #endif /* ENSIGHT_FIELD_DRIVER_HXX */