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 User's Guide) (Parallel CGNS User's Guide) (ADF Implementation) (HDF5 Implementation) (Python Implementation) (CGNS Tools and Utilities)

(General Remarks) (The PCGNS Software Library) (Example Programs)

Parallel CGNS Routines

Miscellaneous Routines

Functions Modes
ier = cgp_pio_mode(PIOmode_t mode); r w m
ier = cgp_gueue_set(int use_queue); - w m
ier = cgp_gueue_flush(); - w m
void cgp_error_exit(); r w m
call cgp_pio_mode_f(mode, ier) r w m
call cgp_gueue_set_f(use_queue, ier) - w m
call cgp_gueue_flush_f(ier) - w m
call cgp_error_exit_f() r w m

Input/Output
(Note that for Fortran calls, all integer arguments are integer*4 in 32-bit mode and integer*8 in 64-bit mode. See 64-bit Fortran Portability and Issues.)

    mode   Parallel input/ouput mode.
use_queue enable or disables queued output.
ier Error status.

The routine cgp_pio_mode sets the mode for parallel data reads and writes. The default value is CGP_INDEPENDENT, which allows any number of processes to access the data. When set to CGP_COLLECTIVE, all processes must access the data.

If cgp_queue_set is called with a non-zero argument, then output data will not be written to the file, but rather stored in a queue. The queued data will then be written out when cgp_queue_flush is called.

Note: The data array to be written is NOT duplicated in the queue. Rather a pointer to the data is stored. Thus, the data must be persistent within the user's program until cgp_queue_flush is called.

The routine cgp_error_exit is similar to cg_error_exit in that the process will exit with an error message. However, it will also print the process rank, and call MPI_Abort with an exit code of 1.

File Operations

Functions Modes
ier = cgp_open(char *filename, int mode, int *fn); r w m
ier = cgp_close(int fn); r w m
call cgp_open_f(filename, mode, fn, ier) r w m
call cgp_close_f(fn, ier) r w m

Input/Output
(Note that for Fortran calls, all integer arguments are integer*4 in 32-bit mode and integer*8 in 64-bit mode. See 64-bit Fortran Portability and Issues.)

    filename   Name of the CGNS file, including path name if necessary. There is no limit on the length of this character variable.
mode Mode used for opening the file. The modes currently supported are CG_MODE_READ, CG_MODE_WRITE, and CG_MODE_MODIFY.
fn CGNS file index number.
ier Error status.

The routines cgp_open and cgp_close are similar to cg_open and cg_close, and call those routines. The differences are that cgp_open explicitly sets the file type to CG_FILE_PHDF5, and cgp_close calls cgp_queue_flush before closing the file.

Grid Coordinate Data

Functions Modes
ier = cgp_coord_write(int fn, int B, int Z, DataType_t datatype,
      char *coordname, int *C);
- w m
ier = cgp_coord_write_data(int fn, int B, int Z, int C,
      cgsize_t *range_min, cgsize_t *range_max, void *coord_array);
- w m
ier = cgp_coord_read_data(int fn, int B, int Z, int C,
      cgsize_t *range_min, cgsize_t *range_max, void *coord_array);
r - m
call cgp_coord_write_f(fn, B, Z, datatype, coordname, C, ier) - w m
call cgp_coord_write_data_f(fn, B, Z, C, range_min, range_max, coord_array, ier) - w m
call cgp_coord_read_data_f(fn, B, Z, C, range_min, range_max, coord_array, ier) r - m

Input/Output
(Note that for Fortran calls, all integer arguments are integer*4 in 32-bit mode and integer*8 in 64-bit mode. See 64-bit Fortran Portability and Issues.)

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
Z Zone index number, where 1 ≤ Znzones.
C Coordinate array index number, where 1 ≤ Cncoords.
datatype Data type in which the coordinate array is written. Admissible data types for a coordinate array are RealSingle and RealDouble.
coordname Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to insure file compatibility.
range_min Lower range index (eg., imin, jmin, kmin).
range_max Upper range index (eg., imax, jmax, kmax).
coord_array Array of coordinate values for the range prescribed.
ier Error status.

The above functions are used to read and write grid coordinate data by multiple processes in a parallel fashion. To write the data in parallel, first call cgp_coord_write to create an empty data node. This call is indentical to cg_coord_write with coord_array set to NULL (no data written). The actual data is then written to the node in parallel using cg_coord_write_data where range_min and range_max specify the subset of coordinate data to be written by a given process. The routine cg_coord_read_data performs the same function for reading the coordinate data in parallel.

Note: It is the responsibility of the application to ensure that the data type for the coordinate data matches that as defined in the file; no conversions are done.

Element Connectivity Data

Functions Modes
ier = cgp_section_write(int fn, int B, int Z,
      char *ElementSectionName, ElementType_t type, cgsize_t start,
      cgsize_t end, int nbndry, int *S);
- w m
ier = cgp_elements_write_data(int fn, int B, int Z, int S,
      cgsize_t start, cgsize_t end, cgsize_t *Elements);
- w m
ier = cgp_elements_read_data(int fn, int B, int Z, int S,
      cgsize_t start, cgsize_t end, cgsize_t *Elements);
r - m
call cgp_section_write_f(fn, B, Z, ElementSectionName, type,
     start, end, nbndry, S, ier)
- w m
call cgp_elements_write_data_f(fn, B, Z, S, start,
     end, Elements, ier)
- w m
call cgp_elements_read_data_f(fn, B, Z, S, start,
     end, Elements, ier)
r - m

Input/Output
(Note that for Fortran calls, all integer arguments are integer*4 in 32-bit mode and integer*8 in 64-bit mode. See 64-bit Fortran Portability and Issues.)

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
Z Zone index number, where 1 ≤ Znzones.
ElementSectionName Name of the Elements_t node.
type Type of element. See the eligible types for ElementType_t in the Typedefs section.
start Index of first element in the section.
end Index of last element in the section.
nbndry Index of last boundary element in the section. Set to zero if the elements are unsorted.
S Element section index, where 1 ≤ Snsections.
Elements Element connectivity data.
ier Error status.

Note: These routines only work for constant sized elements, since it is not possible to compute file offsets for variable sized elements without knowledge of the entire element connectivity data.

The above functions are used to read and write element connectivity data by multiple processes in a parallel fashion. To write the element data in parallel, first call cgp_section_write to create an empty data node. This call is indentical to cg_section_write with Elements set to NULL (no data written). The actual element data is then written to the node in parallel using cg_element_write_data where start and end specify the range of the elements to be written by a given process. The routine cg_element_read_data performs the same function for reading the solution data in parallel.

Note: It is the responsibility of the application to ensure that cgsize_t in the application is the same size as that defined in the file; no conversions are done.

Solution Data

Functions Modes
ier = cgp_field_write(int fn, int B, int Z, int S,
      DataType_t datatype, char *fieldname, int *F);
- w m
ier = cgp_field_write_data(int fn, int B, int Z, int S, int F,
      cgsize_t *range_min, cgsize_t *range_max, void *solution_array);
- w m
ier = cgp_field_read_data(int fn, int B, int Z, int S, int F,
      cgsize_t *range_min, cgsize_t *range_max, void *solution_array);
r - m
call cgp_field_write_f(fn, B, Z, S, datatype, fieldname, F, ier) - w m
call cgp_field_write_data_f(fn, B, Z, S, F,
      range_min, range_max, solution_array, ier)
- w m
call cgp_field_read_data_f(fn, B, Z, S, F,
      range_min, range_max, solution_array, ier)
r - m

Input/Output
(Note that for Fortran calls, all integer arguments are integer*4 in 32-bit mode and integer*8 in 64-bit mode. See 64-bit Fortran Portability and Issues.)

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
Z Zone index number, where 1 ≤ Znzones.
S Flow solution index number, where 1 ≤ Snsols.
F Solution array index number, where 1 ≤ Fnfields.
datatype Data type in which the solution array is written. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
fieldname Name of the solution array. It is strongly advised to use the SIDS nomenclature conventions when naming the solution arrays to insure file compatibility.
range_min Lower range index (eg., imin, jmin, kmin).
range_max Upper range index (eg., imax, jmax, kmax).
solution_array Array of solution values for the range prescribed.
ier Error status.

The above functions are used to read and write solution arrays by multiple processes in a parallel fashion. To write the data in parallel, first call cgp_field_write to create an empty data node. This call is indentical to cg_field_write with solution_array set to NULL (no data written). The actual data is then written to the node in parallel using cg_field_write_data where range_min and range_max specify the subset of the solution data to be written by a given process. The routine cg_field_read_data performs the same function for reading the solution data in parallel.

Note: It is the responsibility of the application to ensure that the data type for the solution data matches that as defined in the file; no conversions are done.

Array Data

Functions Modes
ier = cgp_array_write(char *ArrayName, DataType_t DataType,
      int DataDimension, cgsize_t *DimensionVector, int *A);
- w m
ier = cgp_array_write_data(int A, cgsize_t *range_min, cgsize_t *range_max, void *Data); - w m
ier = cgp_array_read_data(int A, cgsize_t *range_min, cgsize_t *range_max, void *Data); r - m
call cgp_array_write_f(ArrayName, DataType, DataDimension, DimensionVector, A, ier) - w m
call cgp_array_write_data_f(A, range_min, range_max, Data, ier) - w m
call cgp_array_read_data_f(A, range_min, range_max, Data, ier) r - m

Input/Output
(Note that for Fortran calls, all integer arguments are integer*4 in 32-bit mode and integer*8 in 64-bit mode. See 64-bit Fortran Portability and Issues.)

    A   Data array index, where 1 ≤ Anarrays.
ArrayName Name of the DataArray_t node.
DataType Type of data held in the DataArray_t node. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
DataDimension Number of dimensions.
DimensionVector Number of data elements in each dimension.
Data The data array.
ier Error status.

The above functions are used to read and write data arrays by multiple processes in a parallel fashion. To write the data in parallel, first call cg_goto to set the position for the DataArray_t node, then call cgp_array_write to create an empty data node. This call is similar to cg_array_write with Data set to NULL (no data written). This function will return the array index, A, which is used to write the actual data to the node in parallel using cg_array_write_data where range_min and range_max specify the subset of the array data to be written by a given process. The routine cg_array_read_data performs the same function for reading the array data in parallel.

Note: It is the responsibility of the application to ensure that the data type for the array data matches that as defined in the file; no conversions are done.