Merge remote-tracking branch 'origin/BUGFIX/radiationBCConstructor'
[foam-extend-3.0.git] / applications / solvers / coupled / conjugateHeatFoam / conjugateHeatTransfer / functionObjects / heatFlux / fieldAverageItem / fieldAverageItemIO.C
blobe0e0a41262ed5175836269215ecab27014b6bc28
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     |
5     \\  /    A nd           | For copyright notice see file Copyright
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "fieldAverageItem.H"
27 #include "IOstreams.H"
28 #include "dictionaryEntry.H"
30 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
32 Foam::fieldAverageItem::fieldAverageItem(Istream& is)
34     fieldName_("unknown"),
35     mean_(0),
36     prime2Mean_(0)
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)
53     is.check
54     (
55         "Foam::Istream& Foam::operator>>"
56         "(Foam::Istream&, Foam::fieldAverageItem&)"
57     );
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")];
66     return is;
70 Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem)
72     os.check
73     (
74         "Foam::Ostream& Foam::operator<<"
75         "(Foam::Ostream&, const Foam::fieldAverageItem&)"
76     );
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;
85     os.check
86     (
87         "Foam::Ostream& Foam::operator<<"
88         "(Foam::Ostream&, const Foam::fieldAverageItem&)"
89     );
91     return os;
95 // ************************************************************************* //