CGNS/MLL API Overview for C and Fortran applications#
These are all the types and functions available in the CGNS C API.
Note
Please refer to General Remarks for details and conventions regarding the equivalent Fortran APIs, paying special attention to 64-bit Fortran Portability.
File and Library Operations#
-
int cg_is_cgns(const char *filename, int *file_type)#
Check for a valid CGNS file.
For existing files, the function cg_is_cgns() may be used to determine if a file is a CGNS file or not, and the type of file (
CG_FILE_ADF
orCG_FILE_HDF5
). If the file is a CGNS file, cg_is_cgns() returnsCG_OK
, otherwise,CG_ERROR
is returned and file_type is set toCG_FILE_NONE
.- Parameters:
filename – [in] Name of the CGNS file, including path name if necessary. There is no limit on the length of this character variable.
file_type – [out] Type of CGNS file. This will typically be either
CG_FILE_ADF
orCG_FILE_HDF5
depending on the underlying file format. However, note that when built in 32-bit, there is also an option to create a Version 2.5 CGNS file by setting the file type toCG_FILE_ADF2
.
- Returns:
Error status.
-
int cg_open(const char *filename, int mode, int *fn)#
Open a CGNS file.
The function cg_open() must always be called first. It opens a CGNS file for reading and/or writing and returns an index number file_number. The index number serves to identify the CGNS file in subsequent function calls. Several CGNS files can be opened simultaneously. The current limit on the number of files opened simultaneously depends on the platform. On an SGI workstation, this limit is set at 100 (parameter FOPEN_MAX in stdio.h).
The file can be opened in one of the following modes:
CG_MODE_READ
Read only mode.
CG_MODE_WRITE
Write only mode.
CG_MODE_MODIFY
Reading and/or writing is allowed.
When the file is opened, if no CGNSLibraryVersion_t node is found, a default value of 1.05 is assumed for the CGNS version number. Note that this corresponds to an old version of the CGNS standard that doesn’t include many data structures supported by the current standard.
To reduce memory usage and improve execution speed, large arrays such as grid coordinates or flow solutions are not stored in memory. Instead, only basic information about the node is kept, while reads and writes of the data are direct to and from the application’s memory. An attempt is made to do the same with unstructured mesh element data.
Note
CGNS maintains one-way forward compatibility insofar as any file open and modified by, for example, version major.minor.patch will be readable with major.minor.patch+. It can’t be guaranteed the reverse major.minor.patch- compatibility for that file will be true.
- Parameters:
filename – [in] Name of the CGNS file, including path name if necessary. There is no limit on the length of this character variable.
mode – [in] Mode used for opening the file. The modes currently supported are
CG_MODE_READ
,CG_MODE_WRITE
, andCG_MODE_MODIFY
.fn – [out] CGNS file index number.
- Returns:
Error status.
-
int cg_version(int fn, float *version)#
Get CGNS file version.
The function cg_version() returns the CGNS version number.
- Parameters:
fn – [in] CGNS file index number.
version – [out] CGNS version number.
- Returns:
Error status.
-
int cg_precision(int fn, int *precision)#
Get CGNS file precision.
Precision used to write the CGNS file. The
precision
value will be one of 32 (32-bit), 64 (64-bit), or 0 if unknown.- Parameters:
fn – [in] CGNS file index number.
precision – [out] Precision used to write the CGNS file. The return value will be one of 32 (32-bit), 64 (64-bit), or 0 if not known.
- Returns:
Error status.
-
int cg_close(int fn)#
Close a CGNS file.
The function cg_close() must always be called last. It closes the CGNS file designated by the index number fn and frees the memory where the CGNS data was kept. When a file is opened for writing, cg_close() writes all the CGNS data in memory onto disk before closing the file. Consequently, if omitted, the CGNS file will not be written properly.
- Parameters:
fn – [in] CGNS file index number.
- Returns:
Error status.
-
int cg_save_as(int fn, const char *filename, int file_type, int follow_links)#
Save the open CGNS file.
The CGNS file identified by
fn
may be saved to a different filename and type using cg_save_as(). To save as an HDF5 file, the library must have been built with HDF5 support. ADF support is always built. The function cg_set_file_type() sets the default file type for newly created CGNS files. The function cg_get_file_type() returns the file type for the CGNS file identified byfn
. If the CGNS library is built as 32-bit, the additional file type,CG_FILE_ADF2
, is available. This allows the creation of a 2.5-compatible CGNS file.- Parameters:
fn – [in] CGNS file index number.
filename – [in] Name of the CGNS file, including path name if necessary. There is no limit on the length of this character variable.
file_type – [in] Type of CGNS file. This will typically be either
CG_FILE_ADF
orCG_FILE_HDF5
depending on the underlying file format. However, note that when built in 32-bit, there is also an option to create a Version 2.5 CGNS file by setting the file type toCG_FILE_ADF2
.follow_links – [in] This flag determines whether links are left intact when saving a CGNS file. If non-zero, then the links will be removed and the data associated with the linked files copied to the new file.
- Returns:
Error status.
-
int cg_set_file_type(int file_type)#
Set default file type.
When a CGNS file is newly created using
CG_MODE_WRITE
, the default type of database manager used is determined at compile time. If the CGNS library was built with HDF5 version 1.8 or later support, the file type will beCG_FILE_HDF5
, otherwiseCG_FILE_ADF
is used. This may be changed either by setting an environment variable,CGNS_FILETYPE
, to one of adf, hdf5, or adf2, or by calling the routine cg_set_file_type() prior to the cg_open() call. Calling cg_set_file_type() with the argumentCG_FILE_NONE
will reset the library to use the default file type.Note
If the environment variable
CGNS_FILETYPE
is set, it takes precedence.- Parameters:
file_type – [in] Type of CGNS file. This will typically be either
CG_FILE_ADF
orCG_FILE_HDF5
depending on the underlying file format. However, note that when built in 32-bit, there is also an option to create a Version 2.5 CGNS file by setting the file type toCG_FILE_ADF2
.- Returns:
Error status.
-
int cg_get_file_type(int fn, int *file_type)#
Get file type for open CGNS file.
The function cg_get_file_type() gets the file type (adf, hdf5, or adf2) for an open CGNS file.
- Parameters:
fn – [in] CGNS file index number.
file_type – [out] Type of CGNS file. This will typically be either
CG_FILE_ADF
orCG_FILE_HDF5
depending on the underlying file format. However, note that when built in 32-bit, there is also an option to create a Version 2.5 CGNS file by setting the file type toCG_FILE_ADF2
.
- Returns:
Error status.
Configuring CGNS Internals#
-
int cg_configure(int option, void *value)#
Configure CGNS library internal options.
The function cg_configure() allows particular CGNS library internal options to be configured. The currently supported options and expected values are listed below.
- Parameters:
option – [in] The configuration options are defined in cgnslib.h. For the list, please refer to the list below.
value – [in] The value to set, type cast as void * . In Fortran, the type is TYPE(C_PTR).
- Returns:
Error status.
-
CG_CONFIG_ERROR#
This allows the user to define an error call-back function. The value should be a pointer to a function that receives the error. The function is defined as
void err_callback(int is_error, char *errmsg)
and will be called for errors and warnings. The first argument,is_error
, will be 0 for warning messages, 1 for error messages, and -1 if the program is going to terminate (i.e., a call to cg_error_exit()). The second argument is the error or warning message. If this is defined, warning and error messages will go to the function rather than the terminal. Avalue
of NULL (Fortran,C_NULL_PTR
) will remove the call-back function.
-
CG_CONFIG_COMPRESS#
This is the rewrite-upon-close setting. Note: Prior library versions would automatically rewrite the CGNS file when it was closed after being opened in modify mode if there was unused space. This is no longer done due to possible parallel I/O conflicts. The previous behavior may be recovered by setting the value to a positive integer. In this case, the file will be rewritten if the number of node deletions or modifications equals or exceeds this number. Setting the
value
to a negative number will force the rewrite when the file is closed. The default value is 0 (no rewrite).
-
CG_CONFIG_SET_PATH#
Sets the search path for locating linked-to files. The argument
value
should be a character string containing one or more directories, formatted the same as for the PATH environment variable. This will replace any current settings. Settingvalue
to NULL will remove all paths. In Fortran, the path must terminate with aNULL
character,CHAR(0)
orC_NULL_CHAR
.
-
CG_CONFIG_ADD_PATH#
Adds a directory, or list of directories, to the linked-to file search path. This is the same as
CG_CONFIG_SET_PATH
, but adds to the path instead of replacing it. In Fortran, the path must terminate with aNULL
character,CHAR(0)
orC_NULL_CHAR
.
-
CG_CONFIG_FILE_TYPE#
Sets the default file type for newly created CGNS files. The argument
value
should be set to one ofCG_FILE_NONE
,CG_FILE_ADF
,CG_FILE_HDF5
, orCG_FILE_ADF2
. See the discussion above for cg_set_file_type().
-
CG_CONFIG_RIND_INDEX#
This option affects index bounds on structured arrays with rind planes. The SIDS specifies that core array locations begin at index 1. Lower rind planes, if present, would have an index of less than 1 (see structured grid indexing conventions ). Versions of the Mid-Level Library < 3.4 did not produce this behavior. Index 1 always represented the start of an array: in an array with no rind planes, the core location would have index 1; in an array with 1 rind plane, the core location would have index 2. In version 3.4 of the Mid-Level Library, the API’s behavior was fixed to match what was specified in the SIDS: core array locations always begin at index 1. This option allows for configuring the library to pre-3.4 indexing behavior (set value to
CG_CONFIG_RIND_ZERO
) or the new default behavior (set value toCG_CONFIG_RIND_CORE
). Note that usingCG_CONFIG_RIND_ZERO
is considered obsolete but is provided for backward compatibility. Most users should not select this option and use the default. Values used for this option do not need to be explicitly cast asvoid*
. This option does not change the CGNS file in any way; it only modifies the API to the library.
-
CG_CONFIG_HDF5_COMPRESS#
Sets the compression level for data written from HDF5. The default is no compression. Setting
value
to -1 will use the default compression level of 6. The acceptable values are 0 to 9, corresponding to gzip compression levels. This option currently does nothing, as compression has not yet been implemented.
-
CG_CONFIG_HDF5_MPI_COMM#
Sets the MPI communicator for parallel I/O. The default is
MPI_COMM_WORLD
. The new communicator is given by typecasting it to avoid *
. This is generally used internally - see cgp_mpi_comm() instead.
-
CG_CONFIG_HDF5_DISKLESS#
Performs I/O directly to memory and can create temporary CGNS files that never exist on permanent storage. The memory is written to disk depending on the state of CG_CONFIG_HDF5_DISKLESS_WRITE. CGNS will use the
core
file driver in HDF5 viaH5Pset_fapl_core
, and the parameters associated with CG_CONFIG_HDF5_DISKLESS are associated with that API. Whenvalue
is 1, any previously defined driver mode is ignored. Settingvalue
to 0 disables the diskless mode, enabling the previous mode. This configuration is not a valid option when accessing the memory by more than one process.
-
CG_CONFIG_HDF5_DISKLESS_INCR#
Value
specifies the increment by which allocated memory is to be increased each time more memory is required, in bytes. The default is 10MiB. Ideally,value
should be set large enough to minimize repeated increases. The type ofvalue
issize_t
in C andC_SIZE_T
in Fortran. Due to a bug with gfortran, it is advisable to useC_LOC
orC_FUNLOC
in-line of the call instead of using a variable.
-
CG_CONFIG_HDF5_DISKLESS_WRITE#
Value
indicates whether to write (value
=1) the memory contents to disk when the file is closed. Otherwise,value
=0 does not persist the memory to disk.
-
CG_CONFIG_HDF5_ALIGNMENT#
Configures HDF5’s
H5Pset_alignment
and sets the alignment,value[1]
, properties of a file access property list so that any file object greater than or equal in size to a threshold,value[0]
, bytes will be aligned on an address which is a multiple of alignment.
-
CG_CONFIG_HDF5_MD_BLOCK_SIZE#
Configures HDF5’s
H5Pset_meta_block_size
and sets the minimum size,value (in bytes)
, of metadata block allocations.
-
CG_CONFIG_HDF5_BUFFER#
Configures HDF5’s
H5Pset_buffer
and sets the maximum size,value (in bytes)
, for the type conversion buffer and background buffer.
-
CG_CONFIG_HDF5_SIEVE_BUF_SIZE#
Configures HDF5’s
H5Pset_sieve_buf_size
and sets the maximum size,value (in bytes)
, of the data sieve buffer.
-
CG_CONFIG_HDF5_ELINK_CACHE_SIZE#
Configures HDF5’s
H5Pset_elink_file_cache_size
and sets the number of files,value
, that can be held open in an external link open file cache.
-
CG_CONFIG_RESET#
Value
indicates the configuration values to reset to their default values. Currently, onlyCG_CONFIG_RESET_HDF5
is a validvalue
and will reset all theCG_CONFIG_HDF5_*
parameters, excludingCG_CONFIG_HDF5_MPI_COMM
andCG_CONFIG_HDF5_DISKLESS
, to their default values.
-
int cg_error_handler(void (*func)(int, char*))#
Set CGNS error handler.
Note
The routine cg_error_handler() is a convenience function built on top of cg_configure().
Note
There is no Fortran counterpart for function cg_error_handler(). The Fortran function cg_exit_on_error_f() routine can be used instead of cg_error_handler(). If
flag
is non-zero, the library will print the error message and exit with a code of 1 when an error is encountered. Settingflag
to zero (the default) prevents this, and the error is returned to the user code.- Parameters:
func – [in] error handler function
- Returns:
Error status.
-
int cg_set_compress(int compress)#
Set CGNS compression mode.
Note
The routine cg_set_compress() is a convenience function built on top of cg_configure().
- Parameters:
compress – [in] CGNS compress (rewrite) setting
- Returns:
Error status.
-
int cg_get_compress(int *compress)#
Get CGNS compression mode.
- Parameters:
compress – [out] CGNS compress (rewrite) setting
- Returns:
Error status.
-
int cg_set_path(const char *path)#
Set the CGNS link search path.
Note
The routine cg_set_path() is a convenience function built on top of cg_configure().
- Parameters:
path – [in] Path to search for links to files when opening a file with external links.
- Returns:
Error status.
-
int cg_add_path(const char *path)#
Add to the CGNS link search path.
Note
The routine cg_add_path() is a convenience function built on top of cg_configure().
- Parameters:
path – [in] Path to search for links to files when opening a file with external links.
- Returns:
Error status.
Interfacing with CGIO#
-
int cg_root_id(int fn, double *rootid)#
Get the CGIO root node identifier for the CGNS file.
The function cg_root_id() allows the use of the low-level CGIO function in conjunction with the Mid Level Library. It returns the root node identifier for the CGNS file.
- Parameters:
fn – [in] CGNS file index number.
rootid – [out] Root node identifier for the CGNS file
- Returns:
Error status.
-
int cg_get_cgio(int fn, int *cgio_num)#
Get the CGIO database identifier for the specified CGNS file.
The function cg_get_cgio() allows using the low-level CGIO function in conjunction with the Mid Level Library. It returns the CGIO database identifier for the CGNS file.
- Parameters:
fn – [in] CGNS file index number.
cgio_num – [out] CGIO identifier for the CGNS file
- Returns:
Error status.
Error Handling#
-
const char *cg_get_error()#
If an error occurs during the execution of a CGNS library function, signified by a non-zero value of the error status variable
ier
, an error message may be retrieved using the function cg_get_error().- Returns:
The error message
-
void cg_error_exit()#
Print the error message and stop the execution of the program.
Note
In C, you may define a function to be called automatically in the case of a warning or error using the cg_configure() routine. The function is of the form
and will be called whenever an error or warning occurs. The first argument,void err_func(int is_error, char *errmsg)
is_error
, will be 0 for warning messages, 1 for error messages, and -1 if the program is going to terminate (i.e., a call to cg_error_exit()). The second argument is the error or warning message.
-
void cg_error_print()#
Print the error message and continue execution of the program.
Note
In C, you may define a function to be called automatically in the case of a warning or error using the cg_configure() routine. The function is of the form
and will be called whenever an error or warning occurs. The first argument,void err_func(int is_error, char *errmsg)
is_error
, will be 0 for warning messages, 1 for error messages, and -1 if the program is going to terminate (i.e., a call to cg_error_exit()). The second argument is the error or warning message.
Structural Nodes#
CGNS Base Information#
Node: CGNSBase_t
(SIDS)
-
int cg_nbases(int fn, int *nbases)#
Get the number of CGNS base nodes in the file.
- Parameters:
fn – [in] CGNS file index number.
nbases – [out] Number of bases in the CGNS file
fn
.
- Returns:
Error status.
-
int cg_base_read(int fn, int B, char *basename, int *cell_dim, int *phys_dim)#
Read CGNS base information.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
basename – [out] Name of the base
cell_dim – [out] Dimension of the cells; 3 for volume cells, 2 for surface cells and 1 for line cells.
phys_dim – [out] Number of coordinates required to define a vector in the field.
- Returns:
Error status.
-
int cg_base_id(int fn, int B, double *base_id)#
Get the CGIO identifier of the CGNS base.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
base_id – [out] CGIO node identifier for the base.
- Returns:
Error status.
-
int cg_cell_dim(int fn, int B, int *cell_dim)#
Get the cell dimension for the CGNS base.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
cell_dim – [out] Dimension of the cells; 3 for volume cells, 2 for surface cells and 1 for line cells.
- Returns:
Error status.
-
int cg_base_write(int fn, const char *basename, int cell_dim, int phys_dim, int *B)#
Create and/or write to a CGNS base node.
- Parameters:
fn – [in] CGNS file index number.
basename – [in] Name of the base.
cell_dim – [in] Dimension of the cells; 3 for volume cells, 2 for surface cells and 1 for line cells.
phys_dim – [in] Number of coordinates required to define a vector in the field.
B – [out] Base index number, where 1 ≤ B ≤ nbases.
- Returns:
Error status.
CGNS Zone Information#
-
int cg_nzones(int fn, int B, int *nzones)#
Get the number of zones in the base.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
nzones – [out] Number of zones present in base B.
- Returns:
Error status.
-
int cg_zone_type(int fn, int B, int Z, ZoneType_t *zonetype)#
Get type of zone (structured or unstructured)
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
zonetype – [out] Type of the zone. The admissible types are Structured and Unstructured.
- Returns:
Error status.
-
int cg_zone_read(int fn, int B, int Z, char *zonename, cgsize_t *size)#
Read zone information.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
zonename – [out] Name of the zone
size – [out] 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; 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 parameterNBoundVertex
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-zeroNBoundVertex
value only applies to unstructured grids. For structured grids, theNBoundVertex
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
- Returns:
Error status.
-
int cg_zone_id(int fn, int B, int Z, double *zone_id)#
Get the CGIO identifier of the CGNS zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
zone_id – [out] CGIO node identifier for the zone
- Returns:
Error status.
-
int cg_index_dim(int fn, int B, int Z, int *index_dim)#
Get the index dimension of the CGNS zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
index_dim – [out] Index dimension for the zone. For Structured zones, this will be the base cell dimension, and for Unstructured zones, it will be 1.
- Returns:
Error status.
-
int cg_zone_write(int fn, int B, const char *zonename, const cgsize_t *size, ZoneType_t zonetype, int *Z)#
Create and/or write to a CGNS zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
zonename – [in] Name of the zone.
size – [in] 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; 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 – [in] Type of the zone. The admissible types are Structured and Unstructured.
Z – [out] Zone index number, where 1 ≤ Z ≤ nzones.
- Returns:
Error status.
Simulation Type#
Node: SimulationType_t
-
int cg_simulation_type_read(int fn, int B, SimulationType_t *SimulationType)#
Read simulation type.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
SimulationType – [out] Type of simulation. Valid types are CG_Null, CG_UserDefined, TimeAccurate, and NonTimeAccurate.
- Returns:
Error status.
-
int cg_simulation_type_write(int fn, int B, SimulationType_t SimulationType)#
Write simulation type.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
SimulationType – [in] Type of simulation. Valid types are CG_Null, CG_UserDefined, TimeAccurate, and NonTimeAccurate.
- Returns:
Error status.
Descriptors#
Descriptive Text#
Node: Descriptor_t
-
int cg_ndescriptors(int *ndescriptors)#
Get the number of descriptors in the file.
- Parameters:
ndescriptors – [out] Number of Descriptor_t nodes under the current node.
- Returns:
Error status.
-
int cg_descriptor_read(int descr_no, char *descr_name, char **descr_text)#
Read descriptive text.
Note that with cg_descriptor_read(), the memory for the descriptor character string, text, will be allocated by the Mid-Level Library. The application code is responsible for releasing this memory when it is no longer needed by calling cg_free(text).
- Parameters:
descr_no – [in] Descriptor index number, where 1 ≤ descr_no ≤ ndescriptors.
descr_name – [out] Name of the Descriptor_t node.
descr_text – [out] Description held in the Descriptor_t node.
- Returns:
Error status.
-
int cg_descriptor_write(const char *descr_name, const char *descr_text)#
Write descriptive text.
- Parameters:
descr_name – [in] Name of the Descriptor_t node.
descr_text – [in] Description held in the Descriptor_t node.
- Returns:
Error status.
Ordinal Value#
Node: Ordinal_t
-
int cg_ordinal_read(int *Ordinal)#
Read ordinal value.
- Parameters:
Ordinal – [out] Any integer value.
- Returns:
Error status.
-
int cg_ordinal_write(int Ordinal)#
Write ordinal value.
- Parameters:
Ordinal – [in] Any integer value.
- Returns:
Error status.
Physical Data#
Data Arrays#
Node: DataArray_t
-
int cg_narrays(int *narrays)#
Get the number of data arrays under the current node.
- Parameters:
narrays – [out] Number of DataArray_t nodes under the current node.
- Returns:
Error status.
-
int cg_array_info(int A, char *ArrayName, DataType_t *DataType, int *DataDimension, cgsize_t *DimensionVector)#
Get data array info.
- Parameters:
A – [in] Data array index, where 1 ≤ A ≤ narrays.
ArrayName – [out] Name of the DataArray_t node.
DataType – [out] Type of data held in the DataArray_t node. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
DataDimension – [out] Number of dimensions of array in file (max 12). See Node Management Routines in CGIO User’s Guide.
DimensionVector – [out] Dimensions of array in file.
- Returns:
Error status.
-
int cg_array_read(int A, void *Data)#
Read data array.
- Parameters:
A – [in] Data array index, where 1 ≤ A ≤ narrays.
Data – [out] The data array in memory.
- Returns:
Error status.
-
int cg_array_read_as(int A, DataType_t type, void *Data)#
Read data array as a certain type.
- Parameters:
A – [in] Data array index, where 1 ≤ A ≤ narrays.
type – [in] Type of data held in the DataArray_t node. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
Data – [out] The data array in memory.
- Returns:
Error status.
-
int cg_array_general_read(int A, const cgsize_t *s_rmin, const cgsize_t *s_rmax, DataType_t m_type, int m_numdim, const cgsize_t *m_dimvals, const cgsize_t *m_rmin, const cgsize_t *m_rmax, void *data)#
Read subset of data array to a shaped memory.
The functions cg_array_general_read allow for type conversion when reading from the file. When using cg_array_general_read, the lower core elements in the file have index 1 for defining range_min and range_max; whereas for the array in memory, defined by mem_rank and mem_dimensions, the lower array elements in memory have index 1 for defining mem_range_min and mem_range_max. The actual lower and upper bounds of the array in memory can be anything. For example, to fully read a two-dimensional 6 × 6 data array with 1 rind plane on each side in the file to an 8 × 8 array in memory (mem_rank = 2 and mem_dimensions = (8,8)), set range_min and range_max to (0,0) and (7,7), and set mem_range_min and mem_range_max to (1,1) and (8,8).
- Parameters:
A – [in] Data array index, where 1 ≤ A ≤ narrays.
s_rmin – [in] Lower range index in file (eg., imin, jmin, kmin).
s_rmax – [in] Upper range index in file (eg., imax, jmax, kmax).
m_type – [in] The type of data held in memory. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
m_numdim – [in] Number of dimensions of array in memory (max 12).
m_dimvals – [in] Dimensions of array in memory.
m_rmin – [in] Lower range index in memory (eg., imin, jmin, kmin).
m_rmax – [in] Upper range index in memory (eg., imax, jmax, kmax).
data – [out] The data array in memory.
- Returns:
Error status.
-
int cg_array_write(const char *ArrayName, DataType_t DataType, int DataDimension, const cgsize_t *DimensionVector, const void *Data)#
Write data array.
- Parameters:
ArrayName – [in] Name of the DataArray_t node.
DataType – [in] Type of data held in the DataArray_t node. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
DataDimension – [in] Number of dimensions of array in file (max 12). See Node Management Routines in CGIO User’s Guide.
DimensionVector – [in] Dimensions of array in file.
Data – [in] The data array in memory.
- Returns:
Error status.
-
int cg_array_general_write(const char *arrayname, DataType_t s_type, int s_numdim, const cgsize_t *s_dimvals, const cgsize_t *s_rmin, const cgsize_t *s_rmax, DataType_t m_type, int m_numdim, const cgsize_t *m_dimvals, const cgsize_t *m_rmin, const cgsize_t *m_rmax, const void *data)#
Write shaped array to a subset of data array.
The function cg_array_general_write may be used to write from a subset of the array in memory to a subset of the array in the file. When using the partial write, the new values will overwrite any existing data from
range_min
torange_max
. All other values will not be affected. The functions cg_array_general_write allow for type conversion when reading to the file. When using cg_array_general_write, the lower core elements in the file have index 1 for defining range_min and range_max; whereas for the array in memory, defined by mem_rank and mem_dimensions, the lower array elements in memory have index 1 for defining mem_range_min and mem_range_max. The actual lower and upper bounds of the array in memory can be anything. For example, to fully read a two-dimensional 6 × 6 data array with 1 rind plane on each side in the file to an 8 × 8 array in memory (mem_rank = 2 and mem_dimensions = (8,8)), set range_min and range_max to (0,0) and (7,7), and set mem_range_min and mem_range_max to (1,1) and (8,8).- Parameters:
arrayname – [in] Name of the DataArray_t node.
s_type – [in] Type of data held in the DataArray_t node. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
s_numdim – [in] Number of dimensions of array in file (max 12). See Node Management Routines in CGIO User’s Guide.
s_dimvals – [in] Dimensions of array in file.
s_rmin – [in] Lower range index in file (eg., imin, jmin, kmin).
s_rmax – [in] Upper range index in file (eg., imax, jmax, kmax).
m_type – [in] The type of data held in memory. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
m_numdim – [in] Number of dimensions of array in memory (max 12).
m_dimvals – [in] Dimensions of array in memory.
m_rmin – [in] Lower range index in memory (eg., imin, jmin, kmin).
m_rmax – [in] Upper range index in memory (eg., imax, jmax, kmax).
data – [in] The data array in memory.
- Returns:
Error status.
Data Class (DataClass_t)#
Node: DataClass_t
-
int cg_dataclass_read(DataClass_t *dataclass)#
Read data class.
The data classes currently supported in CGNS are:
Dimensional
Regular dimensional data.
NormalizedByDimensional
Nondimensional data that is normalized by dimensional reference quantities.
NormalizedByUnknownDimensional
All fields and reference data are nondimensional.
NondimensionalParameter
Nondimensional parameters such as Mach number and lift coefficient.
DimensionlessConstant
Constant such as π.
These classes are declared within typedef DataClass_t in cgnslib.h, and as parameters in cgnslib_f.h.
- Parameters:
dataclass – [out] Data class for the nodes at this level. See below for the data classes currently supported in CGNS.
- Returns:
Error status.
-
int cg_dataclass_write(DataClass_t dataclass)#
Write data class.
The data classes currently supported in CGNS are:
Dimensional
Regular dimensional data.
NormalizedByDimensional
Nondimensional data that is normalized by dimensional reference quantities.
NormalizedByUnknownDimensional
All fields and reference data are nondimensional.
NondimensionalParameter
Nondimensional parameters such as Mach number and lift coefficient.
DimensionlessConstant
Constant such as π.
These classes are declared within typedef DataClass_t in cgnslib.h, and as parameters in cgnslib_f.h.
- Parameters:
dataclass – [in] Data class for the nodes at this level. See below for the data classes currently supported in CGNS.
- Returns:
Error status.
Data Conversion Factors#
Node: DataConversion_t
-
int cg_conversion_info(DataType_t *DataType)#
Get conversion factors data type.
- Parameters:
DataType – [out] Data type in which the conversion factors are recorded. Admissible data types for the exponents are RealSingle and RealDouble.
- Returns:
Error status.
-
int cg_conversion_read(void *ConversionFactors)#
Read conversion factors.
The DataConversion_t data structure contains factors to convert the nondimensional data to “raw” dimensional data. The scaling and offset factors are contained in the two-element array ConversionFactors. In pseudo-Fortran, the conversion process is as follows:
ConversionScale = ConversionFactors(1) ConversionOffset = ConversionFactors(2) Data(raw) = Data(nondimensional)*ConversionScale + ConversionOffset
- Parameters:
ConversionFactors – [out] Two-element array containing the scaling and offset factors.
- Returns:
Error status.
-
int cg_conversion_write(DataType_t DataType, const void *ConversionFactors)#
Write conversion factors.
- Parameters:
DataType – [in] Data type in which the conversion factors are recorded. Admissible data types for the exponents are
RealSingle
andRealDouble
.ConversionFactors – [in] Two-element array containing the scaling and offset factors.
- Returns:
Error status.
Dimensional Units#
Node: DimensionalUnits_t
-
int cg_nunits(int *nunits)#
Get the number of dimensional units.
- Parameters:
nunits – [out] Number of units used in the file (i.e., either 5 or 8).
- Returns:
Error status.
-
int cg_units_read(MassUnits_t *mass, LengthUnits_t *length, TimeUnits_t *time, TemperatureUnits_t *temperature, AngleUnits_t *angle)#
Read first five dimensional units.
- Parameters:
mass – [out] Mass units. Admissible values are CG_Null, CG_UserDefined, Kilogram, Gram, Slug, and PoundMass.
length – [out] Length units. Admissible values are CG_Null, CG_UserDefined, Meter, Centimeter, Millimeter, Foot, and Inch.
time – [out] Time units. Admissible values are CG_Null, CG_UserDefined, and Second.
temperature – [out] Temperature units. Admissible values are CG_Null, CG_UserDefined, Kelvin, Celsius, Rankine, and Fahrenheit.
angle – [out] Angle units. Admissible values are CG_Null, CG_UserDefined, Degree, and Radian.
- Returns:
Error status.
-
int cg_units_write(MassUnits_t mass, LengthUnits_t length, TimeUnits_t time, TemperatureUnits_t temperature, AngleUnits_t angle)#
Write first five dimensional units.
- Parameters:
mass – [in] Mass units. Admissible values are CG_Null, CG_UserDefined, Kilogram, Gram, Slug, and PoundMass.
length – [in] Length units. Admissible values are CG_Null, CG_UserDefined, Meter, Centimeter, Millimeter, Foot, and Inch.
time – [in] Time units. Admissible values are CG_Null, CG_UserDefined, and Second.
temperature – [in] Temperature units. Admissible values are CG_Null, CG_UserDefined, Kelvin, Celsius, Rankine, and Fahrenheit.
angle – [in] Angle units. Admissible values are CG_Null, CG_UserDefined, Degree, and Radian.
- Returns:
Error status.
-
int cg_unitsfull_read(MassUnits_t *mass, LengthUnits_t *length, TimeUnits_t *time, TemperatureUnits_t *temperature, AngleUnits_t *angle, ElectricCurrentUnits_t *current, SubstanceAmountUnits_t *amount, LuminousIntensityUnits_t *intensity)#
Read all eight dimensional units.
- Parameters:
mass – [out] Mass units. Admissible values are CG_Null, CG_UserDefined, Kilogram, Gram, Slug, and PoundMass.
length – [out] Length units. Admissible values are CG_Null, CG_UserDefined, Meter, Centimeter, Millimeter, Foot, and Inch.
time – [out] Time units. Admissible values are CG_Null, CG_UserDefined, and Second.
temperature – [out] Temperature units. Admissible values are CG_Null, CG_UserDefined, Kelvin, Celsius, Rankine, and Fahrenheit.
angle – [out] Angle units. Admissible values are CG_Null, CG_UserDefined, Degree, and Radian.
current – [out] Electric current units. Admissible values are CG_Null, CG_UserDefined, Ampere, Abampere, Statampere, Edison, and auCurrent.
amount – [out] Substance amount units. Admissible values are CG_Null, CG_UserDefined, Mole, Entities, StandardCubicFoot, and StandardCubicMeter.
intensity – [out] Luminous intensity units. Admissible values are CG_Null, CG_UserDefined, Candela, Candle, Carcel, Hefner, and Violle.
- Returns:
Error status.
-
int cg_unitsfull_write(MassUnits_t mass, LengthUnits_t length, TimeUnits_t time, TemperatureUnits_t temperature, AngleUnits_t angle, ElectricCurrentUnits_t current, SubstanceAmountUnits_t amount, LuminousIntensityUnits_t intensity)#
Write all eight dimensional units.
- Parameters:
mass – [in] Mass units. Admissible values are CG_Null, CG_UserDefined, Kilogram, Gram, Slug, and PoundMass.
length – [in] Length units. Admissible values are CG_Null, CG_UserDefined, Meter, Centimeter, Millimeter, Foot, and Inch.
time – [in] Time units. Admissible values are CG_Null, CG_UserDefined, and Second.
temperature – [in] Temperature units. Admissible values are CG_Null, CG_UserDefined, Kelvin, Celsius, Rankine, and Fahrenheit.
angle – [in] Angle units. Admissible values are CG_Null, CG_UserDefined, Degree, and Radian.
current – [in] Electric current units. Admissible values are CG_Null, CG_UserDefined, Ampere, Abampere, Statampere, Edison, and auCurrent.
amount – [in] Substance amount units. Admissible values are CG_Null, CG_UserDefined, Mole, Entities, StandardCubicFoot, and StandardCubicMeter.
intensity – [in] Luminous intensity units. Admissible values are CG_Null, CG_UserDefined, Candela, Candle, Carcel, Hefner, and Violle.
- Returns:
Error status.
Dimensional Exponents#
Node: DimensionalExponents_t
-
int cg_exponents_info(DataType_t *DataType)#
Get exponent data type.
- Parameters:
DataType – [out] Data type in which the exponents are recorded. Admissible data types for the exponents are RealSingle and RealDouble.
- Returns:
Error status.
-
int cg_nexponents(int *numexp)#
Get the number of dimensional exponents.
- Parameters:
numexp – [out] Number of exponents used in the file (i.e., either 5 or 8).
- Returns:
Error status.
-
int cg_exponents_read(void *exponents)#
Read first five dimensional exponents.
When reading exponent data, either cg_exponents_read() or cg_expfull_read() may be used, regardless of the number of exponents used in the file. If cg_exponents_read() is used, but all eight exponents are used in the file, only the first five exponents are returned. If cg_expfull_read() is used, but only five exponents are used in the file, the returned values of the exponents for electric current, substance amount, and luminous intensity will be zero.
- Parameters:
exponents – [out] Exponents for the dimensional units for mass, length, time, temperature, angle, electric current, substance amount, and luminous intensity, in that order.
- Returns:
Error status.
-
int cg_exponents_write(DataType_t DataType, const void *exponents)#
Write first five dimensional exponents.
- Parameters:
DataType – [in] Data type in which the exponents are recorded. Admissible data types for the exponents are RealSingle and RealDouble.
exponents – [in] Exponents for the dimensional units for mass, length, time, temperature, angle, electric current, substance amount, and luminous intensity, in that order.
- Returns:
Error status.
-
int cg_expfull_read(void *exponents)#
Read all eight dimensional exponents.
When reading exponent data, either cg_exponents_read() or cg_expfull_read() may be used, regardless of the number of exponents used in the file. If cg_exponents_read() is used, but all eight exponents are used in the file, only the first five exponents are returned. If cg_expfull_read() is used, but only five exponents are used in the file, the returned values of the exponents for electric current, substance amount, and luminous intensity will be zero.
- Parameters:
exponents – [out] Exponents for the dimensional units for mass, length, time, temperature, angle, electric current, substance amount, and luminous intensity, in that order.
- Returns:
Error status.
-
int cg_expfull_write(DataType_t DataType, const void *exponents)#
Write all eight dimensional exponents.
- Parameters:
DataType – [in] Data type in which the exponents are recorded. Admissible data types for the exponents are RealSingle and RealDouble.
exponents – [in] Exponents for the dimensional units for mass, length, time, temperature, angle, electric current, substance amount, and luminous intensity, in that order.
- Returns:
Error status.
Location and Position#
Grid Location#
Node: GridLocation_t
(SIDS,
File Mapping)
-
int cg_gridlocation_read(GridLocation_t *GridLocation)#
Read grid location.
- Parameters:
GridLocation – [out] Location in the grid. The admissible locations are
CG_Null
,CG_UserDefined
,Vertex
,CellCenter
,FaceCenter
,IFaceCenter
,JFaceCenter
,KFaceCenter
, andEdgeCenter
.- Returns:
Error status.
-
int cg_gridlocation_write(GridLocation_t GridLocation)#
Write grid location.
- Parameters:
GridLocation – [in] Location in the grid. The admissible locations are
CG_Null
,CG_UserDefined
,Vertex
,CellCenter
,FaceCenter
,IFaceCenter
,JFaceCenter
,KFaceCenter
, andEdgeCenter
.- Returns:
Error status.
Point Sets#
Node: IndexArray_t
,
IndexRange_t
(SIDS,
File Mapping)
-
int cg_ptset_info(PointSetType_t *ptset_type, cgsize_t *npnts)#
Get point set information.
- Parameters:
ptset_type – [out] The point set type; either PointRange for a range of points or cells, or PointList for a list of discrete points or cells.
npnts – [out] The number of points or cells in the point set. For a point set type of PointRange, npnts is always two. For a point set type of PointList, npnts is the number of points or cells in the list.
- Returns:
Error status.
-
int cg_ptset_read(cgsize_t *pnts)#
Read point set data.
- Parameters:
pnts – [out] The array of point or cell indices defining the point set. There should be npnts values, each of dimension IndexDimension (i.e., 1 for unstructured grids, and 2 or 3 for structured grids with 2-D or 3-D elements, respectively).
- Returns:
Error status.
-
int cg_ptset_write(PointSetType_t ptset_type, cgsize_t npnts, const cgsize_t *pnts)#
Write point set data.
- Parameters:
ptset_type – [in] The point set type; either PointRange for a range of points or cells, or PointList for a list of discrete points or cells.
npnts – [in] The number of points or cells in the point set. For a point set type of PointRange, npnts is always two. For a point set type of PointList, npnts is the number of points or cells in the list.
pnts – [in] The array of point or cell indices defining the point set. There should be npnts values, each of dimension IndexDimension (i.e., 1 for unstructured grids, and 2 or 3 for structured grids with 2-D or 3-D elements, respectively).
- Returns:
Error status.
Rind Layers#
Node: Rind_t
(SIDS,
File Mapping)
-
int cg_rind_read(int *RindData)#
Read the number of rind layers.
- Parameters:
RindData – [out] Number of rind layers for each computational direction (structured grid) or number of rind points or elements (unstructured grid). For structured grids, the low/high sides have unit stride in the array (e.g., [NRindLowI, NRindHighI, NRindLowJ, NRindHighJ, NRindLowK, NRindHighK]).
- Returns:
Error status.
-
int cg_rind_write(const int *RindData)#
Write the number of rind layers.
When writing rind data for elements, cg_section_write() must be called first, followed by cg_goto() to access the Elements_t node, and then cg_rind_write().
- Parameters:
RindData – [in] Number of rind layers for each computational direction (structured grid) or number of rind points or elements (unstructured grid). For structured grids, the low/high sides have unit stride in the array (e.g., [NRindLowI, NRindHighI, NRindLowJ, NRindHighJ, NRindLowK, NRindHighK]).
- Returns:
Error status.
Auxiliary Data#
Reference State#
Node: ReferenceState_t
-
int cg_state_read(char **StateDescription)#
Read text description of reference state.
The function cg_state_read reads the StateDescription of the local ReferenceState_t node. If StateDescription is undefined in the CGNS database, this function returns a null string. If StateDescription exists, the library will allocate the space to store the description string, and return the description string to the application. It is the responsibility of the application to free this space when it is no longer needed by a call to cg_free(StateDescription).
- Parameters:
StateDescription – [in] Text description of reference state.
- Returns:
Error status.
-
int cg_state_write(const char *StateDescription)#
Create ReferenceState_t node.
The function cg_state_write creates the ReferenceState_t node and must be called even if StateDescription is undefined (i.e., a blank string). The descriptors, data arrays, data class, and dimensional units characterizing the ReferenceState_t data structure may be added to this data structure after its creation.
- Parameters:
StateDescription – [in] Text description of reference state.
- Returns:
Error status.
Gravity#
Node: Gravity_t
-
int cg_gravity_read(int fn, int B, float *gravity_vector)#
Read Gravity_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
gravity_vector – [in] Components of the gravity vector. The number of components must equal PhysicalDimension. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
-
int cg_gravity_write(int fn, int B, float const *gravity_vector)#
Write Gravity_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
gravity_vector – [in] Components of the gravity vector. The number of components must equal PhysicalDimension. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
Convergence History#
Node: ConvergenceHistory_t
-
int cg_convergence_read(int *iterations, char **NormDefinitions)#
Read ConvergenceHistory_t node.
The function cg_convergence_read() reads a ConvergenceHistory_t node. If NormDefinitions is not defined in the CGNS database, this function returns a null string. If NormDefinitions exists, and then the library will allocate the space to store the description string and return the description string to the application. It is the responsibility of the application to free this space when it is no longer needed by a call to cg_free(NormDefinitions).
- Parameters:
iterations – [out] Number of iterations for which convergence information is recorded.
NormDefinitions – [out] Description of the convergence information recorded in the data arrays.
- Returns:
Error status.
-
int cg_convergence_write(int iterations, const char *NormDefinitions)#
Write ConvergenceHistory_t node.
The function cg_convergence_write creates a ConvergenceHistory_t node. It must be the first one called when recording convergence history data. The NormDefinitions may be left undefined (i.e., a blank string). After the creation of this node, the descriptors, data arrays, data class, and dimensional units characterizing the ConvergenceHistory_t data structure may be added.
- Parameters:
iterations – [in] Number of iterations for which convergence information is recorded.
NormDefinitions – [in] Description of the convergence information recorded in the data arrays.
- Returns:
Error status.
Integral Data#
Node: IntegralData_t
-
int cg_nintegrals(int *nintegrals)#
Get the number of IntegralData_t nodes.
- Parameters:
nintegrals – [out] Number of IntegralData_t nodes under current node.
- Returns:
Error status.
-
int cg_integral_read(int IntegralDataIndex, char *IntegralDataName)#
Get the name of an IntegralData_t node.
- Parameters:
IntegralDataIndex – [in] Integral data index number, where 1 ≤ IntegralDataIndex ≤ nintegrals.
IntegralDataName – [out] Name of the IntegralData_t data structure.
- Returns:
Error status.
-
int cg_integral_write(const char *IntegralDataName)#
Create IntegralData_t node.
- Parameters:
IntegralDataName – [in] Name of the IntegralData_t data structure.
- Returns:
Error status.
User-Defined Data#
Node: UserDefinedData_t
-
int cg_nuser_data(int *nuser_data)#
Get the number of UserDefinedData_t nodes.
After accessing a particular UserDefinedData_t node using cg_goto(), the Point Set functions may be used to read or write point set information for the node. The function cg_gridlocation_write() may also be used to specify the location of the data with respect to the grid (e.g., Vertex or FaceCenter).
Multiple levels of UserDefinedData_t nodes may be written and retrieved by positioning via cg_goto(). E.g.,
ier = cg_goto(fn, B, "Zone_t", Z, "UserDefinedData_t", ud1, "UserDefinedData_t", ud2, "UserDefinedData_t", ud3, "end");
- Parameters:
nuser_data – [out] Number of UserDefinedData_t nodes under current node.
- Returns:
Error status.
-
int cg_user_data_read(int Index, char *UserDataName)#
Get name of an UserDefinedData_t node.
- Parameters:
Index – [in] User-defined data index number, where 1 ≤ Index ≤ nuser_data.
UserDataName – [out] Name of the UserDefinedData_t node.
- Returns:
Error status.
-
int cg_user_data_write(const char *UserDataName)#
Create UserDefinedData_t node.
- Parameters:
UserDataName – [in] Name of the UserDefinedData_t node.
- Returns:
Error status.
Freeing Memory#
-
int cg_free(void *data)#
Release library-allocated memory.
This function does not affect the structure of a CGNS file; it is provided as a convenience to free memory allocated by the Mid-Level Library. This isn’t necessary in Fortran; thus, an equivalent Fortran function is not provided.
The functions that are used to allocate memory for return values are cg_descriptor_read(), cg_convergence_read(), cg_geo_read(), cg_link_read(), and cg_state_read(). Each of these may allocate space to contain the data returned to the application. It is the responsibility of the application to free this data when it is no longer needed. Calling cg_free() is identical to calling the standard C function free, however it is probably safer in that the memory is freed in the same module in which it is created, particularly when the Mid-Level Library is a shared library or DLL. The routine checks for NULL data and will return CG_ERROR in this case, otherwise it returns CG_OK.
- Parameters:
data – [in] Data allocated by the Mid-Level Library.
- Returns:
Error status.
Grid Specification#
Zone Grid Coordinates#
Node: GridCoordinates_t
-
int cg_ngrids(int fn, int B, int Z, int *ngrids)#
Get the number of
GridCoordinates_t
nodes.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
ngrids – [out] Number of
GridCoordinates_t
nodes for zone Z.
- Returns:
Error status.
-
int cg_grid_read(int fn, int B, int Z, int G, char *grid_coord_name)#
Get Name of a
GridCoordinates_t
node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
G – [in] Grid index number, where 1 ≤ G ≤ ngrids.
grid_coord_name – [out] 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.
- Returns:
Error status.
-
int cg_grid_write(int fn, int B, int Z, const char *grid_coord_name, int *G)#
Create a
GridCoordinates_t
nodes.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
grid_coord_name – [in] 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.
G – [out] Grid index number, where 1 ≤ G ≤ ngrids.
- Returns:
Error status.
-
int cg_grid_bounding_box_read(int fn, int B, int Z, int G, DataType_t datatype, void *boundingbox)#
Get bounding box associated with a
GridCoordinates_t
node.When reading a bounding box, if the information is missing from the file, the
boundingbox
array will remain untouched, and the CG_NODE_NOT_FOUND status will be returned. The CGNS MLL relies on the user to compute the bounding box and ensure that the bounding box being stored is coherent with the coordinates under the GridCoordinates_t node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
G – [in] Grid index number, where 1 ≤ G ≤ ngrids.
datatype – [in] Data type of the bounding box array written to the file or read. Admissible data types for a coordinate bounding box are RealSingle and RealDouble.
boundingbox – [out] Data Array with bounding box values.
- Returns:
Error status.
-
int cg_grid_bounding_box_write(int fn, int B, int Z, int G, DataType_t datatype, void *boundingbox)#
Write bounding box associated with a
GridCoordinates_t
node.The CGNS MLL relies on the user to compute the bounding box and ensure that the bounding box being stored is coherent with the coordinates under the GridCoordinates_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
G – [in] Grid index number, where 1 ≤ G ≤ ngrids.
datatype – [in] Data type of the bounding box array written to the file or read. Admissible data types for a coordinate bounding box are RealSingle and RealDouble.
boundingbox – [in] Data Array with bounding box values.
- Returns:
Error status.
-
int cg_ncoords(int fn, int B, int Z, int *ncoords)#
Get the number of coordinate arrays.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
ncoords – [out] Number of coordinate arrays for zone Z.
- Returns:
Error status.
-
int cg_coord_info(int fn, int B, int Z, int C, DataType_t *datatype, char *coordname)#
Get info about a coordinate array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
C – [in] Coordinate array index number, where 1 ≤ C ≤ ncoords.
datatype – [out] Data type of the coordinate array written to the file. Admissible data types for a coordinate array are RealSingle and RealDouble.
coordname – [out] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
- Returns:
Error status.
-
int cg_coord_read(int fn, int B, int Z, const char *coordname, DataType_t mem_datatype, const cgsize_t *s_rmin, const cgsize_t *s_rmax, void *coord_array)#
Read grid coordinate array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
mem_datatype – [in] Data type of an array in memory. Admissible data types for a coordinate array are RealSingle and RealDouble.
s_rmin – [in] Lower range index in file (eg., imin, jmin, kmin).
s_rmax – [in] Upper range index in file (eg., imax, jmax, kmax).
coord_array – [out] Array of coordinate values.
- Returns:
Error status.
-
int cg_coord_general_read(int fn, int B, int Z, const char *coordname, const cgsize_t *s_rmin, const cgsize_t *s_rmax, DataType_t m_type, int m_numdim, const cgsize_t *m_dimvals, const cgsize_t *m_rmin, const cgsize_t *m_rmax, void *coord_ptr)#
Read subset of grid coordinates to a shaped array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
m_type – [in] Data type of an array in memory. Admissible data types for a coordinate array are RealSingle and RealDouble.
s_rmin – [in] Lower range index in file (eg., imin, jmin, kmin).
s_rmax – [in] Upper range index in file (eg., imax, jmax, kmax).
m_numdim – [in] Number of dimensions of the array in memory.
m_dimvals – [in] Dimensions of array in memory.
m_rmin – [in] Lower range index in memory (eg., imin, jmin, kmin).
m_rmax – [in] Upper range index in memory (eg., imax, jmax, kmax).
coord_ptr – [out] Array of coordinate values.
- Returns:
Error status.
-
int cg_coord_write(int fn, int B, int Z, DataType_t datatype, const char *coordname, const void *coord_ptr, int *C)#
Write grid coordinates.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
datatype – [in] Data type of the coordinate array written to the file. Admissible data types for a coordinate array are RealSingle and RealDouble.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
coord_ptr – [in] Array of coordinate values.
C – [out] Coordinate array index number, where 1 ≤ C ≤ ncoords.
- Returns:
Error status.
-
int cg_coord_partial_write(int fn, int B, int Z, DataType_t datatype, const char *coordname, const cgsize_t *s_rmin, const cgsize_t *s_rmax, const void *coord_ptr, int *C)#
Write subset of grid coordinates.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
datatype – [in] Data type of the coordinate array written to the file. Admissible data types for a coordinate array are RealSingle and RealDouble.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
s_rmin – [in] Lower range index in file (eg., imin, jmin, kmin).
s_rmax – [in] Upper range index in file (eg., imax, jmax, kmax).
coord_ptr – [in] Array of coordinate values.
C – [out] Coordinate array index number, where 1 ≤ C ≤ ncoords.
- Returns:
Error status.
-
int cg_coord_general_write(int fn, int B, int Z, const char *coordname, DataType_t s_type, const cgsize_t *s_rmin, const cgsize_t *s_rmax, DataType_t m_type, int m_numdim, const cgsize_t *m_dimvals, const cgsize_t *m_rmin, const cgsize_t *m_rmax, const void *coord_ptr, int *C)#
Write shaped array to a subset of grid coordinates.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
s_type – [in] Data type of the coordinate array written to the file. Admissible data types for a coordinate array are RealSingle and RealDouble.
m_type – [in] Data type of an array in memory. Admissible data types for a coordinate array are RealSingle and RealDouble.
s_rmin – [in] Lower range index in file (eg., imin, jmin, kmin).
s_rmax – [in] Upper range index in file (eg., imax, jmax, kmax).
m_numdim – [in] Number of dimensions of the array in memory.
m_dimvals – [in] Dimensions of array in memory.
m_rmin – [in] Lower range index in memory (eg., imin, jmin, kmin).
m_rmax – [in] Upper range index in memory (eg., imax, jmax, kmax).
coord_ptr – [in] Array of coordinate values.
C – [out] Coordinate array index number, where 1 ≤ C ≤ ncoords.
- Returns:
Error status.
Element Connectivity#
Node: Elements_t
(SIDS,
File Mapping)
-
int cg_nsections(int fn, int B, int Z, int *nsections)#
Get the number of element sections.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
nsections – [out] Number of element sections.
- Returns:
Error status.
-
int cg_section_read(int fn, int B, int Z, int S, char *SectionName, ElementType_t *type, cgsize_t *start, cgsize_t *end, int *nbndry, int *parent_flag)#
Get info for an element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
type – [in] Type of element. See the eligible types for ElementType_t in the Typedefs section.
SectionName – [out] Name of the Elements_t node.
start – [out] Index of the first element in the section.
end – [out] Index of the last element in the section.
nbndry – [out] Index of last boundary element in the section. Set to zero if the elements are unsorted.
parent_flag – [out] Flag indicating if the parent data are defined. If the parent data exists, parent_flag is set to 1; otherwise, it is set to 0.
- Returns:
Error status.
-
int cg_section_write(int fn, int B, int Z, const char *SectionName, ElementType_t type, cgsize_t start, cgsize_t end, int nbndry, const cgsize_t *elements, int *S)#
Write fixed-size element data.
This writing function only works with fixed-size elements.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
type – [in] Type of element. See the eligible types for ElementType_t in the Typedefs section.
SectionName – [in] Name of the Elements_t node.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
nbndry – [in] Index of last boundary element in the section. Set to zero if the elements are unsorted.
elements – [in] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
S – [out] Element section index, where 1 ≤ S ≤ nsections.
- Returns:
Error status.
-
int cg_poly_section_write(int fn, int B, int Z, const char *SectionName, ElementType_t type, cgsize_t start, cgsize_t end, int nbndry, const cgsize_t *elements, const cgsize_t *connect_offset, int *S)#
Write element data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
type – [in] Type of element. See the eligible types for ElementType_t in the Typedefs section.
SectionName – [in] Name of the Elements_t node.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
nbndry – [in] Index of last boundary element in the section. Set to zero if the elements are unsorted.
elements – [in] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
connect_offset – [in] Element connectivity offset data. This is required for NGON_n, NFACE_n and MIXED according to Elements_t Structure Definition.
S – [out] Element section index, where 1 ≤ S ≤ nsections.
- Returns:
Error status.
-
int cg_section_partial_write(int fn, int B, int Z, const char *SectionName, ElementType_t type, cgsize_t start, cgsize_t end, int nbndry, int *S)#
Write subset of element data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
type – [in] Type of element. See the eligible types for ElementType_t in the Typedefs section.
SectionName – [in] Name of the Elements_t node.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
nbndry – [in] Index of last boundary element in the section. Set to zero if the elements are unsorted.
S – [out] Element section index, where 1 ≤ S ≤ nsections.
- Returns:
Error status.
-
int cg_section_general_write(int fn, int B, int Z, const char *SectionName, const ElementType_t type, const DataType_t elementDataType, cgsize_t start, cgsize_t end, cgsize_t elementDataSize, int nbndry, int *S)#
Write section data without element data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
type – [in] Type of element. See the eligible types for ElementType_t in the Typedefs section.
elementDataType – [in] Data type of an array. Admissible data types are Integer and LongInteger.
SectionName – [in] Name of the Elements_t node.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
elementDataSize – [in] Number of element connectivity data values.
nbndry – [in] Index of last boundary element in the section. Set to zero if the elements are unsorted.
S – [out] Element section index, where 1 ≤ S ≤ nsections.
- Returns:
Error status.
-
int cg_section_initialize(int fn, int B, int Z, int S)#
Initialize element data for not fixed size elements.
This function is a kind of helper to be used after a cg_section_general_write(). cg_section_general_write() reserves enough space while this function puts coherent init data. Then cg_poly_elements_partial_write() would run safely.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [out] Element section index, where 1 ≤ S ≤ nsections.
- Returns:
Error status.
-
int cg_ElementDataSize(int fn, int B, int Z, int S, cgsize_t *ElementDataSize)#
Get size of element connectivity data array.
This function was created for revision 1.2 to return the size of the connectivity vector, which can’t be known without it when type=MIXED.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
ElementDataSize – [out] Number of element connectivity data values.
- Returns:
Error status.
-
int cg_ElementPartialSize(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, cgsize_t *ElementDataSize)#
Get size of element connectivity data array for partial read.
This function was created for revision 1.2 to return the size of the connectivity vector, which can’t be known without it when type=MIXED.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
ElementDataSize – [out] Number of element connectivity data values.
- Returns:
Error status.
-
int cg_elements_read(int fn, int B, int Z, int S, cgsize_t *elements, cgsize_t *parent_data)#
Read fixed size element data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
elements – [out] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
parent_data – [out] 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.
- Returns:
Error status.
-
int cg_poly_elements_read(int fn, int B, int Z, int S, cgsize_t *elements, cgsize_t *connect_offset, cgsize_t *parent_data)#
Read element data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
elements – [out] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
connect_offset – [out] Element connectivity offset data. This is required for NGON_n, NFACE_n and MIXED according to Elements_t Structure Definition.
parent_data – [out] 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.
- Returns:
Error status.
-
int cg_elements_partial_read(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, cgsize_t *elements, cgsize_t *parent_data)#
Read subset of fixed size element data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
elements – [out] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
parent_data – [out] 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.
- Returns:
Error status.
-
int cg_elements_general_read(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, DataType_t m_type, void *elements)#
Read subset of fixed size element data to a typed array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
m_type – [in] Data type of an array in memory. Admissible data types are Integer and LongInteger.
elements – [out] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
- Returns:
Error status.
-
int cg_parent_elements_general_read(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, DataType_t m_type, void *ParentElement)#
Read parent info for an element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
m_type – [in] Data type of an array in memory. Admissible data types are Integer and LongInteger.
ParentElement – [out] For boundary or interface elements, this array contains information on the cell(s) sharing the element.
- Returns:
Error status.
-
int cg_parent_elements_position_general_read(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, DataType_t m_type, void *ParentFace)#
Read parent position info for an element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
m_type – [in] Data type of an array in memory. Admissible data types are Integer and LongInteger.
ParentFace – [out] For boundary or interface elements, this array contains information on the cell face(s) sharing the element.
- Returns:
Error status.
-
int cg_poly_elements_partial_read(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, cgsize_t *elements, cgsize_t *connect_offset, cgsize_t *parent_data)#
Read subset of element data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
elements – [out] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
connect_offset – [out] Element connectivity offset data. This is required for NGON_n, NFACE_n and MIXED according to Elements_t Structure Definition.
parent_data – [out] 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.
- Returns:
Error status.
-
int cg_poly_elements_general_read(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, DataType_t m_type, void *elements, void *connect_offset)#
Read subset of element data to typed arrays.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
m_type – [in] Data type of an array in memory. Admissible data types are Integer and LongInteger.
elements – [out] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
connect_offset – [out] Element connectivity offset data. This is required for NGON_n, NFACE_n and MIXED according to Elements_t Structure Definition.
- Returns:
Error status.
-
int cg_elements_partial_write(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, const cgsize_t *elements)#
Write element data for a fixed-size element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
elements – [in] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
- Returns:
Error status.
-
int cg_elements_general_write(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, const DataType_t m_type, const void *elements)#
Write element data for a fixed-size element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
m_type – [in] Data type of an array in memory. Admissible data types are Integer and LongInteger.
elements – [in] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
- Returns:
Error status.
-
int cg_poly_elements_partial_write(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, const cgsize_t *elements, const cgsize_t *connect_offset)#
Write element data for an element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
elements – [in] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
connect_offset – [in] Element connectivity offset data. This is required for NGON_n, NFACE_n and MIXED according to Elements_t Structure Definition.
- Returns:
Error status.
-
int cg_poly_elements_general_write(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, const DataType_t m_type, const void *elements, const void *input_connect_offset)#
Write element data for an element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
m_type – [in] Data type of an array in memory. Admissible data types are Integer and LongInteger.
elements – [in] Element connectivity data. The element connectivity order is given in Element Numbering Conventions.
input_connect_offset – [in] Element connectivity offset data. This is required for NGON_n, NFACE_n and MIXED according to Elements_t Structure Definition.
- Returns:
Error status.
-
int cg_parent_data_write(int fn, int B, int Z, int S, const cgsize_t *parent_data)#
Write parent info for an element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
parent_data – [in] 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.
- Returns:
Error status.
-
int cg_parent_data_partial_write(int fn, int B, int Z, int S, cgsize_t start, cgsize_t end, const cgsize_t *parent_data)#
Write a subset of parent info for an element section.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Element section index, where 1 ≤ S ≤ nsections.
start – [in] Index of the first element in the section.
end – [in] Index of the last element in the section.
parent_data – [in] 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.
- Returns:
Error status.
-
int cg_npe(ElementType_t type, int *npe)#
Get the number of nodes for an element type.
- Parameters:
type – [in] Type of element. See the eligible types for ElementType_t in the Typedefs section.
npe – [out] Number of nodes for an element of type type.
- Returns:
Error status.
Axisymmetry#
Node: Axisymmetry_t
-
int cg_axisym_read(int fn, int B, float *ref_point, float *axis)#
Read Axisymmetry_t node.
This node can only be used for a bi-dimensional model, i.e., PhysicalDimension must equal two.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
ref_point – [out] Origin used for defining the axis of rotation. (In Fortran, this is an array of Real*4 values.)
axis – [out] Direction cosines of the axis of rotation, through the reference point. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
-
int cg_axisym_write(int fn, int B, float const *ref_point, float const *axis)#
Create axisymmetry data.
Axisymmetry_t node can only be used for a bi-dimensional model, i.e., PhysicalDimension must equal two.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
ref_point – [in] Origin used for defining the axis of rotation. (In Fortran, this is an array of Real*4 values.)
axis – [in] Direction cosines of the axis of rotation, through the reference point. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
Rotating Coordinates#
Node: RotatingCoordinates_t
-
int cg_rotating_read(float *rot_rate, float *rot_center)#
Read rotating coordinates data.
- Parameters:
rot_rate – [out] Components of the angular velocity of the grid about the center of rotation. (In Fortran, this is an array of Real*4 values.)
rot_center – [out] Coordinates of the center of rotation. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
-
int cg_rotating_write(float const *rot_rate, float const *rot_center)#
Create rotating coordinates data.
- Parameters:
rot_rate – [in] Components of the angular velocity of the grid about the center of rotation. (In Fortran, this is an array of Real*4 values.)
rot_center – [in] Coordinates of the center of rotation. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
Solution Data#
Flow Solution#
Node: FlowSolution_t
-
int cg_nsols(int fn, int B, int Z, int *nsols)#
Get the number of FlowSolution_t nodes.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
nsols – [out] Number of flow solutions for zone Z.
- Returns:
Error status.
-
int cg_sol_info(int fn, int B, int Z, int S, char *solname, GridLocation_t *location)#
Get information about a FlowSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
solname – [out] Name of the flow solution.
location – [out] Grid location where the solution is recorded. The current permissible locations are Vertex, CellCenter, IFaceCenter, JFaceCenter, and KFaceCenter.
- Returns:
Error status.
-
int cg_sol_id(int fn, int B, int Z, int S, double *sol_id)#
Get ADF Solution ID number (address) of node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
sol_id – [out] ADF Solution ID number (address) of node.
- Returns:
Error status.
-
int cg_sol_write(int fn, int B, int Z, const char *solname, GridLocation_t location, int *S)#
Create and/or write to a FlowSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
solname – [in] Name of the flow solution.
location – [in] Grid location where the solution is recorded. The current permissible locations are Vertex, CellCenter, IFaceCenter, JFaceCenter, and KFaceCenter.
S – [out] Flow solution index number, where 1 ≤ S ≤ nsols.
- Returns:
Error status.
-
int cg_sol_size(int fn, int B, int Z, int S, int *data_dim, cgsize_t *dim_vals)#
Get the dimensions of a FlowSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
data_dim – [out] Number of dimensions defining the solution data. If a point set has been defined, this will be 1, otherwise this will be the current zone index dimension.
dim_vals – [out] The array of data_dim dimensions for the solution data.
- Returns:
Error status.
-
int cg_sol_ptset_info(int fn, int B, int Z, int S, PointSetType_t *ptset_type, cgsize_t *npnts)#
Get info about a point set FlowSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
ptset_type – [out] Type of point set defining the interface in the current solution; either PointRange or PointList.
npnts – [out] Number of points defining the interface in the current solution. For a ptset_type of PointRange,
npnts
is always two. For a ptset_type of PointList,npnts
is the number of points in the PointList.
- Returns:
Error status.
-
int cg_sol_ptset_read(int fn, int B, int Z, int S, cgsize_t *pnts)#
Read a point set FlowSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
pnts – [out] Array of points defining the interface in the current solution.
- Returns:
Error status.
-
int cg_sol_ptset_write(int fn, int B, int Z, const char *solname, GridLocation_t location, PointSetType_t ptset_type, cgsize_t npnts, const cgsize_t *pnts, int *S)#
Create a point set FlowSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
solname – [in] Name of the flow solution.
location – [in] Grid location where the solution is recorded. The permissible locations are Vertex, CellCenter, IFaceCenter, JFaceCenter, and KFaceCenter.
ptset_type – [in] Type of point set defining the interface in the current solution; either PointRange or PointList.
npnts – [in] Number of points defining the interface in the current solution. For a ptset_type of PointRange,
npnts
is always two. For a ptset_type of PointList,npnts
is the number of points in the PointList.pnts – [in] Array of points defining the interface in the current solution.
S – [out] Flow solution index number, where 1 ≤ S ≤ nsols.
- Returns:
Error status.
Discrete Data#
Node: DiscreteData_t
-
int cg_ndiscrete(int fn, int B, int Z, int *ndiscrete)#
Get the number of
DiscreteData_t
nodes.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
ndiscrete – [out] Number of
DiscreteData_t
data structures under zone Z.
- Returns:
Error status.
-
int cg_discrete_read(int fn, int B, int Z, int D, char *discrete_name)#
Get the name of
DiscreteData_t
node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
D – [in] Discrete data index number, where 1 ≤ D ≤ ndiscrete.
discrete_name – [out] Name of
DiscreteData_t
data structures.
- Returns:
Error status.
-
int cg_discrete_write(int fn, int B, int Z, const char *discrete_name, int *D)#
Create a
DiscreteData_t
node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
discrete_name – [in] Name of
DiscreteData_t
data structures.D – [out] Discrete data index number, where 1 ≤ D ≤ ndiscrete.
- Returns:
Error status.
-
int cg_discrete_size(int fn, int B, int Z, int D, int *data_dim, cgsize_t *dim_vals)#
Get the dimensions of
DiscreteData_t
node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
D – [in] Discrete data index number, where 1 ≤ D ≤ ndiscrete.
data_dim – [out] Number of dimensions defining the discrete data. If a point set has been defined, this will be 1, otherwise this will be the current zone index dimension.
dim_vals – [out] The array of data_dim dimensions for the discrete data.
- Returns:
Error status.
-
int cg_discrete_ptset_info(int fn, int B, int Z, int D, PointSetType_t *ptset_type, cgsize_t *npnts)#
Get info about a point set
DiscreteData_t
node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
D – [in] Discrete data index number, where 1 ≤ D ≤ ndiscrete.
ptset_type – [out] Type of point set defining the interface for the discrete data; either PointRange or PointList.
npnts – [out] Number of points defining the interface for the discrete data. For a ptset_type of PointRange,
npnts
is always two. For a ptset_type of PointList,npnts
is the number of points in the list.
- Returns:
Error status.
-
int cg_discrete_ptset_read(int fn, int B, int Z, int D, cgsize_t *pnts)#
Read a point set
DiscreteData_t
node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
D – [in] Discrete data index number, where 1 ≤ D ≤ ndiscrete.
pnts – [out] Array of points defining the interface for the discrete data.
- Returns:
Error status.
-
int cg_discrete_ptset_write(int fn, int B, int Z, const char *discrete_name, GridLocation_t location, PointSetType_t ptset_type, cgsize_t npnts, const cgsize_t *pnts, int *D)#
Create a point set
DiscreteData_t
node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
discrete_name – [in] Name of
DiscreteData_t
data structures.location – [in] Grid location where the discrete data is recorded. The permissible locations are Vertex, CellCenter, IFaceCenter, JFaceCenter, and KFaceCenter.
ptset_type – [in] Type of point set defining the interface for the discrete data; either PointRange or PointList.
npnts – [in] Number of points defining the interface for the discrete data. For a
ptset_type
of PointRange,npnts
is always two. For aptset_type
of PointList,npnts
is the number of points in the list.pnts – [in] Array of points defining the interface for the discrete data.
D – [out] Discrete data index number, where 1 ≤ D ≤ ndiscrete.
- Returns:
Error status.
Zone Subregions#
Node: ZoneSubRegion_t
-
int cg_nsubregs(int fn, int B, int Z, int *nsubregs)#
Get the number of ZoneSubRegion_t nodes.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
nsubregs – [out] Number of ZoneSubRegion_t nodes under Zone Z.
- Returns:
Error status.
-
int cg_subreg_info(int fn, int B, int Z, int S, char *regname, int *dimension, GridLocation_t *location, PointSetType_t *ptset_type, cgsize_t *npnts, int *bcname_len, int *gcname_len)#
Get info about a ZoneSubRegion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] ZoneSubRegion index number, where 1 ≤ S ≤ nsubregs.
regname – [out] Name of the ZoneSubRegion_t node.
dimension – [out] Dimensionality of the subregion, 1 for lines, 2 for faces, 3 for volumes.
location – [out] Grid location used in the definition of the point set. The currently admissible locations are Vertex and CellCenter.
ptset_type – [out] Type of point set defining the interface for the subregion data; either PointRange or PointList.
npnts – [out] Number of points defining the interface for the subregion data. For a
ptset_type
of PointRange,npnts
is always two. For aptset_type
of PointList,npnts
is the number of points in the PointList.bcname_len – [out] String length of bcname.
gcname_len – [out] String length of gcname.
- Returns:
Error status.
-
int cg_subreg_ptset_read(int fn, int B, int Z, int S, cgsize_t *pnts)#
Read point set data for a ZoneSubRegion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] ZoneSubRegion index number, where 1 ≤ S ≤ nsubregs.
pnts – [out] Array of points defining the interface for the subregion data.
- Returns:
Error status.
-
int cg_subreg_bcname_read(int fn, int B, int Z, int S, char *bcname)#
Read the BC_t node name for a ZoneSubRegion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] ZoneSubRegion index number, where 1 ≤ S ≤ nsubregs.
bcname – [out] The name of a BC_t node which defines the subregion.
- Returns:
Error status.
-
int cg_subreg_gcname_read(int fn, int B, int Z, int S, char *gcname)#
Read the GridConnectivity_t node name for a ZoneSubRegion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
S – [in] ZoneSubRegion index number, where 1 ≤ S ≤ nsubregs.
gcname – [out] The name of a GridConnectivity_t or GridConnectivity1to1_t node which defines the subregion.
- Returns:
Error status.
-
int cg_subreg_ptset_write(int fn, int B, int Z, const char *regname, int dimension, GridLocation_t location, PointSetType_t ptset_type, cgsize_t npnts, const cgsize_t *pnts, int *S)#
Create a point set ZoneSubRegion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
regname – [in] Name of the ZoneSubRegion_t node.
dimension – [in] Dimensionality of the subregion, 1 for lines, 2 for faces, 3 for volumes.
location – [in] Grid location used in the definition of the point set. The currently admissible locations are Vertex and CellCenter.
ptset_type – [in] Type of point set defining the interface for the subregion data; either PointRange or PointList.
npnts – [in] Number of points defining the interface for the subregion data. For a
ptset_type
of PointRange,npnts
is always two. For aptset_type
of PointList,npnts
is the number of points in the PointList.pnts – [in] Array of points defining the interface for the subregion data.
S – [out] ZoneSubRegion index number, where 1 ≤ S ≤ nsubregs.
- Returns:
Error status.
-
int cg_subreg_bcname_write(int fn, int B, int Z, const char *regname, int dimension, const char *bcname, int *S)#
Create a ZoneSubRegion_t node that references a BC_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
regname – [in] Name of the ZoneSubRegion_t node.
dimension – [in] Dimensionality of the subregion, 1 for lines, 2 for faces, 3 for volumes.
bcname – [in] The name of a BC_t node which defines the subregion.
S – [out] ZoneSubRegion index number, where 1 ≤ S ≤ nsubregs.
- Returns:
Error status.
-
int cg_subreg_gcname_write(int fn, int B, int Z, const char *regname, int dimension, const char *gcname, int *S)#
Create a ZoneSubRegion_t node that references a GridConnectivity_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
regname – [in] Name of the ZoneSubRegion_t node.
dimension – [in] Dimensionality of the subregion, 1 for lines, 2 for faces, 3 for volumes.
gcname – [in] The name of a GridConnectivity_t or GridConnectivity1to1_t node which defines the subregion.
S – [out] ZoneSubRegion index number, where 1 ≤ S ≤ nsubregs.
- Returns:
Error status.
Grid Connectivity#
One-to-One Connectivity#
Node: GridConnectivity1to1_t
-
int cg_n1to1(int fn, int B, int Z, int *n1to1)#
Get number of 1-to-1 interfaces in a zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
n1to1 – [out] Number of one-to-one interfaces in zone Z, stored under GridConnectivity1to1_t nodes. (I.e., this does not include one-to-one interfaces that may be stored under GridConnectivity_t nodes, used for generalized zone interfaces.)
- Returns:
Error status.
-
int cg_n1to1_global(int fn, int B, int *n1to1_global)#
Get total number of 1-to-1 interfaces in a database.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
n1to1_global – [in] Total number of one-to-one interfaces in base B, stored under GridConnectivity1to1_t nodes. (I.e., this does not include one-to-one interfaces that may be stored under GridConnectivity_t nodes, used for generalized zone interfaces.) Note that the function cg_n1to1 (described below) may be used to get the number of one-to-one interfaces in a specific zone.
- Returns:
Error status.
-
int cg_1to1_read(int fn, int B, int Z, int J, char *connectname, char *donorname, cgsize_t *range, cgsize_t *donor_range, int *transform)#
Read 1-to-1 connectivity data for a zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Interface index number, where 1 ≤ J ≤ n1to1.
connectname – [out] Name of the interface.
donorname – [out] Name of the zone interfacing with the current zone.
range – [out] Range of points for the current zone.
donor_range – [out] Range of points for the donor zone.
transform – [out] Shorthand notation for the transformation matrix defining the relative orientation of the two zones.
- Returns:
Error status.
-
int cg_1to1_read_global(int fn, int B, char **connectname, char **zonename, char **donorname, cgsize_t **range, cgsize_t **donor_range, int **transform)#
Read data for all 1-to-1 interfaces in a database.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
connectname – [out] Name of the interface.
zonename – [out] Name of the first zone, for all one-to-one interfaces in base B.
donorname – [out] Name of the second zone, for all one-to-one interfaces in base B.
range – [out] Range of points for the first zone, for all one-to-one interfaces in base B.
donor_range – [out] Range of points for the current zone, for all one-to-one interfaces in base B.
transform – [out] Shorthand notation for the transformation matrix defining the relative orientation of the two zones. This transformation is given for all one-to-one interfaces in base B.
- Returns:
Error status.
-
int cg_1to1_write(int fn, int B, int Z, const char *connectname, const char *donorname, const cgsize_t *range, const cgsize_t *donor_range, const int *transform, int *J)#
Write 1-to-1 connectivity data for a zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
connectname – [in] Name of the interface.
donorname – [in] Name of the zone interfacing with the current zone.
range – [in] Range of points for the current zone.
donor_range – [in] Range of points for the donor zone.
transform – [in] Shorthand notation for the transformation matrix defining the relative orientation of the two zones.
J – [out] Interface index number, where 1 ≤ J ≤ n1to1.
- Returns:
Error status.
Generalized Connectivity#
Node: GridConnectivity_t
-
int cg_nconns(int fn, int B, int Z, int *nconns)#
Get the number of generalized connectivity interfaces in a zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
nconns – [out] Number of interfaces for zone Z.
- Returns:
Error status.
-
int cg_conn_info(int fn, int B, int Z, int J, char *connectname, GridLocation_t *location, GridConnectivityType_t *connect_type, PointSetType_t *ptset_type, cgsize_t *npnts, char *donorname, ZoneType_t *donor_zonetype, PointSetType_t *donor_ptset_type, DataType_t *donor_datatype, cgsize_t *ndata_donor)#
Get info about a generalized connectivity interface.
In cg_conn_info, donor_datatype is useless starting with version 1.27, because it’s always I4. However, this arg. is left for backward compatibility of API and to be able to read old files
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Interface index number, where 1 ≤ J ≤ nconns.
connectname – [out] Name of the interface.
location – [out] Grid location used in the definition of the point set. The currently admissible locations are Vertex and CellCenter.
connect_type – [out] Type of interface being defined. The admissible types are Overset, Abutting, and Abutting1to1.
ptset_type – [out] Type of point set defining the interface in the current zone; either PointRange or PointList.
npnts – [out] Number of points defining the interface in the current zone. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points in the PointList.
donorname – [out] Name of the zone interfacing with the current zone.
donor_zonetype – [out] Type of the donor zone. The admissible types are Structured and Unstructured.
donor_ptset_type – [out] Type of point set defining the interface in the donor zone; either PointListDonor or CellListDonor.
donor_datatype – [out] Data type in which the donor points are stored in the file. As of Version 3.0, this value is ignored when writing, and on reading, it will return either Integer or LongInteger depending on whether the file was written using 32 or 64-bit. The donor_datatype argument was left in these functions only for backward compatibility. The donor data is always read as cgsize_t.
ndata_donor – [out] Number of points or cells in the current zone. These are paired with points, cells, or fractions thereof in the donor zone.
- Returns:
Error status.
-
int cg_conn_read(int fn, int B, int Z, int J, cgsize_t *pnts, DataType_t donor_datatype, cgsize_t *donor_data)#
Read generalized connectivity data.
In cg_conn_read, donor_datatype is useless starting with version 1.27, because it’s always I4. However, this arg. is left for backward compatibility of API and to be able to read old files
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Interface index number, where 1 ≤ J ≤ nconns.
pnts – [out] Array of points defining the interface in the current zone.
donor_datatype – [out] Data type in which the donor points are stored in the file. As of Version 3.0, this value is ignored when writing, and on reading, it will return either Integer or LongInteger depending on whether the file was written using 32 or 64-bit. The donor_datatype argument was left in these functions only for backward compatibility. The donor data is always read as cgsize_t.
donor_data – [out] Array of donor points or cells corresponding to ndata_donor. Note that it is possible that the same donor point or cell may be used multiple times.
- Returns:
Error status.
-
int cg_conn_read_short(int fn, int B, int Z, int J, cgsize_t *pnts)#
Read generalized connectivity data without donor information.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Interface index number, where 1 ≤ J ≤ nconns.
pnts – [out] Array of points defining the interface in the current zone.
- Returns:
Error status.
-
int cg_conn_write(int fn, int B, int Z, const char *connectname, GridLocation_t location, GridConnectivityType_t connect_type, PointSetType_t ptset_type, cgsize_t npnts, const cgsize_t *pnts, const char *donorname, ZoneType_t donor_zonetype, PointSetType_t donor_ptset_type, DataType_t donor_datatype, cgsize_t ndata_donor, const cgsize_t *donor_data, int *J)#
Write generalized connectivity data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
connectname – [in] Name of the interface.
location – [in] Grid location used in the definition of the point set. The currently admissible locations are Vertex and CellCenter.
connect_type – [in] Type of interface being defined. The admissible types are Overset, Abutting, and Abutting1to1.
ptset_type – [in] Type of point set defining the interface in the current zone; either PointRange or PointList.
npnts – [in] Number of points defining the interface in the current zone. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points in the PointList.
pnts – [in] Array of points defining the interface in the current zone.
donorname – [in] Name of the zone interfacing with the current zone.
donor_zonetype – [in] Type of the donor zone. The admissible types are Structured and Unstructured.
donor_ptset_type – [in] Type of point set defining the interface in the donor zone; either PointListDonor or CellListDonor.
donor_datatype – [in] Data type in which the donor points are stored in the file. As of Version 3.0, this value is ignored when writing, and on reading it will return either Integer or LongInteger depending on whether the file was written using 32 or 64-bit. The donor_datatype argument was left in these functions only for backward compatibility. The donor data is always read as cgsize_t.
ndata_donor – [in] Number of points or cells in the current zone. These are paired with points, cells, or fractions thereof in the donor zone.
donor_data – [in] Array of donor points or cells corresponding to ndata_donor. Note that it is possible that the same donor point or cell may be used multiple times.
J – [out] Interface index number, where 1 ≤ J ≤ nconns.
- Returns:
Error status.
-
int cg_conn_write_short(int fn, int B, int Z, const char *connectname, GridLocation_t location, GridConnectivityType_t connect_type, PointSetType_t ptset_type, cgsize_t npnts, const cgsize_t *pnts, const char *donorname, int *J)#
Write generalized connectivity data without donor information.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
connectname – [in] Name of the interface.
location – [in] Grid location used in the definition of the point set. The currently admissible locations are Vertex and CellCenter.
connect_type – [in] Type of interface being defined. The admissible types are Overset, Abutting, and Abutting1to1.
ptset_type – [in] Type of point set defining the interface in the current zone; either PointRange or PointList.
npnts – [in] Number of points defining the interface in the current zone. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points in the PointList.
pnts – [in] Array of points defining the interface in the current zone.
donorname – [in] Name of the zone interfacing with the current zone.
J – [out] Interface index number, where 1 ≤ J ≤ nconns.
- Returns:
Error status.
Special Grid Connectivity Properties#
Node: GridConnectivityProperty_t
-
int cg_conn_periodic_read(int fn, int B, int Z, int J, float *RotationCenter, float *RotationAngle, float *Translation)#
Read data for periodic interface.
The “read” functions will return with
ier
= 2 = CG_NODE_NOT_FOUND if the requested connectivity property, or the GridConnectivityProperty_t node itself, doesn’t exist.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Grid connectivity index number, where 1 ≤ J ≤ nconns for the “cg_conn” functions, and 1 ≤ J ≤ n1to1 for the “cg_1to1” functions.
RotationCenter – [out] An array of size phys_dim defining the coordinates of the origin for defining the rotation angle between the periodic interfaces. (phys_dim is the number of coordinates required to define a vector in the field.) (In Fortran, this is an array of Real*4 values.)
RotationAngle – [out] An array of size phys_dim defining the rotation angle from the current interface to the connecting interface. If rotating about more than one axis, the rotation is performed first about the x-axis, then the y-axis, then the z-axis. (In Fortran, this is an array of Real*4 values.)
Translation – [out] An array of size phys_dim defining the translation from the current interface to the connecting interface. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
-
int cg_conn_periodic_write(int fn, int B, int Z, int J, float const *RotationCenter, float const *RotationAngle, float const *Translation)#
Write data for periodic interface.
The “write” functions will create the GridConnectivityProperty_t node if it doesn’t already exist, then add the appropriate connectivity property. Multiple grid connectivity properties may be recorded under the same GridConnectivityProperty_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Grid connectivity index number, where 1 ≤ J ≤ nconns for the “cg_conn” functions, and 1 ≤ J ≤ n1to1 for the “cg_1to1” functions.
RotationCenter – [in] An array of size phys_dim defining the coordinates of the origin for defining the rotation angle between the periodic interfaces. (phys_dim is the number of coordinates required to define a vector in the field.) (In Fortran, this is an array of Real*4 values.)
RotationAngle – [in] An array of size phys_dim defining the rotation angle from the current interface to the connecting interface. If rotating about more than one axis, the rotation is performed first about the x-axis, then the y-axis, then the z-axis. (In Fortran, this is an array of Real*4 values.)
Translation – [in] An array of size phys_dim defining the translation from the current interface to the connecting interface. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
-
int cg_conn_average_read(int fn, int B, int Z, int J, AverageInterfaceType_t *AverageInterfaceType)#
Read data for averaging interface.
The “read” functions will return with
ier
= 2 = CG_NODE_NOT_FOUND if the requested connectivity property, or the GridConnectivityProperty_t node itself, doesn’t exist.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Grid connectivity index number, where 1 ≤ J ≤ nconns for the “cg_conn” functions, and 1 ≤ J ≤ n1to1 for the “cg_1to1” functions.
AverageInterfaceType – [out] The type of averaging to be done. Valid types are CG_Null, CG_UserDefined, AverageAll, AverageCircumferential, AverageRadial, AverageI, AverageJ, and AverageK.
- Returns:
Error status.
-
int cg_conn_average_write(int fn, int B, int Z, int J, AverageInterfaceType_t AverageInterfaceType)#
Write data for averaging interface.
The “write” functions will create the GridConnectivityProperty_t node if it doesn’t already exist, then add the appropriate connectivity property. Multiple grid connectivity properties may be recorded under the same GridConnectivityProperty_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Grid connectivity index number, where 1 ≤ J ≤ nconns for the “cg_conn” functions, and 1 ≤ J ≤ n1to1 for the “cg_1to1” functions.
AverageInterfaceType – [in] The type of averaging to be done. Valid types are CG_Null, CG_UserDefined, AverageAll, AverageCircumferential, AverageRadial, AverageI, AverageJ, and AverageK.
- Returns:
Error status.
-
int cg_1to1_periodic_read(int fn, int B, int Z, int J, float *RotationCenter, float *RotationAngle, float *Translation)#
Read data for periodic interface.
The “read” functions will return with
ier
= 2 = CG_NODE_NOT_FOUND if the requested connectivity property, or the GridConnectivityProperty_t node itself, doesn’t exist.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Grid connectivity index number, where 1 ≤ J ≤ nconns for the “cg_conn” functions, and 1 ≤ J ≤ n1to1 for the “cg_1to1” functions.
RotationCenter – [out] An array of size phys_dim defining the coordinates of the origin for defining the rotation angle between the periodic interfaces. (phys_dim is the number of coordinates required to define a vector in the field.) (In Fortran, this is an array of Real*4 values.)
RotationAngle – [out] An array of size phys_dim defining the rotation angle from the current interface to the connecting interface. If rotating about more than one axis, the rotation is performed first about the x-axis, then the y-axis, then the z-axis. (In Fortran, this is an array of Real*4 values.)
Translation – [out] An array of size phys_dim defining the translation from the current interface to the connecting interface. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
-
int cg_1to1_periodic_write(int fn, int B, int Z, int J, float const *RotationCenter, float const *RotationAngle, float const *Translation)#
Write data for periodic interface.
The “write” functions will create the GridConnectivityProperty_t node if it doesn’t already exist, then add the appropriate connectivity property. Multiple grid connectivity properties may be recorded under the same GridConnectivityProperty_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Grid connectivity index number, where 1 ≤ J ≤ nconns for the “cg_conn” functions, and 1 ≤ J ≤ n1to1 for the “cg_1to1” functions.
RotationCenter – [in] An array of size phys_dim defining the coordinates of the origin for defining the rotation angle between the periodic interfaces. (phys_dim is the number of coordinates required to define a vector in the field.) (In Fortran, this is an array of Real*4 values.)
RotationAngle – [in] An array of size phys_dim defining the rotation angle from the current interface to the connecting interface. If rotating about more than one axis, the rotation is performed first about the x-axis, then the y-axis, then the z-axis. (In Fortran, this is an array of Real*4 values.)
Translation – [in] An array of size phys_dim defining the translation from the current interface to the connecting interface. (In Fortran, this is an array of Real*4 values.)
- Returns:
Error status.
-
int cg_1to1_average_read(int fn, int B, int Z, int J, AverageInterfaceType_t *AverageInterfaceType)#
Read data for averaging interface.
The “read” functions will return with
ier
= 2 = CG_NODE_NOT_FOUND if the requested connectivity property, or the GridConnectivityProperty_t node itself, doesn’t exist.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Grid connectivity index number, where 1 ≤ J ≤ nconns for the “cg_conn” functions, and 1 ≤ J ≤ n1to1 for the “cg_1to1” functions.
AverageInterfaceType – [out] The type of averaging to be done. Valid types are CG_Null, CG_UserDefined, AverageAll, AverageCircumferential, AverageRadial, AverageI, AverageJ, and AverageK.
- Returns:
Error status.
-
int cg_1to1_average_write(int fn, int B, int Z, int J, AverageInterfaceType_t AverageInterfaceType)#
Write data for averaging interface.
The “write” functions will create the GridConnectivityProperty_t node if it doesn’t already exist, then add the appropriate connectivity property. Multiple grid connectivity properties may be recorded under the same GridConnectivityProperty_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Grid connectivity index number, where 1 ≤ J ≤ nconns for the “cg_conn” functions, and 1 ≤ J ≤ n1to1 for the “cg_1to1” functions.
AverageInterfaceType – [in] The type of averaging to be done. Valid types are CG_Null, CG_UserDefined, AverageAll, AverageCircumferential, AverageRadial, AverageI, AverageJ, and AverageK.
- Returns:
Error status.
Overset Holes#
Node: OversetHoles_t
-
int cg_nholes(int fn, int B, int Z, int *nholes)#
Get the number of overset holes in a zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
nholes – [out] Number of overset holes in zone Z.
- Returns:
Error status.
-
int cg_hole_info(int fn, int B, int Z, int J, char *holename, GridLocation_t *location, PointSetType_t *ptset_type, int *nptsets, cgsize_t *npnts)#
Get info about an overset hole.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Overset hole index number, where 1 ≤ J ≤ nholes.
holename – [out] Name of the overset hole.
location – [out] Grid location used in the definition of the point set. The currently admissible locations are Vertex and CellCenter.
ptset_type – [out] The extent of the overset hole may be defined using a range of points or cells, or using a discrete list of all points or cells in the overset hole. If a range of points or cells is used, ptset_type is set to PointRange. When a discrete list of points or cells is used, ptset_type equals PointList.
nptsets – [out] Number of point sets used to define the hole. If ptset_type is PointRange, several point sets may be used. If ptset_type is PointList, only one point set is allowed.
npnts – [out] Number of points (or cells) in the point set. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points or cells in the PointList.
- Returns:
Error status.
-
int cg_hole_read(int fn, int B, int Z, int J, cgsize_t *pnts)#
Read overset hole data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
J – [in] Overset hole index number, where 1 ≤ J ≤ nholes.
pnts – [out] Array of points or cells in the point set.
- Returns:
Error status.
-
int cg_hole_write(int fn, int B, int Z, const char *holename, GridLocation_t location, PointSetType_t ptset_type, int nptsets, cgsize_t npnts, const cgsize_t *pnts, int *J)#
Write overset hole data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
holename – [in] Name of the overset hole.
location – [in] Grid location used in the definition of the point set. The currently admissible locations are Vertex and CellCenter.
ptset_type – [in] The extent of the overset hole may be defined using a range of points or cells, or using a discrete list of all points or cells in the overset hole. If a range of points or cells is used, ptset_type is set to PointRange. When a discrete list of points or cells is used, ptset_type equals PointList.
nptsets – [in] Number of point sets used to define the hole. If ptset_type is PointRange, several point sets may be used. If ptset_type is PointList, only one point set is allowed.
npnts – [in] Number of points (or cells) in the point set. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points or cells in the PointList.
pnts – [in] Array of points or cells in the point set.
J – [out] Overset hole index number, where 1 ≤ J ≤ nholes.
- Returns:
Error status.
Boundary Conditions#
Boundary Condition Type and Location#
Node: BC_t
-
int cg_nbocos(int fn, int B, int Z, int *nbocos)#
Get the number of boundary conditions in the zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
nbocos – [out] Number of boundary conditions in zone Z.
- Returns:
Error status.
-
int cg_boco_info(int fn, int B, int Z, int BC, char *boconame, BCType_t *bocotype, PointSetType_t *ptset_type, cgsize_t *npnts, int *NormalIndex, cgsize_t *NormalListSize, DataType_t *NormalDataType, int *ndataset)#
Get boundary condition info.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
boconame – [out] Name of the boundary condition.
bocotype – [out] Type of boundary condition defined. See the eligible types for BCType_t in the Typedefs section. Note that if
bocotype
is FamilySpecified the boundary condition type is being specified for the family to which the boundary belongs. The boundary condition type for the family may be read and written using cg_fambc_read() and cg_fambc_write().ptset_type – [out] The extent of the boundary condition may be defined using a range of points or elements using PointRange, or using a discrete list of all points or elements at which the boundary condition is applied using PointList. When the boundary condition is to be applied anywhere other than points, then GridLocation_t under the BC_t node must be used to indicate this. The value of GridLocation_t may be read or written by cg_boco_gridlocation_read() and cg_boco_gridlocation_write(). As in previous versions of the library, this may also be done by first using cg_goto() to access the BC_t node, then using cg_gridlocation_read() or cg_gridlocation_write().
npnts – [out] Number of points or elements defining the boundary condition region. For a ptset_type of PointRange,
npnts
is always two. For a ptset_type of PointList, npnts is the number of points or elements in the list.NormalIndex – [out] Index vector indicating the computational coordinate direction of the boundary condition patch normal.
NormalListSize – [out] If the normals are defined in NormalList, NormalListSize is the number of points in the patch times phys_dim, the number of coordinates required to define a vector in the field. If the normals are not defined in NormalList, NormalListSize is 0.
NormalDataType – [out] Data type used in defining the normals. Admissible data types for the normals are RealSingle and RealDouble.
ndataset – [out] Number of boundary condition datasets for the current boundary condition.
- Returns:
Error status.
-
int cg_boco_read(int fn, int B, int Z, int BC, cgsize_t *pnts, void *NormalList)#
Read boundary condition data and normals.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
pnts – [out] Array of point or element indices defining the boundary condition region. There should be npnts values, each of dimension IndexDimension (i.e., 1 for unstructured grids, and 2 or 3 for structured grids with 2-D or 3-D elements, respectively).
NormalList – [out] List of vectors normal to the boundary condition patch pointing into the interior of the zone.
- Returns:
Error status.
-
int cg_boco_gridlocation_read(int fn, int B, int Z, int BC, GridLocation_t *location)#
Read boundary condition location.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
location – [out] Grid location used in the definition of the point set. The currently admissible locations are Vertex (the default if not given), and CellCenter. Interpretation of CellCenter, and additional allowable values of grid location depends on the base cell dimension. For CellDim=1, CellCenter refers to line elements. For CellDim=2, CellCenter refers to area elements, and the additional value EdgeCenter is allowed. For CellDim=3, CellCenter refers to volume elements, and in addition to EdgeCenter, the values of FaceCenter, IFaceCenter, JFaceCenter, and KFaceCenter may be used.
- Returns:
Error status.
-
int cg_boco_write(int fn, int B, int Z, const char *boconame, BCType_t bocotype, PointSetType_t ptset_type, cgsize_t npnts, const cgsize_t *pnts, int *BC)#
Write boundary condition type and data.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
boconame – [in] Name of the boundary condition.
bocotype – [in] Type of boundary condition defined. See the eligible types for BCType_t in the Typedefs section. Note that if bocotype is FamilySpecified the boundary condition type is being specified for the family to which the boundary belongs. The boundary condition type for the family may be read and written using cg_fambc_read() and cg_fambc_write().
ptset_type – [in] The extent of the boundary condition may be defined using a range of points or elements using PointRange, or using a discrete list of all points or elements at which the boundary condition is applied using PointList. When the boundary condition is to be applied anywhere other than points, then GridLocation_t under the BC_t node must be used to indicate this. The value of GridLocation_t may be read or written by cg_boco_gridlocation_read() and cg_boco_gridlocation_write(). As in previous versions of the library, this may also be done by first using cg_goto() to access the BC_t node, then using cg_gridlocation_read() or cg_gridlocation_write().
npnts – [in] Number of points or elements defining the boundary condition region. For a ptset_type of PointRange,
npnts
is always two. For a ptset_type of PointList, npnts is the number of points or elements in the list.pnts – [in] Array of point or element indices defining the boundary condition region. There should be
npnts
values, each of dimension IndexDimension (i.e., 1 for unstructured grids, and 2 or 3 for structured grids with 2-D or 3-D elements, respectively).BC – [out] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
- Returns:
Error status.
-
int cg_boco_gridlocation_write(int fn, int B, int Z, int BC, GridLocation_t location)#
Write boundary condition location.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
location – [in] Grid location used in the definition of the point set. The currently admissible locations are Vertex (the default if not given), and CellCenter. Interpretation of CellCenter, and additional allowable values of grid location depends on the base cell dimension. For CellDim=1, CellCenter refers to line elements. For CellDim=2, CellCenter refers to area elements, and the additional value EdgeCenter is allowed. For CellDim=3, CellCenter refers to volume elements, and in addition to EdgeCenter, the values of FaceCenter, IFaceCenter, JFaceCenter, and KFaceCenter may be used.
- Returns:
Error status.
-
int cg_boco_normal_write(int fn, int B, int Z, int BC, const int *NormalIndex, int NormalListFlag, DataType_t NormalDataType, const void *NormalList)#
Write boundary condition normals.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
NormalIndex – [in] Index vector indicating the computational coordinate direction of the boundary condition patch normal.
NormalListFlag – [in] Flag indicating if the normals are defined in NormalList and are to be written out; 1 if they are defined, 0 if they’re not.
NormalDataType – [in] Data type used in defining the normals. Admissible data types for the normals are RealSingle and RealDouble.
NormalList – [in] List of vectors normal to the boundary condition patch pointing into the interior of the zone.
- Returns:
Error status.
Boundary Condition Datasets#
Node: BCDataSet_t
-
int cg_dataset_read(int fn, int B, int Z, int BC, int DSet, char *DatasetName, BCType_t *BCType, int *DirichletFlag, int *NeumannFlag)#
Read boundary condition dataset info.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
DSet – [in] Dataset index number, where 1 ≤ Dset ≤ ndataset.
DatasetName – [out] Name of dataset.
BCType – [out] Simple boundary condition type for the dataset. The supported types are listed in the table of Simple Boundary Condition Types in the SIDS manual, but note that FamilySpecified does not apply here.
DirichletFlag – [out] Flag indicating if the dataset contains Dirichlet data.
NeumannFlag – [out] Flag indicating if the dataset contains Neumann data.
- Returns:
Error status.
-
int cg_dataset_write(int fn, int B, int Z, int BC, const char *DatasetName, BCType_t BCType, int *Dset)#
Write boundary condition dataset info.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
DatasetName – [in] Name of dataset.
BCType – [in] Simple boundary condition type for the dataset. The supported types are listed in the table of Simple Boundary Condition Types in the SIDS manual, but note that FamilySpecified does not apply here.
Dset – [out] Dataset index number, where 1 ≤ Dset ≤ ndataset.
- Returns:
Error status.
-
int cg_bcdataset_info(int *n_dataset)#
Get the number of family boundary condition datasets.
The above functions apply to BCDataSet_t nodes that are used to define boundary conditions for a CFD family and thus are children of a FamilyBC_t node. The FamilyBC_t node must first be accessed using cg_goto().
- Parameters:
n_dataset – [out] Number of BCDataSet nodes under the current FamilyBC_t node.
- Returns:
Error status.
-
int cg_bcdataset_read(int index, char *name, BCType_t *BCType, int *DirichletFlag, int *NeumannFlag)#
Read family boundary condition dataset info.
The above functions apply to BCDataSet_t nodes that define boundary conditions for a CFD family and thus are children of a FamilyBC_t node. The FamilyBC_t node must first be accessed using cg_goto().
- Parameters:
index – [in] Dataset index number, where 1 ≤ index ≤ ndataset.
name – [out] Name of dataset.
BCType – [out] Simple boundary condition type for the dataset. The supported types are listed in the table of Simple Boundary Condition Types in the SIDS manual, but note that FamilySpecified does not apply here.
DirichletFlag – [out] Flag indicating if the dataset contains Dirichlet data.
NeumannFlag – [out] Flag indicating if the dataset contains Neumann data.
- Returns:
Error status.
-
int cg_bcdataset_write(const char *name, BCType_t BCType, BCDataType_t BCDataType)#
Write family boundary condition dataset info.
The above functions apply to BCDataSet_t nodes that define boundary conditions for a CFD family, and thus are children of a FamilyBC_t node. The FamilyBC_t node must first be accessed using cg_goto(). The first time cg_bcdataset_write() is called with a particular DatasetName, BCType, and BCDataType, a new BCDataSet_t node is created, with a child BCData_t node. Subsequent calls with the same DatasetName and BCType may be made to add additional BCData_t nodes, of type BCDataType, to the existing BCDataSet_t node.
- Parameters:
name – [in] Name of dataset.
BCType – [in] Simple boundary condition type for the dataset. The supported types are listed in the table of Simple Boundary Condition Types in the SIDS manual, but note that FamilySpecified does not apply here.
BCDataType – [in] Type of boundary condition in the dataset (i.e., for a BCData_t child node). Admissible types are Dirichlet and Neumann.
- Returns:
Error status.
Boundary Condition Data#
Node: BCData_t
-
int cg_bcdata_write(int fn, int B, int Z, int BC, int Dset, BCDataType_t BCDataType)#
Write boundary condition data.
To write the boundary condition data itself, after creating the BCData_t node using the function cg_bcdata_write(), use cg_goto() to access the node, then cg_array_write() to write the data. Note that when using cg_goto() to access a BCData_t node, the node index should be specified as either Dirichlet or Neumann, depending on the type of boundary condition. See the description of cg_goto() for details.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
Dset – [in] Dataset index number, where 1 ≤ Dset ≤ ndataset.
BCDataType – [in] Type of boundary condition in the dataset. Admissible boundary condition types are Dirichlet and Neumann.
- Returns:
Error status.
Special Boundary Condition Properties#
Node: BCProperty_t
-
int cg_bc_wallfunction_read(int fn, int B, int Z, int BC, WallFunctionType_t *WallFunctionType)#
Read wall function data.
The “read” functions will return with
ier
= 2 = CG_NODE_NOT_FOUND if the requested boundary condition property, or the BCProperty_t node itself, doesn’t exist.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
WallFunctionType – [out] The wall function type. Valid types are CG_Null, CG_UserDefined, and Generic.
- Returns:
Error status.
-
int cg_bc_wallfunction_write(int fn, int B, int Z, int BC, WallFunctionType_t WallFunctionType)#
Write wall function data.
The “write” functions will create the BCProperty_t node if it doesn’t already exist, then add the appropriate boundary condition property. Multiple boundary condition properties may be recorded under the same BCProperty_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
WallFunctionType – [in] The wall function type. Valid types are CG_Null, CG_UserDefined, and Generic.
- Returns:
Error status.
-
int cg_bc_area_read(int fn, int B, int Z, int BC, AreaType_t *AreaType, float *SurfaceArea, char *RegionName)#
Read area-related data.
The “read” functions will return with
ier
= 2 = CG_NODE_NOT_FOUND if the requested boundary condition property, or the BCProperty_t node itself, doesn’t exist.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
AreaType – [out] The type of area. Valid types are CG_Null, CG_UserDefined, BleedArea, and CaptureArea.
SurfaceArea – [out] The size of the area. (In Fortran, this is a Real*4 value.)
RegionName – [out] The name of the region, 32 characters max.
- Returns:
Error status.
-
int cg_bc_area_write(int fn, int B, int Z, int BC, AreaType_t AreaType, float SurfaceArea, const char *RegionName)#
Write area related data.
The “write” functions will create the BCProperty_t node if it doesn’t already exist, then add the appropriate boundary condition property. Multiple boundary condition properties may be recorded under the same BCProperty_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
BC – [in] Boundary condition index number, where 1 ≤ BC ≤ nbocos.
AreaType – [in] The type of area. Valid types are CG_Null, CG_UserDefined, BleedArea, and CaptureArea.
SurfaceArea – [in] The size of the area. (In Fortran, this is a Real*4 value.)
RegionName – [in] The region’s name, 32 characters max.
- Returns:
Error status.
Equation Specification#
Flow Equation Set#
Node: FlowEquationSet_t
-
int cg_equationset_read(int *EquationDimension, int *GoverningEquationsFlag, int *GasModelFlag, int *ViscosityModelFlag, int *ThermalConductivityModelFlag, int *TurbulenceClosureFlag, int *TurbulenceModelFlag)#
Read Flow equation set info.
- Parameters:
EquationDimension – [out] Dimensionality of the governing equations; it is the number of spatial variables describing the flow.
GoverningEquationsFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of the governing equations; 0 if it doesn’t, 1 if it does.
GasModelFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of a gas model; 0 if it doesn’t, 1 if it does.
ViscosityModelFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of a viscosity model; 0 if it doesn’t, 1 if it does.
ThermalConductivityModelFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of a thermal conductivity model; 0 if it doesn’t, 1 if it does.
TurbulenceClosureFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of the turbulence closure; 0 if it doesn’t, 1 if it does.
TurbulenceModelFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of a turbulence model; 0 if it doesn’t, 1 if it does.
- Returns:
Error status.
-
int cg_equationset_chemistry_read(int *ThermalRelaxationFlag, int *ChemicalKineticsFlag)#
Read chemistry equation set info.
- Parameters:
ThermalRelaxationFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of a thermal relaxation model; 0 if it doesn’t, 1 if it does.
ChemicalKineticsFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of a chemical kinetics model; 0 if it doesn’t, 1 if it does.
- Returns:
Error status.
-
int cg_equationset_elecmagn_read(int *ElecFldModelFlag, int *MagnFldModelFlag, int *ConductivityModelFlag)#
Read electromagnetic equation set info.
- Parameters:
ElecFldModelFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of an electric field model for electromagnetic flows; 0 if it doesn’t, 1 if it does.
MagnFldModelFlag – [out] Flag indicates whether this FlowEquationSet_t node includes the definition of a magnetic field model for electromagnetic flows; 0 if it doesn’t, 1 if it does.
ConductivityModelFlag – [out] Flag indicating whether or not this FlowEquationSet_t node includes the definition of a conductivity model for electromagnetic flows; 0 if it doesn’t, 1 if it does.
- Returns:
Error status.
-
int cg_equationset_write(int EquationDimension)#
Write dimensionality of flow equations.
- Parameters:
EquationDimension – [in] Dimensionality of the governing equations; it is the number of spatial variables describing the flow.
- Returns:
Error status.
Particle Equation Set#
Node: ParticleEquationSet_t
(SIDS,
File Mapping)
-
int cg_particle_equationset_read(int *EquationDimension, int *ParticleGoverningEquationsFlag, int *CollisionModelFlag, int *BreakupModelFlag, int *ForceModelFlag, int *WallInteractionModelFlag, int *PhaseChangeModelFlag)#
Read particle equation set info.
- Parameters:
EquationDimension – [out] Dimensionality of the governing equations; it is the number of spatial variables describing the flow.
ParticleGoverningEquationsFlag – [out] Flag indicates whether this ParticleEquationSet_t node includes the definition of the particle governing equations; 0 if it doesn’t, 1 if it does.
CollisionModelFlag – [out] Flag indicates whether or not this ParticleEquationSet_t node includes the definition of a collision model; 0 if it doesn’t, 1 if it does.
BreakupModelFlag – [out] Flag indicates whether this ParticleEquationSet_t node includes the definition of a breakup model; 0 if it doesn’t, 1 if it does.
ForceModelFlag – [out] Flag indicates whether or not this ParticleEquationSet_t node includes the definition of a force model; 0 if it doesn’t, 1 if it does.
WallInteractionModelFlag – [out] Flag indicates whether or not this ParticleEquationSet_t node includes the definition of a wall interaction model; 0 if it doesn’t, 1 if it does.
PhaseChangeModelFlag – [out] Flag indicates whether or not this ParticleEquationSet_t node includes the definition of a phase change model; 0 if it doesn’t, 1 if it does.
- Returns:
Error status.
-
int cg_particle_equationset_write(int EquationDimension)#
Write dimensionality of particle equations.
- Parameters:
EquationDimension – [in] Dimensionality of the governing equations; it is the number of spatial variables describing the particle flow.
- Returns:
Error status.
Governing Equations#
Node: GoverningEquations_t
-
int cg_governing_read(GoverningEquationsType_t *EquationsType)#
Read type of governing equation.
- Parameters:
EquationsType – [out] Type of governing equations. The admissible types are CG_Null, CG_UserDefined, FullPotential, Euler, NSLaminar, NSTurbulent, NSLaminarIncompressible, and NSTurbulentIncompressible.
- Returns:
Error status.
-
int cg_governing_write(GoverningEquationsType_t Equationstype)#
Write the type of governing equation.
- Parameters:
Equationstype – [in] Type of governing equations. The admissible types are CG_Null, CG_UserDefined, FullPotential, Euler, NSLaminar, NSTurbulent, NSLaminarIncompressible, and NSTurbulentIncompressible.
- Returns:
Error status.
-
int cg_diffusion_read(int *diffusion_model)#
Read flags for diffusion terms.
- Parameters:
diffusion_model – [out] Flags defining which diffusion terms are included in the governing equations. This is only applicable to the Navier-Stokes equations with structured grids. See the discussion in the SIDS manual for details.
- Returns:
Error status.
-
int cg_diffusion_write(const int *diffusion_model)#
Write flags for diffusion terms.
- Parameters:
diffusion_model – [in] Flags defining which diffusion terms are included in the governing equations. This is only applicable to the Navier-Stokes equations with structured grids. See the discussion in the SIDS manual for details.
- Returns:
Error status.
Particle Governing Equations#
Node: ParticleGoverningEquationsType_t
-
int cg_particle_governing_read(ParticleGoverningEquationsType_t *ParticleEquationsType)#
Read type of particle governing equation.
- Parameters:
ParticleEquationsType – [out] Type of particle governing equations. The admissible types are CG_Null, CG_UserDefined, DEM, DSMC and SPH.
- Returns:
Error status.
-
int cg_particle_governing_write(ParticleGoverningEquationsType_t ParticleEquationstype)#
Write the type of particle governing equation.
- Parameters:
ParticleEquationstype – [in] Type of particle governing equations. The admissible types are CG_Null, CG_UserDefined, DEM, DSMC and SPH.
- Returns:
Error status.
Auxiliary Model#
-
int cg_model_read(const char *ModelLabel, ModelType_t *ModelType)#
Read auxiliary model types.
The types allowed for the various models are:
GasModel_t
CG_Null, CG_UserDefined, Ideal, VanderWaals, CaloricallyPerfect, ThermallyPerfect, ConstantDensity, RedlichKwong
ViscosityModel_t
CG_Null, CG_UserDefined, Constant, PowerLaw, SutherlandLaw
ThermalConductivityModel_t
CG_Null, CG_UserDefined, PowerLaw, SutherlandLaw, ConstantPrandtl
TurbulenceModel_t
CG_Null, CG_UserDefined, Algebraic_BaldwinLomax, Algebraic_CebeciSmith, HalfEquation_JohnsonKing, OneEquation_BaldwinBarth, OneEquation_SpalartAllmaras, TwoEquation_JonesLaunder, TwoEquation_MenterSST, TwoEquation_Wilcox
TurbulenceClosure_t
CG_Null, CG_UserDefined, EddyViscosity, ReynoldsStress, ReynoldsStressAlgebraic
ThermalRelaxationModel_t
CG_Null, CG_UserDefined, Frozen, ThermalEquilib, ThermalNonequilib
ChemicalKineticsModel_t
CG_Null, CG_UserDefined, Frozen, ChemicalEquilibCurveFit, ChemicalEquilibMinimization, ChemicalNonequilib
EMElectricFieldModel_t
CG_Null, CG_UserDefined, Constant, Frozen, Interpolated, Voltage
EMMagneticFieldModel_t
CG_Null, CG_UserDefined, Constant, Frozen, Interpolated
EMConductivityModel_t
CG_Null, CG_UserDefined, Constant, Frozen, Equilibrium_LinRessler, Chemistry_LinRessler
- Parameters:
ModelLabel – [out] The CGNS label for the model being defined. The models supported by CGNS are:
GasModel_t
ViscosityModel_t
ThermalConductivityModel_t
TurbulenceClosure_t
TurbulenceModel_t
ThermalRelaxationModel_t
ChemicalKineticsModel_t
EMElectricFieldModel_t
EMMagneticFieldModel_t
EMConductivityModel_t
ModelType – [out] One of the model types (listed below) allowed for the ModelLabel selected.
- Returns:
Error status.
-
int cg_model_write(const char *ModelLabel, ModelType_t ModelType)#
Write auxiliary model types.
The types allowed for the various models are:
GasModel_t
CG_Null, CG_UserDefined, Ideal, VanderWaals, CaloricallyPerfect, ThermallyPerfect, ConstantDensity, RedlichKwong
ViscosityModel_t
CG_Null, CG_UserDefined, Constant, PowerLaw, SutherlandLaw
ThermalConductivityModel_t
CG_Null, CG_UserDefined, PowerLaw, SutherlandLaw, ConstantPrandtl
TurbulenceModel_t
CG_Null, CG_UserDefined, Algebraic_BaldwinLomax, Algebraic_CebeciSmith, HalfEquation_JohnsonKing, OneEquation_BaldwinBarth, OneEquation_SpalartAllmaras, TwoEquation_JonesLaunder, TwoEquation_MenterSST, TwoEquation_Wilcox
TurbulenceClosure_t
CG_Null, CG_UserDefined, EddyViscosity, ReynoldsStress, ReynoldsStressAlgebraic
ThermalRelaxationModel_t
CG_Null, CG_UserDefined, Frozen, ThermalEquilib, ThermalNonequilib
ChemicalKineticsModel_t
CG_Null, CG_UserDefined, Frozen, ChemicalEquilibCurveFit, ChemicalEquilibMinimization, ChemicalNonequilib
EMElectricFieldModel_t
CG_Null, CG_UserDefined, Constant, Frozen, Interpolated, Voltage
EMMagneticFieldModel_t
CG_Null, CG_UserDefined, Constant, Frozen, Interpolated
EMConductivityModel_t
CG_Null, CG_UserDefined, Constant, Frozen, Equilibrium_LinRessler, Chemistry_LinRessler
- Parameters:
ModelLabel – [in] The CGNS label for the model being defined. The models supported by CGNS are:
GasModel_t
ViscosityModel_t
ThermalConductivityModel_t
TurbulenceClosure_t
TurbulenceModel_t
ThermalRelaxationModel_t
ChemicalKineticsModel_t
EMElectricFieldModel_t
EMMagneticFieldModel_t
EMConductivityModel_t
ModelType – [in] One of the model types (listed below) allowed for the ModelLabel selected.
- Returns:
Error status.
Particle Model#
Node: ParticleModelType_t
-
int cg_particle_model_read(const char *ModelLabel, ParticleModelType_t *ModelType)#
Read particle model types.
The types allowed for the various models are: ParticleCollisionModel_t CG_Null, CG_UserDefined, Linear, NonLinear, HardSphere, SoftSphere, LinearSpringDashpot, Pair, HertzMindlin, HertzKuwabaraKono, ORourke, Stochastic, NonStochastic, NTC ParticleBreakupModel_t CG_Null, CG_UserDefined, KelvinHelmholtz, KelvinHelmholtzACT, RayleighTaylor, KelvinHelmholtzRayleighTaylor, ReitzKHRT, TAB, ETAB, LISA, SHF, PilchErdman, ReitzDiwakar ParticleForceModel_t CG_Null, CG_UserDefined, Sphere, NonShpere, Tracer, BeetstraVanDerHoefKuipers, Ergun, CliftGrace, Gidaspow, HaiderLevenspiel, PlessisMasliyah, SyamlalOBrien, SaffmanMei, TennetiGargSubramaniam, Tomiyama, Stokes, StokesCunningham, WenYu ParticleWallInteractionModel_t CG_Null, CG_UserDefined, Linear, NonLinear, HardSphere, SoftSphere, LinearSpringDashpot, BaiGosman, HertzMindlin, HertzKuwabaraKono, Khunke, ORourke, NTC ParticlePhaseChangeModel_t CG_Null, CG_UserDefined, Boil, Chiang, Frossling, FuchsKnudsen
- Parameters:
ModelLabel – [out] The CGNS label for the particle model being defined. The particle models supported by CGNS are:
ParticleCollisionModel_t
ParticleBreakupModel_t
ParticleForceModel_t
ParticleWallInteractionModel_t
ParticlePhaseChangeModel_t
ModelType – [out] One of the particle model types (listed below) allowed for the ModelLabel selected.
- Returns:
Error status.
-
int cg_particle_model_write(const char *ModelLabel, ParticleModelType_t ModelType)#
Write particle model types.
The types allowed for the various models are: ParticleCollisionModel_t CG_Null, CG_UserDefined, Linear, NonLinear, HardSphere, SoftSphere, LinearSpringDashpot, Pair, HertzMindlin, HertzKuwabaraKono, ORourke, Stochastic, NonStochastic, NTC ParticleBreakupModel_t CG_Null, CG_UserDefined, KelvinHelmholtz, KelvinHelmholtzACT, RayleighTaylor, KelvinHelmholtzRayleighTaylor, ReitzKHRT, TAB, ETAB, LISA, SHF, PilchErdman, ReitzDiwakar ParticleForceModel_t CG_Null, CG_UserDefined, Sphere, NonShpere, Tracer, BeetstraVanDerHoefKuipers, Ergun, CliftGrace, Gidaspow, HaiderLevenspiel, PlessisMasliyah, SyamlalOBrien, SaffmanMei, TennetiGargSubramaniam, Tomiyama, Stokes, StokesCunningham, WenYu ParticleWallInteractionModel_t CG_Null, CG_UserDefined, Linear, NonLinear, HardSphere, SoftSphere, LinearSpringDashpot, BaiGosman, HertzMindlin, HertzKuwabaraKono, Khunke, ORourke, NTC ParticlePhaseChangeModel_t CG_Null, CG_UserDefined, Boil, Chiang, Frossling, FuchsKnudsen
- Parameters:
ModelLabel – [in] The CGNS label for the particle model being defined. The particle models supported by CGNS are:
ParticleCollisionModel_t
ParticleBreakupModel_t
ParticleForceModel_t
ParticleWallInteractionModel_t
ParticlePhaseChangeModel_t
ModelType – [in] One of the particle model types (listed below) allowed for the ModelLabel selected.
- Returns:
Error status.
Families#
Family Definition#
Node: Family_t
-
int cg_nfamilies(int fn, int B, int *nfamilies)#
Get number of Family_t node at CGNSBase_t level.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
nfamilies – [out] Number of families in base
B
- Returns:
Error status.
-
int cg_family_read(int fn, int B, int Fam, char *family_name, int *nboco, int *ngeos)#
Read family information (CGNSBase_t level)
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
family_name – [out] Name of the family.
nboco – [out] Number of boundary conditions for this family. This should be either 0 or 1.
ngeos – [out] Number of geometry references for this family.
- Returns:
Error status.
-
int cg_family_write(int fn, int B, const char *family_name, int *Fam)#
Read family information (CGNSBase_t level)
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
family_name – [in] Name of the family.
Fam – [out] Family index number, where 1 ≤ Fam ≤ nfamilies.
- Returns:
Error status.
-
int cg_nfamily_names(int fn, int B, int Fam, int *nnames)#
Get number of family names under Family_t (CGNSBase_t level)
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
nnames – [out] Number of FamilyName_t nodes for this family.
- Returns:
Error status.
-
int cg_family_name_read(int fn, int B, int Fam, int N, char *node_name, char *family_name)#
Read multiple family names under Family_t (CGNSBase_t level)
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
N – [in] Family name index number, where 1 ≤ N ≤ nNames.
node_name – [out] Name of the FamilyName_t node. FamilyParent is used to refer to the parent family of the Family_t node.
family_name – [out] Name of the family.
- Returns:
Error status.
-
int cg_family_name_write(int fn, int B, int Fam, const char *node_name, const char *family_name)#
Write multiple family names under Family_t (CGNSBase_t level)
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
node_name – [out] Name of the FamilyName_t node. FamilyParent refers to the parent family of the Family_t node.
family_name – [out] Name of the family.
- Returns:
Error status.
Geometry Reference#
Node: GeometryReference_t
-
int cg_geo_read(int fn, int B, int Fam, int G, char *geo_name, char **geo_file, char *CAD_name, int *npart)#
Read geometry reference information.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
G – [in] Geometry reference index number, where 1 ≤ G ≤ nGeo.
geo_name – [out] Name of GeometryReference_t node.
geo_file – [out] Name of geometry file.
CAD_name – [out] Geometry format.
npart – [out] Number of geometry entities.
- Returns:
Error status.
-
int cg_geo_write(int fn, int B, int Fam, const char *geo_name, const char *geo_file, const char *CAD_name, int *G)#
Create a GeometryReference_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
geo_name – [in] Name of GeometryReference_t node.
geo_file – [in] Name of geometry file.
CAD_name – [in] Geometry format.
G – [out] Geometry reference index number, where 1 ≤ G ≤ nGeo.
- Returns:
Error status.
-
int cg_node_geo_read(int G, char *geo_name, char **geo_file, char *CAD_name, int *npart)#
Read geometry reference information (Family_t level)
- Parameters:
G – [in] Geometry reference index number, where 1 ≤ G ≤ nGeo.
geo_name – [out] Name of GeometryReference_t node.
geo_file – [out] Name of geometry file.
CAD_name – [out] Geometry format.
npart – [out] Number of geometry entities.
- Returns:
Error status.
-
int cg_node_geo_write(const char *geo_name, const char *geo_file, const char *CAD_name, int *G)#
Create GeometryReference_t node (Family_t level)
- Parameters:
geo_name – [in] Name of GeometryReference_t node.
geo_file – [in] Name of geometry file.
CAD_name – [in] Geometry format.
G – [out] Geometry reference index number, where 1 ≤ G ≤ nGeo.
- Returns:
Error status.
-
int cg_part_read(int fn, int B, int Fam, int G, int P, char *part_name)#
Get geometry entity name.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
G – [in] Geometry reference index number, where 1 ≤ G ≤ nGeo.
P – [in] Geometry entity index number, where 1 ≤ P ≤ nparts.
part_name – [out] Name of a geometry entity in the file FileName.
- Returns:
Error status.
-
int cg_part_write(int fn, int B, int Fam, int G, const char *part_name, int *P)#
Write geometry entity name.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
G – [in] Geometry reference index number, where 1 ≤ G ≤ nGeo.
part_name – [in] Name of a geometry entity in the file FileName.
P – [out] Geometry entity index number, where 1 ≤ P ≤ nparts.
- Returns:
Error status.
-
int cg_node_part_read(int G, int P, char *part_name)#
Get geometry entity name (Family_t level)
- Parameters:
G – [in] Geometry reference index number, where 1 ≤ G ≤ nGeo.
P – [in] Geometry entity index number, where 1 ≤ P ≤ nparts.
part_name – [out] Name of a geometry entity in the file FileName.
- Returns:
Error status.
-
int cg_node_part_write(int G, const char *part_name, int *P)#
Write geometry entity name (Family_t level)
- Parameters:
G – [in] Geometry reference index number, where 1 ≤ G ≤ nGeo.
part_name – [in] Name of a geometry entity in the file FileName.
P – [out] Geometry entity index number, where 1 ≤ P ≤ nparts.
- Returns:
Error status.
Family Boundary Condition#
Node: FamilyBC_t
-
int cg_fambc_read(int fn, int B, int Fam, int BC_idx, char *fambc_name, BCType_t *bocotype)#
Read boundary condition type for a family.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
BC_idx – [in] Family boundary condition index number. This must be equal to 1.
fambc_name – [out] Name of the FamilyBC_t node.
bocotype – [out] Boundary condition type for the family. See the eligible types for BCType_t in the Typedefs section.
- Returns:
Error status.
-
int cg_fambc_write(int fn, int B, int Fam, const char *fambc_name, BCType_t bocotype, int *BC_idx)#
Write boundary condition type for a family.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Fam – [in] Family index number, where 1 ≤ Fam ≤ nfamilies.
fambc_name – [in] Name of the FamilyBC_t node.
bocotype – [in] Boundary condition type for the family. See the eligible types for BCType_t in the Typedefs section.
BC_idx – [out] Family boundary condition index number. This must be equal to 1.
- Returns:
Error status.
-
int cg_node_fambc_read(int BC_idx, char *fambc_name, BCType_t *bocotype)#
Read boundary condition information (Family_t level)
- Parameters:
BC_idx – [in] Family boundary condition index number. This must be equal to 1.
fambc_name – [out] Name of the FamilyBC_t node.
bocotype – [out] Boundary condition type for the family. See the eligible types for BCType_t in the Typedefs section.
- Returns:
Error status.
-
int cg_node_fambc_write(const char *fambc_name, BCType_t bocotype, int *BC_idx)#
Write boundary condition information (Family_t level)
- Parameters:
fambc_name – [in] Name of the FamilyBC_t node.
bocotype – [in] Boundary condition type for the family. See the eligible types for BCType_t in the Typedefs section.
BC_idx – [out] Family boundary condition index number. This must be equal to 1.
- Returns:
Error status.
Family Name#
Node: FamilyName_t
-
int cg_famname_read(char *family_name)#
Read family name.
- Parameters:
family_name – [out] Name of the family.
- Returns:
Error status.
-
int cg_famname_write(const char *family_name)#
Write family name.
- Parameters:
family_name – [in] Name of the family.
- Returns:
Error status.
-
int cg_nmultifam(int *nfams)#
Get the number of family names.
- Parameters:
nfams – [out] Number of additional family names.
- Returns:
Error status.
-
int cg_multifam_read(int N, char *name, char *family)#
Read multiple family names.
- Parameters:
N – [in] Family name index number, where 1 ≤ N ≤ nNames.
name – [out] Node name.
family – [out] Family name
- Returns:
Error status.
-
int cg_multifam_write(const char *name, const char *family)#
Write multiple family names.
The additional family names written with cg_multifam_write are stored in AdditionalFamilyName_t nodes.
- Parameters:
name – [in] Node name.
family – [in] Family name
- Returns:
Error status.
Time-Dependent Data#
Base Iterative Data#
Node:BaseIterativeData_t
(SIDS,
File Mapping)-
int cg_biter_read(int fn, int B, char *bitername, int *nsteps)#
Read BaseIterativeData_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
bitername – [out] Name of the BaseIterativeData_t node.
nsteps – [out] Number of time steps or iterations.
- Returns:
Error status.
-
int cg_biter_write(int fn, int B, const char *bitername, int nsteps)#
Write BaseIterativeData_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
bitername – [in] Name of the BaseIterativeData_t node.
nsteps – [in] Number of time steps or iterations.
- Returns:
Error status.
Zone Iterative Data#
Node:ZoneIterativeData_t
(SIDS,
File Mapping)-
int cg_ziter_read(int fn, int B, int Z, char *zitername)#
Read ZontIterativeData_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
zitername – [out] Name of the ZoneIterativeData_t node.
- Returns:
Error status.
-
int cg_ziter_write(int fn, int B, int Z, const char *zitername)#
Write ZontIterativeData_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
zitername – [in] Name of the ZoneIterativeData_t node.
- Returns:
Error status.
Particle Iterative Data#
Node:ParticleIterativeData_t
(SIDS,
File Mapping)-
int cg_piter_read(int fn, int B, int P, char *pitername)#
Read ParticleIterativeData_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
pitername – [out] Name of the ParticleIterativeData_t node.
- Returns:
Error status.
-
int cg_piter_write(int fn, int B, int P, const char *pitername)#
Write ParticleIterativeData_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
pitername – [in] Name of the ParticleIterativeData_t node.
- Returns:
Error status.
Rigid Grid Motion#
Node: RigidGridMotion_t
(SIDS,
File Mapping)
-
int cg_n_rigid_motions(int fn, int B, int Z, int *n_rigid_motions)#
Get the number of RigidGridMotion_t nodes.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
n_rigid_motions – [out] Number of RigidGridMotion_t nodes under zone Z.
- Returns:
Error status.
-
int cg_rigid_motion_read(int fn, int B, int Z, int R, char *name, RigidGridMotionType_t *type)#
Read RigidGridMotion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
R – [in] Rigid rotation index number, where 1 ≤ R ≤ n_rigid_motions.
name – [out] Name of the RigidGridMotion_t node.
type – [out] Type of rigid grid motion. The admissible types are CG_Null, CG_UserDefined, ConstantRate, and VariableRate.
- Returns:
Error status.
-
int cg_rigid_motion_write(int fn, int B, int Z, const char *rmotionname, RigidGridMotionType_t type, int *R)#
Create RigidGridMotion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
rmotionname – [in] Name of the RigidGridMotion_t node.
type – [in] Type of rigid grid motion. The admissible types are CG_Null, CG_UserDefined, ConstantRate, and VariableRate.
R – [out] Rigid rotation index number, where 1 ≤ R ≤ n_rigid_motions.
- Returns:
Error status.
Arbitrary Grid Motion#
Node: ArbitraryGridMotion_t
(SIDS,
File Mapping)
-
int cg_n_arbitrary_motions(int fn, int B, int Z, int *n_arbitrary_motions)#
Get the number of ArbitraryGridMotion_t nodes.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
n_arbitrary_motions – [out] Number of ArbitraryGridMotion_t nodes under zone Z.
- Returns:
Error status.
-
int cg_arbitrary_motion_read(int fn, int B, int Z, int A, char *name, ArbitraryGridMotionType_t *type)#
Read ArbitraryGridMotion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
A – [in] Arbitrary grid motion index number, where 1 ≤ A ≤ n_arbitrary_motions.
name – [out] Name of the ArbitraryGridMotion_t node.
type – [out] Type of arbitrary grid motion. The admissible types are CG_Null, CG_UserDefined, NonDeformingGrid, and DeformingGrid.
- Returns:
Error status.
-
int cg_arbitrary_motion_write(int fn, int B, int Z, const char *amotionname, ArbitraryGridMotionType_t type, int *A)#
Write ArbitraryGridMotion_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
amotionname – [in] Name of the ArbitraryGridMotion_t node.
type – [in] Type of arbitrary grid motion. The admissible types are CG_Null, CG_UserDefined, NonDeformingGrid, and DeformingGrid.
A – [out] Arbitrary grid motion index number, where 1 ≤ A ≤ n_arbitrary_motions.
- Returns:
Error status.
Zone Grid Connectivity#
Node: ZoneGridConnectivity_t
(SIDS,
File Mapping)
-
int cg_nzconns(int fn, int B, int Z, int *nzconns)#
Get the number of ZoneGridConnectivity_t nodes.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
nzconns – [out] Number of ZoneGridConnectivity_t nodes under Zone Z.
- Returns:
Error status.
-
int cg_zconn_read(int fn, int B, int Z, int ZC, char *zcname)#
Read ZoneGridConnectivity_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
ZC – [in] Zone grid connectivity index number, where 1 ≤ ZC ≤ nzconns.
zcname – [out] Name of the ZoneGridConnectivity_t node.
- Returns:
Error status.
-
int cg_zconn_write(int fn, int B, int Z, const char *zcname, int *ZC)#
Create ZoneGridConnectivity_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
zcname – [in] Name of the ZoneGridConnectivity_t node.
ZC – [out] Zone grid connectivity index number, where 1 ≤ ZC ≤ nzconns.
- Returns:
Error status.
-
int cg_zconn_get(int fn, int B, int Z, int *ZC)#
Get the current ZoneGridConnectivity_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
ZC – [out] Zone grid connectivity index number, where 1 ≤ ZC ≤ nzconns.
- Returns:
Error status.
-
int cg_zconn_set(int fn, int B, int Z, int ZC)#
Set the current ZoneGridConnectivity_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
Z – [in] Zone index number, where 1 ≤ Z ≤ nzones.
ZC – [in] Zone grid connectivity index number, where 1 ≤ ZC ≤ nzconns.
- Returns:
Error status.
Links#
-
int cg_is_link(int *path_length)#
Test if a node is a link.
- Parameters:
path_length – [out] Length of the path name of the linked node. The value 0 is returned if the node is not a link
- Returns:
Error status.
-
int cg_link_read(char **filename, char **link_path)#
Get path information for a link at the current location.
Use cg_goto() to position to a location in the file prior to calling these routines. Memory is allocated by the library for the return values of the C function cg_link_read(). This memory should be freed by the user when no longer needed by calling
cg_free(filename)
andcg_free(link_path)
.- Parameters:
filename – [out] Name of the linked file, or an empty string if the link is within the same file.
link_path – [out] Path name of the node the link points to.
- Returns:
Error status.
-
int cg_link_write(const char *nodename, const char *filename, const char *name_in_file)#
Create a link at the current location.
Use cg_goto() to position to a location in the file prior to calling these routines. When using cg_link_write(), the node being linked to does not have to exist when the link is created. However, when the link is used, an error will occur if the linked-to node does not exist.
Only nodes that support child nodes will support links.
It is assumed that the CGNS version for the file containing the link, as determined by the CGNSLibraryVersion_t node, is also applicable to
filename
, the file containing the linked node.- Parameters:
nodename – [in] Name of the link node to create, e.g., GridCoordinates.
filename – [in] Name of the linked file, or an empty string if the link is within the same file.
name_in_file – [in] Path name of the node the link points to. This can be a simple or a compound name, e.g., Base/Zone 1/GridCoordinates.
- Returns:
Error status.
Particle Specification#
Particle Zone Information#
Note
When a CGNS file is opened via the cg_open() MLL function, the particle zones are sorted alphanumerically by name (the creation order is ignored/discarded). It is considered good standard practice to always choose particle names to be alphabetically increasing. For example, Particle0001, Particle0002, etc. is appropriate for up to 9999 particles.
-
int cg_nparticle_zones(int fn, int B, int *nparticlezones)#
Get the number of a particle zone in the base.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
nparticlezones – [out] Number of particle zones present in base B.
- Returns:
Error status.
-
int cg_particle_id(int fn, int B, int P, double *particle_id)#
Get the CGIO identifier of the CGNS Particle zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
particle_id – [out] CGIO node identifier for the particle zone
- Returns:
Error status.
-
int cg_particle_read(int fn, int B, int P, char *particlename, cgsize_t *size)#
Read particle zone information.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
particlename – [out] Name of the particle zone
size – [out] Number of particles in this ParticleZone (i.e. ParticleSize)
- Returns:
Error status.
-
int cg_particle_write(int fn, int B, const char *particlename, const cgsize_t size, int *P)#
Create and/or write to a CGNS particle zone.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
particlename – [in] Name of the particle zone.
size – [in] Number of particles in this particle zone.
P – [out] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
- Returns:
Error status.
Particle Coordinates#
-
int cg_particle_ncoord_nodes(int fn, int B, int P, int *ncoord_nodes)#
Get number of ParticleCoordinates_t nodes.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
ncoord_nodes – [out] Number of ParticleCoordinates_t nodes for ParticleZone
P
.
- Returns:
Error status.
-
int cg_particle_coord_node_read(int fn, int B, int P, int C, char *pcoord_name)#
Get Name of a ParticleCoordinates_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
C – [in] Coordinate array index number, where 1 ≤ C ≤ ncoords.
pcoord_name – [out] Name of the ParticleCoordinates_t node. Note that the name “ParticleCoordinates” is reserved for the original particle location and must be the first ParticleCoordinates_t node to be defined.
- Returns:
Error status.
-
int cg_particle_coord_node_write(int fn, int B, int P, const char *pcoord_name, int *C)#
Create a
ParticleCoordinates_t
nodes.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
C – [in] Coordinate array index number, where 1 ≤ C ≤ ncoords.
pcoord_name – [out] Name of the ParticleCoordinates_t node. Note that the name “ParticleCoordinates” is reserved for the original particle location and must be the first ParticleCoordinates_t node to be defined.
- Returns:
Error status.
-
int cg_particle_bounding_box_read(int fn, int B, int P, int C, DataType_t datatype, void *boundingbox)#
Get bounding box associated with a ParticleCoordinates_t node.
When reading a bounding box, if the information is missing from the file, the
boundingbox
array will remain untouched, and the CG_NODE_NOT_FOUND status is returned. The CGNS MLL relies on the user to compute the bounding box and ensure that the bounding box being stored is coherent with the coordinates under GridCoordinates_t node.- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
C – [in] Coordinate array index number, where 1 ≤ C ≤ ncoords.
datatype – [in] Data type of the bounding box array written to the file or read. Admissible data types for a coordinate bounding box are RealSingle and RealDouble.
boundingbox – [out] Data Array with bounding box values.
- Returns:
Error status.
-
int cg_particle_bounding_box_write(int fn, int B, int P, int C, DataType_t datatype, void *boundingbox)#
Write bounding box associated with a
ParticleCoordinates_t
node.The CGNS MLL relies on the user to compute the bounding box and ensure that the bounding box being stored is coherent with the coordinates under ParticleCoordinates_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
C – [in] Coordinate array index number, where 1 ≤ C ≤ ncoords.
datatype – [in] Data type of the bounding box array written to the file or read. Admissible data types for a coordinate bounding box are RealSingle and RealDouble.
boundingbox – [in] Data Array with bounding box values.
- Returns:
Error status.
-
int cg_particle_ncoords(int fn, int B, int P, int *ncoords)#
Get the number of coordinate arrays.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
ncoords – [out] Number of coordinate arrays for particle zone
P
.
- Returns:
Error status.
-
int cg_particle_coord_info(int fn, int B, int P, int C, DataType_t *datatype, char *coordname)#
Get info about a coordinate array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
C – [in] Coordinate array index number, where 1 ≤ C ≤ ncoords.
datatype – [out] Data type of the coordinate array written to the file. Admissible data types for a coordinate array are RealSingle and RealDouble.
coordname – [out] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
- Returns:
Error status.
-
int cg_particle_coord_read(int fn, int B, int P, const char *coordname, DataType_t mem_datatype, const cgsize_t *s_rmin, const cgsize_t *s_rmax, void *coord_array)#
Read particle coordinate array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
mem_datatype – [in] Data type of an array in memory. Admissible data types for a coordinate array are RealSingle and RealDouble.
s_rmin – [in] Lower range index in file.
s_rmax – [in] Upper range index in file.
coord_array – [out] Array of coordinate values.
- Returns:
Error status.
-
int cg_particle_coord_general_read(int fn, int B, int P, const char *coordname, const cgsize_t *s_rmin, const cgsize_t *s_rmax, DataType_t m_type, const cgsize_t *m_dimvals, const cgsize_t *m_rmin, const cgsize_t *m_rmax, void *coord_ptr)#
Read subset of coordinates to a shaped array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
m_type – [in] Data type of an array in memory. Admissible data types for a coordinate array are RealSingle and RealDouble.
s_rmin – [in] Lower range index in file.
s_rmax – [in] Upper range index in file.
m_dimvals – [in] Dimensions of array in memory.
m_rmin – [in] Lower range index in memory.
m_rmax – [in] Upper range index in memory.
coord_ptr – [out] Array of coordinate values.
- Returns:
Error status.
-
int cg_particle_coord_write(int fn, int B, int P, DataType_t datatype, const char *coordname, const void *coord_ptr, int *C)#
Write particle coordinates.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
datatype – [in] Data type of the coordinate array written to the file. Admissible data types for a coordinate array are RealSingle and RealDouble.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
coord_ptr – [in] Array of coordinate values.
C – [out] Coordinate array index number, where 1 ≤ C ≤ ncoords.
- Returns:
Error status.
-
int cg_particle_coord_partial_write(int fn, int B, int P, DataType_t datatype, const char *coordname, const cgsize_t *s_rmin, const cgsize_t *s_rmax, const void *coord_ptr, int *C)#
Write subset of particle coordinates.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
datatype – [in] Data type of the coordinate array written to the file. Admissible data types for a coordinate array are RealSingle and RealDouble.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
s_rmin – [in] Lower range index in file (eg., imin, jmin, kmin).
s_rmax – [in] Upper range index in file (eg., imax, jmax, kmax).
coord_ptr – [in] Array of coordinate values.
C – [out] Coordinate array index number, where 1 ≤ C ≤ ncoords.
- Returns:
Error status.
-
int cg_particle_coord_general_write(int fn, int B, int P, const char *coordname, DataType_t s_type, const cgsize_t *s_rmin, const cgsize_t *s_rmax, DataType_t m_type, const cgsize_t *m_dimvals, const cgsize_t *m_rmin, const cgsize_t *m_rmax, const void *coord_ptr, int *C)#
Write shaped array to a subset of particle coordinates.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
coordname – [in] Name of the coordinate array. It is strongly advised to use the SIDS nomenclature conventions when naming the coordinate arrays to ensure file compatibility.
s_type – [in] Data type of the coordinate array written to the file. Admissible data types for a coordinate array are RealSingle and RealDouble.
m_type – [in] Data type of an array in memory. Admissible data types for a coordinate array are RealSingle and RealDouble.
s_rmin – [in] Lower range index in file (eg., imin, jmin, kmin).
s_rmax – [in] Upper range index in file (eg., imax, jmax, kmax).
m_dimvals – [in] Dimensions of array in memory.
m_rmin – [in] Lower range index in memory (eg., imin, jmin, kmin).
m_rmax – [in] Upper range index in memory (eg., imax, jmax, kmax).
coord_ptr – [in] Array of coordinate values.
C – [out] Coordinate array index number, where 1 ≤ C ≤ ncoords.
- Returns:
Error status.
Particle Solution#
-
int cg_particle_nsols(int fn, int B, int P, int *nsols)#
Get the number of ParticleSolution_t nodes.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
nsols – [out] Number of solutions for particle
P
.
- Returns:
Error status.
-
int cg_particle_sol_info(int fn, int B, int P, int S, char *solname)#
Get information about a ParticleSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
solname – [out] Name of the particle solution.
- Returns:
Error status.
-
int cg_particle_sol_id(int fn, int B, int P, int S, double *sol_id)#
Get the CGIO node identifier for a ParticleSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
sol_id – [out] CGIO node identifier of the particle solution node
- Returns:
Error status.
-
int cg_particle_sol_write(int fn, int B, int P, const char *solname, int *S)#
Create and/or write to a ParticleSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
solname – [in] Name of the particle solution.
S – [out] Flow solution index number, where 1 ≤ S ≤ nsols.
- Returns:
Error status.
-
int cg_particle_sol_size(int fn, int B, int P, int S, cgsize_t *size)#
Get the dimensions of a ParticleSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
size – [out] Number of particles for which solutions are defined.
- Returns:
Error status.
-
int cg_particle_sol_ptset_info(int fn, int B, int P, int S, PointSetType_t *ptset_type, cgsize_t *npnts)#
Get info about a point set ParticleSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
ptset_type – [out] Type of point set defining the interface in the current solution; either PointRange or PointList.
npnts – [out] Number of points defining the interface in the current solution. For a ptset_type of PointRange, npnts is always two. For a ptset_type of PointList, npnts is the number of points in the PointList.
- Returns:
Error status.
-
int cg_particle_sol_ptset_read(int fn, int B, int P, int S, cgsize_t *pnts)#
Read a point set ParticleSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
pnts – [out] Array of points defining the interface in the current solution.
- Returns:
Error status.
-
int cg_particle_sol_ptset_write(int fn, int B, int P, const char *solname, PointSetType_t ptset_type, cgsize_t npnts, const cgsize_t *pnts, int *S)#
Create a point set ParticleSolution_t node.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
solname – [in] Name of the particle solution.
ptset_type – [in] Type of point set defining the interface in the current solution; either PointRange or PointList.
npnts – [in] Number of points defining the interface in the current solution. For a
ptset_type
of PointRange,npnts
is always two. For aptset_type
of PointList,npnts
is the number of points in the PointList.pnts – [in] Array of points defining the interface in the current solution.
S – [out] Flow solution index number, where 1 ≤ S ≤ nsols.
- Returns:
Error status.
Particle Solution Data#
-
int cg_particle_nfields(int fn, int B, int P, int S, int *nfields)#
Get the number of particle solution arrays.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
nfields – [out] Number of data arrays in particle solution S.
- Returns:
Error status.
-
int cg_particle_field_info(int fn, int B, int P, int S, int F, DataType_t *datatype, char *fieldname)#
Get info about a particle solution array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
F – [in] Solution array index number, where 1 ≤ F ≤ nfields.
datatype – [out] Data type of the solution array written to the file. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
fieldname – [out] Name of the solution array. It is strongly advised to use the SIDS nomenclature conventions when naming the solution arrays to ensure file compatibility.
- Returns:
Error status.
-
int cg_particle_field_read(int fn, int B, int P, int S, const char *fieldname, DataType_t mem_datatype, const cgsize_t *s_rmin, const cgsize_t *s_rmax, void *field_ptr)#
Read particle solution.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
fieldname – [in] Name of the solution array. It is strongly advised to use the SIDS nomenclature conventions when naming the solution arrays to ensure file compatibility.
mem_datatype – [in] Data type of an array in memory. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
s_rmin – [in] Lower range index in file
s_rmax – [in] Upper range index in file
field_ptr – [out] Array of solution values.
- Returns:
Error status.
-
int cg_particle_field_general_read(int fn, int B, int P, int S, const char *fieldname, const cgsize_t *s_rmin, const cgsize_t *s_rmax, DataType_t m_type, const cgsize_t *m_dimvals, const cgsize_t *m_rmin, const cgsize_t *m_rmax, void *field_ptr)#
Read subset of particle solution to a shaped array.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
fieldname – [in] Name of the solution array. It is strongly advised to use the SIDS nomenclature conventions when naming the solution arrays to ensure file compatibility.
s_rmin – [in] Lower range index in file.
s_rmax – [in] Upper range index in file.
m_type – [in] Data type of an array in memory. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
m_dimvals – [in] Dimensions of array in memory.
m_rmin – [in] Lower range index in memory.
m_rmax – [in] Upper range index in memory.
field_ptr – [out] Array of solution values.
- Returns:
Error status.
-
int cg_particle_field_write(int fn, int B, int P, int S, DataType_t type, const char *fieldname, const void *field_ptr, int *F)#
Write Particle solution.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
fieldname – [in] Name of the solution array. It is strongly advised to use the SIDS nomenclature conventions when naming the solution arrays to ensure file compatibility.
type – [in] Data type of the solution array written to the file. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
field_ptr – [in] Array of solution values.
F – [out] Solution array index number, where 1 ≤ F ≤ nfields.
- Returns:
Error status.
-
int cg_particle_field_partial_write(int fn, int B, int P, int S, DataType_t type, const char *fieldname, const cgsize_t *s_rmin, const cgsize_t *s_rmax, const void *field_ptr, int *F)#
Write subset of particle solution.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
fieldname – [in] Name of the solution array. It is strongly advised to use the SIDS nomenclature conventions when naming the solution arrays to ensure file compatibility.
type – [in] Data type of the solution array written to the file. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
s_rmin – [in] Lower range index in file
s_rmax – [in] Upper range index in file
field_ptr – [in] Array of solution values.
F – [out] Solution array index number, where 1 ≤ F ≤ nfields.
- Returns:
Error status.
-
int cg_particle_field_general_write(int fn, int B, int P, int S, const char *fieldname, DataType_t s_type, const cgsize_t *s_rmin, const cgsize_t *s_rmax, DataType_t m_type, const cgsize_t *m_dimvals, const cgsize_t *m_rmin, const cgsize_t *m_rmax, const void *field_ptr, int *F)#
Write shaped array to a subset of the flow solution.
- Parameters:
fn – [in] CGNS file index number.
B – [in] Base index number, where 1 ≤ B ≤ nbases.
P – [in] Particle Zone index number, where 1 ≤ P ≤ n_particle_zones.
S – [in] Flow solution index number, where 1 ≤ S ≤ nsols.
fieldname – [in] Name of the solution array. It is strongly advised to use the SIDS nomenclature conventions when naming the solution arrays to ensure file compatibility.
s_type – [in] Data type of the solution array written to the file. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
s_rmin – [in] Lower range index in file
s_rmax – [in] Upper range index in file
m_type – [in] Data type of an array in memory. Admissible data types for a solution array are Integer, LongInteger, RealSingle, and RealDouble.
m_dimvals – [in] Dimensions of array in memory.
m_rmin – [in] Lower range index in memory
m_rmax – [in] Upper range index in memory
field_ptr – [in] Array of solution values.
F – [out] Solution array index number, where 1 ≤ F ≤ nfields.
- Returns:
Error status.