Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / postProcessing / functionObjects / field / fieldAverage / fieldAverageItem / fieldAverageItem.C
blob61c0e759593319c5953c0513600f9dca1b736731
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2009-2011 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
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
19     for more details.
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"
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 namespace Foam
32     template<>
33     const char* Foam::NamedEnum
34     <
35         Foam::fieldAverageItem::baseType,
36         2
37     >::names[] =
38     {
39         "iteration",
40         "time"
41     };
45 const Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>
46     Foam::fieldAverageItem::baseTypeNames_;
49 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
51 Foam::fieldAverageItem::fieldAverageItem()
53     fieldName_("unknown"),
54     mean_(0),
55     prime2Mean_(0),
56     base_(ITER)
60 Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem)
62     fieldName_(faItem.fieldName_),
63     mean_(faItem.mean_),
64     prime2Mean_(faItem.prime2Mean_),
65     base_(faItem.base_)
69 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
71 Foam::fieldAverageItem::~fieldAverageItem()
75 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
77 void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs)
79     // Check for assignment to self
80     if (this == &rhs)
81     {
82         FatalErrorIn
83         (
84             "Foam::fieldAverageItem::operator=(const Foam::fieldAverageItem&)"
85         )   << "Attempted assignment to self" << nl
86             << abort(FatalError);
87     }
89     // Set updated values
90     fieldName_ = rhs.fieldName_;
91     mean_ = rhs.mean_;
92     prime2Mean_ = rhs.prime2Mean_;
93     base_ = rhs.base_;
97 // ************************************************************************* //