binModelTemplates.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2021-2022 OpenCFD Ltd.
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
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
29
30template<class Type>
32(
34 const label bini,
35 const Type& v,
36 const vector& n
37) const
38{
40}
41
42
43template<class Type>
45{
47 {
48 return stem;
49 }
50
51 string result = "";
52 for (label cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt)
53 {
54 if (cmpt) result += " ";
55 result += stem + "_" + word(pTraits<Type>::componentNames[cmpt]);
56 }
57 return result;
58};
59
60
61template<class Type>
63(
65 Ostream& os
66) const
67{
68 if (cumulative_)
69 {
70 for (auto& datai : data)
71 {
72 for (label bini = 1; bini < nBin_; ++bini)
73 {
74 datai[bini] += datai[bini-1];
75 }
76 }
77 }
78
79 writeCurrentTime(os);
80
81 for (label bini = 0; bini < nBin_; ++bini)
82 {
83 Type total = Zero;
84
85 for (label i = 0; i < data.size(); ++i)
86 {
87 total += data[i][bini];
88 }
89
90 writeValue(os, total);
91
92 for (label i = 0; i < data.size(); ++i)
93 {
94 writeValue(os, data[i][bini]);
95 }
96 }
97
98 os << endl;
99}
100
101
102// ************************************************************************* //
label n
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
string writeComponents(const word &stem) const
Helper function to construct a string description for a given type.
void writeBinnedData(List< List< Type > > &data, Ostream &os) const
Write binned data to stream.
bool decomposePatchValues(List< List< Type > > &data, const label bini, const Type &v, const vector &n) const
bool decomposePatchValues_
Decompose patch values into normal and tangential components.
Definition: binModel.H:73
Database for solution data, solver performance and other reduced data.
Definition: data.H:58
A traits class, which is primarily used for primitives.
Definition: pTraits.H:59
A class for handling character strings derived from std::string.
Definition: string.H:79
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131