next up previous contents
Next: The user interface Up: The Binary Input/Output System Previous: The Binary Input/Output System   Contents

The structure and philosophy of the library

Almost all PSI3 modules must exchange data with raw binary (also called ``direct-access'') files. However, rather than using low-level C or Fortran functions such as read() or write(), PSI3 uses a flexible, but fast I/O system that gives the programmer and user control over the organization and storage of data. Some of the features of the PSI I/O system, libpsio, include:

The TOC structure of PSI binary files provdes several advantages over older I/O systems. For example, data items in the TOC are identified by keyword strings (e.g., "Nuclear Repulsion Energy") and the global address of an entry is known only to the TOC itself, never to the programmer. Hence, if the programmer wishes to read or write an entire TOC entry, he/she is required to provide only the TOC keyword and the entry size (in bytes) to obtain the data. Furthermore, the TOC makes it possible to read only pieces of TOC entries (say a single buffer of a large list of two-electron integrals) by providing the appropriate TOC keyword, a size, and a starting address relative to the beginning of the TOC entry. In short, the TOC design hides all information about the global structure of the direct access file from the programmer and allows him/her to be concerned only with the structure of individual entries. The current TOC is written to the end of the file when it is closed.

Thus the direct-access file itself is viewed as a series of pages, each of which contains an identical number of bytes. The global address of the beginning of a given entry is stored on the TOC as a page/offset pair comprised of the starting page and byte-offset on that page where the data reside. The entry-relative page/offset addresses which the programmer must provide work in exactly the same manner, but the 0/0 position is taken to be the beginning of the TOC entry rather than the beginning of the file.


next up previous contents
Next: The user interface Up: The Binary Input/Output System Previous: The Binary Input/Output System   Contents
psi 2003-01-07