BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
L1Portion.h
Go to the documentation of this file.
1#ifndef L1Portion_H
2#define L1Portion_H
3
4#include "L1TrackPar.h"
5
6#include <vector>
7using std::vector;
8// class for portions organization
9
10template<typename T>
11class L1Portion;
12
13template<>
15{
16 public:
17 typedef L1TrackPar T;
18 // typedef vector<T> vType;
20
22 : a()
23 , dataSize(0) {};
24 L1Portion(int size)
25 : a()
26 , dataSize(0)
27 {
28 reserve(size);
29 };
30 L1Portion(int size, int size2)
31 : a()
32 , dataSize(size2)
33 {
34 reserve(size);
35 // reserve2(size2);
36 };
37 vType& operator[](int i) { return a[i]; }
38 void resize(int size) { a.resize(size); };
39 void reserve(int size) { a.reserve(size); };
40 void reserve2(int size)
41 {
42 for (unsigned int i = 0; i < a.size(); i++)
43 a[i].reserve(size);
44 };
45 void push_back(vType& v) { a.push_back(v); };
46 void add_void()
47 {
48 vType v;
49 // v.resize(dataSize);
50 a.push_back(v);
51 a[a.size() - 1].reserve(dataSize);
52 };
53 void add_void(int i)
54 {
55 T t;
56 a[i].push_back(t);
57 };
58
60 {
61 int size = 0;
62 for (unsigned int i = 0; i < a.size(); i++)
63 size += a[i].size();
64 return size * sizeof(T);
65 };
66
67 private:
68 vector<vType> a;
69 // int mainSize; // size of a
70 int dataSize; // size of vType
71};
72
73template<>
75{
76 public:
79 // typedef std::vector<T, nsL1::SimdAlloc<T> > vType;
80
82 : a()
83 , dataSize(0) {};
84 L1Portion(int size)
85 : a()
86 , dataSize(0)
87 {
88 reserve(size);
89 };
90 L1Portion(int size, int size2)
91 : a()
92 , dataSize(size2)
93 {
94 reserve(size);
95 // reserve2(size2);
96 };
97
98 vType& operator[](int i) { return a[i]; }
99 void resize(int size) { a.resize(size); };
100 void reserve(int size) { a.reserve(size); };
101 void reserve2(int size)
102 {
103 for (unsigned int i = 0; i < a.size(); i++)
104 a[i].reserve(size);
105 };
106 void push_back(vType& v) { a.push_back(v); };
107 void add_void()
108 {
109 vType v;
110 // v.resize(dataSize);
111 a.push_back(v);
112 a[a.size() - 1].reserve(dataSize);
113 };
114 void add_void(int i)
115 {
116 T t;
117 a[i].push_back(t);
118 };
119
121 {
122 int size = 0;
123 for (unsigned int i = 0; i < a.size(); i++)
124 size += a[i].size();
125 return size * sizeof(T);
126 };
127
128 private:
129 vector<vType> a;
130 // int mainSize; // size of a
131 int dataSize; // size of vType
132};
133
134template<typename T>
136{
137 public:
138 typedef vector<T> vType;
139
141 : a()
142 , dataSize(0) {};
143 L1Portion(int size)
144 : a()
145 , dataSize(0)
146 {
147 reserve(size);
148 };
149 L1Portion(int size, int size2)
150 : a()
151 , dataSize(size2)
152 {
153 reserve(size);
154 // reserve2(size2);
155 };
156 vType& operator[](int i) { return a[i]; }
157 void resize(int size) { a.resize(size); };
158 void reserve(int size) { a.reserve(size); };
159 void reserve2(int size)
160 {
161 for (int i = 0; i < a.size(); i++)
162 a[i].reserve(size);
163 };
164 void push_back(vType& v) { a.push_back(v); };
165 void add_void()
166 {
167 vType v;
168 // v.resize(dataSize);
169 a.push_back(v);
170 a[a.size() - 1].reserve(dataSize);
171 };
172 void add_void(int i)
173 {
174 T t;
175 a[i].push_back(t);
176 };
177
179 {
180 int size = 0;
181 for (int i = 0; i < a.size(); i++)
182 size += a[i].size();
183 return size * sizeof(T);
184 };
185
186 private:
187 vector<vType> a;
188 // int mainSize; // size of a
189 int dataSize; // size of vType
190};
191
192#endif // L1Portion_H
__m128 v
Definition P4_F32vec4.h:1
int i
Definition P4_F32vec4.h:22
nsL1::vector< T >::TSimd vType
Definition L1Portion.h:78
void reserve2(int size)
Definition L1Portion.h:101
void push_back(vType &v)
Definition L1Portion.h:106
vType & operator[](int i)
Definition L1Portion.h:98
void resize(int size)
Definition L1Portion.h:99
L1Portion(int size, int size2)
Definition L1Portion.h:90
void resize(int size)
Definition L1Portion.h:38
L1Portion(int size, int size2)
Definition L1Portion.h:30
vector< vType > a
Definition L1Portion.h:68
nsL1::vector< T >::TSimd vType
Definition L1Portion.h:19
void reserve(int size)
Definition L1Portion.h:39
void push_back(vType &v)
Definition L1Portion.h:45
void reserve2(int size)
Definition L1Portion.h:40
vType & operator[](int i)
Definition L1Portion.h:37
vector< vType > a
Definition L1Portion.h:187
vType & operator[](int i)
Definition L1Portion.h:156
void push_back(vType &v)
Definition L1Portion.h:164
vector< T > vType
Definition L1Portion.h:138
void reserve(int size)
Definition L1Portion.h:158
L1Portion(int size)
Definition L1Portion.h:143
void add_void(int i)
Definition L1Portion.h:172
void reserve2(int size)
Definition L1Portion.h:159
void resize(int size)
Definition L1Portion.h:157
void add_void()
Definition L1Portion.h:165
L1Portion(int size, int size2)
Definition L1Portion.h:149
int dataSize
Definition L1Portion.h:189
int CalcSize()
Definition L1Portion.h:178
std::vector< T > TSimd