casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
casacore::Cube< T, Alloc > Class Template Reference

A 3-D Specialization of the Array class. More...

#include <ArrayFwd.h>

Inheritance diagram for casacore::Cube< T, Alloc >:
casacore::Array< T, Alloc > casacore::ArrayBase

Public Member Functions

 Cube (const Alloc &allocator=Alloc())
 A Cube of length zero in each dimension; zero origin. More...
 
 Cube (size_t l1, size_t l2, size_t l3, const T &initialValue=T(), const Alloc &allocator=Alloc())
 A l1xl2xl3 sized cube. More...
 
 Cube (size_t l1, size_t l2, size_t l3, typename Array< T, Alloc >::uninitializedType, const Alloc &allocator=Alloc())
 An uninitialized l1xl2xl3 sized cube. More...
 
 Cube (const IPosition &length, const T &initialValue=T(), const Alloc &allocator=Alloc())
 A Cube where the shape ("len") is defined with IPositions. More...
 
 Cube (const IPosition &length, typename Array< T, Alloc >::uninitializedType, const Alloc &allocator=Alloc())
 An uninitialized Cube where the shape ("len") is defined with IPositions. More...
 
 Cube (const Cube< T, Alloc > &)
 The copy constructor uses reference semantics. More...
 
 Cube (Cube< T, Alloc > &&)
 
 Cube (const Array< T, Alloc > &)
 Construct a cube by reference from "other". More...
 
 Cube (Array< T, Alloc > &&)
 
 Cube (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY)
 Create an Cube of a given shape from a pointer. More...
 
 Cube (const IPosition &shape, T *storage, StorageInitPolicy policy, const Alloc &allocator)
 Create an Cube of a given shape from a pointer. More...
 
 Cube (const IPosition &shape, const T *storage)
 Create an Cube of a given shape from a pointer. More...
 
void resize (size_t nx, size_t ny, size_t nz, bool copyValues=false)
 
Cube< T, Alloc > & operator= (const Cube< T, Alloc > &source)
 Copy the values from other to this cube. More...
 
Cube< T, Alloc > & operator= (Cube< T, Alloc > &&source)
 
Cube< T, Alloc > & operator= (const Array< T, Alloc > &source)
 
Cube< T, Alloc > & operator= (Array< T, Alloc > &&source)
 
Array< T, Alloc > & operator= (const T &val)
 Copy val into every element of this cube; i.e. More...
 
T & operator() (const IPosition &i)
 Copy to this those values in marray whose corresponding elements in marray's mask are true. More...
 
const T & operator() (const IPosition &i) const
 
T & operator() (size_t i1, size_t i2, size_t i3)
 
const T & operator() (size_t i1, size_t i2, size_t i3) const
 
Cube< T, Alloc > operator() (const Slice &sliceX, const Slice &sliceY, const Slice &sliceZ)
 Take a slice of this cube. More...
 
const Cube< T, Alloc > operator() (const Slice &sliceX, const Slice &sliceY, const Slice &sliceZ) const
 
Array< T > operator() (const IPosition &blc, const IPosition &trc, const IPosition &incr)
 Slice using IPositions. More...
 
const Array< T > operator() (const IPosition &blc, const IPosition &trc, const IPosition &incr) const
 
Array< T > operator() (const IPosition &blc, const IPosition &trc)
 
const Array< T > operator() (const IPosition &blc, const IPosition &trc) const
 
Array< T > operator() (const Slicer &slicer)
 
const Array< T > operator() (const Slicer &slicer) const
 
const MaskedArray< T > operator() (const LogicalArray &mask) const
 The array is masked by the input LogicalArray. More...
 
MaskedArray< T > operator() (const LogicalArray &mask)
 Return a MaskedArray. More...
 
const MaskedArray< T > operator() (const MaskedLogicalArray &mask) const
 The array is masked by the input MaskedLogicalArray. More...
 
MaskedArray< T > operator() (const MaskedLogicalArray &mask)
 Return a MaskedArray. More...
 
Matrix< T, Alloc > xyPlane (size_t zplane)
 Extract a plane as a matrix referencing the original data. More...
 
const Matrix< T, Alloc > xyPlane (size_t zplane) const
 
Matrix< T, Alloc > xzPlane (size_t yplane)
 
const Matrix< T, Alloc > xzPlane (size_t yplane) const
 
Matrix< T, Alloc > yzPlane (size_t xplane)
 
const Matrix< T, Alloc > yzPlane (size_t xplane) const
 
const IPositionshape () const
 The length of each axis of the cube. More...
 
void shape (int &s1, int &s2, int &s3) const
 
size_t nrow () const
 The number of rows in the Cube, i.e. More...
 
size_t ncolumn () const
 The number of columns in the Cube, i.e. More...
 
size_t nplane () const
 The number of planes in the Cube, i.e. More...
 
virtual bool ok () const override
 Checks that the cube is consistent (invariants check out). More...
 
- Public Member Functions inherited from casacore::Array< T, Alloc >
 Array (const Alloc &allocator=Alloc())
 Result has dimensionality of zero, and nelements is zero. More...
 
 Array (const IPosition &shape, const Alloc &allocator=Alloc())
 Create an array of the given shape, i.e. More...
 
 Array (const IPosition &shape, const T &initialValue, const Alloc &allocator=Alloc())
 Create an array of the given shape and initialize it with the initial value. More...
 
 Array (const IPosition &shape, uninitializedType, const Alloc &allocator=Alloc())
 Constructor to create an uninitialized array. More...
 
 Array (std::initializer_list< T > list, const Alloc &allocator=Alloc())
 Construct a one-dimensional array from an initializer list. More...
 
 Array (const Array< T, Alloc > &other)
 After construction, this and other reference the same storage. More...
 
 Array (Array< T, Alloc > &&source) noexcept
 Source will be empty after this call. More...
 
 Array (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY, const Alloc &allocator=Alloc())
 Create an Array of a given shape from a pointer. More...
 
 Array (const IPosition &shape, const T *storage)
 Create an Array of a given shape from a pointer. More...
 
template<typename InputIterator >
 Array (const IPosition &shape, InputIterator startIter, const Alloc &allocator=Alloc())
 Construct an array from an iterator and a shape. More...
 
virtual ~Array () noexcept
 Frees up storage only if this array was the last reference to it. More...
 
virtual std::unique_ptr
< ArrayBase
makeArray () const override
 Make an empty array of the same template type. More...
 
void assign (const Array< T, Alloc > &other)
 Assign the other array to this array. More...
 
void assignBase (const ArrayBase &other, bool checkType=true) override
 Assign the source array to this array. More...
 
void set (const T &value)
 Set every element of the array to "value." Also could use the assignment operator which assigns an array from a scalar. More...
 
template<typename Callable >
void apply (Callable function)
 Apply the function to every element of the array. More...
 
virtual void reference (const Array< T, Alloc > &other)
 After invocation, this array and other reference the same storage. More...
 
Array< T, Alloc > & assign_conforming (const Array< T, Alloc > &other)
 Copy the values in other to this. More...
 
template<typename MaskAlloc >
Array< T, Alloc > & assign_conforming (const MaskedArray< T, Alloc, MaskAlloc > &marray)
 Copy to this those values in marray whose corresponding elements in marray's mask are true. More...
 
Array< T, Alloc > & operator= (const Array< T, Alloc > &other)
 TODO we should change the semantics. More...
 
template<typename MaskAlloc >
Array< T, Alloc > & operator= (const MaskedArray< T, Alloc, MaskAlloc > &marray)
 Calls assign_conforming(). More...
 
Array< T, Alloc > & operator= (Array< T, Alloc > &&other)
 The move operator takes the storage from the given array. More...
 
Array< T, Alloc > & operator= (const T &value)
 Set every element of this array to "value". More...
 
Array< T, Alloc > copy () const
 This makes a copy of the array and returns it. More...
 
void copyMatchingPart (const Array< T, Alloc > &from)
 This function copies the matching part of from array to this array. More...
 
void unique ()
 This ensures that this array does not reference any other storage. More...
 
template<class U >
void tovector (std::vector< T, U > &out) const
 Create an STL vector from an Array. More...
 
std::vector< T > tovector () const
 
Array< T, Alloc > reform (const IPosition &shape) const
 It is occasionally useful to have an array which access the same storage appear to have a different shape. More...
 
bool reformOrResize (const IPosition &newShape, size_t resizePercentage=0, bool resizeIfNeeded=true)
 Having an array that can be reused without requiring reallocation can be useful for large arrays. More...
 
bool adjustLastAxis (const IPosition &newShape, size_t resizePercentage=0, bool resizeIfNeeded=true)
 Use this method to extend or reduce the last dimension of an array. More...
 
size_t capacity () const
 Returns the number of elements allocated. More...
 
Array< T, Alloc > nonDegenerate (size_t startingAxis=0, bool throwIfError=true) const
 These member functions remove degenerate (ie. More...
 
Array< T, Alloc > nonDegenerate (const IPosition &ignoreAxes) const
 
void nonDegenerate (const Array< T, Alloc > &other, size_t startingAxis=0, bool throwIfError=true)
 
void nonDegenerate (const Array< T, Alloc > &other, const IPosition &ignoreAxes)
 
void removeDegenerate (size_t startingAxis=0, bool throwIfError=true)
 Remove degenerate axes from this Array object. More...
 
void removeDegenerate (const IPosition &ignoreAxes)
 
const Array< T, Alloc > addDegenerate (size_t numAxes) const
 This member function returns an Array reference with the specified number of extra axes, all of length one, appended to the end of the Array. More...
 
Array< T, Alloc > addDegenerate (size_t numAxes)
 
void resize ()
 Make this array a different shape. More...
 
void resize (const IPosition &newShape, bool copyValues=false) override
 Resize the array and optionally copy the values. More...
 
T & operator() (const IPosition &)
 Access a single element of the array. More...
 
const T & operator() (const IPosition &) const
 
Array< T, Alloc > operator() (const IPosition &start, const IPosition &end)
 Get a reference to an array section extending from start to end (inclusive). More...
 
const Array< T, Alloc > operator() (const IPosition &start, const IPosition &end) const
 
Array< T, Alloc > operator() (const IPosition &start, const IPosition &end, const IPosition &inc)
 Along the ith axis, every inc[i]'th element is chosen. More...
 
const Array< T, Alloc > operator() (const IPosition &start, const IPosition &end, const IPosition &inc) const
 
Array< T, Alloc > operator() (const Slicer &)
 Get a reference to an array section using a Slicer. More...
 
const Array< T, Alloc > operator() (const Slicer &) const
 
std::unique_ptr< ArrayBasegetSection (const Slicer &) const override
 Get a reference to a section of an array. More...
 
Array< T, Alloc > operator[] (size_t i) const
 Get the subset given by the i-th value of the last axis. More...
 
Array< T, Alloc > diagonals (size_t firstAxis=0, long long diag=0) const
 Get the diagonal of each matrix part in the full array. More...
 
const MaskedArray< T > operator() (const LogicalArray &mask) const
 The array is masked by the input LogicalArray. More...
 
MaskedArray< T > operator() (const LogicalArray &mask)
 
const MaskedArray< T > operator() (const MaskedLogicalArray &mask) const
 The array is masked by the input MaskedLogicalArray. More...
 
MaskedArray< T > operator() (const MaskedLogicalArray &mask)
 
size_t nrefs () const
 The number of references the underlying storage has assigned to it. More...
 
bool conform (const Array< T, Alloc > &other) const
 Are the shapes identical? More...
 
bool conform (const MaskedArray< T > &other) const
 
T * data ()
 Get a pointer to the beginning of the array. More...
 
const T * data () const
 
T * getStorage (bool &deleteIt)
 Generally use of this should be shunned, except to use a FORTRAN routine or something similar. More...
 
const T * getStorage (bool &deleteIt) const
 
void * getVStorage (bool &deleteIt) override
 The following functions behave the same as the corresponding getStorage functions in the derived templated Array class. More...
 
const void * getVStorage (bool &deleteIt) const override
 
void putStorage (T *&storage, bool deleteAndCopy)
 putStorage() is normally called after a call to getStorage() (cf). More...
 
void putVStorage (void *&storage, bool deleteAndCopy) override
 
void freeStorage (const T *&storage, bool deleteIt) const
 If deleteIt is set, delete "storage". More...
 
void freeVStorage (const void *&storage, bool deleteIt) const override
 
virtual void takeStorage (const IPosition &shape, T *storage, StorageInitPolicy policy=COPY, const Alloc &allocator=Alloc())
 Replace the data values with those in the pointer storage. More...
 
virtual void takeStorage (const IPosition &shape, const T *storage, const Alloc &allocator=Alloc())
 Since the pointer is const, a copy is always taken. More...
 
std::unique_ptr
< ArrayPositionIterator
makeIterator (size_t byDim) const override
 Create an ArrayIterator object of the correct type. More...
 
Alloc & allocator ()
 Retrieve the allocator associated with this array. More...
 
const Alloc & allocator () const
 
iterator begin ()
 Get the begin iterator object for any array. More...
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
contiter cbegin ()
 Get the begin iterator object for a contiguous array. More...
 
const_contiter cbegin () const
 
contiter cend ()
 
const_contiter cend () const
 
- Public Member Functions inherited from casacore::ArrayBase
 ArrayBase () noexcept
 
 ArrayBase (const IPosition &shape)
 Create an array of the given shape, i.e. More...
 
 ArrayBase (const ArrayBase &other)
 Copy constructor. More...
 
 ArrayBase (ArrayBase &&source) noexcept
 
ArrayBaseassign (const ArrayBase &)
 Assignment. More...
 
ArrayBaseoperator= (const ArrayBase &)=delete
 
ArrayBaseoperator= (ArrayBase &&) noexcept
 
virtual ~ArrayBase () noexcept
 Destructor. More...
 
size_t ndim () const
 The dimensionality of this array. More...
 
size_t nelements () const
 How many elements does this array have? Product of all axis lengths. More...
 
size_t size () const
 
bool empty () const
 Is the array empty (i.e. More...
 
bool contiguousStorage () const
 Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a copy. More...
 
const IPositionshape () const
 The length of each axis. More...
 
IPosition endPosition () const
 A convenience function: endPosition(i) = shape(i) - 1; i.e. More...
 
const IPositionsteps () const
 Return steps to be made if stepping one element in a dimension. More...
 
void validateConformance (const ArrayBase &) const
 Various helper functions. More...
 
void validateIndex (const IPosition &) const
 
void validateIndex (size_t index) const
 
void validateIndex (size_t index1, size_t index2) const
 
void validateIndex (size_t index1, size_t index2, size_t index3) const
 

Protected Member Functions

virtual void preTakeStorage (const IPosition &shape) override
 pre/post processing hook of takeStorage() for subclasses. More...
 
virtual void doNonDegenerate (const Array< T > &other, const IPosition &ignoreAxes) override
 Remove the degenerate axes from other and store result in this cube. More...
 
size_t fixedDimensionality () const override
 Subclasses can return their dimensionality. More...
 
- Protected Member Functions inherited from casacore::Array< T, Alloc >
 Array (Array< T, Alloc > &&source, const IPosition &shapeForSource) noexcept
 Source will be empty with given shape after this call. More...
 
void swap (Array< T, Alloc > &other)
 Swap this array with another array. More...
 
virtual void postTakeStorage ()
 
void checkBeforeResize (const IPosition &newShape)
 This function is called when this array is about to be resized, before any work is done. More...
 
virtual void checkAssignableType (ArrayBase &arrayBase) const
 
virtual void doNonDegenerate (const Array< T, Alloc > &other, const IPosition &ignoreAxes)
 Remove the degenerate axes from the Array object. More...
 
void makeSteps ()
 Fill the steps and the end for a derived class. More...
 
void setEndIter ()
 Set the end iterator. More...
 
- Protected Member Functions inherited from casacore::ArrayBase
 ArrayBase (ArrayBase &&source, const IPosition &shapeForSource) noexcept
 
For subclasses, this move constructor allows the moved-from object to

obtain a given shape after resizing. More...

 
void swap (ArrayBase &source) noexcept
 
bool reformOrResize (const IPosition &newShape, bool resizeIfNeeded, size_t nReferences, long long nElementsAllocated, bool copyDataIfNeeded, size_t resizePercentage)
 Either reforms the array if size permits or resizes it to the new shape. More...
 
bool isStorageContiguous () const
 Determine if the storage of a subset is contiguous. More...
 
void checkVectorShape ()
 Check if the shape of a vector is correct. More...
 
void checkMatrixShape ()
 Check if the shape of a matrix is correct. More...
 
void checkCubeShape ()
 Check if the shape of a cube is correct. More...
 
void baseReform (ArrayBase &tmp, const IPosition &shape, bool strict=true) const
 Reform the array to a shape with the same nr of elements. More...
 
void baseNonDegenerate (const ArrayBase &other, const IPosition &ignoreAxes)
 Remove the degenerate axes from the Array object. More...
 
void baseAddDegenerate (ArrayBase &, size_t numAxes)
 These member functions return an Array reference with the specified number of extra axes, all of length one, appended to the end of the Array. More...
 
size_t makeSubset (ArrayBase &out, const IPosition &b, const IPosition &e, const IPosition &i)
 Make a subset of an array. More...
 
size_t makeDiagonal (size_t firstAxis, long long diag)
 Set the length and stride such that the diagonal of the matrices defined by two consecutive axes is formed. More...
 
bool conform2 (const ArrayBase &other) const
 Are the shapes identical? More...
 
void baseMakeSteps ()
 Make the indexing step sizes. More...
 
bool copyVectorHelper (const ArrayBase &other)
 Helper function for templated Vector class. More...
 

Private Member Functions

size_t xinc () const
 Cached constants to improve indexing. More...
 
size_t yinc () const
 
size_t zinc () const
 
size_t index (size_t i1, size_t i2, size_t i3) const
 
size_t index_continuous (size_t i1, size_t i2, size_t i3) const
 

Additional Inherited Members

- Public Types inherited from casacore::Array< T, Alloc >
typedef Alloc allocator_type
 Define the STL-style iterator functions (only forward iterator). More...
 
typedef T value_type
 Element type. More...
 
typedef const T & const_reference
 TODO This is how std containers define a reference type, but the name 'reference' is already taken by a method. More...
 
typedef T * pointer
 Pointer to an element type. More...
 
typedef const T * const_pointer
 Constant pointer to the element type. More...
 
typedef IteratorSTL iterator
 
typedef ConstIteratorSTL const_iterator
 
typedef T * contiter
 
typedef const T * const_contiter
 
- Static Public Member Functions inherited from casacore::ArrayBase
static unsigned arrayVersion ()
 Array version for major change (used by ArrayIO). More...
 
- Static Public Attributes inherited from casacore::Array< T, Alloc >
static struct
casacore::Array::uninitializedType 
uninitialized
 
- Static Protected Member Functions inherited from casacore::Array< T, Alloc >
static void copyToContiguousStorage (T *dst, Array< T, Alloc > const &src)
 
- Protected Attributes inherited from casacore::Array< T, Alloc >
std::shared_ptr
< arrays_internal::Storage< T,
Alloc > > 
data_p
 Shared pointer to a Storage that contains the data. More...
 
T * begin_p
 This pointer is adjusted to point to the first element of the array. More...
 
T * end_p
 The end for an STL-style iteration. More...
 
- Protected Attributes inherited from casacore::ArrayBase
size_t nels_p
 Number of elements in the array. More...
 
size_t ndimen_p
 Dimensionality of the array. More...
 
bool contiguous_p
 Are the data contiguous? More...
 
IPosition length_p
 Used to hold the shape, increment into the underlying storage and originalLength of the array. More...
 
IPosition inc_p
 
IPosition originalLength_p
 
IPosition steps_p
 Used to hold the step to next element in each dimension. More...
 

Detailed Description

template<typename T, typename Alloc = std::allocator<T>>
class casacore::Cube< T, Alloc >

A 3-D Specialization of the Array class.

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Cube objects are three-dimensional specializations (e.g., more convenient and efficient indexing) of the general Array class. You might also want to look at the Array documentation to see inherited functionality.

Generally the member functions of Array are also available in Cube versions which take a pair of integers where the array needs an IPosition. Since the Cube is three-dimensional, the IPositions are overkill, although you may use those versions if you want to.

Cube<int> ci(100,100,100); // Shape is 100x100
ci.resize(50,50,50); // Shape now 50x50

Slices may be taken with the Slice class. To take a slice, one "indexes" with one Slice(start, length, inc) for each axis, where end and inc are optional. Additionally, there is an xyPlane() member function which return a Matrix which corresponds to some plane:

Cube<float> cube(10,20,30);
for(size_t i=0; i < 30; i++) {
cube.xyPlane(i) = i; // Set every 10x20 plane to its "height"
}

Element-by-element arithmetic and logical operations are available (in aips/ArrayMath.h and aips/ArrayLogical.h).

As with the Arrays, if the preprocessor symbol AIPS_DEBUG is defined at compile time invariants will be checked on entry to most member functions. Additionally, if AIPS_ARRAY_INDEX_CHECK is defined index operations will be bounds-checked. Neither of these should be defined for production code.

Definition at line 11 of file ArrayFwd.h.

Constructor & Destructor Documentation

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( const Alloc &  allocator = Alloc())

A Cube of length zero in each dimension; zero origin.

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( size_t  l1,
size_t  l2,
size_t  l3,
const T &  initialValue = T(),
const Alloc &  allocator = Alloc() 
)

A l1xl2xl3 sized cube.

Fill it with the initial value.

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( size_t  l1,
size_t  l2,
size_t  l3,
typename Array< T, Alloc >::uninitializedType  ,
const Alloc &  allocator = Alloc() 
)

An uninitialized l1xl2xl3 sized cube.

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( const IPosition length,
const T &  initialValue = T(),
const Alloc &  allocator = Alloc() 
)

A Cube where the shape ("len") is defined with IPositions.

Fill it with the initial value.

template<typename T, typename Alloc = std::allocator<T>>
casacore::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.

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( const Cube< T, Alloc > &  )

The copy constructor uses reference semantics.

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( Cube< T, Alloc > &&  )
template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( const Array< T, Alloc > &  )

Construct a cube by reference from "other".

"other must have ndim() of 3 or less. The warning which applies to the copy constructor is also valid here.

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( Array< T, Alloc > &&  )
template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( const IPosition shape,
T *  storage,
StorageInitPolicy  policy = COPY 
)

Create an Cube of a given shape from a pointer.

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( const IPosition shape,
T *  storage,
StorageInitPolicy  policy,
const Alloc &  allocator 
)

Create an Cube of a given shape from a pointer.

template<typename T, typename Alloc = std::allocator<T>>
casacore::Cube< T, Alloc >::Cube ( const IPosition shape,
const T *  storage 
)

Create an Cube of a given shape from a pointer.

Because the pointer is const, a copy is always made.

Member Function Documentation

template<typename T, typename Alloc = std::allocator<T>>
virtual void casacore::Cube< T, Alloc >::doNonDegenerate ( const Array< T > &  other,
const IPosition ignoreAxes 
)
overrideprotectedvirtual

Remove the degenerate axes from other and store result in this cube.

An exception is thrown if removing degenerate axes does not result in a cube.

template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::fixedDimensionality ( ) const
inlineoverrideprotectedvirtual

Subclasses can return their dimensionality.

The Array class will make sure that whenever it is resized, the dimensionality is checked. Array's constructors do not check the dimensionality, because the subclass hasn't been created yet at that point. Subclasses should therefore make sure to call the constructors appropriately. For classes that return 0, any resize will be allowed.

Reimplemented from casacore::Array< T, Alloc >.

Definition at line 306 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::index ( size_t  i1,
size_t  i2,
size_t  i3 
) const
inlineprivate
template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::index_continuous ( size_t  i1,
size_t  i2,
size_t  i3 
) const
inlineprivate

Definition at line 321 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::ncolumn ( ) const
inline

The number of columns in the Cube, i.e.

the length of the 2nd axis.

Definition at line 288 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::nplane ( ) const
inline

The number of planes in the Cube, i.e.

the length of the 3rd axis.

Definition at line 292 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::nrow ( ) const
inline

The number of rows in the Cube, i.e.

the length of the first axis.

Definition at line 284 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
virtual bool casacore::Cube< T, Alloc >::ok ( ) const
overridevirtual

Checks that the cube is consistent (invariants check out).

Reimplemented from casacore::Array< T, Alloc >.

template<typename T, typename Alloc = std::allocator<T>>
T& casacore::Cube< T, Alloc >::operator() ( const IPosition i)
inline

Copy to this those values in marray whose corresponding elements in marray's mask are true.

TODO Cube<T, Alloc> &operator= (const MaskedArray<T> &marray) { Array<T> (*this) = marray; return *this; }

Single-pixel addressing. If AIPS_ARRAY_INDEX_CHECK is defined, bounds checking is performed.

Definition at line 182 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
const T& casacore::Cube< T, Alloc >::operator() ( const IPosition i) const
inline

Definition at line 184 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
T& casacore::Cube< T, Alloc >::operator() ( size_t  i1,
size_t  i2,
size_t  i3 
)
inline

Definition at line 187 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
const T& casacore::Cube< T, Alloc >::operator() ( size_t  i1,
size_t  i2,
size_t  i3 
) const
inline

Definition at line 192 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Cube<T, Alloc> casacore::Cube< T, Alloc >::operator() ( const Slice sliceX,
const Slice sliceY,
const Slice sliceZ 
)

Take a slice of this cube.

Slices are always indexed starting at zero. This uses reference semantics, i.e. changing a value in the slice changes the original.

Cube<double> vd(100,100,100);
//..\.
vd(Slice(0,10),Slice(10,10,Slice(0,10))) = -1.0; // sub-cube set to -1.0
template<typename T, typename Alloc = std::allocator<T>>
const Cube<T, Alloc> casacore::Cube< T, Alloc >::operator() ( const Slice sliceX,
const Slice sliceY,
const Slice sliceZ 
) const
template<typename T, typename Alloc = std::allocator<T>>
Array<T> casacore::Cube< T, Alloc >::operator() ( const IPosition blc,
const IPosition trc,
const IPosition incr 
)
inline

Slice using IPositions.

Required to be defined, otherwise the base class versions are hidden.

Definition at line 216 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
const Array<T> casacore::Cube< T, Alloc >::operator() ( const IPosition blc,
const IPosition trc,
const IPosition incr 
) const
inline

Definition at line 219 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Array<T> casacore::Cube< T, Alloc >::operator() ( const IPosition blc,
const IPosition trc 
)
inline

Definition at line 222 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
const Array<T> casacore::Cube< T, Alloc >::operator() ( const IPosition blc,
const IPosition trc 
) const
inline

Definition at line 224 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Array<T> casacore::Cube< T, Alloc >::operator() ( const Slicer slicer)
inline

Definition at line 226 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
const Array<T> casacore::Cube< T, Alloc >::operator() ( const Slicer slicer) const
inline

Definition at line 228 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
const MaskedArray<T> casacore::Cube< T, Alloc >::operator() ( const LogicalArray mask) const
inline

The array is masked by the input LogicalArray.

This mask must conform to the array.

Return a MaskedArray.

Definition at line 238 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
MaskedArray<T> casacore::Cube< T, Alloc >::operator() ( const LogicalArray mask)
inline

Return a MaskedArray.

Definition at line 242 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
const MaskedArray<T> casacore::Cube< T, Alloc >::operator() ( const MaskedLogicalArray mask) const
inline

The array is masked by the input MaskedLogicalArray.

The mask is effectively the AND of the internal LogicalArray and the internal mask of the MaskedLogicalArray. The MaskedLogicalArray must conform to the array.

Return a MaskedArray.

Definition at line 255 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
MaskedArray<T> casacore::Cube< T, Alloc >::operator() ( const MaskedLogicalArray mask)
inline

Return a MaskedArray.

Definition at line 259 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Cube<T, Alloc>& casacore::Cube< T, Alloc >::operator= ( const Cube< T, Alloc > &  source)
inline

Copy the values from other to this cube.

If this cube has zero elements then it will resize to be the same shape as other; otherwise other must conform to this. Note that the assign function can be used to assign a non-conforming cube.

Definition at line 125 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Cube<T, Alloc>& casacore::Cube< T, Alloc >::operator= ( Cube< T, Alloc > &&  source)
inline

Definition at line 127 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Cube<T, Alloc>& casacore::Cube< T, Alloc >::operator= ( const Array< T, Alloc > &  source)
inline

TODO is it highly confusing that operator= is specialized for Cube, e.g. this is allowed: Cube<int> cube(5,1,1); Vector<int> v(5,0); cube = v; But this is not: Array arr(IPosition{5,1,1}); Vector<int> v(5,0); arr = v; If it should be allowed to assign from dim(5,1,1) to dim(5), this should be supported already by the Array class so that the semantics are the same!

This might work if a.ndim == 1 or 2

Definition at line 130 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Cube<T, Alloc>& casacore::Cube< T, Alloc >::operator= ( Array< T, Alloc > &&  source)
inline

Definition at line 154 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Array<T, Alloc>& casacore::Cube< T, Alloc >::operator= ( const T &  val)
inline

Copy val into every element of this cube; i.e.

behaves as if val were a constant conformant cube.

Definition at line 168 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
virtual void casacore::Cube< T, Alloc >::preTakeStorage ( const IPosition )
overrideprotectedvirtual

pre/post processing hook of takeStorage() for subclasses.

Reimplemented from casacore::Array< T, Alloc >.

template<typename T, typename Alloc = std::allocator<T>>
void casacore::Cube< T, Alloc >::resize ( size_t  nx,
size_t  ny,
size_t  nz,
bool  copyValues = false 
)
template<typename T, typename Alloc = std::allocator<T>>
const IPosition& casacore::Cube< T, Alloc >::shape ( ) const
inline

The length of each axis of the cube.

Definition at line 278 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
void casacore::Cube< T, Alloc >::shape ( int &  s1,
int &  s2,
int &  s3 
) const
inline

Definition at line 280 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::xinc ( ) const
inlineprivate

Cached constants to improve indexing.

size_t xinc_p, yinc_p, zinc_p; Helper fn to calculate the indexing constants. void makeIndexingConstants();

Definition at line 313 of file Cube.h.

Referenced by casacore::Cube< casacore::RigidVector< Double, 2 > >::index().

template<typename T, typename Alloc = std::allocator<T>>
Matrix<T, Alloc> casacore::Cube< T, Alloc >::xyPlane ( size_t  zplane)

Extract a plane as a matrix referencing the original data.

Of course you could also use a Matrix iterator on the cube.

template<typename T, typename Alloc = std::allocator<T>>
const Matrix<T, Alloc> casacore::Cube< T, Alloc >::xyPlane ( size_t  zplane) const
template<typename T, typename Alloc = std::allocator<T>>
Matrix<T, Alloc> casacore::Cube< T, Alloc >::xzPlane ( size_t  yplane)
template<typename T, typename Alloc = std::allocator<T>>
const Matrix<T, Alloc> casacore::Cube< T, Alloc >::xzPlane ( size_t  yplane) const
template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::yinc ( ) const
inlineprivate

Definition at line 314 of file Cube.h.

template<typename T, typename Alloc = std::allocator<T>>
Matrix<T, Alloc> casacore::Cube< T, Alloc >::yzPlane ( size_t  xplane)
template<typename T, typename Alloc = std::allocator<T>>
const Matrix<T, Alloc> casacore::Cube< T, Alloc >::yzPlane ( size_t  xplane) const
template<typename T, typename Alloc = std::allocator<T>>
size_t casacore::Cube< T, Alloc >::zinc ( ) const
inlineprivate

Definition at line 315 of file Cube.h.


The documentation for this class was generated from the following files: