Project
Loading...
Searching...
No Matches
SplineUtil.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
16
17#ifndef ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_SPLINEUTIL_H
18#define ALICEO2_GPUCOMMON_TPCFASTTRANSFORMATION_SPLINEUTIL_H
19
20namespace o2
21{
22namespace gpu
23{
24
29{
30 public:
33 static constexpr int32_t getSpec(int32_t nXdim, int32_t nYdim)
34 {
35 // List of the Spline class specializations:
36 //
37 // 0 - a parent class for other specializations
38 // 1 - nXdim>0, nYdim>0: both nXdim and nYdim are set at the compile time
39 // 2 - at least one of the dimensions must be set during runtime
40 // 3 - specialization where nYdim==1 (a small add-on on top of the other specs)
41
42 return (nYdim == 1) ? 3 : ((nXdim > 0 && nYdim > 0) ? 1 : 2);
43 /*
44 if (nYdim == 1) {
45 return 3;
46 }
47 if (nXdim > 0 && nYdim > 0) {
48 return 1;
49 } else {
50 return 2;
51 }
52 */
53 }
54
57 static constexpr int32_t getSpec(int32_t nYdim)
58 {
59 return getSpec(1, nYdim);
60 }
61
63 static constexpr int32_t abs(int32_t v) { return (v >= 0) ? v : -v; }
64
66 template <bool ConditionT, int32_t ValTrueT>
67 class Switch;
68
75 template <int32_t NdimT>
76 GPUd() static Switch<(NdimT > 0), NdimT> getNdim(int32_t Ndim)
77 {
78 return Switch<(NdimT > 0), NdimT>(Ndim);
79 }
80
86 template <int32_t NdimT>
87 GPUd() static Switch<(NdimT != 0), abs(NdimT)> getMaxNdim(int32_t Ndim)
88 {
90 }
91};
92
93template <int32_t ValTrueT>
94class SplineUtil::Switch<true, ValTrueT>
95{
96 public:
97 GPUd() Switch(int32_t /*valFalse*/) {}
98 GPUd() static constexpr int32_t get() { return ValTrueT; }
99};
100
101template <int32_t ValTrueT>
102class SplineUtil::Switch<false, ValTrueT>
103{
104 public:
105 GPUd() Switch(int32_t valFalse) : mValFalse(valFalse) {}
106 GPUd() int32_t get() const { return mValFalse; }
107
108 private:
109 int32_t mValFalse;
110};
111
112} // namespace gpu
113} // namespace o2
114
115#endif
GPUd() static const expr int32_t get()
Definition SplineUtil.h:98
class lets one to switch between constexpr int32_t ValTrueT and int32_t mValFalse,...
Definition SplineUtil.h:67
GPUd() static Switch<(NdimT > 0)
NdimT getNdim(int32_t Ndim)
Definition SplineUtil.h:76
static constexpr int32_t getSpec(int32_t nXdim, int32_t nYdim)
Definition SplineUtil.h:33
static constexpr int32_t getSpec(int32_t nYdim)
Definition SplineUtil.h:57
static constexpr int32_t abs(int32_t v)
abs() as a constexpr method, to make the GPU compiler happy
Definition SplineUtil.h:63
const GLdouble * v
Definition glcorearb.h:832
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...