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());
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 ndim() const
The dimensionality of this array.
IPosition originalLength_p
IPosition length_p
Used to hold the shape, increment into the underlying storage and originalLength of the array.
T & operator()(const IPosition &)
Access a single element of the array.
T * begin_p
This pointer is adjusted to point to the first element of the array.
Alloc & allocator()
Retrieve the allocator associated with this array.
Array< T, Alloc > & operator=(const Array< T, Alloc > &other)
TODO we should change the semantics.
Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr)
Slice using IPositions.
const Cube< T, Alloc > operator()(const Slice &sliceX, const Slice &sliceY, const Slice &sliceZ) const
Cube(const IPosition &shape, const T *storage)
Create an Cube of a given shape from a pointer.
Cube(const Alloc &allocator=Alloc())
A Cube of length zero in each dimension; zero origin.
Matrix< T, Alloc > xyPlane(size_t zplane)
Extract a plane as a matrix referencing the original data.
size_t ncolumn() const
The number of columns in the Cube, i.e.
Cube< T, Alloc > & operator=(const Array< T, Alloc > &source)
Array< T > operator()(const IPosition &blc, const IPosition &trc)
virtual void doNonDegenerate(const Array< T > &other, const IPosition &ignoreAxes) override
Remove the degenerate axes from other and store result in this cube.
virtual bool ok() const override
Checks that the cube is consistent (invariants check out).
const Array< T > operator()(const Slicer &slicer) const
Cube(Cube< T, Alloc > &&)
Cube(const IPosition &length, typename Array< T, Alloc >::uninitializedType, const Alloc &allocator=Alloc())
An uninitialized Cube where the shape ("len") is defined with IPositions.
T & operator()(const IPosition &i)
Copy to this those values in marray whose corresponding elements in marray's mask are true.
Matrix< T, Alloc > yzPlane(size_t xplane)
T & operator()(size_t i1, size_t i2, size_t i3)
size_t index_continuous(size_t i1, size_t i2, size_t i3) const
Cube(size_t l1, size_t l2, size_t l3, typename Array< T, Alloc >::uninitializedType, const Alloc &allocator=Alloc())
An uninitialized l1xl2xl3 sized cube.
Cube< T, Alloc > & operator=(Array< T, Alloc > &&source)
const T & operator()(size_t i1, size_t i2, size_t i3) const
Matrix< T, Alloc > xzPlane(size_t yplane)
Cube(const IPosition &length, const T &initialValue=T(), const Alloc &allocator=Alloc())
A Cube where the shape ("len") is defined with IPositions.
size_t nrow() const
The number of rows in the Cube, i.e.
const IPosition & shape() const
The length of each axis of the cube.
const Matrix< T, Alloc > yzPlane(size_t xplane) const
Cube(const Array< T, Alloc > &)
Construct a cube by reference from "other".
const Array< T > operator()(const IPosition &blc, const IPosition &trc) const
size_t index(size_t i1, size_t i2, size_t i3) const
size_t xinc() const
Cached constants to improve indexing.
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.
Cube(const IPosition &shape, T *storage, StorageInitPolicy policy, const Alloc &allocator)
Create an Cube of a given shape from a pointer.
void resize(size_t nx, size_t ny, size_t nz, bool copyValues=false)
const Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr) const
Cube< T, Alloc > & operator=(Cube< T, Alloc > &&source)
Cube(const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
Create an Cube of a given shape from a pointer.
Cube(Array< T, Alloc > &&)
Cube< T, Alloc > & operator=(const Cube< T, Alloc > &source)
Copy the values from other to this cube.
Cube(const Cube< T, Alloc > &)
The copy constructor uses reference semantics.
Cube< T, Alloc > operator()(const Slice &sliceX, const Slice &sliceY, const Slice &sliceZ)
Take a slice of this cube.
Array< T, Alloc > & operator=(const T &val)
Copy val into every element of this cube; i.e.
Array< T > operator()(const Slicer &slicer)
size_t fixedDimensionality() const override
Subclasses can return their dimensionality.
void shape(int &s1, int &s2, int &s3) const
const Matrix< T, Alloc > xzPlane(size_t yplane) const
const Matrix< T, Alloc > xyPlane(size_t zplane) const
const T & operator()(const IPosition &i) const
Cube(size_t l1, size_t l2, size_t l3, const T &initialValue=T(), const Alloc &allocator=Alloc())
A l1xl2xl3 sized cube.
@ COPY
COPY is used when an internal copy of the storage is to be made.
this file contains all the compiler specific defines
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
This is a tag for the constructor that may be used to construct an uninitialized Array.