initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / postProcessing / fieldAverage / fieldAverageItem / fieldAverageItem.H
blob1bcb5689bbb45027b259e28d1a4274c08b5fa867
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::fieldAverageItem
28 Description
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:
32     @verbatim
33         {
34             mean            on;
35             prime2Mean      on;
36             base            time; // iteration
37         }
38     @endverbatim
40 SourceFiles
41     fieldAverageItem.C
42     fieldAverageItemIO.C
44 \*---------------------------------------------------------------------------*/
46 #ifndef fieldAverageItem_H
47 #define fieldAverageItem_H
49 #include "NamedEnum.H"
50 #include "Switch.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 namespace Foam
57 // Forward declaration of classes
58 class Istream;
59 class Ostream;
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
73 public:
75     // Public data
77         //- Enumeration defining the averaging base type
78         enum baseType
79         {
80             ITER,
81             TIME
82         };
85 private:
87     // Private data
89         //- Field name
90         word fieldName_;
92         //- Compute mean flag
93         Switch mean_;
95         //- Compute prime-squared mean flag
96         Switch prime2Mean_;
98         //- Averaging base type names
99         static const NamedEnum<baseType, 2> baseTypeNames_;
101         //- Averaging base type
102         baseType base_;
105     // Private Member Functions
107         //- Disallow default bitwise copy construct
108 //        fieldAverageItem(const fieldAverageItem&);
110         //- Disallow default bitwise assignment
111 //        void operator=(const fieldAverageItem&);
114 public:
116     // Constructors
118         //- Construct null
119         fieldAverageItem();
121         //- Construct from Istream
122         fieldAverageItem(Istream&);
124         //- Construct as copy
125         fieldAverageItem(const fieldAverageItem&);
128     // Destructor
130         ~fieldAverageItem();
133     // Member Functions
135         // Access
137             //- Return const access to the field name
138             const word& fieldName() const
139             {
140                 return fieldName_;
141             }
143             //- Return const access to the mean flag
144             const Switch& mean() const
145             {
146                 return mean_;
147             }
149             //- Return const access to the prime-squared mean flag
150             const Switch& prime2Mean() const
151             {
152                 return prime2Mean_;
153             }
155             //- Return averaging base type name
156             const word base() const
157             {
158                 return baseTypeNames_[base_];
159             }
161             //- Return true if base is ITER
162             Switch ITERBase() const
163             {
164                 return base_ == ITER;
165             }
167             //- Return true if base is time
168             Switch timeBase() const
169             {
170                 return base_ == TIME;
171             }
174     // Member Operators
176         void operator=(const fieldAverageItem&);
179     // IOstream Operators
181         friend Istream& operator>>(Istream&, fieldAverageItem&);
182         friend Ostream& operator<<(Ostream&, const fieldAverageItem&);
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 } // End namespace Foam
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #endif
194 // ************************************************************************* //