fieldAverageItem.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "fieldAverageItem.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
31 (
32  "Mean"
33 );
34 
36 (
37  "Prime2Mean"
38 );
39 
40 template<>
41 const char* Foam::NamedEnum
42 <
44  2
45 >::names[] = { "iteration", "time"};
46 
47 const Foam::NamedEnum
48 <
50  2
51 > Foam::functionObjects::fieldAverageItem::baseTypeNames_;
52 
53 
54 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55 
57 :
58  fieldName_("unknown"),
59  mean_(0),
60  meanFieldName_("unknown"),
61  prime2Mean_(0),
62  prime2MeanFieldName_("unknown"),
63  base_(ITER),
64  window_(-1.0),
65  windowName_("")
66 {}
67 
68 
70 (
71  const fieldAverageItem& faItem
72 )
73 :
74  fieldName_(faItem.fieldName_),
75  mean_(faItem.mean_),
76  meanFieldName_(faItem.meanFieldName_),
77  prime2Mean_(faItem.prime2Mean_),
78  prime2MeanFieldName_(faItem.prime2MeanFieldName_),
79  base_(faItem.base_),
80  window_(faItem.window_),
81  windowName_(faItem.windowName_)
82 {}
83 
84 
85 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
86 
88 {}
89 
90 
91 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
92 
93 void Foam::functionObjects::fieldAverageItem::operator=
94 (
95  const fieldAverageItem& rhs
96 )
97 {
98  // Check for assignment to self
99  if (this == &rhs)
100  {
102  << "Attempted assignment to self" << nl
103  << abort(FatalError);
104  }
105 
106  // Set updated values
107  fieldName_ = rhs.fieldName_;
108  mean_ = rhs.mean_;
109  meanFieldName_ = rhs.meanFieldName_;
110  prime2Mean_ = rhs.prime2Mean_;
111  prime2MeanFieldName_ = rhs.prime2MeanFieldName_;
112  base_ = rhs.base_;
113  window_ = rhs.window_;
114  windowName_ = rhs.windowName_;
115 }
116 
117 
118 // ************************************************************************* //
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
baseType
Enumeration defining the averaging base type.
Initialise the NamedEnum HashTable from the static list of names.
Definition: NamedEnum.H:52
static const word EXT_PRIME2MEAN
Prime-squared average.
A class for handling words, derived from string.
Definition: word.H:59
errorManip< error > abort(error &err)
Definition: errorManip.H:131
static const char nl
Definition: Ostream.H:262
Helper class to describe what form of averaging to apply. A set will be applied to each base field in...
static const word EXT_MEAN
Mean average.