73 template<
typename T,
typename Alloc>
class Cube :
public Array<T, Alloc>
82 Cube(
size_t l1,
size_t l2,
size_t l3,
const T &initialValue=T(),
const Alloc&
allocator=Alloc());
85 Cube(
size_t l1,
size_t l2,
size_t l3,
typename Array<T, Alloc>::uninitializedType,
const Alloc&
allocator=Alloc());
92 Cube(
const IPosition& length,
typename Array<T, Alloc>::uninitializedType,
const Alloc&
allocator=Alloc());
95 Cube(
const Cube<T, Alloc> &);
96 Cube(Cube<T, Alloc> &&);
101 Cube(
const Array<T, Alloc> &);
102 Cube(Array<T, Alloc> &&);
110 Cube(
const IPosition &
shape,
const T *storage);
115 using Array<T, Alloc>::resize;
116 void resize(
size_t nx,
size_t ny,
size_t nz,
bool copyValues=
false);
145 if (source.
ndim() == 3) {
156 if (source.ndim() == 3) {
208 const Slice &sliceZ);
210 const Slice &sliceZ)
const;
280 void shape(
int &s1,
int &s2,
int &s3)
const
296 virtual bool ok()
const override;
316 size_t index(
size_t i1,
size_t i2,
size_t i3)
const {
size_t index(size_t i1, size_t i2, size_t i3) const
A Vector of integers, for indexing into Array<T> objects.
Cube< T, Alloc > & operator=(Cube< T, Alloc > &&source)
size_t index_continuous(size_t i1, size_t i2, size_t i3) const
size_t fixedDimensionality() const override
Subclasses can return their dimensionality.
virtual bool ok() const override
Checks that the cube is consistent (invariants check out).
const IPosition & shape() const
The length of each axis of the cube.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
IPosition originalLength_p
Array< T, Alloc > & operator=(const Array< T, Alloc > &other)
TODO we should change the semantics.
Matrix< T, Alloc > yzPlane(size_t xplane)
StorageInitPolicy
A global enum used by some Array constructors.
Cube< T, Alloc > & operator=(const Cube< T, Alloc > &source)
Copy the values from other to this cube.
A 3-D Specialization of the Array class.
Cube< T, Alloc > & operator=(Array< T, Alloc > &&source)
size_t ncolumn() const
The number of columns in the Cube, i.e.
size_t nrow() const
The number of rows in the Cube, i.e.
const T & operator()(const IPosition &i) const
A 2-D Specialization of the Array class.
Matrix< T, Alloc > xyPlane(size_t zplane)
Extract a plane as a matrix referencing the original data.
size_t ndim() const
The dimensionality of this array.
Array< T > operator()(const Slicer &slicer)
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array...
const Array< T > operator()(const IPosition &blc, const IPosition &trc) const
Class for masking an Array for operations on that Array.
virtual void doNonDegenerate(const Array< T > &other, const IPosition &ignoreAxes) override
Remove the degenerate axes from other and store result in this cube.
T & operator()(const IPosition &)
Access a single element of the array.
Array< T > operator()(const IPosition &blc, const IPosition &trc)
virtual void preTakeStorage(const IPosition &shape) override
pre/post processing hook of takeStorage() for subclasses.
size_t nplane() const
The number of planes in the Cube, i.e.
Matrix< T, Alloc > xzPlane(size_t yplane)
define a (start,length,increment) along an axis
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
T * begin_p
This pointer is adjusted to point to the first element of the array.
Array< T, Alloc > & operator=(const T &val)
Copy val into every element of this cube; i.e.
Alloc & allocator()
Retrieve the allocator associated with this array.
Cube< T, Alloc > & operator=(const Array< T, Alloc > &source)
const Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr) const
void shape(int &s1, int &s2, int &s3) const
A templated N-D Array class with zero origin. Array<T, Alloc> is a templated, N-dimensional, Array class. The origin is zero, but by default indices are zero-based. This Array class is the base class for the Vector, Matrix, and Cube subclasses.
Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr)
Slice using IPositions.
Specify which elements to extract from an n-dimensional array.
COPY is used when an internal copy of the storage is to be made.
T & operator()(size_t i1, size_t i2, size_t i3)
void resize()
Make this array a different shape.
const T & operator()(size_t i1, size_t i2, size_t i3) const
T & operator()(const IPosition &i)
Copy to this those values in marray whose corresponding elements in marray's mask are true...
Cube(const Alloc &allocator=Alloc())
A Cube of length zero in each dimension; zero origin.
const Array< T > operator()(const Slicer &slicer) const
size_t xinc() const
Cached constants to improve indexing.