escript::Taipan Class Reference

Taipan array manager, C++ version. Based on TaipanMemManager C module by Lutz Gross. More...

`#include <Taipan.h>`

## Classes

struct | Taipan_MemTable
struct | Taipan_StatTable

## Public Types

typedef long | size_type

## Public Member Functions

| Taipan ()
| Default constructor for Taipan data-array manager. More...
| ~Taipan ()
| Default destructor for Taipan data-array manager. More...
double * | new_array (size_type dim, size_type N)
| Taipan data-array allocator. More...
void | delete_array (double *array)
| Taipan data-array deallocator. More...
void | release_unused_arrays ()
| frees all arrays that are currently unused. More...
int | num_arrays ()
| Calculate the total number of arrays currently under management. More...
int | num_arrays (size_type N)
| Calculate the total number of arrays of N blocks currently under management. More...
int | num_free (size_type N)
| Calculate the total number of free arrays of N blocks currently under management. More...
long | num_elements ()
| Return the total number of array elements currently under management. More...
void | dump_stats ()
| Print out statistics on the memory under management. More...
void | clear_stats ()
| Clear record of statistics on the memory under management. More...

## Private Types

typedef struct escript::Taipan::Taipan_StatTable | Taipan_StatTable
typedef struct escript::Taipan::Taipan_MemTable | Taipan_MemTable

## Private Member Functions

void | operator= (const Taipan &c)

## Private Attributes

Taipan_StatTable * | statTable
Taipan_MemTable * | memTable_Root
long | totalElements

## Detailed Description

Taipan array manager, C++ version. Based on TaipanMemManager C module by Lutz Gross.

Description: Taipan: data-array manager.

The Taipan data-array manager holds a set of (dim x N) arrays distributed across a number of threads. If a (dim x N) array is requested via the Taipan allocator, the buffer of managed arrays is searched for a free array of this size on the current number of threads. If none is available, a new one is allocated and added to the buffer of managed arrays.

When a managed array is deallocated, the array is marked as free but not returned to the system as long as at least one array of N is in use. Otherwise all arrays of N are deallocated as it is assumed that these arrays not be used anymore. The exceptions to this strategy are arrays with N=0 or N=1, these arrays are never deallocated, but are kept for possible reuse.

## Member Typedef Documentation

## size_type

typedef long escript::Taipan::size_type

## Taipan_MemTable

typedef struct escript::Taipan::Taipan_MemTable escript::Taipan::Taipan_MemTable

private

## Taipan_StatTable

typedef struct escript::Taipan::Taipan_StatTable escript::Taipan::Taipan_StatTable

private

## Constructor & Destructor Documentation

## Taipan()

escript::Taipan::Taipan | ( |  | ) |

Default constructor for Taipan data-array manager.

Description: Default constructor for Taipan data-array manager.

Preconditions: Describe any preconditions

Throws: Describe any exceptions thrown

References clear_stats(), and statTable.

## ~Taipan()

escript::Taipan::~Taipan | ( |  | ) |

Default destructor for Taipan data-array manager.

Description: Default destructor for Taipan data-array manager.

Preconditions: Describe any preconditions

Throws: Describe any exceptions thrown

References escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_MemTable::dim, dump_stats(), memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, statTable, and totalElements.

## Member Function Documentation

## clear_stats()

void escript::Taipan::clear_stats | ( |  | ) |

Clear record of statistics on the memory under management.

References escript::Taipan::Taipan_StatTable::allocated_elements, escript::Taipan::Taipan_StatTable::allocations, escript::Taipan::Taipan_StatTable::deallocated_elements, escript::Taipan::Taipan_StatTable::deallocations, escript::Taipan::Taipan_StatTable::frees, escript::Taipan::Taipan_StatTable::max_tab_size, escript::Taipan::Taipan_StatTable::requests, statTable, and totalElements.

Referenced by Taipan().

## delete_array()

void escript::Taipan::delete_array | ( | double * | array | ) |

Taipan data-array deallocator.

The parameter "array" should be an array object that was returned by Taipan::new_array.

References escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_StatTable::deallocated_elements, escript::Taipan::Taipan_StatTable::deallocations, escript::Taipan::Taipan_MemTable::dim, escript::Taipan::Taipan_MemTable::free, escript::Taipan::Taipan_StatTable::frees, memTable_Root, escript::Taipan::Taipan_MemTable::N, paso::N, escript::Taipan::Taipan_MemTable::next, statTable, and totalElements.

Referenced by escript::DataTypes::DataVectorTaipan::copyFromArray(), escript::DataTypes::DataVectorTaipan::operator=(), escript::DataTypes::DataVectorTaipan::resize(), and escript::DataTypes::DataVectorTaipan::~DataVectorTaipan().

## dump_stats()

void escript::Taipan::dump_stats | ( |  | ) |

Print out statistics on the memory under management.

References escript::Taipan::Taipan_StatTable::allocated_elements, escript::Taipan::Taipan_StatTable::allocations, escript::Taipan::Taipan_StatTable::deallocated_elements, escript::Taipan::Taipan_StatTable::deallocations, escript::Taipan::Taipan_StatTable::frees, escript::Taipan::Taipan_StatTable::max_tab_size, num_arrays(), num_elements(), escript::Taipan::Taipan_StatTable::requests, statTable, and totalElements.

Referenced by ~Taipan().

## new_array()

double * escript::Taipan::new_array | ( | size_type | dim,
|  | size_type | N
| ) |  |

Taipan data-array allocator.

The parameter "dim" defines the contiguous "blocksize" within the array. Where the array is allocated accross multiple threads, it will be split on block boundaries only. N defines the number of "blocks" in the array.

References escript::Taipan::Taipan_StatTable::allocated_elements, escript::Taipan::Taipan_StatTable::allocations, escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_MemTable::dim, escript::Taipan::Taipan_MemTable::free, escript::Taipan::Taipan_StatTable::max_tab_size, memTable_Root, escript::Taipan::Taipan_MemTable::N, paso::N, escript::Taipan::Taipan_MemTable::next, escript::Taipan::Taipan_MemTable::numThreads, escript::Taipan::Taipan_StatTable::requests, statTable, and totalElements.

Referenced by escript::DataTypes::DataVectorTaipan::copyFromArray(), escript::DataTypes::DataVectorTaipan::DataVectorTaipan(), escript::DataTypes::DataVectorTaipan::operator=(), and escript::DataTypes::DataVectorTaipan::resize().

## num_arrays() [1/2]

int escript::Taipan::num_arrays | ( |  | ) |

Calculate the total number of arrays currently under management.

References memTable_Root, escript::Taipan::Taipan_MemTable::next, and totalElements.

Referenced by dump_stats(), and num_arrays().

## num_arrays() [2/2]

int escript::Taipan::num_arrays | ( | size_type | N | ) |

Calculate the total number of arrays of N blocks currently under management.

References memTable_Root, escript::Taipan::Taipan_MemTable::N, paso::N, escript::Taipan::Taipan_MemTable::next, num_arrays(), and totalElements.

## num_elements()

long escript::Taipan::num_elements | ( |  | ) |

Return the total number of array elements currently under management.

References totalElements.

Referenced by dump_stats().

## num_free()

int escript::Taipan::num_free | ( | size_type | N | ) |

Calculate the total number of free arrays of N blocks currently under management.

References escript::Taipan::Taipan_MemTable::free, memTable_Root, escript::Taipan::Taipan_MemTable::N, paso::N, escript::Taipan::Taipan_MemTable::next, and totalElements.

## operator=()

void escript::Taipan::operator= | ( | const Taipan & | c | ) |

inline private

Declared (private) as a precaution to ensure that noone tries to copy instances.

## release_unused_arrays()

void escript::Taipan::release_unused_arrays | ( |  | ) |

frees all arrays that are currently unused.

References escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_StatTable::deallocated_elements, escript::Taipan::Taipan_StatTable::deallocations, escript::Taipan::Taipan_MemTable::dim, escript::Taipan::Taipan_MemTable::free, memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, statTable, and totalElements.

Referenced by escript::DataTypes::releaseUnusedMemory().

## Member Data Documentation

## memTable_Root

Taipan_MemTable* escript::Taipan::memTable_Root

private

Referenced by delete_array(), new_array(), num_arrays(), num_free(), release_unused_arrays(), and ~Taipan().

## statTable

Taipan_StatTable* escript::Taipan::statTable

private

Referenced by clear_stats(), delete_array(), dump_stats(), new_array(), release_unused_arrays(), Taipan(), and ~Taipan().

## totalElements

long escript::Taipan::totalElements

private

Referenced by clear_stats(), delete_array(), dump_stats(), new_array(), num_arrays(), num_elements(), num_free(), release_unused_arrays(), and ~Taipan().

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

- Taipan.h
- Taipan.cpp