1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Ensight output with specialized write() for strings, integers and floats.
29 Correctly handles binary write as well.
31 \*---------------------------------------------------------------------------*/
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 /*---------------------------------------------------------------------------*\
45 Class ensightFile Declaration
46 \*---------------------------------------------------------------------------*/
54 //- allow undef in results
55 static bool allowUndef_;
57 //- value to represent undef in results
58 static scalar undefValue_;
61 // Private member functions
63 //- Disallow default bitwise assignment
64 void operator=(const ensightFile&);
66 //- Disallow default copy constructor
67 ensightFile(const ensightFile&);
74 //- Construct from pathname
77 const fileName& pathname,
78 IOstream::streamFormat format=IOstream::BINARY
88 //- Return setting for whether 'undef' values are allowed in results
89 static bool allowUndef();
91 //- '*' mask appropriate for subDir
94 //- consistent zero-padded numbers for subdirectories
95 static string subDir(const label);
100 static bool allowUndef(bool);
102 //- Assign the value to represent undef in the results
103 // Returns the previous value
104 // NB: do not use values larger than floatScalarVGREAT
105 static scalar undefValue(const scalar&);
111 virtual Ostream& write(const char* buf, std::streamsize count);
113 //- write element keyword with trailing newline, optionally with undef
114 virtual Ostream& writeKeyword(const string& key);
116 //- write "C Binary" for binary files (eg, geometry/measured)
117 Ostream& writeBinaryHeader();
119 //- write undef value
120 Ostream& writeUndef();
122 //- write string as "%80s" or as binary
123 Ostream& write(const string& value);
125 //- write integer as "%10d" or as binary
126 Ostream& write(const label& value);
128 //- write integer with specified width or as binary
129 Ostream& write(const label& value, const label fieldWidth);
131 //- write float as "%12.5e" or as binary
132 Ostream& write(const scalar& value);
134 //- Add carriage return to ascii stream
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 } // End namespace Foam
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 // ************************************************************************* //