Loading...
Searching...
No Matches
casacore::TiledShape Class Reference
lattices package (libcasa_lattices) » Lattices_module

More...

`#include <TiledShape.h>`

## Public Member Functions

| TiledShape ()
| Default constructor has empty shape and tile shape.
| TiledShape (const IPosition &shape)
| Use the given shape.
| TiledShape (const IPosition &shape, const IPosition &tileShape)
| Use the given shape and tile shape.
| TiledShape (const TiledShape &that)
| Copy constructor (copy semantics).
| ~TiledShape ()
TiledShape & | operator= (const TiledShape &that)
| Assignment (copy semantics).
Bool | isTileShapeDefined () const
| Is the tile shape defined?
const IPosition & | shape () const
| Return the shape.
IPosition | tileShape (uInt nrPixelsPerTile=32768, Double tolerance=0.5) const
| Return the tile shape.
IPosition | defaultTileShape (uInt nrPixelsPerTile, Double tolerance) const
| Derive the default tile shape from the shape for the given number of pixels per tile.
IPosition | defaultTileShape (uInt nrPixelsPerTile, const Vector< Double > &tolerance, const Vector< Double > &weight) const

## Private Attributes

IPosition | itsShape
IPosition | itsTileShape
Bool | itsTileDefined

## Detailed Description

Define the shape and tile shape

### Intended use:

Public interface

### Review Status

Reviewed By:
  Peter Barnes
Date Reviewed:
  1999/10/30
Test programs:
  tTiledShape

### Prerequisite

- IPosition

### Etymology

TiledShape defines the shape and tile shape of a tiled array.

### Synopsis

TiledShape is a class defining the shape and optionally the tile shape of a lattice. It is used in the constructors of PagedArray and PagedImage.

In principle it serves as a place holder for the lattice shape and tile shape. The functions shape and tileShape can be used to retrieve the shapes. However, when the tile shape is not given, the function tileShape calculates a default tile shape using the given maximum tile size in pixel elements. The default tile shape is calculated in such a way that the sizes of its axes are proportional to the sizes of the lattice axes. Per axis it is tried as much as possible to fit an integral number of tiles in the lattice.
In this way getting the tile shape is completely transparent.

### Example

// Do not explicitly define a tile shape.
// This results in a default tile shape (of 32,32,32).
TiledShape shape(IPosition(3,128,128,128));
cout << shape.shape() << ' ' << shape.tileShape() << endl;
// Use with an explicitly given tile shape.
TiledShape shape(IPosition(3,128,128,128), IPosition(3,64,32,8));
cout << shape.shape() << ' ' << shape.tileShape() << endl;
casacore::IPosition
Definition IPosition.h:117
casacore::TiledShape::TiledShape
TiledShape()
Default constructor has empty shape and tile shape.
casacore::TiledShape::shape
const IPosition & shape() const
Return the shape.
Definition TiledShape.h:163

### Motivation

Classes PagedArray and PagedImage contained several duplicated constructors to be able to pass a tile shape. This class makes it possible to have only one constructor instead of two. Furthermore it contains the logic to check if the shapes are conforming and the logic to calculate a default tile shape.

Definition at line 94 of file TiledShape.h.

## Constructor & Destructor Documentation

## TiledShape() [1/4]

casacore::TiledShape::TiledShape | ( |  | ) |

Default constructor has empty shape and tile shape.

Referenced by operator=(), and TiledShape().

## TiledShape() [2/4]

casacore::TiledShape::TiledShape | ( | const IPosition & | shape | ) |

Use the given shape.

No tile shape is given, so function tileShape will calculate it using the size of a tile.

References shape().

## TiledShape() [3/4]

casacore::TiledShape::TiledShape | ( | const IPosition & | shape,
|  | const IPosition & | tileShape )

Use the given shape and tile shape.

Both shapes must be conforming (i.e. have same number of elements).

References shape(), and tileShape().

## TiledShape() [4/4]

casacore::TiledShape::TiledShape | ( | const TiledShape & | that | ) |

Copy constructor (copy semantics).

References TiledShape().

## ~TiledShape()

casacore::TiledShape::~TiledShape | ( |  | ) |

## Member Function Documentation

## defaultTileShape() [1/2]

IPosition casacore::TiledShape::defaultTileShape | ( | uInt | nrPixelsPerTile,
|  | const Vector< Double > & | tolerance,
|  | const Vector< Double > & | weight ) const

## defaultTileShape() [2/2]

IPosition casacore::TiledShape::defaultTileShape | ( | uInt | nrPixelsPerTile,
|  | Double | tolerance ) const

Derive the default tile shape from the shape for the given number of pixels per tile.

It is tried to get the same number of tiles for each dimension. When a weight vector is given, the number of tiles for a dimension is proportional to the weight.
After the initial guess it tries to optimize it by trying to waste as little space as possible, while trying to keep as close as possible to the initial guess. The given tolerance (possibly per axis) gives the minimum and maximum possible length of a tile axis (minimum = initial_guess*tolerance; maximum = initial_guess/tolerance). The heuristic is such that a tile axis length dividing the cube length exactly is always favoured. The test program tTiledShape can be used to see how the algorithm works out for a given shape and tile size.

Referenced by tileShape().

## isTileShapeDefined()

Bool casacore::TiledShape::isTileShapeDefined | ( |  | ) | const

inline

Is the tile shape defined?

Definition at line 159 of file TiledShape.h.

References itsTileDefined.

## operator=()

TiledShape & casacore::TiledShape::operator= | ( | const TiledShape & | that | ) |

Assignment (copy semantics).

References TiledShape().

## shape()

const IPosition & casacore::TiledShape::shape | ( |  | ) | const

inline

Return the shape.

Definition at line 163 of file TiledShape.h.

References itsShape.

Referenced by TiledShape(), and TiledShape().

## tileShape()

IPosition casacore::TiledShape::tileShape | ( | uInt | nrPixelsPerTile = 32768,
|  | Double | tolerance = 0.5 ) const

inline

Return the tile shape.

When the tile shape is undefined, the default tile shape will be calculated using the given tile size and tolerance.
The tolerance is used to determine the boundaries where it is tried to fit an integral number of tiles.

Definition at line 167 of file TiledShape.h.

References defaultTileShape(), itsTileDefined, and itsTileShape.

Referenced by TiledShape().

## Member Data Documentation

## itsShape

IPosition casacore::TiledShape::itsShape

private

Definition at line 153 of file TiledShape.h.

Referenced by shape().

## itsTileDefined

Bool casacore::TiledShape::itsTileDefined

private

Definition at line 155 of file TiledShape.h.

Referenced by isTileShapeDefined(), and tileShape().

## itsTileShape

IPosition casacore::TiledShape::itsTileShape

private

Definition at line 154 of file TiledShape.h.

Referenced by tileShape().

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

- lattices/Lattices/TiledShape.h