ATLAS Offline Software
Loading...
Searching...
No Matches
CaloRecGPU::NeighOffset Class Reference

A class that expresses the offset from the beginning of the neighbours list for the several neighbour options. More...

#include <NeighArr.h>

Collaboration diagram for CaloRecGPU::NeighOffset:

Public Types

using carrier = unsigned long long int

Public Member Functions

constexpr operator carrier () const
constexpr NeighOffset (const carrier v)
constexpr NeighOffsetoperator= (const carrier v)
constexpr int get_number (const int i) const
constexpr int get_start_cell (const int option) const
constexpr int get_end_cell (const int option) const
 To clarify, this cell no longer corresponds to the option, so it's one past the end (like the end iterator of a C++ container)...
constexpr int get_total_number () const
constexpr int get_num_cells (const int option) const

Static Public Member Functions

static constexpr carrier offset_delta (const int i)
 Returns, for each i, what must be added to the offset to increase the stores numbers appropriately when a cell belonging to option (i-1) is added.

Public Attributes

carrier value

Static Protected Attributes

static constexpr carrier s_numbers_to_keep = NumNeighOptions - 1
static constexpr int s_bits_per_offset = 5
static constexpr int s_bits_per_last_offset = 6
static constexpr int s_more_bits_begin = 9
static constexpr carrier s_offset_mask = 0x1FULL
static constexpr carrier s_offset_mask_last = 0x3FULL
static constexpr carrier s_offset_delta_pattern = 0x0208210842108421ULL
static constexpr carrier s_last_bit_mask = 0x8000000000000000ULL
static constexpr carrier s_only_numbers_mask = ~s_last_bit_mask

Detailed Description

A class that expresses the offset from the beginning of the neighbours list for the several neighbour options.

Bit packed to store all cumulative offsets, since they fit in 5 or 6 bits. (NMaxNeighbours == 34)

Definition at line 26 of file NeighArr.h.

Member Typedef Documentation

◆ carrier

using CaloRecGPU::NeighOffset::carrier = unsigned long long int

Definition at line 28 of file NeighArr.h.

Constructor & Destructor Documentation

◆ NeighOffset()

CaloRecGPU::NeighOffset::NeighOffset ( const carrier v)
inlineconstexpr

Definition at line 67 of file NeighArr.h.

67 : value(v)
68 {
69 }

Member Function Documentation

◆ get_end_cell()

int CaloRecGPU::NeighOffset::get_end_cell ( const int option) const
inlineconstexpr

To clarify, this cell no longer corresponds to the option, so it's one past the end (like the end iterator of a C++ container)...

Definition at line 115 of file NeighArr.h.

116 {
117 /*
118 if (option < 0 || option >= NumNeighOptions)
119 {
120 return -1;
121 }
122 else
123 {*/
124 return get_number(option);
125 /*}*/
126 }
constexpr int get_number(const int i) const
Definition NeighArr.h:77

◆ get_num_cells()

int CaloRecGPU::NeighOffset::get_num_cells ( const int option) const
inlineconstexpr

Definition at line 133 of file NeighArr.h.

134 {
135 return this->get_end_cell(option) - this->get_start_cell(option);
136 }
constexpr int get_start_cell(const int option) const
Definition NeighArr.h:96
constexpr int get_end_cell(const int option) const
To clarify, this cell no longer corresponds to the option, so it's one past the end (like the end ite...
Definition NeighArr.h:115

◆ get_number()

int CaloRecGPU::NeighOffset::get_number ( const int i) const
inlineconstexpr

Definition at line 77 of file NeighArr.h.

78 {
79 carrier ret = value /*& s_only_numbers_mask*/;
80 //Not necessary to mask since we mask the result anyway.
81
82 if (i >= s_more_bits_begin)
83 {
84 ret = ret >> (s_bits_per_offset * s_more_bits_begin);
85 ret = ret >> (s_bits_per_last_offset * (i - s_more_bits_begin));
86 ret &= s_offset_mask_last;
87 }
88 else
89 {
90 ret = ret >> (s_bits_per_offset * i);
91 ret &= s_offset_mask;
92 }
93 return (uint32_t) ret;
94 }
static constexpr carrier s_offset_mask_last
Definition NeighArr.h:45
static constexpr int s_more_bits_begin
Definition NeighArr.h:38
static constexpr carrier s_offset_mask
Definition NeighArr.h:44
unsigned long long int carrier
Definition NeighArr.h:28
static constexpr int s_bits_per_offset
Definition NeighArr.h:36
static constexpr int s_bits_per_last_offset
Definition NeighArr.h:37

◆ get_start_cell()

int CaloRecGPU::NeighOffset::get_start_cell ( const int option) const
inlineconstexpr

Definition at line 96 of file NeighArr.h.

97 {
98 if (option == 0)
99 {
100 return 0;
101 }
102 /*else if (option < 0 || option >= NumNeighOptions)
103 {
104 return -1;
105 }*/
106 else
107 {
108 return get_number(option - 1);
109 }
110 }

◆ get_total_number()

int CaloRecGPU::NeighOffset::get_total_number ( ) const
inlineconstexpr

Definition at line 128 of file NeighArr.h.

129 {
130 return get_number(NumNeighOptions - 1);
131 }
constexpr int NumNeighOptions

◆ offset_delta()

constexpr carrier CaloRecGPU::NeighOffset::offset_delta ( const int i)
inlinestaticconstexpr

Returns, for each i, what must be added to the offset to increase the stores numbers appropriately when a cell belonging to option (i-1) is added.

In other words, the neighbour counts starting from option i are incremented.

Definition at line 144 of file NeighArr.h.

145 {
146 carrier mask = 0xFFFFFFFFFFFFFFFFULL;
147 if (i >= s_more_bits_begin)
148 {
149 // coverity[overflow_const]
151 // coverity[overflow_const]
153 }
154 else
155 {
156 // coverity[overflow_const]
157 mask = mask << (s_bits_per_offset * i);
158 }
159
160 //Suppressing coverity errors here since
161 //adding zeros to the beginning of the mask
162 //and ignoring the higher level bits
163 //is precisely the desired behaviour.
164
167 }
static constexpr carrier s_offset_delta_pattern
Definition NeighArr.h:46
static constexpr carrier s_only_numbers_mask
Definition NeighArr.h:54

◆ operator carrier()

CaloRecGPU::NeighOffset::operator carrier ( ) const
inlineconstexpr

Definition at line 62 of file NeighArr.h.

63 {
64 return value;
65 }

◆ operator=()

NeighOffset & CaloRecGPU::NeighOffset::operator= ( const carrier v)
inlineconstexpr

Definition at line 71 of file NeighArr.h.

72 {
73 value = v;
74 return (*this);
75 }

Member Data Documentation

◆ s_bits_per_last_offset

int CaloRecGPU::NeighOffset::s_bits_per_last_offset = 6
staticconstexprprotected

Definition at line 37 of file NeighArr.h.

◆ s_bits_per_offset

int CaloRecGPU::NeighOffset::s_bits_per_offset = 5
staticconstexprprotected

Definition at line 36 of file NeighArr.h.

◆ s_last_bit_mask

carrier CaloRecGPU::NeighOffset::s_last_bit_mask = 0x8000000000000000ULL
staticconstexprprotected

Definition at line 50 of file NeighArr.h.

◆ s_more_bits_begin

int CaloRecGPU::NeighOffset::s_more_bits_begin = 9
staticconstexprprotected

Definition at line 38 of file NeighArr.h.

◆ s_numbers_to_keep

carrier CaloRecGPU::NeighOffset::s_numbers_to_keep = NumNeighOptions - 1
staticconstexprprotected

Definition at line 33 of file NeighArr.h.

◆ s_offset_delta_pattern

carrier CaloRecGPU::NeighOffset::s_offset_delta_pattern = 0x0208210842108421ULL
staticconstexprprotected

Definition at line 46 of file NeighArr.h.

◆ s_offset_mask

carrier CaloRecGPU::NeighOffset::s_offset_mask = 0x1FULL
staticconstexprprotected

Definition at line 44 of file NeighArr.h.

◆ s_offset_mask_last

carrier CaloRecGPU::NeighOffset::s_offset_mask_last = 0x3FULL
staticconstexprprotected

Definition at line 45 of file NeighArr.h.

◆ s_only_numbers_mask

carrier CaloRecGPU::NeighOffset::s_only_numbers_mask = ~s_last_bit_mask
staticconstexprprotected

Definition at line 54 of file NeighArr.h.

◆ value

carrier CaloRecGPU::NeighOffset::value

Definition at line 29 of file NeighArr.h.


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