POOMA: A C++ Toolkit for High-Performance Parallel Scientific Computing | ||
---|---|---|
Prev | Chapter 5. Array Containers | Next |
A container class is a class whose main purpose is to hold objects. These stored objects, called container values or more simply "values" or "elements", may be accessed and changed, usually using indices. "Container class" is usually abbreviated as "container".
The six POOMA containers can be categorized into two groups. Mathematical containers include Tensors, TinyMatrixs, and Vectors, which model tensors, matrices, and vectors, respectively. Storage containers include Arrays, DynamicArrays, and Fields. In this chapter, we focus on simplest of these: Arrays. DynamicArrays are also described.
C has built-in arrays, and the C++ Standard Library provides maps, vectors, stacks, and other containers, but the POOMA containers better model scientific computing concepts and provide more functionality. They automatically handle memory allocation and deallocation and can be used in expressions and on the left-hand side of assignments. Since POOMA containers separate the concepts of accessing and using values from the concept of storing values, value storage can be optimized to specific needs. For example, if most of an Array's values are known to be identical most of the time, a compressible engine can be used. Whenever all the array's values are identical, it stores only one value. At other times, it stores all the values. Engines will be discussed in Chapter 6.