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) (File Operations) (Navigating a CGNS File) (Error Handling) (Structural Nodes) (Descriptors) (Physical Data) (Location and Position) (Auxiliary Data) (Grid Specification) (Solution Data) (Grid Connectivity) (Boundary Conditions) (Equation Specification) (Families) (Time-Dependent Data) (Links)

Grid Specification

Zone Grid Coordinates

Node: GridCoordinates_t (SIDS, File Mapping)

GridCoordinates_t nodes are used to describe grids associated with a particular zone. The original grid must be described by a GridCoordinates_t node named GridCoordinates. Additional GridCoordinates_t nodes may be used, with user-defined names, to store grids at multiple time steps or iterations. In addition to the discussion of the GridCoordinates_t node in the SIDS and File Mapping manuals, see the discussion of the ZoneIterativeData_t and ArbitraryGridMotion_t nodes in the SIDS manual.

Functions Modes
ier = cg_grid_write(int fn, int B, int Z, char *GridCoordName,
      int *G);
- w m
ier = cg_ngrids(int fn, int B, int Z, int *ngrids); - w m
ier = cg_grid_read(int fn, int B, int Z, int G,
      char *GridCoordName);
r - m
call cg_grid_write_f(fn, B, Z, GridCoordName, G, ier) - w m
call cg_ngrids_f(fn, B, Z, ngrids, ier) - w m
call cg_grid_read_f(fn, B, Z, G, GridCoordName, ier) r - m

Input/Output

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
Z Zone index number, where 1 ≤ Znzones.
G Grid index number, where 1 ≤ Gngrids.
ngrids Number of GridCoordinates_t nodes for zone Z.
GridCoordinateName Name of the GridCoordinates_t node. Note that the name "GridCoordinates" is reserved for the original grid and must be the first GridCoordinates_t node to be defined.
ier Error status.

The above functions are applicable to any GridCoordinates_t node.

Functions Modes
ier = cg_coord_write(int fn, int B, int Z, DataType_t datatype,
      char *coordname, void *coord_array, int *C);
- w m
ier = cg_coord_partial_write(int fn, int B, int Z,
      DataType_t datatype, char *coordname, cgsize_t *range_min,
      cgsize_t *range_max, void *coord_array, int *C);
- w m
ier = cg_ncoords(int fn, int B, int Z, int *ncoords); r - m
ier = cg_coord_info(int fn, int B, int Z, int C,
      DataType_t *datatype, char *coordname);
r - m
ier = cg_coord_read(int fn, int B, int Z, char *coordname,
      DataType_t datatype, cgsize_t *range_min, cgsize_t *range_max,
      void *coord_array);
r - m
call cg_coord_write_f(fn, B, Z, datatype, coordname, coord_array,
     C, ier)
- w m
call cg_coord_partial_write_f(fn, B, Z, datatype, coordname,
     range_min, range_max, coord_array, C, ier)
- w m
call cg_ncoords_f(fn, B, Z, ncoords, ier) r - m
call cg_coord_info_f(fn, B, Z, C, datatype, coordname, ier) r - m
call cg_coord_read_f(fn, B, Z, coordname, datatype,
     range_min, range_max, coord_array, ier)
r - m

Input/Output

    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.
ncoords Number of coordinate arrays for zone Z.
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 applicable only to the GridCoordinates_t node named GridCoordinates, used for the original grid in a zone. Coordinates for additional GridCoordinates_t nodes in a zone must be read and written using the cg_array_xxx functions.

When writing, the function cg_coord_write will automatically write the full range of coordinates (i.e., the entire coord_array). The function cg_coord_partial_write may be used to write only a subset of coord_array. When using the partial write, any existing data as defined by range_min and range_max will be overwritten by the new values. All other values will not be affected.

The function cg_coord_read returns the coordinate array coord_array, for the range prescribed by range_min and range_max. The array is returned to the application in the data type requested in datatype. This data type does not need to be the same as the one in which the coordinates are stored in the file. A coordinate array stored as double precision in the CGNS file can be returned to the application as single precision, or vice versa.

In Fortran, when using cg_coord_read_f to read 2D or 3D coordinates, the extent of each dimension of coord_array must be consistent with the requested range. When reading a 1D solution, the declared size can be larger than the requested range. For example, for a 2D zone with 100 × 50 vertices, if range_min and range_max are set to (11,11) and (20,20) to read a subset of the coordinates, then coord_array must be dimensioned (10,10). If coord_array is declared larger (e.g., (100,50)) the indices for the returned coordinates will be wrong.

Element Connectivity

Node: Elements_t (SIDS, File Mapping)

Functions Modes
ier = cg_section_write(int fn, int B, int Z,
      char *ElementSectionName, ElementType_t type, cgsize_t start,
      cgsize_t end, int nbndry, cgsize_t *Elements, int *S);
- w m
ier = cg_section_partial_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 = cg_elements_partial_write(int fn, int B, int Z, int S,
      cgsize_t start, cgsize_t end, cgsize_t *Elements);
- w m
ier = cg_parent_data_write(int fn, int B, int Z, int S,
      cgsize_t *ParentData);
- w m
ier = cg_parent_data_partial_write(int fn, int B, int Z, int S,
      cgsize_t start, cgsize_t end, cgsize_t *ParentData);
- w m
ier = cg_nsections(int fn, int B, int Z, int *nsections); r - m
ier = cg_section_read(int fn, int B, int Z, int S,
      char *ElementSectionName, ElementType_t *type, cgsize_t *start,
      cgsize_t *end, int *nbndry, int *parent_flag);
r - m
ier = cg_ElementDataSize(int fn, int B, int Z, int S,
      cgsize_t *ElementDataSize);
r - m
ier = cg_ElementPartialSize(int fn, int B, int Z, int S,
      cgsize_t start, cgsize_t end, cgsize_t *ElementDataSize);
r - m
ier = cg_elements_read(int fn, int B, int Z, int S, cgsize_t *Elements,
      cgsize_t *ParentData);
r - m
ier = cg_elements_partial_read(int fn, int B, int Z, int S,
      cgsize_t start, cgsize_t end, cgsize_t *Elements, cgsize_t *ParentData);
r - m
ier = cg_npe(ElementType_t type, int *npe); r w m
call cg_section_write_f(fn, B, Z, ElementSectionName, type,
     start, end, nbndry, Elements, S, ier)
- w m
call cg_section_partial_write_f(fn, B, Z, ElementSectionName, type,
     start, end, nbndry, S, ier)
- w m
call cg_elements_partial_write_f(fn, B, Z, S, start,
     end, Elements, ier)
- w m
call cg_parent_data_write_f(fn, B, Z, S, ParentData, ier)
- w m
call cg_parent_data_partial_write_f(fn, B, Z, S, start,
     end, ParentData, ier)
- w m
call cg_nsections_f(fn, B, Z, nsections, ier)
r - m
call cg_section_read_f(fn, B, Z, S, ElementSectionName, type,
     start, end, nbndry, parent_flag, ier)
r - m
call cg_ElementDataSize_f(fn, B, Z, S, ElementDataSize, ier)
r - m
call cg_ElementPartialSize_f(fn, B, Z, S, start, end, ElementDataSize, ier)
r - m
call cg_elements_read_f(fn, B, Z, S, Elements, ParentData, ier)
r - m
call cg_elements_partial_read_f(fn, B, Z, S, start, end, Elements,
     ParentData, ier)
r - m
call cg_npe_f(type, npe, ier) r w m

Input/Output

    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.
nsections Number of element sections.
S Element section index, where 1 ≤ Snsections.
parent_flag Flag indicating if the parent data are defined. If the parent data exist, parent_flag is set to 1; otherwise it is set to 0.
ElementDataSize Number of element connectivity data values.
Elements Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
ParentData For boundary or interface elements, this array contains information on the cell(s) and cell face(s) sharing the element. If you do not need to read the ParentData when reading the ElementData, you may set the value to NULL.
npe Number of nodes for an element of type type.
ier Error status.

It is important to note that each element under a given Zone_t - including all cells, faces, edges, boundary elements, etc. - must have a unique element index number. The numbering should be consecutive (i.e., no gaps). This global numbering system insures that each and every element within a zone is uniquely identified by its number.

If the specified Elements_t node doesn't yet exist, it may be created using either cg_section_write or cg_section_partial_write. The function cg_section_write writes the full range as indicated by start and end and supplied by the element connectivity array Elements. The cg_section_partial_write function will create the element section data for the range start to end with the element data intialized to 0. To add elements to the section, use cg_elements_partial_write and parent data (it it exists) using cg_parent_data_partial_write. Both of these functions will replace the data for the range as indicated by start and end with the new values. In most cases, the data is not duplicated in the mid-level library, but written directly from the user data to disk. The exception to this is in the case of MIXED, NGON_n, and NFACE_n element sets. Since the size of the element connectivity array is not known directly, the MLL will keep a copy of the data in memory for the partial writes.

The function cg_elements_read returns all of the element connectivity and parent data. Specified subsets of the element connectivity and parent data may be read using cg_elements_partial_read.

Axisymmetry

Node: Axisymmetry_t (SIDS, File Mapping)

Functions Modes
ier = cg_axisym_write(int fn, int B, float *ReferencePoint,
      float *AxisVector);
- w m
ier = cg_axisym_read(int fn, int B, float *ReferencePoint,
      float *AxisVector);
r - m
call cg_axisym_write_f(fn, B, ReferencePoint, AxisVector, ier) - w m
call cg_axisym_read_f(fn, B, ReferencePoint, AxisVector, ier) r - m

Input/Output

    fn   CGNS file index number.
B Base index number, where 1 ≤ Bnbases.
ReferencePoint Origin used for defining the axis of rotation. (In Fortran, this is an array of Real*4 values.)
AxisVector Direction cosines of the axis of rotation, through the reference point. (In Fortran, this is an array of Real*4 values.)
ier Error status.

This node can only be used for a bi-dimensional model, i.e., PhysicalDimension must equal two.

Rotating Coordinates

Node: RotatingCoordinates_t (SIDS, File Mapping)

Functions Modes
ier = cg_rotating_write(float *RotationRateVector,
      float *RotationCenter);
- w m
ier = cg_rotating_read(float *RotationRateVector,
      float *RotationCenter);
r - m
call cg_rotating_write_f(RotationRateVector, RotationCenter, ier) - w m
call cg_rotating_read_f(RotationRateVector, RotationCenter, ier) r - m

Input/Output

    RotationRateVector   Components of the angular velocity of the grid about the center of rotation. (In Fortran, this is an array of Real*4 values.)
RotationCenter Coordinates of the center of rotation. (In Fortran, this is an array of Real*4 values.)
ier Error status.