1 // Copyright (C) 2007-2008 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
22 #ifndef ENSIGHT_FIELD_DRIVER_HXX
23 #define ENSIGHT_FIELD_DRIVER_HXX
27 #include "MEDMEM_EnsightUtils.hxx"
29 // ==========================================================================================
31 Driver Ensight for FIELD.
33 // ==========================================================================================
37 class MEDMEM_EXPORT ENSIGHT_FIELD_DRIVER : public MEDMEM_ENSIGHT::_CaseFileDriver_User
41 std::string _fieldName;
42 std::string _constantValue;
44 void openConst(bool checkDataFile=false) const throw (MEDEXCEPTION);
51 ENSIGHT_FIELD_DRIVER();
52 ENSIGHT_FIELD_DRIVER(const std::string & fileName,
54 MED_EN::med_mode_acces accessMode);
58 ENSIGHT_FIELD_DRIVER(const ENSIGHT_FIELD_DRIVER & fieldDriver);
59 virtual void merge ( const GENDRIVER& driver );
63 virtual ~ENSIGHT_FIELD_DRIVER();
66 Set the name of the FIELD in EnSight file.
68 It could be different than the name of the FIELD object.
70 virtual void setFieldName(const std::string & fieldName) throw (MEDEXCEPTION);
73 Get the name of the FIELD in EnSight file.
75 virtual std::string getFieldName() const { return _fieldName; }
77 virtual void open() throw (MEDEXCEPTION) { openConst(); }
79 virtual void close() {}
81 FIELD_* getField() { return _ptrField; }
83 void setConstantValue(const std::string& value) { _constantValue = value; }
85 const std::string& getConstantValue() const { return _constantValue; }
89 // ==========================================================================================
91 class MEDMEM_EXPORT ENSIGHT_FIELD_RDONLY_DRIVER : public ENSIGHT_FIELD_DRIVER
96 Constructor to read the field of a specified name and index-th time step.
97 Append "_Im" to field name to select an imaginary part of a complex field
99 ENSIGHT_FIELD_RDONLY_DRIVER(const string & fileName, FIELD_ * ptrField, int step=1);
101 ENSIGHT_FIELD_RDONLY_DRIVER();
102 ENSIGHT_FIELD_RDONLY_DRIVER(const ENSIGHT_FIELD_RDONLY_DRIVER & fieldDriver);
103 ~ENSIGHT_FIELD_RDONLY_DRIVER();
104 virtual GENDRIVER * copy ( void ) const ;
105 virtual void merge ( const GENDRIVER& driver );
110 void read ( void ) throw (MEDEXCEPTION);
113 Return a MEDEXCEPTION : it is a read-only driver.
115 void write( void ) const throw (MEDEXCEPTION) ;
119 void readGoldASCII ();
120 void readGoldBinary();
124 void skipTimeStamp(MEDMEM_ENSIGHT::_BinaryFileReader& fileReader);
129 // ==========================================================================================
131 class MEDMEM_EXPORT ENSIGHT_FIELD_WRONLY_DRIVER : public ENSIGHT_FIELD_DRIVER
136 Constructor to append a field to the file
138 ENSIGHT_FIELD_WRONLY_DRIVER(const string & fileName, FIELD_ * ptrField);
140 ENSIGHT_FIELD_WRONLY_DRIVER();
141 ENSIGHT_FIELD_WRONLY_DRIVER(const ENSIGHT_FIELD_WRONLY_DRIVER & fieldDriver);
142 ~ENSIGHT_FIELD_WRONLY_DRIVER();
143 GENDRIVER * copy ( void ) const ;
146 Return a MEDEXCEPTION : it is the write-only driver.
148 void read ( void ) throw (MEDEXCEPTION) ;
151 Write FIELD in the specified file, the mesh is supposed to be
154 void write( void ) const throw (MEDEXCEPTION) ;
158 }//End namespace MEDMEM
160 #endif /* ENSIGHT_FIELD_DRIVER_HXX */