The simple programs contained here go along with the User's Guide to CGNS.
They read and write very simple example CGNS files, in order to help
the user understand the CGNS concepts as well as the usage of the API calls.
These programs assume that the user has obtained the CGNS software (from
www.cgns.org) and has compiled it.
Each code is written in both Fortran and C. Typical compiler options are
included in each file, but the user is responsible for determining how to
compile the programs on his or her own computer system appropriately.
There is a Makefile in each subdirectory to build and/or run the examples.
You will need to edit the first part of each of these Makefiles in order
to set up the options for your system. After doing so, 'make' or 'make all'
should build the example code. To run the examples, use 'make test'.
(DISCLAIMER: These programs are very unsophisticated, purposefully
for ease of readability. Real working codes would be written more
generally, with more checks, and would NOT be so hardwired for
particular cases (e.g., would not use hardwired values
in the dimension statements). For example, a single program could easily
be written to read a CGNS grid regardless of the number of zones and
their sizes - but below we give separate programs, each one HARDWIRED
for a specific number of zones and particular zone sizes.)
It is recommended that the user apply these codes by following along
in the User's Guide; in other words, use them in the order suggested.
Some of these codes are only given as segments, or not at all, in the
User's Guide. This was done in order to conserve space and avoid too
much redundant information. The codes are listed in alphabetical order
below, NOT in the order in which you should run them. (The order in
which you should run them is given in Appendix B of the User's Guide.)
All of the following codes were originally written by Chris Rumsey,
NASA LaRC, MS 128, Hampton VA 23681, C.L.RUMSEY@NASA.GOV. Much of the
C-code was later cleaned up by Bruce Wedan, email@example.com.
Please e-mail any errors or problems discovered.
The following is a list of the Fortran programs. The C programs have
the same names, only with a ".c" appended.
read_bc_str.f - reads BCS (as PointRange) for structured example
read_bcpnts_str.f - reads BCS (as PointList) for structured example
read_bcpnts_unst.f - reads BCS (as ElementList) for unstructured example
read_bcpnts_unst_NR.f - reads BCS (as PointList, FaceCenter) for unstructured example (not recommended)
read_con2zn_genrl_str.f - reads general 1-to-1 connectivity for 2-zone structured example
read_con2zn_str.f - reads 1-to-1 connectivity for 2-zone structured example
read_convergence.f - reads convergence history
read_descriptor.f - reads descriptor node under CGNSBase_t
read_dimensional.f - reads dimensional data from an existing grid + flow solution
read_flowcent_str.f - reads flow soln (as CellCenter) for structured example
read_flowcentrind_str.f - reads flow soln (as CellCenter+Rind cells) for structured example
read_floweqn_str.f - reads flow equation information for structured example
read_flowvert_str.f - reads flow soln (as Vertex) for structured example
read_flowvert_unst.f - reads flow soln (as Vertex) for unstructured example
read_grid2zn_str.f - reads 2-zone grid for structured example
read_grid_str.f - reads grid for structured example
read_grid_unst.f - reads grid for unstructured example
read_nondimensional.f - reads nondimensional data from an existing CGNS file
read_timevert_str.f - reads time-dependent flow soln (as Vertex) for structured example
write_bc_str.f - writes BCS (as PointRange) for structured example
write_bcpnts_str.f - writes BCS (as PointList) for structured example
write_bcpnts_unst.f - writes BCS (as ElementList) for unstructured example
write_bcpnts_unst_NR.f - writes BCS (as PointList, FaceCenter) for unstructured example (not recommended)
write_con2zn_genrl_str.f - writes general 1-to-1 connectivity for 2-zone structured example
write_con2zn_str.f - writes 1-to-1 connectivity for 2-zone structured example
write_convergence.f - writes convergence history
write_descriptor.f - writes descriptor node under CGNSBase_t
write_dimensional.f - writes dimensional data to an existing grid + flow solution
write_flowcent_str.f - writes flow soln (as CellCenter) for structured example
write_flowcentrind_str.f - writes flow soln (as CellCenter+Rind cells) for structured example
write_floweqn_str.f - writes flow equation information for structured example
write_flowvert_str.f - writes flow soln (as Vertex) for structured example
write_flowvert_unst.f - writes flow soln (as Vertex) for unstructured example
write_grid2zn_str.f - writes 2-zone grid for structured example
write_grid_str.f - writes grid for structured example
write_grid_unst.f - writes grid for unstructured example
write_nondimensional.f - writes nondimensional data to an existing CGNS file
write_timevert_str.f - writes time-dependent flow soln (as Vertex) for structured example
Changes from Release 2:
- Corrected errors in C-codes write_grid_str.c and write_grid2zn_str.c involving character assignments
- Added new write_bcpnts_str.f&c and read_bcpnts_unst.f&c codes, for less confusing way to
write BC info for unstructured grids. Better method uses ElementList (or ElementRange) under
BC_t, rather than PointList (or PointRange)+GridLocation=FaceCenter. The latter method is
still allowed and is legal - and actually MEANS elements (see SIDS) - but use of the word "Point" can
be misleading for users. (Old method still available, but has "_NR" appended to names.)
Changes from Release 3:
- Added Makefile in each directory
- In Fortran codes, changed MODE_READ and MODE_MODIFY to CG_MODE_READ and CG_MODE_MODIFY
- In Fortran codes, added error return check after cg_open_f call
- In a few of the Fortran codes, removed unnecessary variable declarations
- In C codes, made more extensive changes in order to bring them more in-line with standard
C practices and also to support new 64-bit mode