14 #include <pyre/grid.h>
17 template <
typename cell_t>
22 using rep_t = std::array<size_t, 3>;
23 using index_t = pyre::grid::index_t<rep_t>;
24 using layout_t = pyre::grid::layout_t<index_t>;
27 using grid_t = pyre::grid::grid_t<cell_t, layout_t, pyre::memory::view_t<cell_t>>;
30 using view_t =
typename grid_t::view_type;
31 using shape_t =
typename layout_t::shape_type;
32 using slice_t =
typename layout_t::slice_type;
33 using packing_t =
typename layout_t::packing_type;
40 inline Cube(
size_t nslices,
size_t nrows,
size_t ncols);
49 inline Cube(cell_t *
data,
size_t nslices,
size_t nrows,
size_t ncols);
52 inline Cube(std::valarray<cell_t> & data,
size_t nrows,
size_t ncols);
55 inline Cube(std::vector<cell_t> & data,
size_t nrows,
size_t ncols);
67 inline void resize(
size_t nslices,
size_t nrows,
size_t ncols);
70 inline const view_t
subcube(
size_t slice,
size_t row,
size_t col,
size_t slicespan,
size_t rowspan,
size_t colspan);
73 inline cell_t *
data();
76 inline const cell_t *
data()
const;
79 inline cell_t *
sliceptr(
size_t slice);
82 inline const cell_t *
sliceptr(
size_t slice)
const;
85 inline cell_t &
operator()(
size_t slice,
size_t row,
size_t col);
88 inline const cell_t &
operator()(
size_t slice,
size_t row,
size_t col)
const;
94 inline const cell_t &
operator()(
size_t index)
const;
97 inline cell_t &
operator[](
const index_t & index);
100 inline const cell_t &
operator[](
const index_t & index)
const;
106 inline void fill(cell_t value);
109 inline shape_t
shape()
const;
112 inline size_t width()
const;
115 inline size_t length()
const;
118 inline size_t height()
const;
140 inline void _resetGrid();
144 #define ISCE_CORE_CUBE_ICC
146 #undef ISCE_CORE_CUBE_ICC
cell_t * data()
Access to data buffer.
Definition: Cube.icc:199
~Cube()
Destructor.
Definition: Cube.icc:102
void resize(size_t nslices, size_t nrows, size_t ncols)
Resize memory for a given number of slices, rows and columns.
Definition: Cube.icc:150
size_t width() const
Get cube width.
Definition: Cube.icc:331
const view_t subcube(size_t slice, size_t row, size_t col, size_t slicespan, size_t rowspan, size_t colspan)
Extract copy of sub-cube given starting indices and span.
Definition: Cube.icc:178
shape_t byteoffset() const
Get byteoffset for row and column for reading flat binary buffer.
Definition: Cube.icc:355
cell_t & operator[](const index_t &index)
Access matrix value for a given grid::index_type.
Definition: Cube.icc:278
cell_t & operator()(size_t slice, size_t row, size_t col)
Access matrix value for a given slice, row and column.
Definition: Cube.icc:240
Cube< cell_t > & operator=(const Cube< cell_t > &m)
Deep assignment operator - allocates memory and copies values.
Definition: Cube.icc:118
cell_t * sliceptr(size_t slice)
Access to data buffer at a specific slice.
Definition: Cube.icc:215
size_t height() const
Get cube height.
Definition: Cube.icc:347
shape_t shape() const
Get shape information as grid::shape_type.
Definition: Cube.icc:323
Cube()
Default constructor.
Definition: Cube.icc:14
void zeros()
Fill with zeros.
Definition: Cube.icc:303
size_t length() const
Get cube length.
Definition: Cube.icc:339
void fill(cell_t value)
Fill with a constant value.
Definition: Cube.icc:313