Project
Loading...
Searching...
No Matches
Spline1DHelper.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
16
17#ifndef ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_Spline1DHelper_H
18#define ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_Spline1DHelper_H
19
20#include "GPUCommonDef.h"
21#include "GPUCommonRtypes.h"
22#include "Spline1D.h"
23
24#include <vector>
25#include <string>
26
27namespace o2
28{
29namespace gpu
30{
34template <typename DataT>
36{
37 public:
39
42
44 Spline1DHelper(const Spline1DHelper&) = default;
45
48
50 ~Spline1DHelper() = default;
51
53
56 double xMin, double xMax,
57 const double vx[], const double vf[], int32_t nDataPoints);
58
61 Spline1DContainer<DataT>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
62 int32_t nAuxiliaryDataPoints = 4);
63
66 const double vx[], const double vf[], int32_t nDataPoints);
67
69 Spline1DContainer<DataT>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
70 int32_t nAuxiliaryDataPoints);
71
74 double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F);
75
77
78 const Spline1D<double>& getSpline() const { return mSpline; }
79
82 static void getScoefficients(const typename Spline1D<double>::Knot& knotL, double u,
83 double& cSl, double& cDl, double& cSr, double& cDr);
84
85 static void getDScoefficients(const typename Spline1D<double>::Knot& knotL, double u,
86 double& cSl, double& cDl, double& cSr, double& cDr);
87
88 static void getDDScoefficients(const typename Spline1D<double>::Knot& knotL, double u,
89 double& cSl, double& cDl, double& cSr, double& cDr);
90
91 static void getDDScoefficientsLeft(const typename Spline1D<double>::Knot& knotL,
92 double& cSl, double& cDl, double& cSr, double& cDr);
93
94 static void getDDScoefficientsRight(const typename Spline1D<double>::Knot& knotL,
95 double& cSl, double& cDl, double& cSr, double& cDr);
96 static void getDDDScoefficients(const typename Spline1D<double>::Knot& knotL,
97 double& cSl, double& cDl, double& cSr, double& cDr);
98
100 const char* getLastError() const { return mError.c_str(); }
101
102#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
104 static int32_t test(const bool draw = 0, const bool drawDataPoints = 1);
105#endif
106
107 private:
109 int32_t storeError(int32_t code, const char* msg);
110
111 std::string mError = "";
112
113 void setSpline(const Spline1DContainer<DataT>& spline);
114
115 void makeDataPoints(Spline1DContainer<DataT>& spline, double xMin, double xMax, std::function<void(double x, double f[/*spline.getFdimensions()*/])> F,
116 int32_t nAuxiliaryDataPoints, std::vector<double>& vx, std::vector<double>& vf);
117
119
120 Spline1D<double> mSpline;
121
122 ClassDefNV(Spline1DHelper, 0);
123};
124
125} // namespace gpu
126} // namespace o2
127
128#endif
Definition of Spline1D class.
Spline1DHelper(const Spline1DHelper &)=default
Copy constructor: disabled.
static void getDDScoefficientsRight(const typename Spline1D< double >::Knot &knotL, double &cSl, double &cDl, double &cSr, double &cDr)
const char * getLastError() const
Gives error string.
static void getDDScoefficientsLeft(const typename Spline1D< double >::Knot &knotL, double &cSl, double &cDl, double &cSr, double &cDr)
void approximateFunction(Spline1DContainer< DataT > &spline, double xMin, double xMax, std::function< void(double x, double f[])> F, int32_t nAuxiliaryDataPoints=4)
Create best-fit spline parameters for a function F.
void approximateFunctionClassic(Spline1DContainer< DataT > &spline, double xMin, double xMax, std::function< void(double x, double f[])> F)
Create classic spline parameters for a given input function F.
void approximateDataPoints(Spline1DContainer< DataT > &spline, double xMin, double xMax, const double vx[], const double vf[], int32_t nDataPoints)
_______________ Main functionality ________________________
void approximateFunctionGradually(Spline1DContainer< DataT > &spline, double xMin, double xMax, std::function< void(double x, double f[])> F, int32_t nAuxiliaryDataPoints)
static void getDDScoefficients(const typename Spline1D< double >::Knot &knotL, double u, double &cSl, double &cDl, double &cSr, double &cDr)
Spline1DHelper()
_____________ Constructors / destructors __________________________
static void getDDDScoefficients(const typename Spline1D< double >::Knot &knotL, double &cSl, double &cDl, double &cSr, double &cDr)
Spline1DHelper & operator=(const Spline1DHelper &)=default
Assignment operator: disabled.
static void getDScoefficients(const typename Spline1D< double >::Knot &knotL, double u, double &cSl, double &cDl, double &cSr, double &cDr)
void approximateDerivatives(Spline1DContainer< DataT > &spline, const double vx[], const double vf[], int32_t nDataPoints)
Approximate only derivatives assuming the spline values at knozts are already set.
const Spline1D< double > & getSpline() const
_______________ Utilities ________________________
static void getScoefficients(const typename Spline1D< double >::Knot &knotL, double u, double &cSl, double &cDl, double &cSr, double &cDr)
~Spline1DHelper()=default
Destructor.
GLint GLenum GLint x
Definition glcorearb.h:403
GLdouble f
Definition glcorearb.h:310
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint64_t const void const *restrict const msg
Definition x9.h:153