Database-Level Routines

cgio_is_supported

C Signature:
int cgio_is_supported(int file_type)
Fortran Signature:
subroutine  cgio_is_supported_f(file_type, ier)
Parameters:
  • int file_type

    IN: Type of database file. acceptable values are CGIO_FILE_NONE, CGIO_FILE_ADF, CGIO_FILE_HDF5 and CGIO_FILE_ADF2.

Returns:

ier - Error status

Modes:

- - -

Description:

Determines if the database type given by file_type is supported by the library. Returns 0 if supported, else CGIO_ERR_FILE_TYPE if not. CGIO_FILE_ADF is always supported; CGIO_FILE_HDF5 is supported if the library was built with HDF5; and CGIO_FILE_ADF2 is supported when built in 32-bit mode.

cgio_check_file

C Signature:
int cgio_check_file(const char *filename, int *file_type)
Fortran Signature:
subroutine  cgio_check_file_f(filename, file_type, ier)
Parameters:
  • const char *filename

    IN: Name of the database file, including path name if necessary. There is no limit on the length of this character variable.

  • int *file_type

    OUT: Type of database file. acceptable values are CGIO_FILE_NONE, CGIO_FILE_ADF, CGIO_FILE_HDF5 and CGIO_FILE_ADF2.

Returns:

ier - Error status

Modes:

- - -

Description:

Checks the file filename to determine if it is a valid database. If so, returns 0 and the type of database in file_type, otherwise returns an error code and file_type will be set to CGIO_FILE_NONE.

cgio_open_file

C Signature:
int cgio_open_file(const char *filename, int file_mode, int file_type, int *cgio_num)
Fortran Signature:
subroutine  cgio_open_file_f(filename, file_mode, file_type, cgio_num, ier)
Parameters:
  • char* filename

    IN: Name of the database file, including path name if necessary. There is no limit on the length of this character variable.

  • int file_type

    IN: Type of database file. acceptable values are CGIO_FILE_NONE, CGIO_FILE_ADF, CGIO_FILE_HDF5 and CGIO_FILE_ADF2.

  • int file_mode

    IN: Mode used for opening the file. The supported modes are. CGIO_MODE_READ, CGIO_MODE_WRITE, and CGIO_MODE_MODIFY.

  • int* cgio_num

    OUT: Identifier for the open database file.

Returns:

ier - Error status

Modes:

r w m

Description:

Opens a database file of the specified type and mode. If successful, returns 0, and the database identifier in cgio_num, otherwise returns an error code. The database identifier is used to access the database in subsequent function calls.

The mode in which the database is opened is given by file_mode, which may take the value CGIO_MODE_READ, CGIO_MODE_WRITE, or CGIO_MODE_MODIFY. New databases should be opened with CGIO_MODE_WRITE, while existing databases are opened with either CGIO_MODE_READ (for read-only access) or CGIO_MODE_MODIFY (for read/write access).

A specific database type may be specified by file_type, which may be one of CGIO_FILE_NONE, CGIO_FILE_ADF, CGIO_FILE_HDF5, or CGIO_FILE_ADF2. When opening a database in write mode, CGIO_FILE_NONE indicates that the default database type should be used, otherwise the specified database type will be opened. When opening in read or modify mode, CGIO_FILE_NONE indicates that any database type is acceptable, otherwise if the database type does not match that given by file_type an error will be returned.

cgio_close_file

C Signature:
int cgio_close_file(int cgio_num)
Fortran Signature:
subroutine  cgio_close_file_f(cgio_num, ier)
Parameters:
  • int cgio_num

    OUT: Identifier for the open database file.

Returns:

ier - Error status

Modes:

r w m

Description:

Closes the database given by cgio_num. Returns 0 for success, else an error code.

cgio_get_file_type

C Signature:
int cgio_get_file_type(int cgio_num, int *file_type)
Fortran Signature:
subroutine  cgio_get_file_type_f(cgio_num, file_type, ier)
Parameters:
  • int cgio_num

    IN: Identifier for the open database file.

  • int *file_type

    OUT: Type of database file. acceptable values are CGIO_FILE_NONE, CGIO_FILE_ADF, CGIO_FILE_HDF5 and CGIO_FILE_ADF2.

Returns:

ier - Error status

Modes:

r w m

Description:

Gets the type of the database given by cgio_num. Returns 0 and the type in file_type if successful, else an error code.

cgio_get_root_id

C Signature:
int cgio_get_root_id(int cgio_num, double *rootid)
Fortran Signature:
subroutine  cgio_get_root_id_f(cgio_num, rootid, ier)
Parameters:
  • int cgio_num

    IN: Identifier for the open database file.

  • double *rootid

    OUT: Node identifier for the root node of the database.

Returns:

ier - Error status

Modes:

r w m

Description:

Gets the unique node identifier for the root node in the database given by cgio_num. Returns 0 and the identifier in rootid if successful, else an error code.