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)

Data Query Routines

Get the String in a Node's Label Field


ADF_Get_Label (ID,label,error_return)

Language C Fortran
Routine Name ADF_Get_Label ADFGLB
Input const double ID real*8 ID
Output char *label
int *error_return
character*(*) label
integer error_return

    ID   The ID of the node to use.
 
label The 32-character label of the node.
 
error_return Error return code.

This routine returns the 32-character string stored in the node's label field. In C, the label will be null terminated after the last nonblank character. Therefore, in general, 33 characters should be allocated (32 for the label, plus 1 for the null). In Fortran, the label is left justified and blank filled to the right. The null character is not returned in Fortran, therefore, the variable declaration can be for 32 characters (e.g., CHARACTER*(32)).

Example

   PROGRAM TEST
   C
         PARAMETER (MAXCHR=32)
   C
         CHARACTER*(MAXCHR) NODNAM,LABL
   C
   C *** NODE IDS
   C
         REAL*8 RID,CID
   C
   C *** OPEN DATABASE
   C
         CALL ADFDOPN('db.adf','NEW',' ',RID,IERR)
         CALL ADFCRE(RID,'NODE 1',CID,IERR)
         CALL ADFSLB(CID,'THIS IS A NODE LABEL',IERR)
   C
         CALL ADFGNAM(CID,NODNAM,IERR)
         CALL ADFGLB(CID,LABL,IERR)
   C
         PRINT *,' NODE NAME = ',NODNAM
         PRINT *,' LABEL     = ',LABL
   C
         STOP
         END

The resulting output is:

   NODE NAME = NODE 1
   LABEL     = THIS IS A NODE LABEL

Set the String in a Node's Label Field


ADF_Set_Label (ID,label,error_return)

Language C Fortran
Routine Name ADF_Set_Label ADFSLB
Input const double ID
const char *label
real*8 ID
character*(*) label
Output int *error_return integer error_return

    ID   The ID of the node to use.
 
label The 32-character label for the node.
 
error_return Error return code.

This routine, ADF_Set_Label, sets the 32-character string in the node's label field.

Example

See the example for ADF_Get_Label.

Get the String in a Node's Data-Type Field


ADF_Get_Data_Type (ID,data_type,error_return)

Language C Fortran
Routine Name ADF_Get_Data_Type ADFGDT
Input const double ID real*8 ID
Output char *data_type
int *error_return
character*(*) data_type
integer error_return

    ID   The ID of the node to use.
 
data_type The 32-character data type field stored in the node information header.
 
error_return Error return code.

This routine, ADF_Get_Data_Type, returns the 32-character string in the node's data-type field. In C, the label will be null terminated after the last nonblank; therefore, at least 33 characters (32 for the label, plus 1 for the null) should be allocated for the data_type string. In Fortran, the null character is not returned; therefore, the declaration for the string data_type can be for 32 characters.

Example

This example illustrates the process of creating a node, storing data in it, querying the node for the information in the header, and reading the data back out.

   PROGRAM TEST
   C
         PARAMETER (MAXCHR=32)
         PARAMETER (MAXROW=2)
         PARAMETER (MAXCOL=10)
   C
         CHARACTER*(MAXCHR) NODNAM,LABL
         CHARACTER*(MAXCHR) DTYPE
         REAL R4DATI(MAXROW,MAXCOL),R4DATO(MAXROW,MAXCOL)
         INTEGER IDIMI(2),IDIMO(2)
   C
   C *** NODE IDS
   C
         REAL*8 RID,CID
   C
   C *** OPEN DATABASE
   C
         CALL ADFDOPN('db.adf','NEW',' ',RID,IERR)
   C
   C *** GENERATE SOME DATA
   C
         IDIMI(1) = MAXROW
         IDIMI(2) = MAXCOL
         DO 200 ICOL = 1,MAXCOL
            DO 100 IROW = 1,MAXROW
               R4DATI(IROW,ICOL) = 2.0*ICOL*IROW
     100    CONTINUE
     200 CONTINUE
   C
   C *** GENERATE A NODE AND PUT DATA IN IT
   C
         CALL ADFCRE(RID,'NODE 1',CID,IERR)
         CALL ADFSLB(CID,'LABEL FOR NODE 1',IERR)
         CALL ADFPDIM(CID,'R4',2,IDIMI,IERR)
         CALL ADFWALL(CID,R4DATI,IERR)
   C
   C *** GET INFORMATION FROM NODE
   C
         CALL ADFGNAM(CID,NODNAM,IERR)
         CALL ADFGLB(CID,LABL,IERR)
         CALL ADFGDT(CID,DTYPE,IERR)
         CALL ADFGND(CID,NDIM,IERR)
         CALL ADFGDV(CID,IDIMO,IERR)
         CALL ADFRALL(CID,R4DATO,IERR)
   C
         PRINT *,' NODE NAME            = ',NODNAM
         PRINT *,' LABEL                = ',LABL
         PRINT *,' DATA TYPE            = ',DTYPE
         PRINT *,' NUMBER OF DIMENSIONS = ',NDIM
         PRINT *,' DIMENSIONS           = ',IDIMO
         PRINT *,' DATA:'
         WRITE(*,300)((R4DATO(I,J),I=1,MAXROW),J=1,MAXCOL)
     300 FORMAT(2(5X,F10.2))
   C
         STOP
         END

The resulting output is:

   NODE NAME            = NODE 1
   LABEL                = LABEL FOR NODE 1
   DATA TYPE            = R4
   NUMBER OF DIMENSIONS =            2
   DIMENSIONS           =            2           10
   DATA:
            2.00           4.00
            4.00           8.00
            6.00          12.00
            8.00          16.00
           10.00          20.00
           12.00          24.00
           14.00          28.00
           16.00          32.00
           18.00          36.00
           20.00          40.00

Get the Number of Node Dimensions


ADF_Get_Number_of_Dimensions (ID,num_dims,error_return)

Language C Fortran
Routine Name ADF_Get_Number_of_Dimensions ADFGND
Input const double ID real*8 ID
Output int *num_dims
int *error_return
integer num_dims
integer error_return

    ID   The ID of the node to use.
 
num_dims The integer dimension value.
 
error_return Error return code.

This routine, ADF_Get_Number_of_Dimensions, returns the number of data dimensions used in the node. Values will be returned only for the number of dimensions defined in the node. If the number of dimensions for the node is zero, an error is returned.

Example

See the example for ADF_Get_Data_Type.

Get the Values of the Node Dimensions


ADF_Get_Dimension_Values (ID,dim_vals[],error_return)

Language C Fortran
Routine Name ADF_Get_Dimension_Values ADFGDV
Input const double ID real*8 ID
Output int *dim_vals[]
int *error_return
integer dim_vals()
integer error_return

    ID   The ID of the node to use.
 
dim_vals The array (list) of dimension values.
 
error_return Error return code.

This routine, ADF_Get_Dimension_Values, returns the array (list) of dimension values for a node. Values will be returned only for the number of dimensions defined in the node. If the number of dimensions for the node is zero, an error is returned.

Example

See the example for ADF_Get_Data_Type.

Set or Change the Data Type and Dimensions of a Node


ADF_Put_Dimension_Information (ID,data_type,dims,dim_vals[],error_return)

Language C Fortran
Routine Name ADF_Put_Dimension_Information ADFPDIM
Input const double ID
const char *data_type
const int dims
int dim_vals[]
real*8 ID
character*(*) data_type
integer dims
integer dim_vals()
Output int *error_return integer error_return

    ID   The ID of the node to use.
 
data_type The 32-character data type of the node. The valid user-definable data types are:

    Data Type   Notation
No Data MT
Integer 32 I4
Integer 64 I8
Unsigned Integer 32 U4
Unsigned Integer 64 U8
Real 32 R4
Real 64 R8
Complex 64 X4
Complex 128 X8
Character (unsigned byte) C1
Byte (unsigned byte) B1

Compound data types can be defined as a combination of types ("I4,I4,R8"), an array ("I4[25]"), or a combination of types and arrays ("I4,C1[20],R8[3]"). They can contain up to 32 characters. This style of data type definition is not very portable across platforms; therefore, it is not recommended.
 
dims The number of dimensions of this node. dims can be a number from 0 to 12. "0" means no data. The dimension of an array can range from 1 (vector) to 12.
 
dim_vals The array (list) of dimension values for this node. dim_vals is a vector of integers that define the size of the array in each dimension as defined by dims. If the dims is zero, the dims_vals are not used. The valid range of dim_vals is from 1 to 2,147,483,648. The total data size in bytes, calculated by the data_type size times the dimension values, cannot exceed 2,147,483,648 for any one node.
 
error_return Error return code.

This routine, ADF_Put_Dimension_Information, sets or changes the data type and dimension information for a node.

Note: When this routine is used to change the data type or number of dimensions of an existing node, any data currently associated with the node are lost. The dimension values can be changed and the data space will be extended as needed. Be very careful changing the dimension values. The layout of the data is assumed to be Fortran-like. If the left-most dimension values are changed, the data are not shifted around on disk to account for this; only the amount of data is changed. Therefore, the indexing into the data will be changed. In general, it is safe to change the right-most dimension value. For example, if the array of dimension values was (10,11,20,50), then changing the 10, 11, or 20 is very risky, whereas changing the 50 should be safe.

Note: See the section on Fortran character array portability.

Example

See the example for ADF_Get_Data_Type.