Structural Nodes

  CGNS Base Information
cg_base_write Create and/or write to a CGNS base node
cg_nbases Get number of CGNS base nodes in file
cg_base_read Read CGNS base information
cg_cell_dim Get the cell dimension for the CGNS base
  Zone Information
cg_zone_write Create and/or write to a zone node
cg_nzones Get number of zones in base
cg_zone_read Read zone information
cg_zone_type Get type of zone (structured or unstructured)
cg_index_dim Get the index dimension for the CGNS zone
  Simulation Type
cg_simulation_type_write Write simulation type
cg_simulation_type_read Read simulation type

CGNS Base Information

Node: CGNSBase_t (SIDS, File Mapping)

C Functions Modes
ier = cg_base_write (int fn, char *basename, int cell_dim, int phys_dim, int *B); - w m
ier = cg_nbases (int fn, int *nbases); r - m
ier = cg_base_read (int fn, int B, char *basename, int *cell_dim, int *phys_dim); r - m
ier = cg_cell_dim (int fn, int B, int *cell_dim); r - m
Fortran interfaces Modes
call cg_base_write_f (fn, basename, cell_dim, phys_dim, B, ier) - w m
call cg_nbases_f (fn, nbases, ier) r - m
call cg_base_read_f (fn, B, basename, cell_dim, phys_dim, ier) r - m
call cg_cell_dim_f (fn, B, cell_dim, ier) r - m

Input / Ouput

fn
CGNS file index number.
B
Base index number, where 1 ≤ B ≤ nbases.
nbases
Number of bases present in the CGNS file fn.
basename
Name of the base.
cell_dim
Dimension of the cells; 3 for volume cells, 2 for surface cells and 1 for line cells.
phys_dim
Number of coordinates required to define a vector in the field.
ier
Error status.

Zone Information

Node: Zone_t (SIDS, File Mapping)

C Functions Modes
ier = cg_zone_write (int fn, int B, char *zonename, cgsize_t *size, ZoneType_t zonetype, int *Z); - w m
ier = cg_nzones (int fn, int B, int *nzones); r - m
ier = cg_zone_read (int fn, int B, int Z, char *zonename, cgsize_t *size); r - m
ier = cg_zone_type (int fn, int B, int Z, ZoneType_t *zonetype); r - m
ier = cg_index_dim (int fn, int B, int Z, int *index_dim); r - m
Fortran interfaces Modes
call cg_zone_write_f (fn, B, zonename, size, zonetype, Z, ier) - w m
call cg_nzones_f (fn, B, nzones, ier) r - m
call cg_zone_read_f (fn, B, Z, zonename, size, ier) r - m
call cg_zone_type_f (fn, B, Z, zonetype, ier) r - m
call cg_index_dim_f (fn, B, Z, index_dim, ier) r - m

Input / Ouput

fn

CGNS file index number.

B

Base index number, where 1 ≤ B ≤ nbases.

Z

Zone index number, where 1 ≤ Z ≤ nzones.

nzones

Number of zones present in base B.

zonename

Name of the zone.

size

Number of vertices, cells, and boundary vertices in each (index)-dimension. For structured grids, the dimensions have unit stride in the array (e.g., [NVertexI, NVertexJ, NVertexK, NCellI, NCellJ, NCellK, NBoundVertexI, NBoundVertexJ, NBoundVertexK]).

Note that for unstructured grids, the number of cells is the number of highest order elements. Thus, in three dimensions it’s the number of 3-D cells, and in two dimensions it’s the number of 2-D cells.

Also for unstructured grids, if the nodes are sorted between internal nodes and boundary nodes, the optional parameter NBoundVertex must be set equal to the number of boundary nodes. By default, NBoundVertex equals zero, meaning that the nodes are unsorted.

Note that a non-zero value for NBoundVertex only applies to unstructured grids. For structured grids, the NBoundVertex parameter always equals 0 in all directions.

Mesh Type Size
3D structured
NVertexI, NVertexJ, NVertexK
NCellI, NCellJ, NCellK
NBoundVertexI = 0, NBoundVertexJ = 0, NBoundVertexK = 0
2D structured
NVertexI, NVertexJ
NCellI, NCellJ
NBoundVertexI = 0, NBoundVertexJ = 0
3D unstructured NVertex, NCell3D, NBoundVertex
2D unstructured NVertex, NCell2D, NBoundVertex
zonetype

Type of the zone. The admissible types are Structured and Unstructured.

index_dim

Index dimension for the zone. For Structured zones, this will be the base cell dimension and for Unstructured zones it will be 1

ier

Error status.

Note

When a CGNS file is opened via the cg_open() MLL function, the zones are sorted alphanumerically by name (the creation order is ignored/discarded). This mechanism is provided to enable ordinal zone indexing. Therefore, if ordinal zone indexing is desired, it is considered good standard practice to always choose zone names to be alphabetically increasing. For example, Zone0001, Zone0002, etc. is appropriate for up to 9999 zones.

Important: Because the cgnsview tool uses the low-level cgio API, it does not sort the zones by name and zone order presented may not match that of the MLL API. Generally, cgnsview presents the zones in creation order for both ADF and HDF5 formats.

Simulation Type

Node: SimulationType_t (SIDS, File Mapping)

C Functions Modes
ier = cg_simulation_type_write (int fn, int B, SimulationType_t SimulationType); - w m
ier = cg_simulation_type_read (int fn, int B, SimulationType_t *SimulationType); r - m
Fortran interfaces Modes
call cg_simulation_type_write_f (fn, B, SimulationType, ier) - w m
call cg_simulation_type_read_f (fn, B, SimulationType, ier) r - m

Input / Ouput

fn
CGNS file index number.
B
Base index number, where 1 ≤ B ≤ nbases.
SimulationType
Type of simulation. Valid types are CG_Null, CG_UserDefined, TimeAccurate, and NonTimeAccurate.
ier
Error status.