Project
Loading...
Searching...
No Matches
o2::gpu::Spline1DContainer< DataT > Class Template Reference

#include <Spline1DSpec.h>

Inherits o2::gpu::FlatObject.

Inherited by o2::gpu::Spline1DSpec< DataT, YdimT, 0 >.

Classes

struct  Knot
 

Public Types

enum  SafetyLevel { kNotSafe , kSafe }
 Named enumeration for the safety level used by some methods. More...
 

Public Member Functions

 GPUd () static const expr int32_t getVersion()
 _____________ Version control __________________________
 
 Spline1DContainer ()=default
 _____________ C++ constructors / destructors __________________________
 
 Spline1DContainer (const Spline1DContainer &)=delete
 Disable all other constructors.
 
 ~Spline1DContainer ()=default
 Destructor.
 
void approximateFunction (double xMin, double xMax, std::function< void(double x, double f[])> F, int32_t nAuxiliaryDataPoints=4)
 _______________ Construction interface ________________________
 
int32_t writeToFile (TFile &outf, const char *name)
 _______________ IO ________________________
 
 GPUd () int32_t getUmax() const
 _______________ Getters ________________________
 
 GPUd () int32_t getYdimensions() const
 Get number of Y dimensions.
 
 GPUd () size_t getParameterAlignmentBytes() const
 Get minimal required alignment for the spline parameters.
 
 GPUd () int32_t getNumberOfParameters() const
 Number of parameters.
 
 GPUd () size_t getSizeOfParameters() const
 Size of the parameter array in bytes.
 
 GPUd () int32_t getNumberOfKnots() const
 Get a number of knots.
 
 GPUd () const Knot *getKnots() const
 Get the array of knots.
 
template<SafetyLevel SafeT = SafetyLevel::kSafe>
 GPUd () const Knot &getKnot(int32_t i) const
 Get i-th knot.
 
template<SafetyLevel SafeT = SafetyLevel::kSafe>
 GPUd () int32_t getLeftKnotIndexForU(DataT u) const
 Get index of an associated knot for a given U coordinate. Performs a boundary check.
 
 GPUd () DataT *getParameters()
 Get spline parameters.
 
 GPUd () const DataT *getParameters() const
 Get spline parameters const.
 
 GPUd () const int32_t *getUtoKnotMap() const
 _______________ Technical stuff ________________________
 
 GPUd () DataT convXtoU(DataT x) const
 Convert X coordinate to U.
 
 GPUd () DataT convUtoX(DataT u) const
 Convert U coordinate to X.
 
 GPUd () DataT getXmin() const
 Get Xmin.
 
 GPUd () DataT getXmax() const
 Get Xmax.
 
 GPUd () DataT getXtoUscale() const
 Get XtoUscale.
 
 GPUd () void setXrange(DataT xMin
 Set X range.
 
void print () const
 Print method.
 
 GPUd () int32_t calcNumberOfParameters(int32_t nYdim) const
 _______________ Expert tools _______________
 
void cloneFromObject (const Spline1DContainer &obj, char *newFlatBufferPtr)
 
void moveBufferTo (char *newBufferPtr)
 
void destroy ()
 
void setActualBufferAddress (char *actualFlatBufferPtr)
 
void setFutureBufferAddress (char *futureFlatBufferPtr)
 
charreleaseInternalBuffer ()
 _____________ Methods for making the data buffer external __________________________
 
- Public Member Functions inherited from o2::gpu::FlatObject
 FlatObject ()=default
 _____________ Constructors / destructors __________________________
 
 ~FlatObject ()
 
 FlatObject (const FlatObject &)=delete
 
FlatObjectoperator= (const FlatObject &)=delete
 
void destroy ()
 _______________ Utilities _______________________________________________
 
size_t getFlatBufferSize () const
 Gives size of the flat buffer.
 
const chargetFlatBufferPtr () const
 Gives pointer to the flat buffer.
 
bool isConstructed () const
 Tells if the object is constructed.
 
bool isBufferInternal () const
 Tells if the buffer is internal.
 
void adoptInternalBuffer (char *buf)
 
void clearInternalBufferPtr ()
 
void printC () const
 Print the content of the flat buffer.
 

Static Public Member Functions

static Spline1DContainerreadFromFile (TFile &inpf, const char *name)
 read a class object from the file
 
static int32_t test (const bool draw=0, const bool drawDataPoints=1)
 _______________ Test tools _______________
 
static constexpr size_t getBufferAlignmentBytes ()
 _____________ FlatObject functionality, see FlatObject class for description ____________
 
static constexpr size_t getClassAlignmentBytes ()
 _____________ Memory alignment __________________________
 
- Static Public Member Functions inherited from o2::gpu::FlatObject
static size_t alignSize (size_t sizeBytes, size_t alignmentBytes)
 _______________ Generic utilities _______________________________________________
 
template<class T >
static T * relocatePointer (const char *oldBase, char *newBase, const T *ptr)
 Relocates a pointer inside a buffer to the new buffer address.
 
template<class T , class TFile >
static int32_t writeToFile (T &obj, TFile &outf, const char *name)
 write a child class object to the file
 
template<class T , class TFile >
static T * readFromFile (TFile &inpf, const char *name)
 read a child class object from the file
 
template<class T >
static std::string stressTest (T &obj)
 Test the flat object functionality for a child class T.
 

Public Attributes

DataT xMax
 

Protected Member Functions

KnotgetKnots ()
 Non-const accessor to the knots array.
 
int32_t * getUtoKnotMap ()
 Non-const accessor to U->knots map.
 
void recreate (int32_t nYdim, int32_t numberOfKnots)
 Constructor for a regular spline.
 
void recreate (int32_t nYdim, int32_t numberOfKnots, const int32_t knotU[])
 Constructor for an irregular spline.
 
 ClassDefNV (Spline1DContainer, 1)
 (transient!!) pointer to F-dependent parameters inside the mFlatBufferPtr array
 
- Protected Member Functions inherited from o2::gpu::FlatObject
void startConstruction ()
 _____________ Construction _________
 
void finishConstruction (int32_t flatBufferSize)
 
void cloneFromObject (const FlatObject &obj, char *newFlatBufferPtr)
 
charreleaseInternalBuffer ()
 _____________ Methods for making the data buffer external __________________________
 
void moveBufferTo (char *newBufferPtr)
 
void setActualBufferAddress (char *actualFlatBufferPtr)
 _____________ Methods for moving the class with its external buffer to another location __________________________
 
void setFutureBufferAddress (char *futureFlatBufferPtr)
 
 ClassDefNV (FlatObject, 1)
 Pointer to the flat buffer.
 

Protected Attributes

int32_t mYdim = 0
 _____________ Data members ____________
 
int32_t mNumberOfKnots = 0
 n knots on the grid
 
int32_t mUmax = 0
 U of the last knot.
 
DataT mXmin = 0
 X of the first knot.
 
DataT mXtoUscale = 0
 a scaling factor to convert X to U
 
int32_t * mUtoKnotMap = nullptr
 
DataT * mParameters = nullptr
 (transient!!) pointer to (integer U -> knot index) map inside the mFlatBufferPtr array
 
- Protected Attributes inherited from o2::gpu::FlatObject
int32_t mFlatBufferSize = 0
 size of the flat buffer
 
uint32_t mConstructionMask = ConstructionState::NotConstructed
 mask for constructed object members, first two bytes are used by this class
 
charmFlatBufferContainer = nullptr
 
charmFlatBufferPtr = nullptr
 

Additional Inherited Members

- Protected Types inherited from o2::gpu::FlatObject
enum  ConstructionState : uint32_t { NotConstructed = 0x0 , Constructed = 0x1 , InProgress = 0x2 }
 GPUCA_GPUCODE. More...
 
- Static Protected Member Functions inherited from o2::gpu::FlatObject
static constexpr size_t getClassAlignmentBytes ()
 _____________ Memory alignment __________________________
 
static constexpr size_t getBufferAlignmentBytes ()
 Gives minimal alignment in bytes required for the flat buffer.
 

Detailed Description

template<typename DataT>
class o2::gpu::Spline1DContainer< DataT >

================================================================================================== The class Spline1DContainer is a base class of Spline1D. It contains all the class members and those methods which only depends on the DataT data type. It also contains all non-inlined methods with the implementation in Spline1DSpec.cxx file.

DataT is a data type, which is supposed to be either double or float. For other possible data types one has to add the corresponding instantiation line at the end of the Spline1DSpec.cxx file

Definition at line 45 of file Spline1DSpec.h.

Member Enumeration Documentation

◆ SafetyLevel

template<typename DataT >
enum o2::gpu::Spline1DContainer::SafetyLevel

Named enumeration for the safety level used by some methods.

Enumerator
kNotSafe 
kSafe 

Definition at line 49 of file Spline1DSpec.h.

Constructor & Destructor Documentation

◆ Spline1DContainer() [1/2]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::Spline1DContainer ( )
default

_____________ C++ constructors / destructors __________________________

Default constructor, required by the Root IO

◆ Spline1DContainer() [2/2]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::Spline1DContainer ( const Spline1DContainer< DataT > &  )
delete

Disable all other constructors.

◆ ~Spline1DContainer()

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::~Spline1DContainer ( )
default

Destructor.

Member Function Documentation

◆ approximateFunction()

template<class DataT >
void Spline1DContainer::approximateFunction ( double  xMin,
double  xMax,
std::function< void(double x, double f[])>  F,
int32_t  nAuxiliaryDataPoints = 4 
)

_______________ Construction interface ________________________

approximate a function F with this spline

approximate a function F with this spline

Definition at line 166 of file Spline1DSpec.cxx.

◆ ClassDefNV()

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::ClassDefNV ( Spline1DContainer< DataT >  ,
 
)
protected

(transient!!) pointer to F-dependent parameters inside the mFlatBufferPtr array

◆ cloneFromObject()

template<class DataT >
void Spline1DContainer::cloneFromObject ( const Spline1DContainer< DataT > &  obj,
char newFlatBufferPtr 
)

See FlatObject for description

Definition at line 196 of file Spline1DSpec.cxx.

◆ destroy()

template<class DataT >
void Spline1DContainer::destroy ( )

See FlatObject for description

Definition at line 224 of file Spline1DSpec.cxx.

◆ getBufferAlignmentBytes()

template<typename DataT >
static constexpr size_t o2::gpu::FlatObject::getBufferAlignmentBytes ( )
inlinestaticconstexpr

_____________ FlatObject functionality, see FlatObject class for description ____________

Definition at line 197 of file FlatObject.h.

◆ getClassAlignmentBytes()

template<typename DataT >
static constexpr size_t o2::gpu::FlatObject::getClassAlignmentBytes ( )
inlinestaticconstexpr

_____________ Memory alignment __________________________

Gives minimal alignment in bytes required for the class object

Definition at line 194 of file FlatObject.h.

◆ getKnots()

template<typename DataT >
Knot * o2::gpu::Spline1DContainer< DataT >::getKnots ( )
inlineprotected

Non-const accessor to the knots array.

Definition at line 199 of file Spline1DSpec.h.

◆ getUtoKnotMap()

template<typename DataT >
int32_t * o2::gpu::Spline1DContainer< DataT >::getUtoKnotMap ( )
inlineprotected

Non-const accessor to U->knots map.

Definition at line 202 of file Spline1DSpec.h.

◆ GPUd() [1/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Get spline parameters const.

Definition at line 141 of file Spline1DSpec.h.

◆ GPUd() [2/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

_______________ Technical stuff ________________________

Get a map (integer U -> corresponding knot index)

Definition at line 146 of file Spline1DSpec.h.

◆ GPUd() [3/20]

template<typename DataT >
template<SafetyLevel SafeT = SafetyLevel::kSafe>
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const &
inline

Get i-th knot.

Definition at line 125 of file Spline1DSpec.h.

◆ GPUd() [4/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Get the array of knots.

Definition at line 121 of file Spline1DSpec.h.

◆ GPUd() [5/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( )
inline

Get spline parameters.

Definition at line 138 of file Spline1DSpec.h.

◆ GPUd() [6/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Convert U coordinate to X.

Definition at line 152 of file Spline1DSpec.h.

◆ GPUd() [7/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Convert X coordinate to U.

Definition at line 149 of file Spline1DSpec.h.

◆ GPUd() [8/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Get Xmax.

Definition at line 158 of file Spline1DSpec.h.

◆ GPUd() [9/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Get Xmin.

Definition at line 155 of file Spline1DSpec.h.

◆ GPUd() [10/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Get XtoUscale.

Definition at line 161 of file Spline1DSpec.h.

◆ GPUd() [11/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

_______________ Expert tools _______________

Number of parameters for given Y dimensions

Definition at line 172 of file Spline1DSpec.h.

◆ GPUd() [12/20]

template<typename DataT >
template<SafetyLevel SafeT = SafetyLevel::kSafe>
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const

Get index of an associated knot for a given U coordinate. Performs a boundary check.

◆ GPUd() [13/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Get a number of knots.

Definition at line 118 of file Spline1DSpec.h.

◆ GPUd() [14/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Number of parameters.

Definition at line 112 of file Spline1DSpec.h.

◆ GPUd() [15/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

_______________ Getters ________________________

Get U coordinate of the last knot

Definition at line 99 of file Spline1DSpec.h.

◆ GPUd() [16/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Get number of Y dimensions.

Definition at line 102 of file Spline1DSpec.h.

◆ GPUd() [17/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Get minimal required alignment for the spline parameters.

Definition at line 105 of file Spline1DSpec.h.

◆ GPUd() [18/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

Size of the parameter array in bytes.

Definition at line 115 of file Spline1DSpec.h.

◆ GPUd() [19/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( ) const
inline

_____________ Version control __________________________

Version control

Definition at line 64 of file Spline1DSpec.h.

◆ GPUd() [20/20]

template<typename DataT >
o2::gpu::Spline1DContainer< DataT >::GPUd ( )

Set X range.

◆ moveBufferTo()

template<class DataT >
void Spline1DContainer::moveBufferTo ( char newBufferPtr)

See FlatObject for description

Definition at line 212 of file Spline1DSpec.cxx.

◆ print()

template<class DataT >
void Spline1DContainer::print ( ) const

Print method.

Definition at line 150 of file Spline1DSpec.cxx.

◆ readFromFile()

template<class DataT >
Spline1DContainer< DataT > * Spline1DContainer::readFromFile ( TFile &  inpf,
const char name 
)
static

read a class object from the file

read a class object from the file

Definition at line 184 of file Spline1DSpec.cxx.

◆ recreate() [1/2]

template<class DataT >
void Spline1DContainer::recreate ( int32_t  nYdim,
int32_t  numberOfKnots 
)
protected

Constructor for a regular spline.

Constructor for a regular spline

Parameters
numberOfKnotsNumber of knots

Definition at line 38 of file Spline1DSpec.cxx.

◆ recreate() [2/2]

template<class DataT >
void Spline1DContainer::recreate ( int32_t  nYdim,
int32_t  numberOfKnots,
const int32_t  knotU[] 
)
protected

Constructor for an irregular spline.

Main constructor for an irregular spline

Number of created knots may differ from the input values:

  • Duplicated knots will be deleted
  • At least 2 knots will be created
Parameters
numberOfKnotsNumber of knots in knots[] array
knotsArray of relative knot positions (integer values)

Definition at line 55 of file Spline1DSpec.cxx.

◆ releaseInternalBuffer()

template<typename DataT >
char * o2::gpu::FlatObject::releaseInternalBuffer ( )
inline

_____________ Methods for making the data buffer external __________________________

Definition at line 220 of file FlatObject.h.

◆ setActualBufferAddress()

template<class DataT >
void Spline1DContainer::setActualBufferAddress ( char actualFlatBufferPtr)

See FlatObject for description

Definition at line 238 of file Spline1DSpec.cxx.

◆ setFutureBufferAddress()

template<class DataT >
void Spline1DContainer::setFutureBufferAddress ( char futureFlatBufferPtr)

See FlatObject for description

Definition at line 254 of file Spline1DSpec.cxx.

◆ test()

template<class DataT >
int32_t Spline1DContainer::test ( const bool  draw = 0,
const bool  drawDataPoints = 1 
)
static

_______________ Test tools _______________

Test the class functionality

Definition at line 264 of file Spline1DSpec.cxx.

◆ writeToFile()

template<class DataT >
int32_t Spline1DContainer::writeToFile ( TFile &  outf,
const char name 
)

_______________ IO ________________________

write a class object to the file

write a class object to the file

Definition at line 177 of file Spline1DSpec.cxx.

Member Data Documentation

◆ mNumberOfKnots

template<typename DataT >
int32_t o2::gpu::Spline1DContainer< DataT >::mNumberOfKnots = 0
protected

n knots on the grid

Definition at line 215 of file Spline1DSpec.h.

◆ mParameters

template<typename DataT >
DataT* o2::gpu::Spline1DContainer< DataT >::mParameters = nullptr
protected

(transient!!) pointer to (integer U -> knot index) map inside the mFlatBufferPtr array

Definition at line 220 of file Spline1DSpec.h.

◆ mUmax

template<typename DataT >
int32_t o2::gpu::Spline1DContainer< DataT >::mUmax = 0
protected

U of the last knot.

Definition at line 216 of file Spline1DSpec.h.

◆ mUtoKnotMap

template<typename DataT >
int32_t* o2::gpu::Spline1DContainer< DataT >::mUtoKnotMap = nullptr
protected

Definition at line 219 of file Spline1DSpec.h.

◆ mXmin

template<typename DataT >
DataT o2::gpu::Spline1DContainer< DataT >::mXmin = 0
protected

X of the first knot.

Definition at line 217 of file Spline1DSpec.h.

◆ mXtoUscale

template<typename DataT >
DataT o2::gpu::Spline1DContainer< DataT >::mXtoUscale = 0
protected

a scaling factor to convert X to U

Definition at line 218 of file Spline1DSpec.h.

◆ mYdim

template<typename DataT >
int32_t o2::gpu::Spline1DContainer< DataT >::mYdim = 0
protected

_____________ Data members ____________

dimentionality of F

Definition at line 214 of file Spline1DSpec.h.

◆ xMax

template<typename DataT >
DataT o2::gpu::Spline1DContainer< DataT >::xMax

Definition at line 164 of file Spline1DSpec.h.


The documentation for this class was generated from the following files: