AxesMapping.h

Classes

AxesMapping -- Info about mapping array axes to another order. (full description)

class AxesMapping

Interface

Public Members
AxesMapping()
explicit AxesMapping (const IPosition& oldToNew)
AxesMapping(const AxesMapping& other)
~AxesMapping()
AxesMapping& operator= (const AxesMapping& other)
Bool isRemoved() const
Bool isReordered() const
const IPosition& getToNew() const
const IPosition& getToOld() const
IPosition posToNew (const IPosition& pos) const
IPosition posToOld (const IPosition& pos) const
IPosition shapeToNew (const IPosition& shape) const
IPosition shapeToOld (const IPosition& shape) const
Slicer slicerToNew (const Slicer& slicer) const
Slicer slicerToOld (const Slicer& slicer) const

Description

Review Status

Date Reviewed:
yyyy/mm/dd
Programs:
Tests:

Prerequisite

Synopsis

AxesMapping holds the information about mapping axes to another order. It can be constructed by AxesSpecifier by applying a shape to the axes specification.
AxesMapping is thereafter used to map positions, shapes, and slices to the new axes or backwards.
Caution Shapes and positions are both represented by class IPosition. However, they have to be treated differently in this class, because removed axes for a position have value 0, while for a shape they have value 1. Hence there are different functions for them and the user has to take care that the correct function is called.

Example


Motivation

The class encapsulates the mapping functionality. It is meant as a helper class for SubLattice.

Member Description

AxesMapping()

The default constructor creates empty maps.

explicit AxesMapping (const IPosition& oldToNew)

Construct it with the mapping from old to new axes order. A value of -1 means that the old axes is ignored in the new one. Another value gives the new axis number.
It determines if axes are removed and/or reordered.

AxesMapping(const AxesMapping& other)

Copy constructor (copy semantics).

~AxesMapping()

AxesMapping& operator= (const AxesMapping& other)

Assignment (copy semantics). This and that do not have to have the same length.

Bool isRemoved() const

Are axes removed?

Bool isReordered() const

Is the axes order reordered?

const IPosition& getToNew() const

Get the mapping of old->new. The length of the resulting IPosition is the dimensionality of the original lattice. A value of -1 indicates that the corresponding axis in the original lattice is removed. Another value is the axis number in the new lattice,

const IPosition& getToOld() const

Get the mapping of new->old. The length of the resulting IPosition is the dimensionality of the new lattice. Its values give the axes in the original lattice.

IPosition posToNew (const IPosition& pos) const

Map an old position to the new one. In debug-mode it checks if the removed axes have position 0 in the input position.

IPosition posToOld (const IPosition& pos) const

Map a new position or shape to the old one.

IPosition shapeToNew (const IPosition& shape) const

Map an old shape to the new one. In debug-mode it checks if the removed axes have length 1 in the input shape.

IPosition shapeToOld (const IPosition& shape) const

Map a new position or shape to the old one.

Slicer slicerToNew (const Slicer& slicer) const

Map an old shape to the new one. In debug-mode it checks if the removed axes have length 1 in the input slicer.

Slicer slicerToOld (const Slicer& slicer) const

Map a new position or shape to the old one.