Interface c1
------------
Interface CGNS/MLL functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. raw:: html
cg_nbases
~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``nbases`` | ``int*`` | number of bases in the file (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**Remarks**
The nbase returned value is a single integer
**API C** ``int cg_nbases(int fn,int *nbases);``
.. raw:: html
cg_base_read
~~~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``name`` | ``char*`` | name of the target base (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``cdim`` | ``int*`` | CellDimension (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``pdim`` | ``int*`` | PhysicalDimension (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**Remarks**
The CellDimension and PhysicalDimension are single integers.The name is an already allocated string of 33 chars (32+1)
**API C** ``int cg_base_read(int fn,int B,char *name,int *cdim,int *pdim);``
.. raw:: html
cg_base_write
~~~~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``name`` | ``char*`` | name of the new base (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``cdim`` | ``int`` | CellDimension (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``pdim`` | ``int`` | PhysicalDimension (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int*`` | index of the new base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**Remarks**
Creates a new base, there is no way to modify an existing base
**API C** ``int cg_base_write(int fn,char const *name,int cdim,int pdim,int *B);``
.. raw:: html
cg_zone_write
~~~~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``name`` | ``char*`` | name of the new zone (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``zsize`` | ``int*`` | dimensions of the zone (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``ztype`` | ``CG_ZoneType_t`` | type of the new zone (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``Z`` | ``int*`` | index of the new zone |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**Remarks**
Creates a new zone, there is no way to modify an existing zone.Dimensions of the zsize array depends on the CGNSBase_t dimensions and the ZoneType_t (cf CGNS/SIDS).
**API C** ``int cg_zone_write(int fn, int B, char const *name,int const *zsize, CG_ZoneType_t ztype, int *Z);``
.. raw:: html
cg_zone_type
~~~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``Z`` | ``int`` | index of the target zone |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``ztype`` | ``CG_ZoneType_t*`` | type of the zone (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``zsize`` | ``int*`` | dimensions of the zone (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**API C** ``int cg_zone_type(int fn, int B, int Z, CG_ZoneType_t *ztype);``
.. raw:: html
cg_zone_read
~~~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``Z`` | ``int`` | index of the target zone |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``name`` | ``char*`` | name of the zone (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``zsize`` | ``int*`` | dimensions of the zone (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**Remarks**
Dimensions of the zsize array depends on the CGNSBase_t dimensions and the ZoneType_t (cf CGNS/SIDS). It should be allocated before passed asarg to the function.
**API C** ``int cg_zone_read(int fn, int B, int Z, char *name, int *zsize);``
.. raw:: html
cg_nzones
~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``nzones`` | ``int*`` | number of Zone_t in the CGNSBase_t (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**API C** ``int cg_nzones(int fn,int B,int *nzones);``
.. raw:: html
cg_ncoords
~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``Z`` | ``int`` | index of the target zone |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``ncoords`` | ``int*`` | number of GridCoordinates_t in the Zone_t (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**API C** ``int cg_ncoords(int fn, int B, int Z, int *ncoords);``
.. raw:: html
cg_coord_info
~~~~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``Z`` | ``int`` | index of the target zone |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``C`` | ``int`` | index of the target grid coordinates |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``cgnstype`` | ``CG_DataType_t*`` | type of data in coords (output) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``name`` | ``char*`` | name of the grid coordinates |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**API C** ``int cg_coord_info(int fn, int B, int Z, int C,CG_DataType_t *cgnstype, char *name);``
.. raw:: html
cg_coord_read
~~~~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``Z`` | ``int`` | index of the target zone |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``coordname`` | ``char*`` | name of the coordinate to read (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``cgnstype`` | ``CG_DataType_t`` | type of data in coords (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``rmin`` | ``int*`` | range min to load |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``rmax`` | ``int*`` | range max to load |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**Remarks**
Skips the GridCoordinate node and gets the DataArray associated with it,then only the GridCoordinates node can be read using this function.Use DataArray read after a goto to get other grids.
**API C** ``int cg_coord_read(int fn, int B, int Z, char const * coordname,CG_DataType_t cgnstype, int const * rmin, int const * rmax,void *coord);``
.. raw:: html
cg_coord_write
~~~~~~~~~~~~~~
.. raw:: html
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``fn`` | ``int`` | id of the file to use |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``B`` | ``int`` | index of the target base |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``Z`` | ``int`` | index of the target zone |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``cgnstype`` | ``CG_DataType_t`` | type of data in coords (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``coordname`` | ``char*`` | name of the coordinate to read (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``coord_ptr`` | ``void*`` | pointer to actual coordinates array (input) |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
| ``ZC`` | ``int*`` | index of the new grid coordinates node |
+--------------------------------------+--------------------------------------+------------------------------------------------------------------+
**Return**
non-null returned value means error
**Remarks**
Actual coordinates are referred to by a void* pointre. The type of thedata is set by the cgnstype arg.Data is copied, you can de-allocate arg array once the function returns.
**API C** ``int cg_coord_write(int fn, int B, int Z, CG_DataType_t cgnstype,char const * coordname, void const * coord_ptr, int *ZC);``
.. raw:: html
**Error Codes**
``1000`` - Error on level
``1001`` - Name [] not allowed
``1002`` - Child [] already exists
``1003`` - Cannot find child []
``1004`` - Cannot find node []
``1101`` - No such Base index []
``1102`` - Base [)
``1103`` - Base write failed name [)
``1201`` - No such Zone index []
``1202`` - Zone [] bad dimension
``1203`` - Zone [] bad ZoneType
``1204`` - Zone write failed name []
``1205`` - Zone [] type should be Structured/Unstructured
``1301`` - No such GridCoordinates index []
``1302`` - Create GridCoordinates failed for []