Tpetra provides the same functionality as Epetra: the fundamental construction routines and services functions that are required for serial and parallel linear algebra libraries. Unlike Epetra, Tpetra makes extensive use of templates and the Standard Template Library (STL). This provides numerous benefits, including the ability to template the ordinal and scalar fields on any well-defined types, and the use of automatic resource allocation.
Tpetra captures a significant subset of the functionality present in the Epetra package. Functionality not included is either a consequence of different design motivations or of Tpetra's status as a work in progress.
Most of the classes in Tpetra are templated according to the data types which constitute the class. These are the following:
Scalaris the data structure used for storing values. This is the type most likely to be changed by many users. The most common use cases are
complex<double>. However, any data type can be used so long as it implements Teuchos::ScalarTraits and supports the necessary arithmetic operations, such as addition, subtraction, division and multiplication.
LocalOrdinalis used to store indices representing local IDs. The standard use case, as well as the default for most classes, is
int. Any type can be used that implements Teuchos::OrdinalTraits and supports the necessary arithmetic. The purpose of template local and global ordinals as two (possibly) different types is for efficiency purposes. For example, the indices of a completed CrsGraph contain objects of type
LocalOrdinal. If the specific application allows it, using smaller local ordinals requires less storage and potentially higher rates of computation.
GlobalOrdinalis used to store indices representing global IDs and to describe global properties of a distributed object (e.g., global number of non-zeros in a sparse matrix, global number of rows in a vector.) The
GlobalOrdinaltherefore dictates the maximum size of a distributed object.
The Tpetra::Distributor class is unique in that it is not templated instantiated on any templated types. However, the class includes some templated member functions. The Tpetra::Distributor::createFromRecvs() method is templated on the ordinal type used to encode IDs, while Tpetra::Distributor::doPosts() and the other post methods are templated on the
Packet, the data type being communicated by a particular invocation of the Tpetra::Distributor.