DLA Required Reading |
Table of ContentsDLA Required Reading Abstract Intended audience Related Documents Introduction DLA Files DLA File Structure The DLA File Record DLA Comment Area DLA Format Version DLA Forward and Backward Pointers DLA Segment Descriptors DLA Segment Layout DLA Routines Summary of DLA Mnemonics Summary of DAS Mnemonics Summary of Calling Sequences Appendix A: Revision History 2017 APR 03 by N. J. Bachman DLA Required Reading
Abstract
Intended audience
It may also be of interest to SPICE users who wish to access the segment-oriented routines of the DSK subsystem; however, such users may find adequate guidance in the code examples provided in API documentation of those DSK routines and of the DLA routines referenced by DSK documentation. Users of DSK files can find documentation of the DSK interface routines in the DSK Required Reading file, dsk.req. Related Documents
Introduction
The DLA file format is an instance of the DAS architecture. DLA files enable user application software to view the data in a DAS file as a doubly linked list of virtual arrays, usually called ``segments,'' where each segment may contain character, double precision, and integer components. DLA segments provide a mechanism for grouping related data. For example, in the SPICE DSK format, which is a specialization of the DLA format, data are grouped into segments; each DSK segment is a DLA segment as well. DSK segments contain data representing shapes of extended objects. Such representations may use both integer and double precision data. For example, in DSK data type 2, segments contain double precision numbers that represent the vertex coordinates of triangular plates, and integers that indicate which vertices belong to each plate. DLA files may be thought of as a functional generalization of DAF files: DAF arrays contain only double precision data; DLA segments contain data of multiple types. However, there are some differences that prevent either format from being a special case of the other:
In the SPICE Toolkit, functionality that makes use of DLA segments' data is provided by higher-level code, as is the case for the DSK subsystem. DLA Files
DLA File Structure
The underlying DAS architecture, in its segregated form, is:
File component Record count ============== ============ +------------------------+ | file record | ( 1 ) +------------------------+ | reserved records | ( variable ) +------------------------+ | comment records | | | ( variable ) | | +------------------------+ | first data directory | ( 1 ) +------------------------+ | character data records | | | ( variable ) | | +------------------------+ | d.p. data records | | | ( variable ) | | +------------------------+ | integer data records | | | ( variable ) | | +------------------------+The DLA format presents a higher-level view of the DAS architecture. For most purposes, DLA files can be thought of as having the following logical components:
+----------------------------+ | file record | +----------------------------+ | comment area | | | | | +----------------------------+ | DLA format version | +----------------------------+ | DLA forward and backward | | pointers | +----------------------------+ | DLA descriptors | +----------------------------+ | first virtual DLA segment | +----------------------------+ | second virtual DLA segment | | | | | +----------------------------+ ... +----------------------------+ | last virtual DLA segment | | | +----------------------------+The diagram above does not show the physical order of the segments, since segment data are distributed across the character, double precision, and integer records of the file, and since DLA descriptors are interleaved with DLA segments' integer components. Details of these components are discussed below. The DLA File Record
DAS/xxxxwhere the pattern
xxxxrepresents up to four printing characters identifying the file type. For example, in DSK files, the ID word is
DAS/DSKIn general the portion of the ID word indicating file type need not indicate explicitly that the file is a DLA file. That fact can be derived from the file type string if the type is known to the SPICE system. DLA Comment Area
DLA Format Version
SPICE identifies DLA files using a combination of three attributes:
DLA Forward and Backward Pointers
DLA Segment Descriptors
DLA descriptors are also data structures used as input and output arguments of DLA routines. They are also used extensively as arguments to DSK routines; the DSK subsystem is currently the only other SPICE subsystem where they're used. In the Fortran, IDL, and MATLAB SPICE Toolkits, DLA descriptors are implemented as arrays. In the CSPICE Toolkit, DLA descriptors are implemented by the structure SpiceDLADescr. The DLA segment descriptor members are:
+---------------+ | BACKWARD PTR | Linked list backward pointer +---------------+ | FORWARD PTR | Linked list forward pointer +---------------+ | BASE INT ADDR | Base DAS integer address +---------------+ | INT COMP SIZE | Size of integer segment component +---------------+ | BASE DP ADDR | Base DAS d.p. address +---------------+ | DP COMP SIZE | Size of d.p. segment component +---------------+ | BASE CHR ADDR | Base DAS character address +---------------+ | CHR COMP SIZE | Size of character segment component +---------------+The ``base address'' of a segment component of a given data type is the address, in the DAS address space of that type, preceding the first element of that component. All DAS addresses are 1-based. The general form of the doubly linked list layout in DAS integer address space is:
+------------------------------+ | Pointer to first descriptor | ----+ +------------------------------+ | +-------------| Pointer to last descriptor | | | +------------------------------+ | | | | +------------------------------+ | | NULL <---- | Backward pointer | <---+ First node | +---> | | | | +------------------------------+ | | | Forward pointer | ----+ | | +------------------------------+ | | | | Rest of DLA Descriptor 1 | | | | +------------------------------+ | | | | Segment 1 integer component | | | | +------------------------------+ | | +---- | Backward pointer | <---+ Second node | +---> | | | | +------------------------------+ | | | Forward pointer | ----+ | | +------------------------------+ | | | | Rest of DLA Descriptor 2 | | | | +------------------------------+ | | | | Segment 2 integer component | | | | +------------------------------+ | | pointer from third node <---+ Third node | . | . | . | pointer to node N-1 pointer from node N-1 | | | | | +------------------------------+ | +---> +---- | Backward pointer | <---+ Final (Nth) node +------------------------------+ | Forward pointer | ----> NULL +------------------------------+ | Rest of DLA Descriptor N | +------------------------------+ | Segment N integer component | +------------------------------+While this diagram shows the presence of multiple segments, a DLA file need not contain more than one segment. It is valid, but usually not useful, for a DLA file to have no segments. DLA Segment Layout
The segments of a DLA file consist of components in the respective DAS character, double precision, and integer address spaces. The components occupy contiguous address ranges in the respective address spaces. The general form of the DLA segment layout is:
Character space Double precision space Integer space +-------------+ +--------------------+ |Segment 1 | |Segment 1 | +------------+ |character | |double precision | |Segment 1 | |component | |component | |integer | +-------------+ | | |component | |Segment 2 | | | | | |character | +--------------------+ | | |component | |Segment 2 | +------------+ | | |double precision | +-------------+ |component | +------------+ +--------------------+ |Segment 2 | |integer | |component | +------------+ ... ... ...In the diagram above, the first integer segment component is displaced downward slightly to indicate that the first component starts at an integer address greater than 1: that component is preceded by other information. DLA descriptors lie between consecutively numbered integer components, so those components are not contiguous. Any of the segment components may be empty, but the DAS integer address space is never empty. In a segregated DLA file, all segment components of a given type are stored sequentially in the DAS address space of that type. DLA Routines
In all languages supported by SPICE, the DLA subsystem provides routines for traversing DLA segment lists. Although the term is somewhat inaccurate, this is usually referred to as ``searching'' the lists. Routines of the DAS subsystem enable applications to open a DLA file for read access, close a DLA file, and extract comments from a DLA file's comment area. In the Fortran and C SPICE Toolkits, DAS routines can open an existing DLA file for write access and delete or write to a DLA file's comment area. In the Fortran SPICE Toolkit, DLA routines are provided to open a new DLA file and to start and finish new DLA segments. DAS routines are provided to write data to DLA segments, read data from DLA segments, and update data in existing DLA segments. Summary of DLA Mnemonics
BBS Begin backward search BFS Begin forward search BNS Begin new segment ENS End new segment FNS Find next segment FPS Find previous segment OPN Open new DLA file SSG Test for same segment Summary of DAS Mnemonics
AC Add comments from buffer to file ADC Add character data to file ADD Add double precision data to file ADI Add integer data to file CLS Close file DC Delete comments from file EC Extract comments from file OPR Open file for read access OPW Open file for write access RDC Read character data from file RDD Read double precision data from file RDI Read integer data from file UDC Update character data in file UDD Update double precision data in file UDI Update integer data in file Summary of Calling Sequences
The following routines are intended for use by both SPICELIB users' application programs and by SPICELIB routines. Opening and closing files:
DASCLS ( HANDLE ) DASOPR ( FNAME, HANDLE ) DLAOPN ( FNAME, FTYPE, IFNAME, NRESV, HANDLE ) DASOPW ( FNAME, HANDLE )Beginning and ending new segments:
DLABNS ( HANDLE ) DLAENS ( HANDLE )Adding data to files:
DASADC ( HANDLE, N, BPOS, EPOS, DATA ) DASADD ( HANDLE, N, DATA ) DASADI ( HANDLE, N, DATA )Updating data in files:
DASUDC ( HANDLE, FIRST, LAST, BPOS, EPOS, DATA ) DASUDD ( HANDLE, FIRST, LAST, DATA ) DASUDI ( HANDLE, FIRST, LAST, DATA )Reading data from files:
DASRDC ( HANDLE, FIRST, LAST, BPOS, EPOS, DATA ) DASRDD ( HANDLE, FIRST, LAST, DATA ) DASRDI ( HANDLE, FIRST, LAST, DATA )Searching for segments:
DLABBS ( HANDLE, DESCR, FOUND ) DLAFNS ( HANDLE, DESCR, NXTDSC, FOUND ) DLAFPS ( HANDLE, DESCR, PRVDSC, FOUND ) DLABFS ( HANDLE, DESCR, FOUND )Accessing the comment area:
DASAC ( HANDLE, N, BUFFER ) DASDC ( HANDLE ) DASEC ( HANDLE, BUFSIZ, N, BUFFER, DONE )Comparing DLA segment descriptors
DLASSG Appendix A: Revision History2017 APR 03 by N. J. Bachman
|