1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::fieldAverageItem
29 Helper class to describe what form of averaging to apply. A set will be
30 applied to each base field in Foam::fieldAverage, of the form:
36 base time; // iteration
44 \*---------------------------------------------------------------------------*/
46 #ifndef fieldAverageItem_H
47 #define fieldAverageItem_H
49 #include "NamedEnum.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 // Forward declaration of classes
61 // Forward declaration of friend functions and operators
62 class fieldAverageItem;
63 Istream& operator>>(Istream&, fieldAverageItem&);
64 Ostream& operator<<(Ostream&, const fieldAverageItem&);
67 /*---------------------------------------------------------------------------*\
68 Class fieldAverageItem Declaration
69 \*---------------------------------------------------------------------------*/
71 class fieldAverageItem
77 //- Enumeration defining the averaging base type
95 //- Compute prime-squared mean flag
98 //- Averaging base type names
99 static const NamedEnum<baseType, 2> baseTypeNames_;
101 //- Averaging base type
112 //- Construct from Istream
113 fieldAverageItem(Istream&);
115 //- Construct as copy
116 fieldAverageItem(const fieldAverageItem&);
128 //- Return const access to the field name
129 const word& fieldName() const
134 //- Return const access to the mean flag
135 const Switch& mean() const
140 //- Return const access to the prime-squared mean flag
141 const Switch& prime2Mean() const
146 //- Return averaging base type name
147 const word base() const
149 return baseTypeNames_[base_];
152 //- Return true if base is ITER
153 Switch ITERBase() const
155 return base_ == ITER;
158 //- Return true if base is time
159 Switch timeBase() const
161 return base_ == TIME;
167 void operator=(const fieldAverageItem&);
171 friend bool operator==
173 const fieldAverageItem& a,
174 const fieldAverageItem& b
178 a.fieldName_ == b.fieldName_
179 && a.mean_ == b.mean_
180 && a.prime2Mean_ == b.prime2Mean_
181 && a.base_ == b.base_;
184 friend bool operator!=
186 const fieldAverageItem& a,
187 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 // ************************************************************************* //