-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAdiosStManColumn.cc
315 lines (294 loc) · 12.7 KB
/
AdiosStManColumn.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
// (c) University of Western Australia
// International Centre of Radio Astronomy Research
// M468, 35 Stirling Hwy
// Crawley, Perth WA 6009
// Australia
//
// Shanghai Astronomical Observatory, Chinese Academy of Sciences
// 80 Nandan Road, Shanghai 200030, China
//
// This library is free software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library. If not, see <http://www.gnu.org/licenses/>.
//
// Any bugs, questions, concerns and/or suggestions please email to
// lbq@shao.ac.cn, jason.wang@icrar.org
#include "AdiosStManColumn.h"
namespace casacore {
AdiosStManColumn::AdiosStManColumn (AdiosStMan* aParent, int aDataType, uInt aColNr)
:StManColumn (aDataType),
itsAdiosWriteIDs (0),
itsStManPtr (aParent),
itsCasaDataType(aDataType),
itsShape(0)
{
switch (aDataType){
case TpBool:
case TpArrayBool:
itsAdiosDataType = adios_byte;
itsDataTypeSize = sizeof(Bool);
break;
case TpChar:
case TpArrayChar:
itsAdiosDataType = adios_byte;
itsDataTypeSize = sizeof(Char);
break;
case TpUChar:
case TpArrayUChar:
itsAdiosDataType = adios_unsigned_byte;
itsDataTypeSize = sizeof(uChar);
break;
case TpShort:
case TpArrayShort:
itsAdiosDataType = adios_short;
itsDataTypeSize = sizeof(Short);
break;
case TpUShort:
case TpArrayUShort:
itsAdiosDataType = adios_unsigned_short;
itsDataTypeSize = sizeof(uShort);
break;
case TpInt:
case TpArrayInt:
itsAdiosDataType = adios_integer;
itsDataTypeSize = sizeof(Int);
break;
case TpUInt:
case TpArrayUInt:
itsAdiosDataType = adios_unsigned_integer;
itsDataTypeSize = sizeof(uInt);
break;
case TpFloat:
case TpArrayFloat:
itsAdiosDataType = adios_real;
itsDataTypeSize = sizeof(Float);
break;
case TpDouble:
case TpArrayDouble:
itsAdiosDataType = adios_double;
itsDataTypeSize = sizeof(Double);
break;
case TpComplex:
case TpArrayComplex:
itsAdiosDataType = adios_complex;
itsDataTypeSize = sizeof(Complex);
break;
case TpDComplex:
case TpArrayDComplex:
itsAdiosDataType = adios_double_complex;
itsDataTypeSize = sizeof(DComplex);
break;
case TpString:
case TpArrayString:
itsAdiosDataType = adios_string;
itsDataTypeSize = -1;
break;
}
}
AdiosStManColumn::~AdiosStManColumn (){
}
void AdiosStManColumn::setColumnName (String aName){
itsColumnName = aName;
}
String AdiosStManColumn::getColumnName (){
return itsColumnName;
}
IPosition AdiosStManColumn::getShapeColumn (){
return itsShape;
}
int AdiosStManColumn::getDataTypeSize(){
return itsDataTypeSize;
}
int AdiosStManColumn::getDataType(){
return itsCasaDataType;
}
// ------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------
void AdiosStManColumn::putArrayMetaV (uint64_t row, const void* data){
}
void AdiosStManColumn::getArrayMetaV (uint64_t rowStart, uint64_t nrRows, const Slicer& ns, void* data){
}
// *** access a row for an array column ***
void AdiosStManColumn::putArrayV (uInt rownr, const void* dataPtr){
itsStManPtr->logdbg("AdiosStManColumn::putArrayV","");
Bool deleteIt;
const void *data;
switch (itsCasaDataType){
case TpArrayBool:
case TpBool:
data = ((const Array<Bool>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<Bool>*)dataPtr)->freeStorage((const Bool*&)data, deleteIt);
break;
case TpArrayChar:
case TpChar:
data = ((const Array<Char>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<Char>*)dataPtr)->freeStorage((const Char*&)data, deleteIt);
break;
case TpArrayUChar:
case TpUChar:
data = ((const Array<uChar>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<uChar>*)dataPtr)->freeStorage((const uChar*&)data, deleteIt);
break;
case TpArrayShort:
case TpShort:
data = ((const Array<Short>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<Short>*)dataPtr)->freeStorage((const Short*&)data, deleteIt);
break;
case TpArrayUShort:
case TpUShort:
data = ((const Array<uShort>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<uShort>*)dataPtr)->freeStorage((const uShort*&)data, deleteIt);
break;
case TpArrayInt:
case TpInt:
data = ((const Array<Int>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<Int>*)dataPtr)->freeStorage((const Int*&)data, deleteIt);
break;
case TpArrayUInt:
case TpUInt:
data = ((const Array<uInt>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<uInt>*)dataPtr)->freeStorage((const uInt*&)data, deleteIt);
break;
case TpArrayFloat:
case TpFloat:
data = ((const Array<Float>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<Float>*)dataPtr)->freeStorage((const Float*&)data, deleteIt);
break;
case TpArrayDouble:
case TpDouble:
data = ((const Array<Double>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<Double>*)dataPtr)->freeStorage((const Double*&)data, deleteIt);
break;
case TpArrayComplex:
case TpComplex:
data = ((const Array<Complex>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<Complex>*)dataPtr)->freeStorage((const Complex*&)data, deleteIt);
break;
case TpArrayDComplex:
case TpDComplex:
data = ((const Array<DComplex>*)dataPtr)->getStorage (deleteIt);
putArrayMetaV(rownr, data);
((const Array<DComplex>*)dataPtr)->freeStorage((const DComplex*&)data, deleteIt);
break;
}
}
void AdiosStManColumn::getArrayV (uInt rownr, void* dataPtr){
itsStManPtr->logdbg("AdiosStManColumn::getArrayV","");
Slicer ns(IPosition(itsShape.size(),0,0,0,0,0,0,0,0,0,0), itsShape);
getArrayWrapper(rownr, 1, ns, dataPtr);
}
// *** access a slice of a row for an array column ***
// *** inactive by default
// *** only active when canAccessSlice() returns true in child class
void AdiosStManColumn::getSliceV(uInt aRowNr, const Slicer& ns, void* dataPtr){
itsStManPtr->logdbg("AdiosStManColumn::getSliceV","row number=", aRowNr);
getArrayWrapper(aRowNr, 1, ns, dataPtr);
}
// *** access all rows for an array column ***
// *** inactive by default
// *** only active when canAccessArrayColumn() returns true in child class
void AdiosStManColumn::getArrayColumnV(void* dataPtr){
itsStManPtr->logdbg("AdiosStManColumn::getArrayColumnV","");
Slicer ns(IPosition(itsShape.size(),0,0,0,0,0,0,0,0,0,0), itsShape);
getArrayWrapper(0, itsStManPtr->getNrRows(), ns, dataPtr);
}
// *** access a slice of all rows for an array column ***
// *** inactive by default
// *** only active when canAccessColumnSlice() returns true in child class
void AdiosStManColumn::getColumnSliceV(const Slicer& ns, void *dataPtr){
itsStManPtr->logdbg("AdiosStManColumn::getColumnSliceV","");
getArrayWrapper(0, itsStManPtr->getNrRows(), ns, dataPtr);
}
void AdiosStManColumn::getArrayWrapper(uint64_t rowStart, uint64_t nrRows, const Slicer& ns, void* dataPtr){
Bool deleteIt;
void *data;
switch (itsCasaDataType){
case TpArrayBool:
case TpBool:
data = ((Array<Bool>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<Bool>*)dataPtr)->putStorage ((Bool *&)data, deleteIt);
break;
case TpArrayChar:
case TpChar:
data = ((Array<Char>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<Char>*)dataPtr)->putStorage ((Char *&)data, deleteIt);
break;
case TpArrayUChar:
case TpUChar:
data = ((Array<uChar>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<uChar>*)dataPtr)->putStorage ((uChar *&)data, deleteIt);
break;
case TpArrayShort:
case TpShort:
data = ((Array<Short>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<Short>*)dataPtr)->putStorage ((Short *&)data, deleteIt);
break;
case TpArrayUShort:
case TpUShort:
data = ((Array<uShort>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<uShort>*)dataPtr)->putStorage ((uShort *&)data, deleteIt);
break;
case TpArrayInt:
case TpInt:
data = ((Array<Int>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<Int>*)dataPtr)->putStorage ((Int *&)data, deleteIt);
break;
case TpArrayUInt:
case TpUInt:
data = ((Array<uInt>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<uInt>*)dataPtr)->putStorage ((uInt *&)data, deleteIt);
break;
case TpArrayFloat:
case TpFloat:
data = ((Array<Float>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<Float>*)dataPtr)->putStorage ((Float *&)data, deleteIt);
break;
case TpArrayDouble:
case TpDouble:
data = ((Array<Double>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<Double>*)dataPtr)->putStorage ((Double *&)data, deleteIt);
break;
case TpArrayComplex:
case TpComplex:
data = ((Array<Complex>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<Complex>*)dataPtr)->putStorage ((Complex *&)data, deleteIt);
break;
case TpArrayDComplex:
case TpDComplex:
data = ((Array<DComplex>*)dataPtr)->getStorage (deleteIt);
getArrayMetaV(rowStart, nrRows, ns, data);
((Array<DComplex>*)dataPtr)->putStorage ((DComplex *&)data, deleteIt);
break;
}
}
}