17#ifndef ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_Spline2DHelper_H
18#define ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_Spline2DHelper_H
39template <
typename DataT>
62 double x1Min,
double x1Max,
double x2Min,
double x2Max,
63 std::function<
void(
double x1,
double x2,
double f[])> F,
64 int32_t nAuxiliaryDataPointsU1 = 4, int32_t nAuxiliaryDataPointsU2 = 4);
69 double x1Min,
double x1Max,
double x2Min,
double x2Max,
70 std::function<
void(
double x1,
double x2,
double f[])> F,
71 int32_t nAuxiliaryDataPointsU1 = 4, int32_t nAuxiliaryDataPointsU2 = 4);
76 const double dataPointX1[],
const double dataPointX2[],
77 const double dataPointF[], int32_t nDataPoints);
86 DataT* Fparameters,
double x1Min,
double x1Max,
double x2Min,
double x2Max,
87 std::function<
void(
double x1,
double x2,
double f[])> F)
const;
91 DataT* Fparameters,
double x1Min,
double x1Max,
double x2Min,
double x2Max,
92 std::function<
void(
const std::vector<double>&
x1,
const std::vector<double>& x2, std::vector<double>
f[])> F,
93 uint32_t batchsize)
const;
97 DataT* Fparameters,
const double DataPointF[])
const;
113#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
115 static int32_t test(const bool draw = 0, const bool drawDataPoints = 1);
120 void getScoefficients(int32_t iu, int32_t iv,
double u,
double v,
124 int32_t storeError(int32_t code,
const char*
msg);
126 std::string mError =
"";
127 int32_t mFdimensions;
136template <
typename DataT>
139 double x1Min,
double x1Max,
double x2Min,
double x2Max,
140 std::function<
void(
double x1,
double x2,
double f[])> F,
141 int32_t nAuxiliaryDataPointsU1, int32_t nAuxiliaryDataPointsU2)
144 setSpline(spline, nAuxiliaryDataPointsU1, nAuxiliaryDataPointsU2);
145 approximateFunction(spline.getParameters(), x1Min, x1Max, x2Min, x2Max, F);
146 spline.
setXrange(x1Min, x1Max, x2Min, x2Max);
149template <
typename DataT>
158 mFdimensions = spline.getYdimensions();
159 if (mHelperU1.setSpline(spline.getGridX1(), mFdimensions, nAuxiliaryPointsU) != 0) {
160 ret = storeError(-2,
"Spline2DHelper::setSpline2D: error by setting U axis");
162 if (mHelperU2.setSpline(spline.getGridX2(), mFdimensions, nAuxiliaryPointsV) != 0) {
163 ret = storeError(-3,
"Spline2DHelper::setSpline2D: error by setting V axis");
Definition of Spline1DHelperOld class.
Definition of Spline1D class.
Definition of Spline2D class.
mGridX2 setXrange(x2Min, x2Max)
int32_t setSpline(const Spline2DContainer< DataT > &spline, int32_t nAuxiliaryPointsU1, int32_t nAuxiliaryPointsU2)
_______________ Interface for a step-wise construction of the best-fit spline _______________________...
const Spline1DHelperOld< DataT > & getHelperU2() const
const char * getLastError() const
_______________ Utilities ________________________
const Spline1DHelperOld< DataT > & getHelperU1() const
void approximateFunction(Spline2DContainer< DataT > &spline, double x1Min, double x1Max, double x2Min, double x2Max, std::function< void(double x1, double x2, double f[])> F, int32_t nAuxiliaryDataPointsU1=4, int32_t nAuxiliaryDataPointsU2=4)
_______________ Main functionality ________________________
int32_t getNumberOfDataPoints() const
Spline2DHelper(const Spline2DHelper &)=delete
Copy constructor: disabled.
Spline2DHelper & operator=(const Spline2DHelper &)=delete
Assignment operator: disabled.
void approximateFunctionViaDataPoints(Spline2DContainer< DataT > &spline, double x1Min, double x1Max, double x2Min, double x2Max, std::function< void(double x1, double x2, double f[])> F, int32_t nAuxiliaryDataPointsU1=4, int32_t nAuxiliaryDataPointsU2=4)
void approximateFunctionBatch(DataT *Fparameters, double x1Min, double x1Max, double x2Min, double x2Max, std::function< void(const std::vector< double > &x1, const std::vector< double > &x2, std::vector< double > f[])> F, uint32_t batchsize) const
approximate std::function, output in Fparameters. F calculates values for a batch of points.
int32_t getNumberOfDataPointsU1() const
int32_t getNumberOfDataPointsU2() const
~Spline2DHelper()=default
Destructor.
void approximateDataPoints(Spline2DContainer< DataT > &spline, DataT *splineParameters, double x1Min, double x1Max, double x2Min, double x2Max, const double dataPointX1[], const double dataPointX2[], const double dataPointF[], int32_t nDataPoints)
Create best-fit spline parameters for a given set of data points.
Spline2DHelper()
_____________ Constructors / destructors __________________________
GLuint GLfloat GLfloat GLfloat x1
GLsizei GLenum const void * indices
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint64_t const void const *restrict const msg