Repository navigation
Expand file tree
/
Copy pathview3.h
More file actions
574 lines (478 loc) · 23.3 KB
/
Copy pathview3.h
File metadata and controls
574 lines (478 loc) · 23.3 KB
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
#ifndef ZFP_VIEW3_H
#define ZFP_VIEW3_H
// 3D array views
namespace zfp {
namespace internal {
namespace dim3 {
// abstract view of 3D array (base class)
template <class Container>
class preview {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
// rate in bits per value
double rate() const { return array->rate(); }
// dimensions of (sub)array
size_t size() const { return nx * ny * nz; }
// local to global array indices
size_t global_x(size_t i) const { return x + i; }
size_t global_y(size_t j) const { return y + j; }
size_t global_z(size_t k) const { return z + k; }
protected:
// construction and assignment--perform shallow copy of (sub)array
explicit preview(container_type* array) : array(array), x(0), y(0), z(0), nx(array->size_x()), ny(array->size_y()), nz(array->size_z()) {}
explicit preview(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz) : array(array), x(x), y(y), z(z), nx(nx), ny(ny), nz(nz) {}
preview& operator=(container_type* a)
{
array = a;
x = y = z = 0;
nx = a->nx;
ny = a->ny;
nz = a->nz;
return *this;
}
// global index bounds for iterators
size_t min_x() const { return x; }
size_t max_x() const { return x + nx; }
size_t min_y() const { return y; }
size_t max_y() const { return y + ny; }
size_t min_z() const { return z; }
size_t max_z() const { return z + nz; }
container_type* array; // underlying container
size_t x, y, z; // offset into array
size_t nx, ny, nz; // dimensions of subarray
};
// generic read-only view into a rectangular subset of a 3D array
template <class Container>
class const_view : public preview<Container> {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
typedef typename zfp::internal::dim3::const_reference<const_view> const_reference;
typedef typename zfp::internal::dim3::const_pointer<const_view> const_pointer;
typedef typename zfp::internal::dim3::const_iterator<const_view> const_iterator;
// construction--perform shallow copy of (sub)array
const_view(container_type* array) : preview<Container>(array) {}
const_view(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz) : preview<Container>(array, x, y, z, nx, ny, nz) {}
// dimensions of (sub)array
size_t size_x() const { return nx; }
size_t size_y() const { return ny; }
size_t size_z() const { return nz; }
// (i, j, k) inspector
const_reference operator()(size_t i, size_t j, size_t k) const { return const_reference(this, x + i, y + j, z + k); }
// random access iterators
const_iterator cbegin() const { return const_iterator(this, x, y, z); }
const_iterator cend() const { return const_iterator(this, x, y, z + nz); }
const_iterator begin() const { return cbegin(); }
const_iterator end() const { return cend(); }
protected:
friend class zfp::internal::dim3::const_handle<const_view>;
friend class zfp::internal::dim3::const_pointer<const_view>;
friend class zfp::internal::dim3::const_iterator<const_view>;
using preview<Container>::min_x;
using preview<Container>::max_x;
using preview<Container>::min_y;
using preview<Container>::max_y;
using preview<Container>::min_z;
using preview<Container>::max_z;
using preview<Container>::array;
using preview<Container>::x;
using preview<Container>::y;
using preview<Container>::z;
using preview<Container>::nx;
using preview<Container>::ny;
using preview<Container>::nz;
// inspector
value_type get(size_t x, size_t y, size_t z) const { return array->get(x, y, z); }
};
// generic read-write view into a rectangular subset of a 3D array
template <class Container>
class view : public const_view<Container> {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
typedef typename zfp::internal::dim3::const_reference<view> const_reference;
typedef typename zfp::internal::dim3::const_pointer<view> const_pointer;
typedef typename zfp::internal::dim3::const_iterator<view> const_iterator;
typedef typename zfp::internal::dim3::reference<view> reference;
typedef typename zfp::internal::dim3::pointer<view> pointer;
typedef typename zfp::internal::dim3::iterator<view> iterator;
// construction--perform shallow copy of (sub)array
view(container_type* array) : const_view<Container>(array) {}
view(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz) : const_view<Container>(array, x, y, z, nx, ny, nz) {}
// (i, j, k) inspector
const_reference operator()(size_t i, size_t j, size_t k) const { return const_reference(this, x + i, y + j, z + k); }
// (i, j, k) mutator
reference operator()(size_t i, size_t j, size_t k) { return reference(this, x + i, y + j, z + k); }
// random access iterators
const_iterator cbegin() const { return const_iterator(this, x, y, z); }
const_iterator cend() const { return const_iterator(this, x, y, z + nz); }
const_iterator begin() const { return cbegin(); }
const_iterator end() const { return cend(); }
iterator begin() { return iterator(this, x, y, z); }
iterator end() { return iterator(this, x, y, z + nz); }
protected:
friend class zfp::internal::dim3::const_handle<view>;
friend class zfp::internal::dim3::const_pointer<view>;
friend class zfp::internal::dim3::const_iterator<view>;
friend class zfp::internal::dim3::reference<view>;
friend class zfp::internal::dim3::pointer<view>;
friend class zfp::internal::dim3::iterator<view>;
using const_view<Container>::min_x;
using const_view<Container>::max_x;
using const_view<Container>::min_y;
using const_view<Container>::max_y;
using const_view<Container>::min_z;
using const_view<Container>::max_z;
using const_view<Container>::get;
using const_view<Container>::array;
using const_view<Container>::x;
using const_view<Container>::y;
using const_view<Container>::z;
using const_view<Container>::nx;
using const_view<Container>::ny;
using const_view<Container>::nz;
// mutator
void set(size_t x, size_t y, size_t z, value_type val) { array->set(x, y, z, val); }
// in-place updates
void add(size_t x, size_t y, size_t z, value_type val) { array->add(x, y, z, val); }
void sub(size_t x, size_t y, size_t z, value_type val) { array->sub(x, y, z, val); }
void mul(size_t x, size_t y, size_t z, value_type val) { array->mul(x, y, z, val); }
void div(size_t x, size_t y, size_t z, value_type val) { array->div(x, y, z, val); }
};
// flat view of 3D array (operator[] returns scalar)
template <class Container>
class flat_view : public view<Container> {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
typedef typename zfp::internal::dim3::const_reference<flat_view> const_reference;
typedef typename zfp::internal::dim3::const_pointer<flat_view> const_pointer;
typedef typename zfp::internal::dim3::reference<flat_view> reference;
typedef typename zfp::internal::dim3::pointer<flat_view> pointer;
// construction--perform shallow copy of (sub)array
flat_view(container_type* array) : view<Container>(array) {}
flat_view(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz) : view<Container>(array, x, y, z, nx, ny, nz) {}
// convert (i, j, k) index to flat index
size_t index(size_t i, size_t j, size_t k) const { return i + nx * (j + ny * k); }
// convert flat index to (i, j, k) index
void ijk(size_t& i, size_t& j, size_t& k, size_t index) const
{
i = index % nx; index /= nx;
j = index % ny; index /= ny;
k = index;
}
// flat index [] inspector
const_reference operator[](size_t index) const
{
size_t i, j, k;
ijk(i, j, k, index);
return const_reference(this, x + i, y + j, z + k);
}
// flat index [] mutator
reference operator[](size_t index)
{
size_t i, j, k;
ijk(i, j, k, index);
return reference(this, x + i, y + j, z + k);
}
// (i, j, k) inspector
const_reference operator()(size_t i, size_t j, size_t k) const { return const_reference(this, x + i, y + j, z + k); }
// (i, j, k) mutator
reference operator()(size_t i, size_t j, size_t k) { return reference(this, x + i, y + j, z + k); }
protected:
friend class zfp::internal::dim3::const_handle<flat_view>;
friend class zfp::internal::dim3::const_pointer<flat_view>;
friend class zfp::internal::dim3::reference<flat_view>;
friend class zfp::internal::dim3::pointer<flat_view>;
using view<Container>::array;
using view<Container>::x;
using view<Container>::y;
using view<Container>::z;
using view<Container>::nx;
using view<Container>::ny;
using view<Container>::nz;
// inspector
value_type get(size_t x, size_t y, size_t z) const { return array->get(x, y, z); }
// mutator
void set(size_t x, size_t y, size_t z, value_type val) { array->set(x, y, z, val); }
// in-place updates
void add(size_t x, size_t y, size_t z, value_type val) { array->add(x, y, z, val); }
void sub(size_t x, size_t y, size_t z, value_type val) { array->sub(x, y, z, val); }
void mul(size_t x, size_t y, size_t z, value_type val) { array->mul(x, y, z, val); }
void div(size_t x, size_t y, size_t z, value_type val) { array->div(x, y, z, val); }
};
// forward declaration of friends
template <class Container> class nested_view1;
template <class Container> class nested_view2;
template <class Container> class nested_view3;
// nested view into a 1D rectangular subset of a 3D array
template <class Container>
class nested_view1 : public preview<Container> {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
typedef typename zfp::internal::dim3::const_reference<nested_view1> const_reference;
typedef typename zfp::internal::dim3::const_pointer<nested_view1> const_pointer;
typedef typename zfp::internal::dim3::reference<nested_view1> reference;
typedef typename zfp::internal::dim3::pointer<nested_view1> pointer;
// dimensions of (sub)array
size_t size_x() const { return nx; }
// [i] inspector and mutator
const_reference operator[](size_t index) const { return const_reference(this, x + index, y, z); }
reference operator[](size_t index) { return reference(this, x + index, y, z); }
// (i) inspector and mutator
const_reference operator()(size_t i) const { return const_reference(this, x + i, y, z); }
reference operator()(size_t i) { return reference(this, x + i, y, z); }
protected:
friend class zfp::internal::dim3::const_handle<nested_view1>;
friend class zfp::internal::dim3::const_pointer<nested_view1>;
friend class zfp::internal::dim3::reference<nested_view1>;
friend class zfp::internal::dim3::pointer<nested_view1>;
using preview<Container>::array;
using preview<Container>::x;
using preview<Container>::y;
using preview<Container>::z;
using preview<Container>::nx;
using preview<Container>::ny;
using preview<Container>::nz;
// construction--perform shallow copy of (sub)array
friend class nested_view2<Container>;
explicit nested_view1(container_type* array) : preview<Container>(array) {}
explicit nested_view1(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz) : preview<Container>(array, x, y, z, nx, ny, nz) {}
// inspector
value_type get(size_t x, size_t y, size_t z) const { return array->get(x, y, z); }
// mutator
void set(size_t x, size_t y, size_t z, value_type val) { array->set(x, y, z, val); }
// in-place updates
void add(size_t x, size_t y, size_t z, value_type val) { array->add(x, y, z, val); }
void sub(size_t x, size_t y, size_t z, value_type val) { array->sub(x, y, z, val); }
void mul(size_t x, size_t y, size_t z, value_type val) { array->mul(x, y, z, val); }
void div(size_t x, size_t y, size_t z, value_type val) { array->div(x, y, z, val); }
};
// nested view into a 2D rectangular subset of a 3D array
template <class Container>
class nested_view2 : public preview<Container> {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
typedef typename zfp::internal::dim3::const_reference<nested_view2> const_reference;
typedef typename zfp::internal::dim3::const_pointer<nested_view2> const_pointer;
typedef typename zfp::internal::dim3::reference<nested_view2> reference;
typedef typename zfp::internal::dim3::pointer<nested_view2> pointer;
// construction--perform shallow copy of (sub)array
nested_view2(container_type* array) : preview<Container>(array) {}
nested_view2(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz) : preview<Container>(array, x, y, z, nx, ny, nz) {}
// dimensions of (sub)array
size_t size_x() const { return nx; }
size_t size_y() const { return ny; }
// 1D view
nested_view1<Container> operator[](size_t index) const { return nested_view1<Container>(array, x, y + index, z, nx, 1, 1); }
// (i, j) inspector and mutator
const_reference operator()(size_t i, size_t j) const { return const_reference(this, x + i, y + j, z); }
reference operator()(size_t i, size_t j) { return reference(this, x + i, y + j, z); }
protected:
friend class zfp::internal::dim3::const_handle<nested_view2>;
friend class zfp::internal::dim3::const_pointer<nested_view2>;
friend class zfp::internal::dim3::reference<nested_view2>;
friend class zfp::internal::dim3::pointer<nested_view2>;
using preview<Container>::array;
using preview<Container>::x;
using preview<Container>::y;
using preview<Container>::z;
using preview<Container>::nx;
using preview<Container>::ny;
using preview<Container>::nz;
// inspector
value_type get(size_t x, size_t y, size_t z) const { return array->get(x, y, z); }
// mutator
void set(size_t x, size_t y, size_t z, value_type val) { array->set(x, y, z, val); }
// in-place updates
void add(size_t x, size_t y, size_t z, value_type val) { array->add(x, y, z, val); }
void sub(size_t x, size_t y, size_t z, value_type val) { array->sub(x, y, z, val); }
void mul(size_t x, size_t y, size_t z, value_type val) { array->mul(x, y, z, val); }
void div(size_t x, size_t y, size_t z, value_type val) { array->div(x, y, z, val); }
};
// nested view into a 3D rectangular subset of a 3D array
template <class Container>
class nested_view3 : public preview<Container> {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
typedef typename zfp::internal::dim3::const_reference<nested_view3> const_reference;
typedef typename zfp::internal::dim3::const_pointer<nested_view3> const_pointer;
typedef typename zfp::internal::dim3::reference<nested_view3> reference;
typedef typename zfp::internal::dim3::pointer<nested_view3> pointer;
// construction--perform shallow copy of (sub)array
nested_view3(container_type* array) : preview<Container>(array) {}
nested_view3(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz) : preview<Container>(array, x, y, z, nx, ny, nz) {}
// dimensions of (sub)array
size_t size_x() const { return nx; }
size_t size_y() const { return ny; }
size_t size_z() const { return nz; }
// 2D view
nested_view2<Container> operator[](size_t index) const { return nested_view2<Container>(array, x, y, z + index, nx, ny, 1); }
// (i, j, k) inspector and mutator
const_reference operator()(size_t i, size_t j, size_t k) const { return const_reference(this, x + i, y + j, z + k); }
reference operator()(size_t i, size_t j, size_t k) { return reference(this, x + i, y + j, z + k); }
protected:
friend class zfp::internal::dim3::const_handle<nested_view3>;
friend class zfp::internal::dim3::const_pointer<nested_view3>;
friend class zfp::internal::dim3::reference<nested_view3>;
friend class zfp::internal::dim3::pointer<nested_view3>;
using preview<Container>::array;
using preview<Container>::x;
using preview<Container>::y;
using preview<Container>::z;
using preview<Container>::nx;
using preview<Container>::ny;
using preview<Container>::nz;
// inspector
value_type get(size_t x, size_t y, size_t z) const { return array->get(x, y, z); }
// mutator
void set(size_t x, size_t y, size_t z, value_type val) { array->set(x, y, z, val); }
// in-place updates
void add(size_t x, size_t y, size_t z, value_type val) { array->add(x, y, z, val); }
void sub(size_t x, size_t y, size_t z, value_type val) { array->sub(x, y, z, val); }
void mul(size_t x, size_t y, size_t z, value_type val) { array->mul(x, y, z, val); }
void div(size_t x, size_t y, size_t z, value_type val) { array->div(x, y, z, val); }
};
// thread-safe read-only view of 3D (sub)array with private cache
template <class Container>
class private_const_view : public preview<Container> {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
typedef typename container_type::store_type store_type;
typedef typename zfp::internal::dim3::const_reference<private_const_view> const_reference;
typedef typename zfp::internal::dim3::const_pointer<private_const_view> const_pointer;
typedef typename zfp::internal::dim3::const_iterator<private_const_view> const_iterator;
// construction--perform shallow copy of (sub)array
private_const_view(container_type* array, size_t cache_size = 0) :
preview<Container>(array),
cache(array->store, cache_size ? cache_size : array->cache.size())
{}
private_const_view(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz, size_t cache_size = 0) :
preview<Container>(array, x, y, z, nx, ny, nz),
cache(array->store, cache_size ? cache_size : array->cache.size())
{}
// dimensions of (sub)array
size_t size_x() const { return nx; }
size_t size_y() const { return ny; }
size_t size_z() const { return nz; }
// cache size in number of bytes
size_t cache_size() const { return cache.size(); }
// set minimum cache size in bytes (array dimensions must be known)
void set_cache_size(size_t bytes) { cache.resize(bytes); }
// empty cache without compressing modified cached blocks
void clear_cache() const { cache.clear(); }
// (i, j, k) inspector
const_reference operator()(size_t i, size_t j, size_t k) const { return const_reference(this, x + i, y + j, z + k); }
// random access iterators
const_iterator cbegin() const { return const_iterator(this, x, y, z); }
const_iterator cend() const { return const_iterator(this, x, y, z + nz); }
const_iterator begin() const { return cbegin(); }
const_iterator end() const { return cend(); }
protected:
friend class zfp::internal::dim3::const_handle<private_const_view>;
friend class zfp::internal::dim3::const_pointer<private_const_view>;
friend class zfp::internal::dim3::const_iterator<private_const_view>;
using preview<Container>::min_x;
using preview<Container>::max_x;
using preview<Container>::min_y;
using preview<Container>::max_y;
using preview<Container>::min_z;
using preview<Container>::max_z;
using preview<Container>::array;
using preview<Container>::x;
using preview<Container>::y;
using preview<Container>::z;
using preview<Container>::nx;
using preview<Container>::ny;
using preview<Container>::nz;
// inspector
value_type get(size_t x, size_t y, size_t z) const { return cache.get(x, y, z); }
BlockCache3<value_type, store_type> cache; // cache of decompressed blocks
};
// thread-safe read-write view of private 3D (sub)array
template <class Container>
class private_view : public private_const_view<Container> {
public:
typedef Container container_type;
typedef typename container_type::value_type value_type;
typedef typename zfp::internal::dim3::const_reference<private_view> const_reference;
typedef typename zfp::internal::dim3::const_pointer<private_view> const_pointer;
typedef typename zfp::internal::dim3::const_iterator<private_view> const_iterator;
typedef typename zfp::internal::dim3::reference<private_view> reference;
typedef typename zfp::internal::dim3::pointer<private_view> pointer;
typedef typename zfp::internal::dim3::iterator<private_view> iterator;
// construction--perform shallow copy of (sub)array
private_view(container_type* array, size_t cache_size = 0) : private_const_view<Container>(array, cache_size) {}
private_view(container_type* array, size_t x, size_t y, size_t z, size_t nx, size_t ny, size_t nz, size_t cache_size = 0) : private_const_view<Container>(array, x, y, z, nx, ny, nz, cache_size) {}
// partition view into count block-aligned pieces, with 0 <= index < count
void partition(size_t index, size_t count)
{
if (nx > std::max(ny, nz))
partition(x, nx, index, count);
else if (ny > std::max(nx, nz))
partition(y, ny, index, count);
else
partition(z, nz, index, count);
}
// flush cache by compressing all modified cached blocks
void flush_cache() const { cache.flush(); }
// (i, j, k) inspector
const_reference operator()(size_t i, size_t j, size_t k) const { return const_reference(this, x + i, y + j, z + k); }
// (i, j, k) mutator
reference operator()(size_t i, size_t j, size_t k) { return reference(this, x + i, y + j, z + k); }
// random access iterators
const_iterator cbegin() const { return const_iterator(this, x, y, z); }
const_iterator cend() const { return const_iterator(this, x, y, z + nz); }
const_iterator begin() const { return cbegin(); }
const_iterator end() const { return cend(); }
iterator begin() { return iterator(this, x, y, z); }
iterator end() { return iterator(this, x, y, z + nz); }
protected:
friend class zfp::internal::dim3::const_handle<private_view>;
friend class zfp::internal::dim3::const_pointer<private_view>;
friend class zfp::internal::dim3::const_iterator<private_view>;
friend class zfp::internal::dim3::reference<private_view>;
friend class zfp::internal::dim3::pointer<private_view>;
friend class zfp::internal::dim3::iterator<private_view>;
using private_const_view<Container>::min_x;
using private_const_view<Container>::max_x;
using private_const_view<Container>::min_y;
using private_const_view<Container>::max_y;
using private_const_view<Container>::min_z;
using private_const_view<Container>::max_z;
using private_const_view<Container>::get;
using private_const_view<Container>::array;
using private_const_view<Container>::x;
using private_const_view<Container>::y;
using private_const_view<Container>::z;
using private_const_view<Container>::nx;
using private_const_view<Container>::ny;
using private_const_view<Container>::nz;
using private_const_view<Container>::cache;
// block-aligned partition of [offset, offset + size): index out of count
static void partition(size_t& offset, size_t& size, size_t index, size_t count)
{
size_t bmin = offset / 4;
size_t bmax = (offset + size + 3) / 4;
size_t xmin = std::max(offset + 0, 4 * (bmin + (bmax - bmin) * (index + 0) / count));
size_t xmax = std::min(offset + size, 4 * (bmin + (bmax - bmin) * (index + 1) / count));
offset = xmin;
size = xmax - xmin;
}
// mutator
void set(size_t x, size_t y, size_t z, value_type val) { cache.set(x, y, z, val); }
// in-place updates
void add(size_t x, size_t y, size_t z, value_type val) { cache.ref(x, y, z) += val; }
void sub(size_t x, size_t y, size_t z, value_type val) { cache.ref(x, y, z) -= val; }
void mul(size_t x, size_t y, size_t z, value_type val) { cache.ref(x, y, z) *= val; }
void div(size_t x, size_t y, size_t z, value_type val) { cache.ref(x, y, z) /= val; }
};
} // dim3
} // internal
} // zfp
#endif