Project
Loading...
Searching...
No Matches
o2::gpu::IrregularSpline2D3D Class Reference

#include <IrregularSpline2D3D.h>

Inherits o2::gpu::FlatObject.

Public Member Functions

 IrregularSpline2D3D ()
 _____________ Constructors / destructors __________________________
 
 IrregularSpline2D3D (const IrregularSpline2D3D &)=delete
 Copy constructor: disabled to avoid ambiguity. Use cloneFromObject() instead.
 
IrregularSpline2D3Doperator= (const IrregularSpline2D3D &)=delete
 Assignment operator: disabled to avoid ambiguity. Use cloneFromObject() instead.
 
 ~IrregularSpline2D3D ()=default
 Destructor.
 
void cloneFromObject (const IrregularSpline2D3D &obj, char *newFlatBufferPtr)
 Construction interface.
 
void destroy ()
 
void moveBufferTo (char *newBufferPtr)
 
void setActualBufferAddress (char *actualFlatBufferPtr)
 Moving the class with its external buffer to another location.
 
void setFutureBufferAddress (char *futureFlatBufferPtr)
 
void construct (int32_t numberOfKnotsU, const float knotsU[], int32_t numberOfAxisBinsU, int32_t numberOfKnotsV, const float knotsV[], int32_t numberOfAxisBinsV)
 _______________ Construction interface ________________________
 
void constructRegular (int32_t numberOfKnotsU, int32_t numberOfKnotsV)
 Constructor for a regular spline.
 
template<typename T >
 GPUd () void correctEdges(T *data) const
 _______________ Main functionality ________________________
 
template<typename T >
 GPUd () void getSpline(GPUgeneric() const T *correctedData
 Get interpolated value for f(u,v) using data array correctedData[getNumberOfKnots()] with corrected edges.
 
float float GPUgeneric () T &x
 
float float GPUgeneric () T &y
 
float float GPUgeneric () T &z) const
 
 GPUd () void getSplineVec(const float *correctedData
 
 GPUd () int32_t getNumberOfKnots() const
 Get number total of knots: UxV.
 
 GPUd () const IrregularSpline1D &getGridU() const
 Get 1-D grid for U coordinate.
 
 GPUd () const IrregularSpline1D &getGridV() const
 Get 1-D grid for V coordinate.
 
 GPUd () const IrregularSpline1D &getGrid(int32_t uv) const
 Get 1-D grid for U or V coordinate.
 
 GPUd () void getKnotUV(int32_t iKnot
 Get u,v of i-th knot.
 
size_t getFlatBufferSize () const
 Get size of the mFlatBuffer data.
 
const chargetFlatBufferPtr () const
 Get pointer to the flat buffer.
 
size_t getGridUOffset () const
 technical stuff
 
size_t getGridVOffset () const
 Get offset of GridV flat data in the flat buffer.
 
void print () const
 Print method.
 
charreleaseInternalBuffer ()
 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 constexpr size_t getClassAlignmentBytes ()
 Get minimal required alignment for the class.
 
static constexpr size_t getBufferAlignmentBytes ()
 Get minimal required alignment for the flat buffer.
 
static constexpr size_t getDataAlignmentBytes ()
 Get minimal required alignment for the spline data.
 
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

float u
 
float float v
 
float float float & x
 
float float float float & y
 
float float float float float &z const
 
float & u
 
float float &v const
 

Additional Inherited Members

- Protected Types inherited from o2::gpu::FlatObject
enum  ConstructionState : uint32_t { NotConstructed = 0x0 , Constructed = 0x1 , InProgress = 0x2 }
 GPUCA_GPUCODE. More...
 
- 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.
 
- 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.
 
- 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
 

Detailed Description

The IrregularSpline2D3D class represents twoo-dimensional spline interpolation on nonunifom (irregular) grid.

The class is flat C structure. No virtual methods, no ROOT types are used. It is designed for spline parameterisation of TPC transformation.


The spline interpolates a generic function F:[u,v)->(x,y,z), where u,v belong to [0,1]x[0,1]

It is an extension of IrregularSpline1D class, see IrregularSpline1D.h for more details.

Important: – The number of knots and their positions may change during initialisation – Don't forget to call correctEdges() for the array of F values (see IrregularSpline1D.h )


Example of creating a spline:

const int32_t nKnotsU=5; const int32_t nKnotsV=6; float knotsU[nKnotsU] = {0., 0.25, 0.5, 0.7, 1.}; float knotsV[nKnotsV] = {0., 0.2, 0.3, 0.45, 0.8, 1.}; IrregularSpline2D3D spline(nKnotsU, knotsU, 4, nKnotsV, knotsV, 10 ); float f[nKnotsU*nKnotsV] = { 3.5, 2.0, 1.4, 3.8, 2.3, .... }; spline.correctEdges( f ); spline.getSpline( f, 0., 0. ); // == 3.5 spline.getSpline( f, 0.1, 0.32 ); // == some interpolated value

Definition at line 64 of file IrregularSpline2D3D.h.

Constructor & Destructor Documentation

◆ IrregularSpline2D3D() [1/2]

IrregularSpline2D3D::IrregularSpline2D3D ( )

_____________ Constructors / destructors __________________________

Default constructor. Creates an empty uninitialised object

Default constructor. Creates an empty uninitialised object

Definition at line 26 of file IrregularSpline2D3D.cxx.

◆ IrregularSpline2D3D() [2/2]

o2::gpu::IrregularSpline2D3D::IrregularSpline2D3D ( const IrregularSpline2D3D )
delete

Copy constructor: disabled to avoid ambiguity. Use cloneFromObject() instead.

◆ ~IrregularSpline2D3D()

o2::gpu::IrregularSpline2D3D::~IrregularSpline2D3D ( )
default

Destructor.

Member Function Documentation

◆ cloneFromObject()

void IrregularSpline2D3D::cloneFromObject ( const IrregularSpline2D3D obj,
char newFlatBufferPtr 
)

Construction interface.

See FlatObject for description

Definition at line 39 of file IrregularSpline2D3D.cxx.

◆ construct()

void IrregularSpline2D3D::construct ( int32_t  numberOfKnotsU,
const float  knotsU[],
int32_t  numberOfAxisBinsU,
int32_t  numberOfKnotsV,
const float  knotsV[],
int32_t  numberOfAxisBinsV 
)

_______________ Construction interface ________________________

Constructor

Number of knots created and their values may differ from the input values:

  • Edge knots 0.f and 1.f will be added if they are not present.
  • Knot values are rounded to closest axis bins: k*1./numberOfAxisBins.
  • Knots which are too close to each other will be merged
  • At least 5 knots and at least 4 axis bins will be created for consistency reason
Parameters
numberOfKnotsUU axis: Number of knots in knots[] array
knotsUU axis: Array of knots.
numberOfAxisBinsUU axis: Number of axis bins to map U coordinate to an appropriate [knot(i),knot(i+1)] interval. The knot positions have a "granularity" of 1./numberOfAxisBins
numberOfKnotsVV axis: Number of knots in knots[] array
knotsVV axis: Array of knots.
numberOfAxisBinsVV axis: Number of axis bins to map U coordinate to an appropriate [knot(i),knot(i+1)] interval. The knot positions have a "granularity" of 1./numberOfAxisBins

Constructor

Number of knots created and their values may differ from the input values:

  • Edge knots 0.f and 1.f will be added if they are not present.
  • Knot values are rounded to closest axis bins: k*1./numberOfAxisBins.
  • Knots which are too close to each other will be merged
  • At least 5 knots and at least 4 axis bins will be created for consistency reason
Parameters
numberOfKnotsUU axis: Number of knots in knots[] array
knotsUU axis: Array of knots.
numberOfAxisBinsUU axis: Number of axis bins to map U coordinate to an appropriate [knot(i),knot(i+1)] interval. The knot positions have a "granularity" of 1./numberOfAxisBins
numberOfKnotsVV axis: Number of knots in knots[] array
knotsVV axis: Array of knots.
numberOfAxisBinsVV axis: Number of axis bins to map U coordinate to an appropriate [knot(i),knot(i+1)] interval. The knot positions have a "granularity" of 1./numberOfAxisBins

Definition at line 84 of file IrregularSpline2D3D.cxx.

◆ constructRegular()

void IrregularSpline2D3D::constructRegular ( int32_t  numberOfKnotsU,
int32_t  numberOfKnotsV 
)

Constructor for a regular spline.

Constructor for a regular spline

Parameters
numberOfKnotsUU axis: Number of knots in knots[] array
numberOfKnotsVV axis: Number of knots in knots[] array

Definition at line 120 of file IrregularSpline2D3D.cxx.

◆ destroy()

void IrregularSpline2D3D::destroy ( )

See FlatObject for description

Definition at line 31 of file IrregularSpline2D3D.cxx.

◆ getBufferAlignmentBytes() [1/2]

static constexpr size_t o2::gpu::FlatObject::getBufferAlignmentBytes ( )
inlinestaticconstexpr

_____________ FlatObject functionality, see FlatObject class for description ____________

Memory alignment

Definition at line 197 of file FlatObject.h.

◆ getBufferAlignmentBytes() [2/2]

static constexpr size_t o2::gpu::IrregularSpline2D3D::getBufferAlignmentBytes ( )
inlinestaticconstexpr

Get minimal required alignment for the flat buffer.

Definition at line 173 of file IrregularSpline2D3D.h.

◆ getClassAlignmentBytes() [1/2]

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.

◆ getClassAlignmentBytes() [2/2]

static constexpr size_t o2::gpu::IrregularSpline2D3D::getClassAlignmentBytes ( )
inlinestaticconstexpr

Get minimal required alignment for the class.

Definition at line 170 of file IrregularSpline2D3D.h.

◆ getDataAlignmentBytes()

static constexpr size_t o2::gpu::IrregularSpline2D3D::getDataAlignmentBytes ( )
inlinestaticconstexpr

Get minimal required alignment for the spline data.

Definition at line 176 of file IrregularSpline2D3D.h.

◆ getFlatBufferPtr()

const char * o2::gpu::IrregularSpline2D3D::getFlatBufferPtr ( ) const
inline

Get pointer to the flat buffer.

Definition at line 167 of file IrregularSpline2D3D.h.

◆ getFlatBufferSize()

size_t o2::gpu::IrregularSpline2D3D::getFlatBufferSize ( ) const
inline

Get size of the mFlatBuffer data.

Definition at line 164 of file IrregularSpline2D3D.h.

◆ getGridUOffset()

size_t o2::gpu::IrregularSpline2D3D::getGridUOffset ( ) const
inline

technical stuff

Get offset of GridU flat data in the flat buffer

Definition at line 181 of file IrregularSpline2D3D.h.

◆ getGridVOffset()

size_t o2::gpu::IrregularSpline2D3D::getGridVOffset ( ) const
inline

Get offset of GridV flat data in the flat buffer.

Definition at line 184 of file IrregularSpline2D3D.h.

◆ GPUd() [1/8]

o2::gpu::IrregularSpline2D3D::GPUd ( ) const &
inline

Get 1-D grid for U or V coordinate.

Definition at line 158 of file IrregularSpline2D3D.h.

◆ GPUd() [2/8]

o2::gpu::IrregularSpline2D3D::GPUd ( ) const &
inline

Get 1-D grid for U coordinate.

Definition at line 152 of file IrregularSpline2D3D.h.

◆ GPUd() [3/8]

o2::gpu::IrregularSpline2D3D::GPUd ( ) const &
inline

Get 1-D grid for V coordinate.

Definition at line 155 of file IrregularSpline2D3D.h.

◆ GPUd() [4/8]

o2::gpu::IrregularSpline2D3D::GPUd ( ) const
inline

Get number total of knots: UxV.

Definition at line 149 of file IrregularSpline2D3D.h.

◆ GPUd() [5/8]

template<typename T >
o2::gpu::IrregularSpline2D3D::GPUd ( ) const

_______________ Main functionality ________________________

Correction of data values at edge knots.

It is needed for the fast spline mathematics to work correctly. See explanation in IrregularSpline1D.h header

Parameters
dataarray of function values. It has the size of getNumberOfKnots()

◆ GPUd() [6/8]

o2::gpu::IrregularSpline2D3D::GPUd ( )

Get u,v of i-th knot.

◆ GPUd() [7/8]

template<typename T >
o2::gpu::IrregularSpline2D3D::GPUd ( ) const

Get interpolated value for f(u,v) using data array correctedData[getNumberOfKnots()] with corrected edges.

◆ GPUd() [8/8]

o2::gpu::IrregularSpline2D3D::GPUd ( ) const

Same as getSpline, but using vectorized calculation.

Parameters
correctedDatashould be at least 128-bit aligned

◆ GPUgeneric() [1/3]

float float o2::gpu::IrregularSpline2D3D::GPUgeneric ( ) &

◆ GPUgeneric() [2/3]

float float o2::gpu::IrregularSpline2D3D::GPUgeneric ( ) &

◆ GPUgeneric() [3/3]

float float o2::gpu::IrregularSpline2D3D::GPUgeneric ( ) const &

◆ moveBufferTo()

void IrregularSpline2D3D::moveBufferTo ( char newBufferPtr)

See FlatObject for description

Definition at line 54 of file IrregularSpline2D3D.cxx.

◆ operator=()

IrregularSpline2D3D & o2::gpu::IrregularSpline2D3D::operator= ( const IrregularSpline2D3D )
delete

Assignment operator: disabled to avoid ambiguity. Use cloneFromObject() instead.

◆ print()

void IrregularSpline2D3D::print ( ) const

Print method.

Definition at line 140 of file IrregularSpline2D3D.cxx.

◆ releaseInternalBuffer()

char * o2::gpu::FlatObject::releaseInternalBuffer ( )
inline

Making the data buffer external.

Definition at line 220 of file FlatObject.h.

◆ setActualBufferAddress()

void IrregularSpline2D3D::setActualBufferAddress ( char actualFlatBufferPtr)

Moving the class with its external buffer to another location.

See FlatObject for description

Definition at line 61 of file IrregularSpline2D3D.cxx.

◆ setFutureBufferAddress()

void IrregularSpline2D3D::setFutureBufferAddress ( char futureFlatBufferPtr)

See FlatObject for description

Definition at line 70 of file IrregularSpline2D3D.cxx.

Member Data Documentation

◆ const [1/2]

float float float float float& z o2::gpu::IrregularSpline2D3D::const

Definition at line 146 of file IrregularSpline2D3D.h.

◆ const [2/2]

float float& v o2::gpu::IrregularSpline2D3D::const

Definition at line 161 of file IrregularSpline2D3D.h.

◆ u [1/2]

float o2::gpu::IrregularSpline2D3D::u

Definition at line 142 of file IrregularSpline2D3D.h.

◆ u [2/2]

float& o2::gpu::IrregularSpline2D3D::u

Definition at line 161 of file IrregularSpline2D3D.h.

◆ v

float float o2::gpu::IrregularSpline2D3D::v

Definition at line 142 of file IrregularSpline2D3D.h.

◆ x

float float float& o2::gpu::IrregularSpline2D3D::x

Definition at line 146 of file IrregularSpline2D3D.h.

◆ y

float float float float& o2::gpu::IrregularSpline2D3D::y

Definition at line 146 of file IrregularSpline2D3D.h.


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