interpolationWeights.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) 2012-2016 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::interpolationWeights
29
30Description
31 Abstract base class for interpolating in 1D
32
33SourceFiles
34 interpolationWeights.C
35 interpolationWeightsTemplates.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef interpolationWeights_H
40#define interpolationWeights_H
41
42#include "scalarField.H"
43#include "autoPtr.H"
45#include "pointField.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52class fvMesh;
53class objectRegistry;
54
55/*---------------------------------------------------------------------------*\
56 Class interpolationWeights Declaration
57\*---------------------------------------------------------------------------*/
60{
61protected:
62
63 // Protected Data
65 const scalarField& samples_;
66
67
68 // Protected Member Functions
69
70 //- No copy construct
72
73 //- No copy assignment
74 void operator=(const interpolationWeights&) = delete;
75
76
77public:
78
79 //- Runtime type information
80 TypeName("interpolationWeights");
81
82
83 // Declare run-time constructor selection table
86 (
87 autoPtr,
89 word,
90 (
91 const scalarField& samples
92 ),
93 (samples)
94 );
95
96
97 // Constructors
98
99 //- Construct from components
101
102
103 // Selectors
104
105 //- Return a reference to the selected interpolationWeights
107 (
108 const word& type,
109 const scalarField& samples
110 );
111
112
113 //- Destructor
114 virtual ~interpolationWeights() = default;
115
116
117 // Member Functions
118
119 //- Calculate weights and indices to calculate t from samples.
120 // Returns true if indices changed.
121 virtual bool valueWeights
122 (
123 const scalar t,
124 labelList& indices,
125 scalarField& weights
126 ) const = 0;
127
128 //- Calculate weights and indices to calculate integrand of t1..t2
129 // from samples. Returns true if indices changed.
130 virtual bool integrationWeights
131 (
132 const scalar t1,
133 const scalar t2,
134 labelList& indices,
135 scalarField& weights
136 ) const = 0;
137
138 //- Helper: weighted sum
139 template<class ListType1, class ListType2>
140 static typename outerProduct
141 <
142 typename ListType1::value_type,
143 typename ListType2::value_type
145 weightedSum(const ListType1& f1, const ListType2& f2);
146
147};
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151} // End namespace Foam
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155#ifdef NoRepository
157#endif
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161#endif
162
163// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Abstract base class for interpolating in 1D.
declareRunTimeSelectionTable(autoPtr, interpolationWeights, word,(const scalarField &samples),(samples))
virtual bool integrationWeights(const scalar t1, const scalar t2, labelList &indices, scalarField &weights) const =0
Calculate weights and indices to calculate integrand of t1..t2.
TypeName("interpolationWeights")
Runtime type information.
interpolationWeights(const interpolationWeights &)=delete
No copy construct.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const =0
Calculate weights and indices to calculate t from samples.
void operator=(const interpolationWeights &)=delete
No copy assignment.
static outerProduct< typenameListType1::value_type, typenameListType2::value_type >::type weightedSum(const ListType1 &f1, const ListType2 &f2)
Helper: weighted sum.
static autoPtr< interpolationWeights > New(const word &type, const scalarField &samples)
Return a reference to the selected interpolationWeights.
virtual ~interpolationWeights()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
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)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
scalarField samples(nIntervals, Zero)