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)

Miscellaneous Routines

Flush the Data to the Disk


ADF_Flush_to_Disk (ID,error_return)

Language C Fortran
Routine Name ADF_Flush_to_Disk ADFFTD
Input const double ID real*8 ID
Output int *error_return integer error_return

    ID   The ID of the node to use.
 
error_return Error return code.

This routine, ADF_Flush_to_Disk, flushes data to disk; it is used to force any modified information to be flushed to the physical disk. This ensures that data will not be lost if a program aborts. The control of when to flush all data to disk is provided to the user rather than flushing the data every time it is modified, which would result in reduced performance.

Redistribute the Data Within a File


ADF_Database_Garbage_Collection (ID,error_return)

Language C Fortran
Routine Name ADF_Database_Garbage_Collection ADFDGC
Input const double ID real*8 ID
Output int *error_return integer error_return

    ID   The ID of the node to use.
 
error_return Error return code.

This routine, ADF_Database_Garbage_Collection, redistributes the data within a file to use free space within the file. This free space is not located at the end of the file, and it may have been created during node deletions or other file operations. Neighboring free spaces will be merged.

Note: For better file compaction, a utility could be written to copy an ADF file into a newly created ADF file without wasted space.

Note: This routine is currently not implemented.

Get a Description of the Error


ADF_Error_Message (error_code,error_string)

Language C Fortran
Routine Name ADF_Error_Message ADFERR
Input const int error_code integer error_code
Output char *error_string character*(*) error_string

    error_code   The error return code from any ADF routine.
 
error_string An 80-byte description for the specified error. If ADF_Error_Message cannot find a message corresponding to the input error_code, the error string "Unknown error#nnn" will be returned.

This routine, ADF_Error_Message, returns a textual error message when given the error return code from any ADF routine.

Example

See the example for ADF_Set_Error_State.

Set the Error State Flag


ADF_Set_Error_State (error_state,error_return)

Language C Fortran
Routine Name ADF_Set_Error_State ADFSES
Input const int error_state integer error_state
Output int *error_return integer error_return

    error_state   Flag specifying the action to take when an error occurs; 0 to return the error code and continue, 1 to abort. The default is 0.
 
error_return Error return code.

This routine, ADF_Set_Error_State, sets the error state flag. This flag controls the error handling convention for all ADF routines: either return the error codes or print an error message and abort the program on error. The flag covers all open ADF files associated with the current program, and it is not done on a file-by-file basis. The default state for the ADF interface is to return error codes and not abort.

Example

   PROGRAM TEST
   C
         PARAMETER (MAXCHR=32)
   C
         CHARACTER*(MAXCHR) NODNAM
         CHARACTER*(80) MESS
   C
   C *** NODE IDS
   C
         REAL*8 RID,CID1,CID2
   C
   C *** OPEN DATABASE
   C
         CALL ADFDOPN('db.adf','NEW',' ',RID,IERR)
   C
   C *** CREATE 2 NODES
   C
         CALL ADFCRE(RID,'NODE 1',CID1,IERR)
         CALL ADFCRE(RID,'NODE 2',CID2,IERR)
   C
         CALL ADFGES(IDEFS,IERR)
         PRINT *,' DEFAULT ERROR STATE = ',IDEFS
   C
   C *** REQUEST NODE NAME FOR A NODE THAT DOES NOT EXIST
   C
         PRINT *,' *** ON ERROR CONTINUE'
         CALL ADFGNAM(CID3,NODNAM,IERR)
         CALL ADFERR(IERR,MESS)
         PRINT *,'     ADF ERROR OCURRED, MESSAGE: ',MESS
         PRINT *,' '
   C
   C *** SET ABORT ON ERROR FLAG
   C
         INEWS = 1
         CALL ADFSES(INEWS,IERR)
         PRINT *,' *** ABORT ON ERROR SET'
   C
   C *** REQUEST NODE NAME FOR A NODE THAT DOES NOT EXIST
   C
         CALL ADFGNAM(CID3,NODNAM,IERR)
         PRINT *,' HELLO WORLD'
   C
         STOP
         END

The resulting output is:

   DEFAULT ERROR STATE =            0
     *** ON ERROR CONTINUE
         ADF ERROR OCURRED, MESSAGE:
   ADF 10: ADF file index out of legal range.

     *** ABORT ON ERROR SET
   ADF 10: ADF file index out of legal range.
   ADF Aborted: Exiting

Get the Error State


ADF_Get_Error_State (error_state,error_return)

Language C Fortran
Routine Name ADF_Get_Error_State ADFGES
Input    
Output int *error_state
int *error_return
integer error_state
integer error_return

    error_state   Flag specifying the action to take when an error occurs; 0 to return the error code and continue, 1 to abort. The default is 0.
 
error_return Error return code.

This routine, ADF_Get_Error_State, returns the currently set error state.

Example

   PROGRAM TEST
   C
   C *** NODE IDS
   C
         REAL*8 RID
   C
   C *** OPEN DATABASE
   C
         CALL ADFDOPN('db.adf','NEW',' ',RID,IERR)
   C
   C *** CHECK THE DEFAULT ERROR STATE
   C
         CALL ADFGES(IDEFS,IERR)
   C
   C *** SET THE ERROR STATE TO ABORT ON ERROR
   C
         CALL ADFSES(1,IERR)
   C
   C *** MAKE SURE STATE WAS SET AS DESIRED
   C
         CALL ADFGES(NDEFS,IERR)
   C
   C *** PRINT OUT RESULTS
   C
         PRINT *,' DEFAULT ERROR STATE = ',IDEFS
         PRINT *,' RESET ERROR STATE   = ',NDEFS
   C
         STOP
         END

The resulting output is:

   DEFAULT ERROR STATE =            0
   RESET ERROR STATE   =            1

Get the Version Number of the ADF Library That Created the ADF Database


ADF_Database_Version (root_ID,version,creation_date,modification_date,error_return)

Language C Fortran
Routine Name ADF_Database_Version ADFDVER
Input constant double root_ID real*8 root_ID
Output char *version
char *creation_date
char *modification_date
int *error_return
character*(*)version
character*(*) creation_date
character*(*) modification_date
integer error_return

    root_ID   The ID of the root node in the ADF file.
 
version A 32-byte character string containing the version ID.
 
creation_date A 32-byte character string containing the creation date of the file.
 
modification_date A 32-byte character string containing the last modification date of the file.
 
error_return Error return code.

This routine, ADF_Database_Version, returns the version number of the ADF library that created an ADF database, the file creation date and time, and the last modification date and time. A modified ADF database will take on the version ID of the current ADF library version if it is higher than the version indicated in the file. On return, "version" contains a six-character string. The meaning of the characters are described in detail in the section "ADF File Version Control Numbering".

Example

   PROGRAM TEST
   C
         PARAMETER (MAXCHR=32)
   C
         CHARACTER*(MAXCHR) NODNAM
         CHARACTER*(MAXCHR) CVER,LVER,CDATE,MDATE
         CHARACTER*(80) MESS
   C
   C *** NODE IDS
   C
         REAL*8 RID,CID1,CID2
   C
   C *** OPEN DATABASE
   C
         CALL ADFDOPN('db.adf','NEW',' ',RID,IERR)
   C
   C *** CREATE 2 NODES
   C
         CALL ADFCRE(RID,'NODE 1',CID1,IERR)
         CALL ADFCRE(RID,'NODE 2',CID2,IERR)
   C
         CALL ADFDVER(RID,CVER,CDATE,MDATE,IERR)
         CALL ADFLVER(LVER,IERR)
         PRINT *,' VERSION INFORMATION:'
         PRINT *,'    ADF LIBRARY USED FOR CREATION: ',CVER
         PRINT *,'    CREATION DATE                : ',CDATE
         PRINT *,'    MODIFICATION DATE            : ',MDATE
         PRINT *,'    ADF LIBRARY BEING USED       : ',LVER
   C
         STOP
         END

The resulting output is:

   VERSION INFORMATION:
      ADF LIBRARY USED FOR CREATION: ADF Database Version A01007
      CREATION DATE                : Thu Apr 24 15:41:55 1997
      MODIFICATION DATE            : Thu Apr 24 15:41:55 1997
      ADF LIBRARY BEING USED       : ADF Library  Version C01

Get the Version Number of the ADF Library That the Application Program is Currently Using


ADF_Library_Version (version,error_return)

Language C Fortran
Routine Name ADF_Library_Version ADFLVER
Input    
Output char *version
int *error_return
character*(*) version
integer error_return

    version   A 32-byte character string containing the ADF library version ID information.
 
error_return Error return code.

This routine, ADF_Library_Version, gets the ADF library version number. This is the version number of the ADF library that the application program is currently using. For this routine, the format of the version ID is "ADF Library Version AXXXxxx".

Example

See the example for ADF_Database_Version.