Go to the documentation of this file.
33 #include <casacore/casa/aips.h>
34 #include <casacore/casa/Arrays/Array.h>
39 template<
class T>
class Matrix;
80 template<
class T>
class Cube :
public Array<T>
88 Cube(
size_t l1,
size_t l2,
size_t l3);
95 Cube(
size_t l1,
size_t l2,
size_t l3,
const T &initialValue);
177 #if defined(AIPS_ARRAY_INDEX_CHECK)
178 this->validateIndex(i1, i2, i3);
185 #if defined(AIPS_ARRAY_INDEX_CHECK)
186 this->validateIndex(i1, i2, i3);
193 T &
at(
size_t i1,
size_t i2,
size_t i3)
195 #if defined(AIPS_ARRAY_INDEX_CHECK)
196 this->validateIndex(i1, i2, i3);
198 return this->contiguous_p ? this->begin_p[i1 + i2*
yinc_p + i3*
zinc_p] :
202 const T &
at(
size_t i1,
size_t i2,
size_t i3)
const
204 #if defined(AIPS_ARRAY_INDEX_CHECK)
205 this->validateIndex(i1, i2, i3);
207 return this->contiguous_p ? this->begin_p[i1 + i2*
yinc_p + i3*
zinc_p] :
222 const Slice &sliceZ);
224 const Slice &sliceZ)
const;
293 {
return this->length_p; }
295 { s1 = this->length_p(0); s2=this->length_p(1); s3=this->length_p(2); }
299 {
return this->length_p(0); }
303 {
return this->length_p(1); }
307 {
return this->length_p(2); }
329 #ifndef CASACORE_NO_AUTO_TEMPLATES
330 #include <casacore/casa/Arrays/Cube.tcc>
331 #endif //# CASACORE_NO_AUTO_TEMPLATES
Specify which elements to extract from an n-dimensional array.
virtual Array< T > & operator=(const Array< T > &other)
A 2-D Specialization of the Array class.
size_t nrow() const
The number of rows in the Cube, i.e.
A Vector of integers, for indexing into Array<T> objects.
Array< T > operator()(const Slicer &slicer)
virtual Bool ok() const
Checks that the cube is consistent (invariants check out).
Cube(const IPosition &shape, const T *storage)
Create an Cube of a given shape from a pointer.
virtual ~Cube()
Define a destructor, otherwise the (SUN) compiler makes a static one.
StorageInitPolicy
A global enum used by some Array constructors.
Cube< T > & operator=(const Cube< T > &other)
Copy the values from other to this cube.
const Matrix< T > xyPlane(size_t zplane) const
Cube(size_t l1, size_t l2, size_t l3)
A l1xl2xl3 sized cube.
const Matrix< T > xzPlane(size_t yplane) const
Cube()
A Cube of length zero in each dimension; zero origin.
Cube(const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
Create an Cube of a given shape from a pointer.
Matrix< T > xyPlane(size_t zplane)
Extract a plane as a matrix referencing the original data.
A global enum used by some Array/Block constructors.
T & at(size_t i1, size_t i2, size_t i3)
const Cube< T > operator()(const Slice &sliceX, const Slice &sliceY, const Slice &sliceZ) const
A 3-D Specialization of the Array class.
T & operator()(const IPosition &i)
Single-pixel addressing.
Cube(size_t l1, size_t l2, size_t l3, const T &initialValue)
A l1xl2xl3 sized cube.
const Array< T > operator()(const IPosition &blc, const IPosition &trc) const
Array< T > operator()(const IPosition &blc, const IPosition &trc)
const IPosition & shape() const
The length of each axis of the cube.
Cube(size_t l1, size_t l2, size_t l3, ArrayInitPolicy initPolicy)
A l1xl2xl3 sized cube.
const Array< T > operator()(const Slicer &slicer) const
T & operator()(const IPosition &)
Access a single element of the array.
T & operator()(size_t i1, size_t i2, size_t i3)
@ COPY
COPY is used when an internal copy of the storage is to be made.
virtual Array< T > & operator=(const Array< T > &other)
Copy the values in other to this.
define a (start,length,increment) along an axis
void shape(Int &s1, Int &s2, Int &s3) const
void resize(size_t nx, size_t ny, size_t nz, Bool copyValues, ArrayInitPolicy policy)
Cube(const IPosition &len)
A Cube where the shape ("len") is defined with IPositions.
virtual void preTakeStorage(const IPosition &shape)
Cube(const Cube< T > &)
The copy constructor uses reference semantics.
this file contains all the compiler specific defines
Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr)
Slice using IPositions.
size_t nplane() const
The number of planes in the Cube, i.e.
void makeIndexingConstants()
Helper fn to calculate the indexing constants.
const Matrix< T > yzPlane(size_t xplane) const
Cube(const Array< T > &)
Construct a cube by reference from "other".
Cube(const IPosition &len, ArrayInitPolicy initPolicy)
A Cube where the shape ("len") is defined with IPositions.
Class for masking an Array for operations on that Array.
const Array< T > operator()(const IPosition &blc, const IPosition &trc, const IPosition &incr) const
const T & operator()(const IPosition &i) const
Cube(const IPosition &len, const T &initialValue)
A Cube where the shape ("len") is defined with IPositions.
Cube< T > operator()(const Slice &sliceX, const Slice &sliceY, const Slice &sliceZ)
Take a slice of this cube.
const T & at(size_t i1, size_t i2, size_t i3) const
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
TableExprNode marray(const TableExprNode &array, const TableExprNode &mask)
Form a masked array.
template <class T, class U> class vector;
const T & operator()(size_t i1, size_t i2, size_t i3) const
bool Bool
Define the standard types used by Casacore.
virtual void reference(const Array< T > &other)
Make this cube a reference to other.
size_t xinc_p
Cached constants to improve indexing.
virtual void doNonDegenerate(const Array< T > &other, const IPosition &ignoreAxes)
Remove the degenerate axes from other and store result in this cube.
virtual void resize(const IPosition &newShape, Bool copyValues, ArrayInitPolicy policy)
virtual void postTakeStorage()
size_t ncolumn() const
The number of columns in the Cube, i.e.
Cube(const IPosition &shape, T *storage, StorageInitPolicy policy, AbstractAllocator< T > const &allocator)
Create an Cube of a given shape from a pointer.
Matrix< T > xzPlane(size_t yplane)
Array< T > & operator=(const T &val)
Copy val into every element of this cube; i.e.
void resize(size_t nx, size_t ny, size_t nz, Bool copyValues=False)
Matrix< T > yzPlane(size_t xplane)
virtual void assign(const Array< T > &other)
Assign the other array (which must be dimension 3) to this cube.