Skip navigation links
(CGNS Documentation Home Page) (Steering Committee Charter) (Overview and Entry-Level Document) (A User's Guide to CGNS) (Mid-Level Library) (Standard Interface Data Structures) (SIDS File Mapping Manual) (CGIO Manual) (Parallel CGNS User's Guide) (ADF Implementation) (HDF5 Implementation) (Python Implementation) (CGNS Tools and Utilities)

(Introduction) (The ADF Software Library) (Glossary of Terms) (History of ADF Version Releases) (File System Architectures) (File Version Control Numbering) (Design Considerations) (Conventions and Implementations) (Error Messages) (Default Values and Limits) (Database-Level Routines) (Data Structure and Management Routines) (Data Query Routines) (Data I/O Routines) (Miscellaneous Routines) (Sample Fortran Program) (Sample C Program)

ADF Conventions and Implementations

    C   All input strings are to be null terminated. All returned strings will have the trailing blanks removed and will be null terminated. Variables declared to hold Names, Labels, and Data-Types should be at least 33 characters long. ADF.h has a number of variables defined. An example declaration would be:
   char name[ADF_NAME_LENGTH+1];
Fortran Strings will be determined using inherited length. Returned strings will be blank filled to the specified length. All returned names will be left justified and blank filled on the right. There will be no null character. An example declaration would be:
ID A unique identifier to access a given node within a file. This 8-byte field contains sufficient information for ADF to locate the node within a file. For any given node, the ID is generated only after the file it resides in has been opened by a program and the user requests information about the node. The ID is valid only within the program that opened the file and while that file is open. If the file is closed and reopened, the ID for any given node will be different. Within different programs, the node ID for the same node will be different. The ID is not ever actually written into a file.

The declaration for variables that will hold node IDs should be for an 8-byte real number.

The ID is actually a 64-bit combination of a system-generated file index along with the block and offset of the location of the node on the disk. In general, users do not need to know the internal coding of this information.
error_return The error code for the ADF routines is the following:

    −1     No error.
n (> 0) ADF error code. The routine ADF_Error_Message is used to get a textual description of the error.
0 ADF should never return the value zero.
Indexing All indexing is Fortran-like in that the starting index is 1 and the last is N for N items in an index or array dimension. The array structure is assumed to be the same as in Fortran with the first array dimension varying the fastest and the last dimension varying the slowest.

The index starting at one is used in ADF_Read_Data, ADF_Write_Data, and ADF_Children_Names.

The user should be aware of the differences in array indexing between Fortran and C. The subroutines ADF_Read_All_Data and ADF_Write_All_Data merely take a pointer to the beginning of the data, compute how much data is to be read/written, and process as many bytes as have been requested. Thus, these routines effectively make a copy of memory onto disk or vice versa. Given this convention, it is possible for a C program to use standard C conventions for array indexing and use ADF_Write_All_Data to store the array on disk. Then a Fortran program might use ADF_Read_All_Data to read the data set. Unless the user is aware of the structure of the data, it is possible for the array to be transposed relative to what is expected.

The implications of the assumed array structure convention can be quite subtle. The subroutines ADF_Write_Data and ADF_Read_Data assume the Fortran array structure in order to index the data. Again, unless the user is aware of the implications of this, it is possible to write an array on disk and later try to change a portion of the data and not change the correct numbers.

As long as users are aware of how their data structure maps onto ADF, there will not be any problems.