casa::ArrayBase Class Reference
[Arrays]

#include <ArrayBase.h>

Inheritance diagram for casa::ArrayBase:

Inheritance graph
[legend]
Collaboration diagram for casa::ArrayBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

Non-templated base class for templated Array class.

ArrayBase is only used to factor out common code from the templated Array class.

Definition at line 67 of file ArrayBase.h.

Public Member Functions

 ArrayBase ()
 ArrayBase (const IPosition &shape)
 Create an array of the given shape, i.e.
 ArrayBase (const ArrayBase &other)
 Copy constructor.
ArrayBaseoperator= (const ArrayBase &)
 Assignment.
virtual ~ArrayBase ()
 Destructor.
uInt ndim () const
 The dimensionality of this array.
Bool contiguousStorage () const
 Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a copy.
virtual Bool ok () const
 Check to see if the Array is consistent.
const IPositionshape () const
 The length of each axis.
IPosition endPosition () const
 A convenience function: endPosition(i) = shape(i) - 1; i.e.
const IPositionsteps () const
 Return steps to be made if stepping one element in a dimension.
uInt nelements () const
 How many elements does this array have? Product of all axis lengths.
uInt size () const
void validateConformance (const ArrayBase &) const
 Various helper functions.
void validateIndex (const IPosition &) const

Static Public Member Functions

static uInt arrayVersion ()
 Array version for major change (used by ArrayIO).

Protected Member Functions

void baseCopy (const ArrayBase &that)
Bool isStorageContiguous () const
 Determine if the storage of a subset is contiguous.
void checkVectorShape ()
 Check if the shape of a vector is correct.
void checkMatrixShape ()
 Check if the shape of a matrix is correct.
void checkCubeShape ()
 Check if the shape of a cube is correct.
void baseReform (ArrayBase &tmp, const IPosition &shape) const
 Reform the array to a shape with the same nr of elements.
void baseNonDegenerate (ArrayBase &other, const IPosition &ignoreAxes)
 Remove the degenerate axes from the Array object.
void baseAddDegenerate (ArrayBase &, uInt 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.
Int makeSubset (ArrayBase &out, const IPosition &b, const IPosition &e, const IPosition &i)
 Make a subset of an array.
Bool conform2 (const ArrayBase &other) const
 Are the shapes identical?
void baseMakeSteps ()
 Make the indexing step sizes.

Protected Attributes

uInt nels_p
 Number of elements in the array.
uInt ndimen_p
 Dimensionality of the array.
Bool contiguous_p
 Are the data contiguous?
IPosition length_p
 Used to hold the shape, increment into the underlying storage and originalLength of the array.
IPosition inc_p
IPosition originalLength_p
IPosition steps_p
 Used to hold the step to next element in each dimension.


Constructor & Destructor Documentation

casa::ArrayBase::ArrayBase (  ) 

casa::ArrayBase::ArrayBase ( const IPosition shape  )  [explicit]

Create an array of the given shape, i.e.

after construction array.ndim() == shape.nelements() and array.shape() == shape. The origin of the Array is zero.

casa::ArrayBase::ArrayBase ( const ArrayBase other  ) 

Copy constructor.

virtual casa::ArrayBase::~ArrayBase (  )  [virtual]

Destructor.


Member Function Documentation

ArrayBase& casa::ArrayBase::operator= ( const ArrayBase  ) 

Assignment.

Referenced by baseCopy().

uInt casa::ArrayBase::ndim (  )  const [inline]

The dimensionality of this array.

Definition at line 87 of file ArrayBase.h.

References ndimen_p.

Referenced by casa::Array< ArgType >::setEndIter().

uInt casa::ArrayBase::nelements (  )  const [inline]

How many elements does this array have? Product of all axis lengths.

Definition at line 92 of file ArrayBase.h.

References nels_p.

Referenced by casa::SimDopplerList::addDoppler(), casa::TabVecRep< T >::conform(), casa::TPGuiCallBackHooks::createiterplotlabels(), casa::MSPlotAntennaCallBack::createiterplotlabels(), casa::PlotCalCallBacks::createiterplotlabels(), casa::MSPlotMainMSCallBack::createiterplotlabels(), casa::MSPlotUVWCallBack::createiterplotlabels(), casa::MSAsRaster::ind_(), casa::ColumnsIndexArray::isUnique(), casa::ColumnsIndex::isUnique(), casa::ArrayMath_global_functions_Array_mathematical_operations::median(), casa::ArrayMath_global_functions_Array_mathematical_operations::medianInPlace(), casa::LCSlicer::ndim(), casa::RINEXSat::nelements(), casa::EDProfile::nelements(), casa::SimDataDesc::numWindows(), and casa::IonosphModel::setAlt().

uInt casa::ArrayBase::size (  )  const [inline]

Definition at line 94 of file ArrayBase.h.

References nels_p.

Bool casa::ArrayBase::contiguousStorage (  )  const [inline]

Are the array data contiguous? If they are not contiguous, getStorage (see below) needs to make a copy.

Definition at line 101 of file ArrayBase.h.

References contiguous_p.

virtual Bool casa::ArrayBase::ok (  )  const [virtual]

Check to see if the Array is consistent.

This is about the same thing as checking for invariants. If AIPS_DEBUG is defined, this is invoked after construction and on entry to most member functions.

const IPosition& casa::ArrayBase::shape (  )  const [inline]

The length of each axis.

Definition at line 110 of file ArrayBase.h.

References length_p.

IPosition casa::ArrayBase::endPosition (  )  const

A convenience function: endPosition(i) = shape(i) - 1; i.e.

this is the IPosition of the last element of the Array.

const IPosition& casa::ArrayBase::steps (  )  const [inline]

Return steps to be made if stepping one element in a dimension.

This is the 'physical' step, thus it also works correctly for non-contiguous arrays. E.g. data() + steps(0) gives the second element of the first axis.

Definition at line 121 of file ArrayBase.h.

References steps_p.

static uInt casa::ArrayBase::arrayVersion (  )  [inline, static]

Array version for major change (used by ArrayIO).

enum did not work properly with cfront 3.0.1), so replaced by a static inline function. Users won't normally use this.

Definition at line 127 of file ArrayBase.h.

void casa::ArrayBase::baseCopy ( const ArrayBase that  )  [inline, protected]

Definition at line 132 of file ArrayBase.h.

References operator=().

Bool casa::ArrayBase::isStorageContiguous (  )  const [protected]

Determine if the storage of a subset is contiguous.

void casa::ArrayBase::checkVectorShape (  )  [protected]

Check if the shape of a vector is correct.

If possible, adjust if not. It is possible if at most one axis has length > 1.

void casa::ArrayBase::checkMatrixShape (  )  [protected]

Check if the shape of a matrix is correct.

Adjust it if smaller.

void casa::ArrayBase::checkCubeShape (  )  [protected]

Check if the shape of a cube is correct.

Adjust it if smaller.

void casa::ArrayBase::baseReform ( ArrayBase tmp,
const IPosition shape 
) const [protected]

Reform the array to a shape with the same nr of elements.

void casa::ArrayBase::baseNonDegenerate ( ArrayBase other,
const IPosition ignoreAxes 
) [protected]

Remove the degenerate axes from the Array object.

This is the implementation of the nonDegenerate functions. It has a different name to be able to make it virtual without having the "hide virtual function" message when compiling derived classes.

void casa::ArrayBase::baseAddDegenerate ( ArrayBase ,
uInt  numAxes 
) [protected]

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.

Note that the reform function can also be used to add extra axes.

Int casa::ArrayBase::makeSubset ( ArrayBase out,
const IPosition b,
const IPosition e,
const IPosition i 
) [protected]

Make a subset of an array.

It checks if start,end,incr are within the array limits. It returns the offset of the subset in the array.

Bool casa::ArrayBase::conform2 ( const ArrayBase other  )  const [inline, protected]

Are the shapes identical?

Definition at line 172 of file ArrayBase.h.

References casa::IPosition::isEqual(), and length_p.

Referenced by casa::Array< ArgType >::conform().

void casa::ArrayBase::baseMakeSteps (  )  [protected]

Make the indexing step sizes.

Referenced by casa::Array< ArgType >::makeSteps().

void casa::ArrayBase::validateConformance ( const ArrayBase  )  const

Various helper functions.

void casa::ArrayBase::validateIndex ( const IPosition  )  const

Referenced by casa::Vector< ArgType >::operator()(), casa::Matrix< std::complex< Float > >::operator()(), and casa::Cube< std::complex< Float > >::operator()().


Member Data Documentation

uInt casa::ArrayBase::nels_p [protected]

Number of elements in the array.

Cached rather than computed.

Definition at line 187 of file ArrayBase.h.

Referenced by nelements(), casa::Array< ArgType >::setEndIter(), and size().

uInt casa::ArrayBase::ndimen_p [protected]

Dimensionality of the array.

Definition at line 189 of file ArrayBase.h.

Referenced by ndim().

Bool casa::ArrayBase::contiguous_p [protected]

Are the data contiguous?

Definition at line 191 of file ArrayBase.h.

Referenced by contiguousStorage(), casa::Matrix< std::complex< Float > >::operator()(), casa::Cube< std::complex< Float > >::operator()(), and casa::Array< ArgType >::setEndIter().

IPosition casa::ArrayBase::length_p [protected]

Used to hold the shape, increment into the underlying storage and originalLength of the array.

Definition at line 194 of file ArrayBase.h.

Referenced by conform2(), casa::Cube< std::complex< Float > >::ncolumn(), casa::Matrix< std::complex< Float > >::ncolumn(), casa::Cube< std::complex< Float > >::nplane(), casa::Matrix< std::complex< Float > >::nrow(), casa::Cube< std::complex< Float > >::nrow(), casa::Array< ArgType >::setEndIter(), shape(), casa::Cube< std::complex< Float > >::shape(), casa::Vector< ArgType >::shape(), and casa::Matrix< std::complex< Float > >::shape().

IPosition casa::ArrayBase::inc_p [protected]

Definition at line 194 of file ArrayBase.h.

Referenced by casa::Vector< ArgType >::operator()().

IPosition casa::ArrayBase::originalLength_p [protected]

Definition at line 194 of file ArrayBase.h.

IPosition casa::ArrayBase::steps_p [protected]

Used to hold the step to next element in each dimension.

Definition at line 196 of file ArrayBase.h.

Referenced by casa::Array< ArgType >::setEndIter(), and steps().


The documentation for this class was generated from the following file:
Generated on Mon Sep 1 22:43:38 2008 for NRAOCASA by  doxygen 1.5.1