windowModel.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) 2016-2018 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
26Class
27 Foam::windowModel
28
29Description
30 Base class for windowing models
31
32SourceFiles
33 windowModel.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef windowModel_H
38#define windowModel_H
39
40#include "autoPtr.H"
42#include "scalarField.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class windowModel Declaration
51\*---------------------------------------------------------------------------*/
53class windowModel
54:
55 public scalarField
56{
57
58protected:
59
60 // Protected Data
61
62 //- Number of overlap samples per window
63 label nOverlapSamples_;
64
65 //- Number of windows
66 label nWindow_;
67
68
69public:
70
71 //- Runtime type information
72 TypeName("windowModel");
73
74 // Declare runtime constructor selection table
76 (
77 autoPtr,
80 (
81 const dictionary& dict,
82 const label nSamples
83 ),
84 (dict, nSamples)
85 );
86
87
88 //- Construct from dictionary
89 windowModel(const dictionary& dict, const label nSamples);
90
91
92 // Selectors
93
94 //- Return a reference to the selected window model
96 (
97 const dictionary& dict,
98 const label nSamples
99 );
100
101
102 //- Destructor
103 virtual ~windowModel() = default;
104
105
106 // Public Member Functions
107
108 //- Return the number of samples in the window
109 label nSamples() const;
110
111 //- Return the number of windows
112 label nWindow() const;
113
114 //- Return the total number of windows for a given number of samples
115 label nWindowsTotal(label nSamplesTotal) const;
116
117 //- Validate that the window is applicable to the data set size, and
118 // return the number of required data points
119 label validate(label n);
120
121 //- Return the windowed data
122 template<class Type>
124 (
125 const Field<Type>& fld,
126 const label windowI
127 ) const;
128};
129
130
131// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132
133} // End namespace Foam
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137#ifdef NoRepository
138 #include "windowModelTemplates.C"
139#endif
140
141// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143#endif
144
145// ************************************************************************* //
label n
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for managing temporary objects.
Definition: tmp.H:65
Base class for windowing models.
Definition: windowModel.H:55
label nWindow() const
Return the number of windows.
Definition: windowModel.C:62
TypeName("windowModel")
Runtime type information.
tmp< Field< Type > > apply(const Field< Type > &fld, const label windowI) const
Return the windowed data.
virtual ~windowModel()=default
Destructor.
label nWindowsTotal(label nSamplesTotal) const
Return the total number of windows for a given number of samples.
Definition: windowModel.C:68
static autoPtr< windowModel > New(const dictionary &dict, const label nSamples)
Return a reference to the selected window model.
label nSamples() const
Return the number of samples in the window.
Definition: windowModel.C:56
declareRunTimeSelectionTable(autoPtr, windowModel, dictionary,(const dictionary &dict, const label nSamples),(dict, nSamples))
label nWindow_
Number of windows.
Definition: windowModel.H:65
label validate(label n)
Validate that the window is applicable to the data set size, and.
Definition: windowModel.C:76
label nOverlapSamples_
Number of overlap samples per window.
Definition: windowModel.H:62
Namespace for OpenFOAM.
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73