splineInterpolationWeights.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-2015 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::splineInterpolationWeights
29 
30 Description
31  Catmull-Rom spline interpolation.
32 
33 SourceFiles
34  splineInterpolationWeights.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef splineInterpolationWeights_H
39 #define splineInterpolationWeights_H
40 
41 #include "interpolationWeights.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class splineInterpolationWeights Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 :
55 {
56  // Private Data
57 
58  //- Cached index in samples from previous invocation
59  mutable label index_;
60 
61 
62 public:
63 
64  //- Runtime type information
65  TypeName("spline");
66 
67 
68  // Constructors
69 
70  //- Construct from components. By default make sure samples are
71  // equidistant.
73  (
74  const scalarField& samples,
75  const bool checkEqualDistance = true
76  );
77 
78 
79  //- Destructor
80  virtual ~splineInterpolationWeights() = default;
81 
82 
83  // Member Functions
84 
85  //- Calculate weights and indices to calculate t from samples.
86  // \return true if indices changed.
87  virtual bool valueWeights
88  (
89  const scalar t,
90  labelList& indices,
91  scalarField& weights
92  ) const;
93 
94  //- Calculate weights and indices to calculate integrand of t1..t2
95  //- from samples.
96  // \return true if indices changed.
97  virtual bool integrationWeights
98  (
99  const scalar t1,
100  const scalar t2,
101  labelList& indices,
102  scalarField& weights
103  ) const
104  {
106  return false;
107  }
108 
109 };
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #endif
119 
120 // ************************************************************************* //
Foam::splineInterpolationWeights::integrationWeights
virtual bool integrationWeights(const scalar t1, const scalar t2, labelList &indices, scalarField &weights) const
Definition: splineInterpolationWeights.H:97
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::Field< scalar >
Foam::splineInterpolationWeights::TypeName
TypeName("spline")
Runtime type information.
samples
scalarField samples(nIntervals, Zero)
interpolationWeights.H
Foam::splineInterpolationWeights::splineInterpolationWeights
splineInterpolationWeights(const scalarField &samples, const bool checkEqualDistance=true)
Construct from components. By default make sure samples are.
Definition: splineInterpolationWeights.C:51
Foam::splineInterpolationWeights::valueWeights
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
Definition: splineInterpolationWeights.C:83
Foam::interpolationWeights
Abstract base class for interpolating in 1D.
Definition: interpolationWeights.H:58
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< label >
Foam::splineInterpolationWeights::~splineInterpolationWeights
virtual ~splineInterpolationWeights()=default
Destructor.
Foam::splineInterpolationWeights
Catmull-Rom spline interpolation.
Definition: splineInterpolationWeights.H:51