Skip to content

Commit 8aeb68e

Browse files
sgorbunodavidrohr
authored andcommitted
bugfix in ND splines
1 parent c7404dc commit 8aeb68e

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

GPU/TPCFastTransformation/SplineSpec.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -327,31 +327,28 @@ class SplineSpec<DataT, XdimT, YdimT, 0> : public SplineContainer<DataT>
327327
DataT S1[maxInterpolations];
328328
DataT D1[maxInterpolations];
329329

330-
int nrofInterpolations = (1 << (2 * nXdim - 2)) * nYdim;
331-
int nrofKnots = 1 << (nXdim);
330+
int nInterpolations = (1 << (2 * nXdim - 2)) * nYdim;
331+
int nKnots = 1 << (nXdim);
332332

333333
for (int d = 0; d < nXdim; d++) { //for every dimension
334334
DataT* pointer[4] = {S0, D0, S1, D1}; // pointers for interpolation arrays S0, D0, S1, D1 point to Arraystart
335-
for (int i = 0; i < nrofKnots; i++) { //for every knot
336-
for (int j = 0; j < nrofKnots; j++) { // for every parametertype
335+
for (int i = 0; i < nKnots; i++) { //for every knot
336+
for (int j = 0; j < nKnots; j++) { // for every parametertype
337337
int pointernr = 2 * (i % 2) + (j % 2); //to which array should it be delivered
338338
for (int k = 0; k < nYdim; k++) {
339-
pointer[pointernr][0] = iParameters[(i * nrofKnots + j) * nYdim + k];
339+
pointer[pointernr][0] = iParameters[(i * nKnots + j) * nYdim + k];
340340
pointer[pointernr]++;
341341
}
342342
} // end for j (every parametertype)
343343
} // end for i (every knot)
344344

345345
const typename Spline1D<DataT>::Knot& knotL = mGrid[d].getKnot(indices[d]);
346-
int Ydim = nrofInterpolations;
347346
DataT coordinate = u[d];
348-
349-
typedef Spline1DSpec<DataT, 0, YdimT> TGridX;
347+
typedef Spline1DSpec<DataT, 0, 0> TGridX;
350348
const TGridX& gridX = *((const TGridX*)&(mGrid[d]));
351-
gridX.interpolateU(Ydim, knotL, S0, D0, S1, D1, coordinate, iParameters);
352-
353-
nrofInterpolations = nrofInterpolations / 4;
354-
nrofKnots = nrofKnots / 2;
349+
gridX.interpolateU(nInterpolations, knotL, S0, D0, S1, D1, coordinate, iParameters);
350+
nInterpolations /= 4;
351+
nKnots /= 2;
355352
} //end d (every dimension)
356353

357354
for (int i = 0; i < nYdim; i++) {

0 commit comments

Comments
 (0)