1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Ensight output with specialized write() for strings, integers and floats.
30 Correctly handles binary write as well.
32 \*---------------------------------------------------------------------------*/
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 /*---------------------------------------------------------------------------*\
46 Class ensightFile Declaration
47 \*---------------------------------------------------------------------------*/
55 //- allow undef in results
56 static bool allowUndef_;
58 //- value to represent undef in results
59 static scalar undefValue_;
62 // Private member functions
64 //- Disallow default bitwise assignment
65 void operator=(const ensightFile&);
67 //- Disallow default copy constructor
68 ensightFile(const ensightFile&);
75 //- Construct from pathname
78 const fileName& pathname,
79 IOstream::streamFormat format=IOstream::BINARY
89 //- Return setting for whether 'undef' values are allowed in results
90 static bool allowUndef();
92 //- '*' mask appropriate for subDir
95 //- consistent zero-padded numbers for subdirectories
96 static string subDir(const label);
101 static bool allowUndef(bool);
103 //- Assign the value to represent undef in the results
104 // Returns the previous value
105 // NB: do not use values larger than floatScalarVGREAT
106 static scalar undefValue(const scalar&);
112 virtual Ostream& write(const char* buf, std::streamsize count);
114 //- write element keyword with trailing newline, optionally with undef
115 virtual Ostream& writeKeyword(const string& key);
117 //- write "C Binary" for binary files (eg, geometry/measured)
118 Ostream& writeBinaryHeader();
120 //- write undef value
121 Ostream& writeUndef();
123 //- write string as "%80s" or as binary
124 Ostream& write(const string& value);
126 //- write integer as "%10d" or as binary
127 Ostream& write(const label& value);
129 //- write integer with specified width or as binary
130 Ostream& write(const label& value, const label fieldWidth);
132 //- write float as "%12.5e" or as binary
133 Ostream& write(const scalar& value);
135 //- Add carriage return to ascii stream
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 } // End namespace Foam
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 // ************************************************************************* //