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 ENSIGHT_FIELD_DRIVER_HXX
24 #define ENSIGHT_FIELD_DRIVER_HXX
28 #include "MEDMEM_EnsightUtils.hxx"
30 // ==========================================================================================
32 Driver Ensight for FIELD.
34 // ==========================================================================================
38 class MEDMEM_EXPORT ENSIGHT_FIELD_DRIVER : public MEDMEM_ENSIGHT::_CaseFileDriver_User
42 std::string _fieldName;
43 std::string _constantValue;
45 void openConst(bool checkDataFile=false) const throw (MEDEXCEPTION);
52 ENSIGHT_FIELD_DRIVER();
53 ENSIGHT_FIELD_DRIVER(const std::string & fileName,
55 MED_EN::med_mode_acces accessMode);
59 ENSIGHT_FIELD_DRIVER(const ENSIGHT_FIELD_DRIVER & fieldDriver);
60 virtual void merge ( const GENDRIVER& driver );
64 virtual ~ENSIGHT_FIELD_DRIVER();
67 Set the name of the FIELD in EnSight file.
69 It could be different than the name of the FIELD object.
71 virtual void setFieldName(const std::string & fieldName) throw (MEDEXCEPTION);
74 Get the name of the FIELD in EnSight file.
76 virtual std::string getFieldName() const { return _fieldName; }
78 virtual void open() throw (MEDEXCEPTION) { openConst(); }
80 virtual void close() {}
82 FIELD_* getField() { return _ptrField; }
84 void setConstantValue(const std::string& value) { _constantValue = value; }
86 const std::string& getConstantValue() const { return _constantValue; }
90 // ==========================================================================================
92 class MEDMEM_EXPORT ENSIGHT_FIELD_RDONLY_DRIVER : public ENSIGHT_FIELD_DRIVER
97 Constructor to read the field of a specified name and index-th time step.
98 Append "_Im" to field name to select an imaginary part of a complex field
100 ENSIGHT_FIELD_RDONLY_DRIVER(const string & fileName, FIELD_ * ptrField, int step=1);
102 ENSIGHT_FIELD_RDONLY_DRIVER();
103 ENSIGHT_FIELD_RDONLY_DRIVER(const ENSIGHT_FIELD_RDONLY_DRIVER & fieldDriver);
104 ~ENSIGHT_FIELD_RDONLY_DRIVER();
105 virtual GENDRIVER * copy ( void ) const ;
106 virtual void merge ( const GENDRIVER& driver );
111 void read ( void ) throw (MEDEXCEPTION);
114 Return a MEDEXCEPTION : it is a read-only driver.
116 void write( void ) const throw (MEDEXCEPTION) ;
120 void readGoldASCII ();
121 void readGoldBinary();
125 void skipTimeStamp(MEDMEM_ENSIGHT::_BinaryFileReader& fileReader);
130 // ==========================================================================================
132 class MEDMEM_EXPORT ENSIGHT_FIELD_WRONLY_DRIVER : public ENSIGHT_FIELD_DRIVER
137 Constructor to append a field to the file
139 ENSIGHT_FIELD_WRONLY_DRIVER(const string & fileName, const FIELD_ * ptrField);
141 ENSIGHT_FIELD_WRONLY_DRIVER();
142 ENSIGHT_FIELD_WRONLY_DRIVER(const ENSIGHT_FIELD_WRONLY_DRIVER & fieldDriver);
143 ~ENSIGHT_FIELD_WRONLY_DRIVER();
144 GENDRIVER * copy ( void ) const ;
147 Return a MEDEXCEPTION : it is the write-only driver.
149 void read ( void ) throw (MEDEXCEPTION) ;
152 Write FIELD in the specified file, the mesh is supposed to be
155 void write( void ) const throw (MEDEXCEPTION) ;
159 }//End namespace MEDMEM
161 #endif /* ENSIGHT_FIELD_DRIVER_HXX */