linearInterpolationWeights.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 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::linearInterpolationWeights
29
30Description
31
32SourceFiles
33 linearInterpolationWeights.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef linearInterpolationWeights_H
38#define linearInterpolationWeights_H
39
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44namespace Foam
45{
46
47/*---------------------------------------------------------------------------*\
48 Class linearInterpolationWeights Declaration
49\*---------------------------------------------------------------------------*/
52:
54{
55 // Private Data
56
57 //- Cached index in samples from previous invocation
58 mutable label index_;
59
60
61 // Private Member Functions
62
63 //- Get weights of i and i+1 to calculate integration from t to
64 //- samples_[i+1]
65 Pair<scalar> integrationWeights(const label i, const scalar t) const;
66
67
68public:
69
70 //- Runtime type information
71 TypeName("linear");
72
73
74 // Constructors
75
76 //- Construct from components
78
79
80 //- Destructor
81 virtual ~linearInterpolationWeights() = default;
82
83
84 // Member Functions
85
86 //- Calculate weights and indices to calculate t from samples.
87 // \return true if indices changed.
88 virtual bool valueWeights
89 (
90 const scalar t,
91 labelList& indices,
92 scalarField& weights
93 ) const;
94
95 //- Calculate weights and indices to calculate integrand of t1..t2
96 //- from samples.
97 // \return true if indices changed.
98 virtual bool integrationWeights
99 (
100 const scalar t1,
101 const scalar t2,
102 labelList& indices,
103 scalarField& weights
104 ) const;
105};
106
107
108// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109
110} // End namespace Foam
111
112// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113
114#endif
115
116// ************************************************************************* //
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:69
Abstract base class for interpolating in 1D.
virtual ~linearInterpolationWeights()=default
Destructor.
TypeName("linear")
Runtime type information.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
scalarField samples(nIntervals, Zero)