Loading...
Searching...
No Matches
casacore::LatticeCache< T > Class Template Reference
lattices package (libcasa_lattices) » Lattices_module

More...

`#include <LatticeCache.h>`

## Public Member Functions

| LatticeCache (Lattice< T > &image, Int cacheSize, IPosition tileShape, Vector< Float > &tileOverlap, Bool additive)
| Constructor: cachesize in units of T.
| LatticeCache (const LatticeCache< T > &other)
LatticeCache< T > & | operator= (const LatticeCache< T > &other)
virtual | ~LatticeCache ()
Array< T > & | tile (IPosition &cacheLoc, const IPosition &tileLoc, Bool discard=True)
| Return the tile for a given location.
Array< T > & | tile (const IPosition &tileLoc, Bool discard=True)
const Array< T > & | tile (const IPosition &tileLoc)
| const version is needed
IPosition & | cacheLocation (IPosition &cacheLoc, const IPosition &tileLoc)
| Return the IPosition for the start of this tile.
virtual void | showCacheStatistics (ostream &os)
| Show the statistics of cache access.
virtual void | clearCacheStatistics ()
| Clear the statistics of cache access.
virtual void | flush ()
| Flush contents.

## Protected Member Functions

| LatticeCache ()
Int | getFreeTile (Bool readonly)
void | writeTile (Int tile)
void | readTile (Int tile, Bool readonly)

## Protected Attributes

Int | numberTiles
IPosition | tileShape
Vector< Int > | tileShapeVec
Vector< Int > | tileOffsetVec
Vector< Float > | tileOverlap
Bool | additive
Int | cacheSize
Int | cacheAccesses
Int | cacheHits
Int | cacheMisses
Int | cacheReads
Int | cacheWrites
Block< IPosition > | tileLocs
Block< Int > | tileSequence
Block< Array< T > > | tileContents
Lattice< T > * | image_p

## Detailed Description

template<class T>
class casacore::LatticeCache< T >

a class for caching image access via tiles

### Intended use:

Public interface

### Prerequisite

- Lattice

### Etymology

This class divides an image into Tiles that are stored in a Cache.

### Synopsis

An image is divided into tiles of a specified shape. Access to the image pixels is via these tiles. A cache of active tiles is kept in memory up to a specified limit in memory allocation. Tiles are flushed to disk using a Least-Recently-Used Criterion.

The tile size specified is the maximum dimension. Near the edge, smaller tiles are returned if necessary.

The offset needed to get back to true pixels is also available.

The cache hit rate for a sufficient number of random accesses goes as the ratio of cache size to image size.

Tiles may be overlapped. If there is any overlap then the caller is responsible for dealing with the overlap. Normally one will only want overlapping windows for additive operations in which case the additive flag to the constructor should be used.

### Example

### Motivation

To aid in gridding

Definition at line 93 of file LatticeCache.h.

## Constructor & Destructor Documentation

## LatticeCache() [1/3]

template<class T>

casacore::LatticeCache< T >::LatticeCache | ( | Lattice< T > & | image,
|  | Int | cacheSize,
|  | IPosition | tileShape,
|  | Vector< Float > & | tileOverlap,
|  | Bool | additive )

Constructor: cachesize in units of T.

tileOverlap is the fractional overlap between neighbouring tile.

References additive, cacheSize, tileOverlap, and tileShape.

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

## LatticeCache() [2/3]

template<class T>

casacore::LatticeCache< T >::LatticeCache | ( | const LatticeCache< T > & | other | ) |

References LatticeCache().

## ~LatticeCache()

template<class T>

virtual casacore::LatticeCache< T >::~LatticeCache | ( |  | ) |

virtual

## LatticeCache() [3/3]

template<class T>

casacore::LatticeCache< T >::LatticeCache | ( |  | ) |

inline protected

Definition at line 131 of file LatticeCache.h.

## Member Function Documentation

## cacheLocation()

template<class T>

IPosition & casacore::LatticeCache< T >::cacheLocation | ( | IPosition & | cacheLoc,
|  | const IPosition & | tileLoc )

Return the IPosition for the start of this tile.

## clearCacheStatistics()

template<class T>

virtual void casacore::LatticeCache< T >::clearCacheStatistics | ( |  | ) |

virtual

Clear the statistics of cache access.

## flush()

template<class T>

virtual void casacore::LatticeCache< T >::flush | ( |  | ) |

virtual

Flush contents.

## getFreeTile()

template<class T>

Int casacore::LatticeCache< T >::getFreeTile | ( | Bool | readonly | ) |

protected

## operator=()

template<class T>

LatticeCache< T > & casacore::LatticeCache< T >::operator= | ( | const LatticeCache< T > & | other | ) |

References LatticeCache().

## readTile()

template<class T>

void casacore::LatticeCache< T >::readTile | ( | Int | tile,
|  | Bool | readonly )

protected

References tile().

## showCacheStatistics()

template<class T>

virtual void casacore::LatticeCache< T >::showCacheStatistics | ( | ostream & | os | ) |

virtual

Show the statistics of cache access.

## tile() [1/3]

template<class T>

const Array< T > & casacore::LatticeCache< T >::tile | ( | const IPosition & | tileLoc | ) |

const version is needed

## tile() [2/3]

template<class T>

Array< T > & casacore::LatticeCache< T >::tile | ( | const IPosition & | tileLoc,
|  | Bool | discard = True )

References casacore::True.

## tile() [3/3]

template<class T>

Array< T > & casacore::LatticeCache< T >::tile | ( | IPosition & | cacheLoc,
|  | const IPosition & | tileLoc,
|  | Bool | discard = True )

Return the tile for a given location.

References casacore::True.

Referenced by readTile(), and writeTile().

## writeTile()

template<class T>

void casacore::LatticeCache< T >::writeTile | ( | Int | tile | ) |

protected

References tile().

## Member Data Documentation

## additive

template<class T>

Bool casacore::LatticeCache< T >::additive

protected

Definition at line 137 of file LatticeCache.h.

Referenced by LatticeCache().

## cacheAccesses

template<class T>

Int casacore::LatticeCache< T >::cacheAccesses

protected

Definition at line 140 of file LatticeCache.h.

## cacheHits

template<class T>

Int casacore::LatticeCache< T >::cacheHits

protected

Definition at line 141 of file LatticeCache.h.

## cacheMisses

template<class T>

Int casacore::LatticeCache< T >::cacheMisses

protected

Definition at line 142 of file LatticeCache.h.

## cacheReads

template<class T>

Int casacore::LatticeCache< T >::cacheReads

protected

Definition at line 143 of file LatticeCache.h.

## cacheSize

template<class T>

Int casacore::LatticeCache< T >::cacheSize

protected

Definition at line 139 of file LatticeCache.h.

Referenced by LatticeCache().

## cacheWrites

template<class T>

Int casacore::LatticeCache< T >::cacheWrites

protected

Definition at line 144 of file LatticeCache.h.

## image_p

template<class T>

Lattice<T>* casacore::LatticeCache< T >::image_p

protected

Definition at line 155 of file LatticeCache.h.

## numberTiles

template<class T>

Int casacore::LatticeCache< T >::numberTiles

protected

Definition at line 133 of file LatticeCache.h.

## tileContents

template<class T>

Block<Array<T> > casacore::LatticeCache< T >::tileContents

protected

Definition at line 150 of file LatticeCache.h.

## tileLocs

template<class T>

Block<IPosition> casacore::LatticeCache< T >::tileLocs

protected

Definition at line 148 of file LatticeCache.h.

## tileOffsetVec

template<class T>

Vector<Int> casacore::LatticeCache< T >::tileOffsetVec

protected

Definition at line 135 of file LatticeCache.h.

## tileOverlap

template<class T>

Vector<Float> casacore::LatticeCache< T >::tileOverlap

protected

Definition at line 136 of file LatticeCache.h.

Referenced by LatticeCache().

## tileSequence

template<class T>

Block<Int> casacore::LatticeCache< T >::tileSequence

protected

Definition at line 149 of file LatticeCache.h.

## tileShape

template<class T>

IPosition casacore::LatticeCache< T >::tileShape

protected

Definition at line 134 of file LatticeCache.h.

Referenced by LatticeCache().

## tileShapeVec

template<class T>

Vector<Int> casacore::LatticeCache< T >::tileShapeVec

protected

Definition at line 135 of file LatticeCache.h.

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

- lattices/Lattices/LatticeCache.h