fieldAverageItemIO.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 #include "fieldAverage.H"
28 #include "wordAndDictionary.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const fieldAverage& fa,
35  Istream& is
36 )
37 :
38  fieldName_("unknown"),
39  mean_(false),
40  meanFieldName_("unknown"),
41  prime2Mean_(false),
42  prime2MeanFieldName_("unknown")
43 {
44  is.check
45  (
46  "Foam::Istream& Foam::operator>>"
47  "(Foam::Istream&, Foam::functionObjects::fieldAverageItem&)"
48  );
49 
50  wordAndDictionary wd(is);
51 
52  fieldName_ = wd.first();
53 
54  mean_ = wd.second().lookupOrDefault<Switch>("mean", fa.mean_);
55  prime2Mean_ =
56  wd.second().lookupOrDefault<Switch>("prime2Mean", fa.prime2Mean_);
57 
58  meanFieldName_ = IOobject::groupName
59  (
60  IOobject::member(fieldName_) + fieldAverageItem::meanExt,
61  IOobject::group(fieldName_)
62  );
63 
64  prime2MeanFieldName_ = IOobject::groupName
65  (
66  IOobject::member(fieldName_) + fieldAverageItem::prime2MeanExt,
67  IOobject::group(fieldName_)
68  );
69 
70  if ((fa.window_ > 0) && (fa.windowName_ != ""))
71  {
72  meanFieldName_ =
73  meanFieldName_ + "_" + fa.windowName_;
74 
75  prime2MeanFieldName_ =
76  prime2MeanFieldName_ + "_" + fa.windowName_;
77  }
78 }
79 
80 
81 // ************************************************************************* //
const char *const group
Group name for atomic constants.
Switch mean_
Compute mean flag.
Definition: fieldAverage.H:210
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
const Type1 & first() const
Return first.
Definition: Tuple2.H:116
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Switch prime2Mean_
Compute prime-squared mean flag.
Definition: fieldAverage.H:213
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
Tuple of a word and dictionary, used to read in per-field options for function objects in the followi...
scalar window_
Averaging window - defaults to -1 for &#39;all iters/time&#39;.
Definition: fieldAverage.H:204
Calculates average quantities for a user-specified selection of volumetric and surface fields...
Definition: fieldAverage.H:160
word windowName_
Averaging window name - defaults to &#39;window&#39;.
Definition: fieldAverage.H:207
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const Type2 & second() const
Return second.
Definition: Tuple2.H:128