bufferedAccumulator.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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::bufferedAccumulator
28
29Description
30
31SourceFiles
32 bufferedAccumulatorI.H
33 bufferedAccumulator.C
34 bufferedAccumulatorIO.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef bufferedAccumulator_H
39#define bufferedAccumulator_H
40
41#include "Field.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48template<class Type>
49class bufferedAccumulator;
50
51template<class Type>
52Ostream& operator<<
53(
54 Ostream&,
56);
57
58/*---------------------------------------------------------------------------*\
59 Class bufferedAccumulator Declaration
60\*---------------------------------------------------------------------------*/
61
62template<class Type>
64:
65 public List<Field<Type>>
66{
67 // Private data
68
69 label averagesTaken_;
70
71 List<label> bufferOffsets_;
72
73
74 // Private Member Functions
75
76 inline Field<Type>& accumulationBuffer();
77
78 inline const Field<Type>& accumulationBuffer() const;
79
80 void accumulateAndResetBuffer(const label b);
81
82
83public:
84
85 //- Component type
86 typedef typename pTraits<Type>::cmptType cmptType;
87
88
89 // Static data members
91 static const char* const typeName;
92
93
94 // Constructors
95
96 //- Construct null
98
99 //- Construct from components
101 (
102 const label nBuffers,
103 const label bufferLength,
104 const label bufferingInterval
105 );
106
107 //- Construct as copy
109
110
111 //- Destructor
113
114
115 // Member Functions
116
117 label addToBuffers(const List<Type>& valuesToAdd);
118
119 Field<Type> averaged() const;
120
121 void resetAveraging();
122
123
124 // Access
125
126 inline label averagesTaken() const;
127
128 inline label nBuffers() const;
129
130 inline label bufferLength() const;
131
132 inline const List<label>& bufferOffsets() const;
133
134
135 // Edit
136
137 void setSizes
138 (
139 const label nBuffers,
140 const label bufferLength,
141 const label bufferingInterval
142 );
143
144
145 // Member Operators
146
148
149
150 // IOstream Operators
152 friend Ostream& operator<< <Type>
153 (
154 Ostream&,
156 );
157};
158
159
160// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161
162} // End namespace Foam
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166#include "bufferedAccumulatorI.H"
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170#ifdef NoRepository
171 #include "bufferedAccumulator.C"
172#endif
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#endif
177
178// ************************************************************************* //
Generic templated field type.
Definition: Field.H:82
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Field< Type > averaged() const
bufferedAccumulator()
Construct null.
void operator=(const bufferedAccumulator< Type > &)
label addToBuffers(const List< Type > &valuesToAdd)
pTraits< Type >::cmptType cmptType
Component type.
const List< label > & bufferOffsets() const
void setSizes(const label nBuffers, const label bufferLength, const label bufferingInterval)
static const char *const typeName
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
Namespace for OpenFOAM.
volScalarField & b
Definition: createFields.H:27