1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2011 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
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
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 \*---------------------------------------------------------------------------*/
26 #include "fieldAverageItem.H"
27 #include "IOstreams.H"
28 #include "dictionaryEntry.H"
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 Foam::fieldAverageItem::fieldAverageItem(Istream& is)
34 fieldName_("unknown"),
38 is.check("Foam::fieldAverageItem::fieldAverageItem(Foam::Istream&)");
40 const dictionaryEntry entry(dictionary::null, is);
42 fieldName_ = entry.keyword();
43 entry.lookup("mean") >> mean_;
44 entry.lookup("prime2Mean") >> prime2Mean_;
45 base_ = baseTypeNames_[entry.lookup("base")];
49 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
51 Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
55 "Foam::Istream& Foam::operator>>"
56 "(Foam::Istream&, Foam::fieldAverageItem&)"
59 const dictionaryEntry entry(dictionary::null, is);
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")];
70 Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem)
74 "Foam::Ostream& Foam::operator<<"
75 "(Foam::Ostream&, const Foam::fieldAverageItem&)"
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_
81 << token::END_STATEMENT << nl;
82 os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_]
83 << token::END_STATEMENT << nl << token::END_BLOCK << nl;
87 "Foam::Ostream& Foam::operator<<"
88 "(Foam::Ostream&, const Foam::fieldAverageItem&)"
95 // ************************************************************************* //