1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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/>.
25 Foam::fieldAverageItem
28 Helper class to describe what form of averaging to apply. A set will be
29 applied to each base field in Foam::fieldAverage, of the form:
35 base time; // iteration
43 \*---------------------------------------------------------------------------*/
45 #ifndef fieldAverageItem_H
46 #define fieldAverageItem_H
48 #include "NamedEnum.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 // Forward declaration of classes
60 // Forward declaration of friend functions and operators
61 class fieldAverageItem;
62 Istream& operator>>(Istream&, fieldAverageItem&);
63 Ostream& operator<<(Ostream&, const fieldAverageItem&);
66 /*---------------------------------------------------------------------------*\
67 Class fieldAverageItem Declaration
68 \*---------------------------------------------------------------------------*/
70 class fieldAverageItem
76 //- Enumeration defining the averaging base type
94 //- Compute prime-squared mean flag
97 //- Averaging base type names
98 static const NamedEnum<baseType, 2> baseTypeNames_;
100 //- Averaging base type
111 //- Construct from Istream
112 fieldAverageItem(Istream&);
114 //- Construct as copy
115 fieldAverageItem(const fieldAverageItem&);
126 //- Return const access to the field name
127 const word& fieldName() const
132 //- Return const access to the mean flag
133 const Switch& mean() const
138 //- Return const access to the prime-squared mean flag
139 const Switch& prime2Mean() const
144 //- Return averaging base type name
145 const word base() const
147 return baseTypeNames_[base_];
150 //- Return true if base is ITER
151 Switch ITERBase() const
153 return base_ == ITER;
156 //- Return true if base is time
157 Switch timeBase() const
159 return base_ == TIME;
165 void operator=(const fieldAverageItem&);
170 friend bool operator==
172 const fieldAverageItem& a,
173 const fieldAverageItem& b
177 a.fieldName_ == b.fieldName_
178 && a.mean_ == b.mean_
179 && a.prime2Mean_ == b.prime2Mean_
180 && a.base_ == b.base_;
183 friend bool operator!=
185 const fieldAverageItem& a,
186 const fieldAverageItem& b
193 // IOstream Operators
195 friend Istream& operator>>(Istream&, fieldAverageItem&);
196 friend Ostream& operator<<(Ostream&, const fieldAverageItem&);
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 } // End namespace Foam
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 // ************************************************************************* //