BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / applications / utilities / postProcessing / dataConversion / foamToEnsight / ensightAsciiStream.H
blob68eb88e1589a1fc853c07765eeeed2f5cac76a55
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::ensightAsciiStream
27 Description
29 SourceFiles
30     ensightAsciiStream.C
32 \*---------------------------------------------------------------------------*/
34 #ifndef ensightAsciiStream_H
35 #define ensightAsciiStream_H
37 #include "ensightStream.H"
38 #include "OFstream.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 namespace Foam
45 /*---------------------------------------------------------------------------*\
46                          Class ensightAsciiStream Declaration
47 \*---------------------------------------------------------------------------*/
49 class ensightAsciiStream
51     public ensightStream
53     // Private data
55         //- Description of data_
56         OFstream str_;
59     // Private Member Functions
61         //- Disallow default bitwise copy construct
62         ensightAsciiStream(const ensightAsciiStream&);
64         //- Disallow default bitwise assignment
65         void operator=(const ensightAsciiStream&);
68 public:
70     // Constructors
72         //- Construct from components
73         ensightAsciiStream(const fileName& f, const Time& runTime)
74         :
75             ensightStream(f),
76             str_
77             (
78                 f,
79                 runTime.writeFormat(),
80                 runTime.writeVersion(),
81                 IOstream::UNCOMPRESSED
82             )
83         {
85             str_.setf(ios_base::scientific, ios_base::floatfield);
86             str_.precision(5);
87         }
90     //- Destructor
91     virtual ~ensightAsciiStream()
92     {}
95     // Member Functions
97         virtual bool ascii() const
98         {
99             return true;
100         }
102         virtual void write(const char* c)
103         {
104             str_ << c << nl;
105         }
107         virtual void write(const int v)
108         {
109             str_ << setw(10) << v << nl;
110         }
112         virtual void write(const scalarField& sf)
113         {
114             forAll(sf, i)
115             {
116                 if (mag(sf[i]) >= scalar(floatScalarVSMALL))
117                 {
118                     str_ << setw(12) << sf[i] << nl;
119                 }
120                 else
121                 {
122                     str_ << setw(12) << scalar(0) << nl;
123                 }
124             }
125         }
127         virtual void write(const List<int>& sf)
128         {
129             forAll(sf, i)
130             {
131                 str_ << setw(10) << sf[i];
132             }
133             str_<< nl;
134         }
136         virtual void writePartHeader(const label partI)
137         {
138             str_<< "part" << nl
139                 << setw(10) << partI << nl;
140         }
142     // Member Operators
144     // Friend Functions
146     // Friend Operators
148     // IOstream Operators
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 #endif
161 // ************************************************************************* //