AverageField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::AverageField
28 
29 Description
30  A primitive field with a separate average value.
31 
32 SourceFiles
33  AverageField.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef AverageField_H
38 #define AverageField_H
39 
40 #include "Field.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class AverageField Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class Type>
52 class AverageField
53 :
54  public Field<Type>
55 {
56  // Private data
57 
58  //- The average of the field
59  Type average_;
60 
61 
62 public:
63 
64  // Constructors
65 
66  //- Construct from size (does not set values)
67  AverageField(const label size);
68 
69  //- Construct from components
70  AverageField(const Field<Type>&, const Type& average);
71 
72  //- Construct from Istream
74 
75 
76  // Member functions
77 
78  const Type& average() const;
79 
80  Type& average();
81 
82  bool writeData(Ostream& os) const;
83 };
84 
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 } // End namespace Foam
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 #ifdef NoRepository
93  #include "AverageField.C"
94 #endif
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 #endif
99 
100 // ************************************************************************* //
Foam::AverageField::writeData
bool writeData(Ostream &os) const
Definition: AverageField.C:77
Foam::AverageField::average
const Type & average() const
Definition: AverageField.C:63
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Field.H
Foam::AverageField
A primitive field with a separate average value.
Definition: AverageField.H:51
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
AverageField.C
Foam::AverageField::AverageField
AverageField(const label size)
Construct from size (does not set values)
Definition: AverageField.C:33
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56