FreeFOAM The Cross-Platform CFD Toolkit
fieldAverageItemIO.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "fieldAverageItem.H"
27 #include <OpenFOAM/IOstreams.H>
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 :
34  fieldName_("unknown"),
35  mean_(0),
36  prime2Mean_(0)
37 {
38  is.check("Foam::fieldAverageItem::fieldAverageItem(Foam::Istream&)");
39 
41 
42  fieldName_ = entry.keyword();
43  entry.lookup("mean") >> mean_;
44  entry.lookup("prime2Mean") >> prime2Mean_;
45  base_ = baseTypeNames_[entry.lookup("base")];
46 }
47 
48 
49 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
50 
52 {
53  is.check
54  (
55  "Foam::Istream& Foam::operator>>"
56  "(Foam::Istream&, Foam::fieldAverageItem&)"
57  );
58 
60 
61  faItem.fieldName_ = entry.keyword();
62  entry.lookup("mean") >> faItem.mean_;
63  entry.lookup("prime2Mean") >> faItem.prime2Mean_;
64  faItem.base_ = faItem.baseTypeNames_[entry.lookup("base")];
65 
66  return is;
67 }
68 
69 
71 {
72  os.check
73  (
74  "Foam::Ostream& Foam::operator<<"
75  "(Foam::Ostream&, const Foam::fieldAverageItem&)"
76  );
77 
78  os << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl;
79  os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl;
80  os.writeKeyword("prime2Mean") << faItem.mean_
82  os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_]
84 
85  os.check
86  (
87  "Foam::Ostream& Foam::operator<<"
88  "(Foam::Ostream&, const Foam::fieldAverageItem&)"
89  );
90 
91  return os;
92 }
93 
94 
95 // ************************ vim: set sw=4 sts=4 et: ************************ //