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 -------------------------------------------------------------------------------
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::windowModel
28 
29 Description
30  Base class for windowing models
31 
32 SourceFiles
33  windowModel.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef windowModel_H
38 #define windowModel_H
39 
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 #include "scalarField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class windowModel Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class windowModel
54 :
55  public scalarField
56 {
57 
58 protected:
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 
69 public:
70 
71  //- Runtime type information
72  TypeName("windowModel");
73 
74  // Declare runtime constructor selection table
76  (
77  autoPtr,
79  dictionary,
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 // ************************************************************************* //
Foam::windowModel::apply
tmp< Field< Type > > apply(const Field< Type > &fld, const label windowI) const
Return the windowed data.
Foam::windowModel::windowModel
windowModel(const dictionary &dict, const label nSamples)
Construct from dictionary.
Definition: windowModel.C:41
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
scalarField.H
Foam::windowModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, windowModel, dictionary,(const dictionary &dict, const label nSamples),(dict, nSamples))
Foam::windowModel::New
static autoPtr< windowModel > New(const dictionary &dict, const label nSamples)
Return a reference to the selected window model.
Definition: windowModelNew.C:33
Foam::windowModel::nWindow_
label nWindow_
Number of windows.
Definition: windowModel.H:65
n
label n
Definition: TABSMDCalcMethod2.H:31
windowModelTemplates.C
Foam::Field< scalar >
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam::windowModel::nWindowsTotal
label nWindowsTotal(label nSamplesTotal) const
Return the total number of windows for a given number of samples.
Definition: windowModel.C:68
Foam::windowModel::~windowModel
virtual ~windowModel()=default
Destructor.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::windowModel::nOverlapSamples_
label nOverlapSamples_
Number of overlap samples per window.
Definition: windowModel.H:62
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::windowModel::TypeName
TypeName("windowModel")
Runtime type information.
Foam::windowModel::nWindow
label nWindow() const
Return the number of windows.
Definition: windowModel.C:62
Foam::windowModel::nSamples
label nSamples() const
Return the number of samples in the window.
Definition: windowModel.C:56
Foam::windowModel::validate
label validate(label n)
Validate that the window is applicable to the data set size, and.
Definition: windowModel.C:76
Foam::windowModel
Base class for windowing models.
Definition: windowModel.H:52
autoPtr.H