CGNS.WRA.mll

The CGNS/MLL library wrapper.

CGNS.WRA.mll is a CGNS/MLL v3.2 Python wrapper. It defines a pyCGNS class which performs the cg_open and holds the opened file descriptor for subsequent calls.

CGNS.WRA.mll is using a Cython wrapping, it replaces the CGNS.WRA._mll which was an old hand-coded wrapper, difficult to maintain.

To get the actual list of CGNS/MLL functions wrapped::
python -c ‘import CGNS.WRA.mll;CGNS.WRA.mll.getCGNSMLLAPIlist()’
class CGNS.WRA.mll.pyCGNS

A pyCGNS object is a CGNS/MLL file handler. You can call any CGNS/MLL function on this object, a cg_<function> in the C API is named <function> in this Python API. Functions are returning values instead of error code, you have to check each function mapping to known what are the inputs/outputs. You would also find extra functions providing the user with a better Python interface.

A pyCGNS object creation is a call to cg_open:

db=CGNS.WRA.mll.pyCGNS('5blocks.cgns',CGNS.WRA.mll.MODE_READ)
for b in db.bases():
  for z in db.zones(b):
     print db.zone_read(b,z)
  • Args:
  • filename: the target file path
  • mode: an integer setting the open mode, an enumerate you should

use through the Python module enumerate (CGNS.WRA.mll.MODE_READ, CGNS.WRA.mll.MODE_WRITE,CGNS.WRA.mll.MODE_MODIFY)

  • Return:
  • A pyCGNS class instance, the object is the CGNS/MLL file descriptor

on which you can call CGNS/MLL functions.

ElementDataSize

Returns the number of element connectivity data values.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : element section id (int)
  • Return:
  • number of element connectivity data values (int)
ElementPartialSize

Returns the number of element connectivity data values in a range.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : element section id (int)
  • start : min range of element connectivity data to read (int)
  • end: max range of element connectivity data to read (int)
  • Return:
  • number of element connectivity data values contained in range (int)
array_info

Returns a tuple with information about a given array. You need to access the parent node of the requested array. You can use the gopath function to do it.

  • Args:
  • A : data array id between 1 and the number of arrays under the current node (int)
  • Return:
  • name of the data array (string)
  • type of data held in the DataArray_t node (int)
  • number of dimensions (int)
  • number of data elements in each dimension (int)
array_read

Reads a data array contained in a given node. Use ‘goto’-like

  • Args:
  • A : data array id which is comprised between 1 and the number of arrays under the current node (int)
  • Return:
  • data array (numpy.ndarray)
array_read_as

Reads a data array as a certain type. Should set the target node with goto-like function.

  • Args:
  • A : data array id which is comprised between 1 and the number of arrays under the current node (int)
  • type : requested type of data held in the array (int)
  • Return:
  • data array (numpy.ndarray)
  • Remarks:
  • The data array is returned only if its data type corresponds to the required data type. Otherwise, nothing is returned.
array_write

Creates a new data array.

  • Args:
  • aname : name of the data array (string)
  • adata : data array (‘numpy.ndarray`)
  • Return:
  • None
  • Remarks:
  • the datatype is guessed from the numpy.ndarray data type
base_id

Returns the base internal id.

  • Args:
  • B: the CGNS/MLL base id (int) (this is not the internal id)
  • Return:
  • The base internal id (int)
  • Remarks:
  • This id can be used with the CGNS/ADF or CGNS/HDF5 API. If you don’t

know what this id is... then you should not use it.

base_read

Returns a tuple with information about the base.

  • Args:
  • B: the base id
  • Return:
  • argument base id (int)
  • base name (string)
  • cell dimensions (int)
  • physical dimensions (int)
base_write

Creates a new base:

bid=db.base_write('Base-001',3,3)
  • Args:
  • basename: name of the new base (string should not exceed 32 chars)
  • celldim: cell dimensions of the base (int)
  • physicaldim: physical dimension of the base (int)
  • Return:
  • New base id (int)
bases

Returns the bases indices:

for B in db.bases():
   print db.base_read(B)
  • Return:
  • An xrange from 1 to <number of bases> or an empty list if there is no base at all.
  • Remarks:
bcdataset_write

Create a new BCDataSet:

db.bcdataset_write("Dataset-1",BCTypeNull,Dirichlet)
boco_gridlocation_read

Returns the location of a given boundary condition.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • BC: boundary condition id (int)
  • Return:
  • grid location used in the definition of the point set (int)
boco_gridlocation_write

Writes the boundary condition location.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • BC: boundary condition id (int)
  • location : grid location of the point set (int)
  • Return:
  • None
boco_info

Gets info from a given boundary condition. Returns info in a tuple.

  • Args:
  • B : base id (int)(numpy.ndarray)
  • Z : zone id (int)
  • BC: boundary condition id (int)
  • Return:
  • name of the boundary condition (string)
  • type of boundary condition defined (int)
  • extent of the bc (int). The extent may be defined using a range of points or elements using PointRange`using, or using a discrete list of all points or elements at which the boundary condition is applied using `PointList.
  • number of points or elements defining the bc region (int) For a ptset_type of PointRange, the number is always 2. For a ptset_type of PointList, the number is equal to the number of points or elements in the list.
  • index vector indicating the computational coordinate direction of bc patch normal (numpy.ndarray)
  • flag indicating if the normals are defined in NormalList`(`int) Returns 1 if they are defined, 0 if they are not.
  • data type used in the definition of the normals (int) Admissible data types are RealSingle and RealDouble.
  • number of bc datasets for the current boundary condition (int)
boco_normal_write

Writes the normals of a given BC boundary condition.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • BC: boundary condition id (int)
  • NormalIndex:index vector indicating the computational coordinate direction of the boundary condition patch normal (numpy.ndarray)
  • NormalListFlag: flag indicating if the normals are defined in NormalList`(`int) . The flag is equal to 1 if they are defined, 0 if they are not. If the flag is forced to 0, ‘NormalDataType’ and ‘NormalList’ are not taken into account. In this case, these arguments are not required.
  • NormalDataType: data type of the normals (int). Admissible data types are RealSingle and RealDouble.
  • NormalList: list of vectors normal to the boundary condition patch pointing into the interior of the zone (numpy.ndarray)
  • Returns:
  • None
boco_read

Reads boundary condition data and normals.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • BC: boundary condition id (int)
  • Returns:
  • array of point or element indices defining the boundary condition region (numpy.ndarray)
  • list of vectors normal to the boundary condition patch pointing into the interior of the zone (numpy.ndarray)
boco_write

Creates a new boundary condition.

  • Args:
  • B : base id (int)

  • Z : zone id (int)

  • boconame : name of the boundary condition (string)

  • bocotype : type of the boundary condition (int)

  • ptset_type : extent of the boundary condition (`int)

  • npnts : number of points or elements defining the boundary

    condition region (int)

  • pnts : array of point or element indices defining the boundary condition region (numpy.ndarray)

  • Return:
  • boundary condition id (int)
close

Closes the CGNS/MLL file descriptor.

  • Remarks:
  • The pyCGNS object is still there, however you cannot call any CGNS/MLL

function with it. The __del__ of the Python object calls the close.

conn_1to1_read

Returns a tuple with information about a 1-to-1 connectivity data.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • I : interface id (int)
  • Returns:
  • name of the interface (string)
  • name of the zone interfacing with the current zone (string)
  • range of points for the current zone (numpy.ndarray)
  • range of points for the donor zone (numpy.ndarray)
conn_1to1_write

Creates a new 1-to-1 connectivity node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • cname : name of the interface (string)
  • dname : name of the zone interfacing with the current zone (string)
  • crange : range of points for the current zone (numpy.ndarray)
  • drange : range of points for the donor zone (numpy.ndarray)
  • tr : notation for the transformation matrix defining the relative orientation of the two zones (numpy.ndarray)
  • Returns:
  • interface id (int)
conn_info

Generalized connectivity data node info.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • I : interface id (int)
  • Returns:
  • name of the interface (string)
  • grid location used in the definition of the point set (int)
  • type of the interface. The admissible types are Overset, Abutting and Abutting1to1. (int)
  • type of point set defining the interface in the zone. The admissible types are PointRange or PointList. (int)
  • number of points defining the interface in the zone (int)
  • name of the zone interfacing with the zone (string)
  • type of the donor zone. The admissible types are Structured and Unstructured. (int)
  • type of point set defining the interface in the donor zone. The admissible types are PointListDonor and CellListDonor. (int)
  • data type in which the donor points are stored in the file
  • number of points or cells in the zone. This number is the same as the number of points or cells contained in the donor zone. (int)
conn_read

Generalized connectivity data node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • I : interface id (int)
  • Returns:
  • array of points defining the interface in the zone (numpy.ndarray)
  • data type in which the donor points are stored in the file (int)
  • array of donor points or cells (numpy.ndarray)
conn_read_short

Reads generalized connectivity data without donor information.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • I : interface id (int)
  • Return:
  • array of points as the interface in the current zone (numpy.ndarray)
conn_write

Creates a new generalized connectivity data node.

  • Args:
  • B : base id (int)

  • Z : zone id (int)

  • cname : name of the interface (string)

  • loc : grid location used for the point set (int)

  • gct : type of interface. The admissible types are Overset, Abutting and Abutting1to1. (int)

  • pst : type of point set defining the interface in the current zone.

    The admissible types are PointRange and PointList. (int)

  • npnts : number of points defining the interface in the current zone. For a type of point set as PointRange, npnts is always two. For a type of point set as PointList , npnts is equal to the number of points defined in the PointList. (int)

  • pnts : array of points defining the interface in the

    zone (numpy.ndarray)

  • dname : name of the donnor zone (string)

  • dzt : type of the donnor zone. The admissible types are Structured

    and Unstructured. (int)

  • dpst : type of point set of the donnor zone (int)

  • ddt : data type of the donor points (int)

  • ndd : number of points or cells in the current zone (int)

  • dd : array of donor points or cells whose dimension corresponds

    to the number ndd`(`numpy.ndarray)

  • Returns:
  • interface id (int)
conn_write_short

Creates a new generalized connectivity data node without donor information.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • name : name of the interface (string)
  • location : grid location used for the point set (int)
  • gct : type of interface. The admissible types are Overset, Abutting and Abutting1to1. (int)
  • pst : type of point set defining the interface in the current zone. The admissible types are PointRange and PointList. (int)
  • npnts : number of points defining the interface in the current zone. For a type of point set as PointRange, npnts is always two. For a type of point set as PointList , npnts is equal to the number of points defined in the PointList. (int)
  • pnts : array of points as the interface in the zone (numpy.ndarray)
  • dname : name of the donnor zone (string)
convergence_write

Creates a convergence history node.

  • Args:
  • iter : number of iterations recorded (int)
  • ndef : description of the convergence information (string)
  • Return:
  • None
conversion_info

Returns the conversion factors data type.

  • Args:
  • None
  • Return:
  • data type of the conversion factors (int)
conversion_read
Returns the conversion factors.
  • Args:
  • None
  • Return:
  • two-element array with scaling and offset factors (numpy.ndarray)
conversion_write

Writes the conversion factors in a new node.

  • Args:
  • dt : data type in which the exponents are recorded (int) The admissible data types for conversion factors are RealSingle and RealDouble.
  • fact : two-element array which contains the scaling and the offset factors (numpy.ndarray)
  • Return:
  • None
coord_id

Returns the base internal id.

  • Args:
  • B: the CGNS/MLL base id (int)
  • Z: the CGNS/MLL zone id (int)
  • C: the CGNS/MLL coordinates id (int)
  • Return:
  • The coordinates internal id (int)
  • Remarks:
  • This id can be used with the CGNS/ADF or CGNS/HDF5 API. If you don’t

know what this id is... then you should not use it.

coord_info

Returns a tuple with information about the coordinates.

  • Args:
  • Return:
  • argument base id (int)
  • argument zone id (int)
  • argument coordinates id (int)
  • coordinates array data type (int)
  • coordinate name (string)
  • Remarks:
  • With a X,Y,Z coordinate system, you should look for X (one coordinate

id), X (another coordinate id) and Z (another coordinate id). That makes three calls of coord_info. * The coordinate array datatype is from CGNS.PAT.cgnskeywords.DataType_

coord_partial_write

Modify coordinates.

  • Args:
  • B: base id (int)
  • Z: zone id (int)
  • dtype: data type of the array contents (int)
  • coordname: name of the new coordinates (string <= 32 chars)
  • rmin: min range of data to write (numpy.ndarray)
  • rmax: max range of data to write (numpy.ndarray)
  • coords: array of actual coordinates (numpy.ndarray)
  • Return:
  • Creates by default the GridCoordinates node
  • the coords array is a numpy with correct data type with respect

to the CGNS.PAT.cgnskeywords.DataType_ argument.

coord_read

Returns a tuple with actual coordinates array.

  • Args:
  • B: base id (int)
  • Z: zone id (int)
  • coordname: coordinate array name to read (string)
  • dtype: datatype of the array (int)
  • Return:
  • argument base id (int)
  • argument zone id (int)
  • argument coordinates name (string)
  • argument coordinates array data type (int)
  • min indices (numpy.ndarray)
  • max indices (numpy.ndarray)
  • coordinates (numpy.ndarray)
  • Remarks:
  • The datatype forces a cast if it is not the original type of the array
  • The coordinate array datatype is from CGNS.PAT.cgnskeywords.DataType_
  • The dtype can be a numpy dtype as far as it can be translated
coord_write

Creates a new coordinates.

  • Args:
  • B: base id (int)
  • Z: zone id (int)
  • dtype: data type of the array contents (int)
  • coordname: name of the new coordinates (string <= 32 chars)
  • coords: array of actual coordinates (numpy.ndarray)
  • Return:
  • coordinate array id (int)
  • Remarks:
  • Creates by default the GridCoordinates node
  • the coords array is a numpy with correct data type with respect

to the CGNS.PAT.cgnskeywords.DataType_ argument. * The dtype can be a numpy dtype as far as it can be translated

coords

Returns the number of coordinates array indices of a zone.

  • Args:
  • B: parent base id (int)
  • Z: parent zone id (int)
  • Return:
  • An xrange from 1 to <number of nodes> or an empty list if there is no coordinates at all.
  • Remarks:
dataclass_read

Returns the data class.

  • Args:
  • None
  • Return:
  • dclass : data class for the nodes at this level (int)
dataclass_write

Writes the data class in a new node.

  • Args:
  • dclass : data class for the nodes at this level (int) The admissible data classes are Dimensional, NormalizedByDimensional, NormalizedByUnknownDimensional, NondimensionalParameter and DimensionlessConstant.
  • Return:
  • None
dataset_read

Returns a tuple with information about a boundary condition dataset.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • BC: boundary condition id (int)
  • dataset id (int)
  • Return:
  • name of the dataset (string)
  • boundary condition type (int)
  • flag indicating if the dataset contains Dirichlet data (int)
  • flag indicating if the dataset contains Neumann data (int)
dataset_write

Writes the dataset set of a given boundary condition.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • BC: boundary condition id (int)
  • BCType : boundary condition type (int)
  • Return:
  • dataset id (int)
descriptor_write

Writes descriptive text.

  • Args:
  • dname : name of the descriptor node (string)
  • dtext : description contained in the descriptor node (string)
  • Return:
  • None
descriptors

Returns the descriptors indices:

for D in db.descriptors():
   print db.descriptor_read(D)
  • Return:
  • An xrange from 1 to <number of descriptors> or an empty list if there is no descriptor at all.
  • Remarks:
diffusion_read

Reads a diffusion model node.

  • Args:
  • None
  • Return:
  • flags defining diffusion terms in the governing equations (int)
diffusion_write

Creates a diffusion model node.

  • Args:
  • dmodel : flags defining which diffusion terms are included in the governing equations (int), the array size depends on the dimensions of the base and the equations, each array value is either 0 or 1. Only suitable for the Navier-Stokes equations with structured grids.
  • Return:
  • None
discrete_ptset_info

Returns a tuple with information about a given discrete data node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • D : discrete data id which is necessarily comprised between 1 and the total number of discrete data nodes under the zone (int)
  • Return:
  • type of point set defining the interface (‘int`). It can be PointRange or PointList.
  • number of points defining the interface (int)
discrete_ptset_read

Reads a point set of a given discrete data node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • D : discrete data id which is necessarily comprised between 1 and the total number of discrete data nodes under the zone (int)
  • Return:
  • array of points defining the interface (‘numpy.ndarray`)
discrete_ptset_write

Creates a new point set DiscreteData_t node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • D : discrete data id which is necessarily comprised between 1 and the total number of discrete data nodes under the zone (int)
  • Return:
  • array of points defining the interface (‘numpy.ndarray`)
discrete_read

Returns the name of a given DiscreteData_t node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • D : discrete data id which is necessarily comprised between 1 and the total number of discrete data nodes under the zone (int)
  • Return:
  • name of discrete data node (string)
discrete_size

Returns the dimensions of a DiscreteData_t node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • D : discrete data id which is necessarily comprised between 1 and the total number of discrete data nodes under the zone (int)
  • Return:
  • number of dimensions defining the discrete data (int). If a point set has been defined, this is 1, otherwise this is the current zone index dimension.
  • array of dimensions (‘numpy.ndarray`)
discrete_write

Creates a new DiscreteData_t node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • name : name of the created node (string)
  • Return:
  • discreted data id (int)
elements_partial_read

Returns a tuple with the element connectivity data and the parent data for a given range.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : element section id (int)
  • start : min range of element connectivity data to read (int)
  • end: max range of element connectivity data to read (int)
  • Return:
  • element connectivity data (numpy.ndarray)
  • For boundary of interface elements, the ParentData array contains information on the cells and cell faces sharing the element. (numpy.ndarray)
elements_partial_write

Writes element data for an element section.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : element section id (int)
  • start : index of first element in the section to write (int)
  • end : index of last element in the section to write (int)
  • elements : element conncetivity data (numpy.ndarray)
elements_read

Returns a tuple with the element connectivity data and the parent data.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : element section id (int)
  • Return:
  • element connectivity data (numpy.ndarray)
  • For boundary of interface elements, the ParentData array contains information on the
cells and cell faces sharing the element. (numpy.ndarray)
equationset_chemistry_read

Returns a tuple with information about the chemistry equation node.

  • Args:
  • None
  • Return:
  • thermal relaxation model flag (int) 1 if definition available
  • same for chemical kinetics model
equationset_elecmagn_read

Returns a tuple with information about the electromagnetic equation node.

  • Args:
  • None
  • Return:
  • electric field model flag (int) 1 if definition available
  • same for magnetic field model
  • same for conductivity model
equationset_read

Returns a tuple with information about the flow equation node.

  • Args:
  • None
  • Return:
  • dimensionality of the governing equations (int)
  • governing equations flag (int) 1 if definition available
  • same for gas model
  • same for viscosity model
  • same for thermal conductivity model
  • same for turbulence closure
  • same for turbulence model (int)
equationset_write

Creates a convergence history node.

  • Args:
  • eqdim : dimensionality of the governing equations (int) Dimensionality is the number of spatial variables describing the flow
  • Return:
  • None
expfull_read

Reads all eight dimensional exponents.

  • Args:
  • None
  • Return:
  • exponents for the dimensional units are written in that order: mass, length, time, temperature, angle, electric current, substance amount, and luminous intensity (numpy.ndarray)
expfull_write

Writes all height dimensional exponents.

  • Args:
  • dt : data type in which the exponents are recorded (int) Data types for the exponents are RealSingle and RealDouble.
  • e : exponents for the dimensional units are written in that order: mass, length, time, temperature, angle, electric current, substance amount, and luminous intensity (numpy.ndarray)
  • Return:
  • None
exponents_info

Returns the exponent data type.

  • Args:
  • None
  • Return:
  • data type of the exponents (int)
exponents_read

Reads the first five dimensional exponents.

  • Args:
  • None
  • Return:
  • exponents for the dimensional units are written in that order: mass, length, time, temperature and angle (numpy.ndarray)
exponents_write

Writes the first five dimensional exponents in a new node.

  • Args:
  • dt : data type in which the exponents are recorded (int) Data types for the exponents are RealSingle and RealDouble.
  • e : exponents for the dimensional units are written in that order: mass, length, time, temperature and angle (numpy.ndarray)
  • Return:
  • None
fambc_read

Returns a tuple with information about the family BC.

  • Args:
  • B: base id (int)
  • F: family id (int)
  • BC: BC family id (int)
  • Return:
  • argument base id (int)
  • argument family id (int)
  • argument BC family id (int)
  • BC family name (string)
  • BC type (int)
  • Remarks:
  • The BC type is one of the keys of CGNS.PAT.cgnskeywords.BCType_
fambc_write

Creates a new BC family:

fbcid=db.fambc_write(B,F,CGNS.PAT.cgnskeywords.FamilyBC_s)
  • Args:
  • B: parent base id (int) (bases() and nbases()).
  • F: parent family id (int) (families() and nfamilies()).
  • fambcname: name of the new BC family (string <= 32 chars)
  • bocotype: type of the actual BC for all BCs refering to the parent family name of F (int)
  • Return:
  • New BCfamily id (int)
  • Remarks:
  • A BCFamily takes place as a child of a Family in a Base, once

created you can create or change some BCs with a type of FamilySpecified and with a FamilyName equals to this BCFamily parent Family. * a FamilyBC_t`node name usually is `FamilyBC

families

Returns all the families indices of a base:

for F in db.families(B):
   print db.family_read(B)
  • Args:
  • Return:
  • An xrange from 1 to <number of families> or an empty list if there is no family at all.
  • Remarks:
family_read

Returns a tuple with information about the family.

  • Args:
  • B: base id (int)
  • F: family id (int)
  • Return:
  • argument base id (int)
  • argument family id (int)
  • family name (string)
  • number of FamilyBC_t children nodes (int)
  • number of GeometryReference_t children nodes (int)
  • Remarks:
  • returned numbers of children for each FamilyBC_t

and GeometryReference_t have to be fambc_read() and geo_read(). You have to parse each child a compare with some parameter of yours to find the one you are looking for.

family_write

Creates a new family:

bid=db.family_write(B,'LeftWing')
  • Args:
  • B: the parent base id (int) (bases() and nbases()).
  • familyname: name of the new family (string <= 32 chars)
  • Return:
  • New family id
geo_read

Returns a tuple with information about the Geometry reference.

  • Args:
  • B: base id (int)
  • F: family id (int)
  • G: geometry reference id (int)
  • Return:
  • argument base id (int)
  • argument family id (int)
  • argument geometry reference id (int)
  • geometry reference name (string)
  • geometry reference file (string)
  • geometry reference CAD name (string)
  • geometry reference number of parts (int)
  • Remarks:
geo_write

Creates a new Geometry reference.

  • Args:
  • B: parent base id (int) (bases()

    and nbases()).

  • F: parent family id (int) (families() and nfamilies()).

  • geoname: name of the new geometry reference (string <= 32 chars)

  • filename: path to geometry reference file (string)

  • cadname: name of the geometry reference CAD (string)

  • Return:
  • New Geometry reference id (int)
  • Remarks:
  • The cad should be an enumerate as described in SIDS section 12.7
governing_read

Returns type of the governing equations.

  • Args:
  • None
  • Return:
  • type of governing equations (int)
governing_write

Creates type of the governing equations.

  • Args:
  • etype: type of governing equations (int)
  • Return:
  • None
grid_read

Returns a tuple with information about the grid.

  • Args:
  • B: base id (int)
  • Z: zone id (int)
  • G: grid id (int)
  • Return:
  • argument base id (int)
  • argument zone id (int)
  • argument grid id (int)
  • grid name (string)
grid_write

Creates a new grid.

  • Args:
  • B: base id (int)
  • Z: zone id (int)
  • gridname: name of the new grid (string <= 32 chars) (string)
  • Return:
  • grid id (int)
  • Remarks:
  • The GridCoordinates name is reserved for the default grid name.

You should have one GridCoordinates grid per zone if your zone is not empty. See also coord_write() which creates GridCoordinates or uses it if present.

gridlocation_read

Reads the grid location.

  • Args:
  • None
  • Return:
  • location in the grid (int)
gridlocation_write

Writes the grid location in a new node.

  • Args:
  • gloc : location in the grid (int) The admissible locations are CG_Null, CG_UserDefined, Vertex, CellCenter, FaceCenter, IFaceCenter, JFaceCenter, KFaceCenter, EdgeCenter
  • Return:
  • None
grids

Returns the number of grids indices of a zone:

for G in db.grids(B,Z):
   print db.grid_read(B,Z,G)
  • Args:
  • Return:
  • An xrange from 1 to <number of grids> or an empty list if there is no grid at all.
  • Remarks:
integral_read

Returns the name of a integral data node.

  • Args:
  • idx : integral data id (int)
  • Return:
  • name of the integral data node (string)
integral_write

Creates a new integral data node.

  • Args:
  • name : name of the integral data node (string)
  • Return:
  • number of integral data nodes contained in the current node (int)

link_read memory is allocated by CGNS/MLL

model_read

Reads auxiliary model types.

  • Args:
  • label : CGNS label of the defined model (string) The admissible types are: GasModel_t ViscosityModel_t ThermalConductivityModel_t TurbulenceClosure_t TurbulenceModel_t ThermalRelaxationModel_t ChemicalKineticsModel_t EMElectricFieldModel_t EMMagneticFieldModel_t EMConductivityModel_t
  • Return:
  • model type allowed for the label selected (int)
model_write

Writes auxiliary model types.

  • Args:
  • label : CGNS label of the defined model (string) The admissible types are: GasModel_t ViscosityModel_t ThermalConductivityModel_t TurbulenceClosure_t TurbulenceModel_t ThermalRelaxationModel_t ChemicalKineticsModel_t EMElectricFieldModel_t EMMagneticFieldModel_t EMConductivityModel_t
  • model type allowed for the label selected (int)
  • Return:
  • None
n1to1

Returns the number of 1-to-1 interfaces in a zone.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • Returns:
  • number of 1-to-1 interfaces contained in a GridConnectivity1to1_t node (int)
  • Remarks:
  • 1-to-1 interfaces that may be stored under `GridConnectivity_t nodes are not taken into account.
n1to1_global

Counts the number of 1-to-1 interfaces in a base.

  • Args:
  • B : base id (int)
  • Return:
  • number of 1-to-1 interfaces in the database (int)
narrays

Returns the number of data arrays under the current node. pathname by using the gopath function.

  • Args:
  • None
  • Returns:
  • number of data arrays contained in a given node (int)
nbases

Returns the number of bases:

for B in range(1,db.nbases()+1):
   print db.base_read(B)
  • Return:
  • The number of bases as an integer
  • Remarks:
nbocos

Gets number of boundary conditions.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • Return:
  • number of boundary conditions in zone Z (int)
nconns

Returns the number of generalized connectivity data.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • Returns:
  • number of interfaces (int)
ncoords

Returns the number of coordinates array in the GridCoordinates node.

  • Args:
  • B: parent base id (int)
  • Z: parent zone id (int)
  • Return:
  • The number of coordinates arrays as an integer (int)
  • Remarks:
ndescriptors

Returns the number of descriptor nodes contained in the current node.

  • Args:
  • None
  • Return:
  • number of descriptor nodes under the current node (int)
ndiscrete

Returns the number of DiscreteData_t nodes in a given zone.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • Return:
  • number of DiscreteData_t`nodes contained in the zone (`int)
nexponents

Returns the number of dimensional exponents.

  • Args:
  • None
  • Return:
  • number of exponents used in the file (int)
nfamilies

Returns the number of families in a base:

for F in range(1,db.nfamilies(B)+1):
   print db.family_read(B)
  • Args:
  • Return:
  • The number of families as an integer (int)
  • Remarks:
ngrids

Returns the number of grids in a zone:

for G in range(1,db.ngrids(B,Z)+1):
   print db.grid_read(B,Z,G)
  • Args:
  • Return:
  • The number of grids as an integer (int)
  • Remarks:
nintegrals

Returns the number of integral data nodes.

  • Args:
  • None
  • Return:
  • number of integral data nodes contained in the current node (int)
npe

Returns the number of nodes of an element.

  • Args:
  • type : type of element (int)
  • Return:
  • number of nodes for an element of type type (int)
nsections

Returns the number of element sections.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • Return:
  • number of element sections (int)
nsols

Returns the number of flow solutions.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • Return:
  • number of flow solutions for zone Z`(`int)
nunits

Returns the number of dimensional units.

  • Args:
  • None
  • Return:
  • number of units used in the file (int)
nuser_data

Counts the number of UserDefinedData_t nodes contained in the current node. You can access the current node by using the gopath function.

  • Args:
  • None
  • Return:
  • number of UserDefinedData_t nodes contained in the current node (int)
nzconns

Returns the number of ZoneGridConnectivity_t nodes.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • Returns:
  • number of ZoneGridConnectivity_t nodes (int)
nzones

Returns the number of zones in a base:

for Z in range(1,db.nzones(B)+1):
   print db.zone_read(B,Z)[2]
  • Args:
  • Return:
  • Number of zones as an integer (int)
  • Remarks:
ordinal_read

Reads the ordinal value.

  • Args:
  • None
  • Return:
  • any integer value (int)
ordinal_write

Writes the ordinal value in a new node.

  • Args:
  • ord : any integer value (int)
  • Return:
  • None
parent_data_partial_write

Writes subset of parent info for an element section.

  • Args:
  • B : base id (int)

  • Z : zone id (int)

  • S : element section index number (int)

  • start : index of first element in the section (int)

  • end : index of last element in the section (int)

  • parent_data : For boundary of interface elements, the ParentData

    array contains cells and cell faces sharing the element. (numpy.ndarray)

  • Return:
  • None
parent_data_write

Writes parent info for an element section.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : element section id which is comprised between 1 and the total number of element sections(int)
  • parent_data : For boundary of interface elements, the ParentData array contains information on the cells and cell faces sharing the element. (numpy.ndarray)
part_read

Returns a tuple with information about a Geometry reference part.

  • Args:
  • B: base id (int)
  • F: family id (int)
  • G: geometry reference id (int)
  • P: geometry reference part id (int)
  • Return:
  • argument base id (int)
  • argument family id (int)
  • argument geometry reference id (int)
  • argument geometry reference part id (int)
  • geometry reference part name (string)
part_write

Creates a new Geometry reference part.

  • Args:
  • B: parent base id (int) (bases() and nbases()).

  • F: parent family id (int) (families()

    and nfamilies()).

  • G: geometry reference id (int)

  • partname: name of the new geometry reference part (string) (string should not exceed 32 chars)

  • Return:
  • New Geometry reference part id
ptset_info

Returns a tuple with information about the point set.

  • Args:
  • None
  • Return:
  • point set type (int) The types are PointRange for a range of points or cells, list of discrete points or cells.
  • number of points or cells in the point set (int) For a point set type of PointRange, the number is always two. For a point set type of PointList, this is the number of points or cells in the list.
section_partial_write

Writes subset of element data.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • SectionName : name of the element section (string)
  • type : type of element (int)
  • start : index of first element in the section to write (int)
  • end : index of last element in the section to write (int)
  • nbndry : index of last boundary element in the section (int) If the elements are unsorted, this index is set to 0.
  • Return:
  • element section index
section_read

Returns a tuple with information about the element section data.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : element section id (int)
  • Return:
  • name of the Elements_t node (string)
  • type of element (int)
  • index of first element in the section (int)
  • index of last element in the section (int)
  • index of last boundary element in the section (int) If the elements are unsorted, this index is set to 0.
  • flag indicating if the parent data are defined (int) If the parent data exist, parent_flag is set to 1
section_write

Creates a new element section.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • SectionName : name of the element section (string)
  • type : type of element (int)
  • start : min range of element connectivity data to write (int)
  • end: max range of element connectivity data to write (int)
  • nbndry : index of last boundary element (int) If the elements are unsorted, this index is set to 0.
  • elements : element connectivity data (numpy.ndarray)
  • Return:
  • element section id (int)
sol_info

Returns a tuple with contains the name of the flow solution and the grid location of the solution.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : flow solution id which is comprised between 1 and the total number of flow solutions (int)
  • Return:
  • name of the flow solution (string)
  • grid location of the solution (int)
sol_size

Returns a tuple with information about the flow solution data.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • S : flow solution id (int)
  • Return:
  • number of dimensions defining the solution data (int) If a point set has been defined, this will be 1, otherwise this will be the current zone index dimension
  • array of data_dim dimensions for the solution data (numpy.ndarray)
sol_write

Creates a new flow solution node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • solname : name of the flow solution (string)
  • location : grid location where the solution is recorded (int) The admissible locations are Vertex, CellCenter, IFaceCenter, JFaceCenter and KFaceCenter.
  • Return:
  • flow solution id (int)
state_write

Creates a reference state node.

  • Args:
  • sdes : description of the reference state (string)
  • Return:
  • None
units_read

Reads the first five dimensional units.

  • Args:
  • None
  • Return:
  • m : mass units (int)
  • l : length units (int)
  • tps: mass units (int)
  • t: mass units (int)
  • a: mass units (int)
units_write

Writes the first five dimensional units in a new node.

  • Args:
  • m : mass units (int) Values are CG_Null, CG_UserDefined, Kilogram, Gram, Slug, and PoundMass.
  • l : length units (int) Values are CG_Null, CG_UserDefined, Meter, Centimeter, Millimeter, Foot, and Inch.
  • tps: mass units (int) Values are CG_Null, CG_UserDefined, and Second.
  • t: mass units (int) Values are CG_Null, CG_UserDefined, Kelvin, Celsius, Rankine, and Fahrenheit.
  • a: mass units (int) Values are CG_Null, CG_UserDefined, Degree, and Radian.
  • Return:
  • None
unitsfull_read

Returns all eight dimensional units.

  • Args:
  • None
  • Return:
  • m : mass units (int)
  • l : length units (int)
  • tps: mass units (int)
  • t: mass units (int)
  • a: mass units (int)
  • c: electric current units (int)
  • sa: admissible value units (int)
  • i: luminous intensity units (int)
unitsfull_write

Writes all eight dimensional units.

  • Args:
  • m : mass units (int) Value in CG_Null, CG_UserDefined, Kilogram, Gram, Slug and PoundMass.
  • l : length units (int) Value in CG_Null, CG_UserDefined, Meter, Centimeter, Millimeter, Foot and Inch.
  • tps: mass units (int) Value in CG_Null, CG_UserDefined and Second.
  • t: mass units (int) Value in CG_Null, CG_UserDefined, Kelvin, Celsius, Rankine and Fahrenheit.
  • a: mass units (int) Value in CG_Null, CG_UserDefined, Degree and Radian.
  • c: electric current units (int) Value in CG_Null, CG_UserDefined, Ampere, Abampere, Statampere, Edison and auCurrent.
  • sa: admissible value units (int) Value in CG_Null, CG_UserDefined, Mole, Entities, StandardCubicFoot and StandardCubicMeter.
  • i: luminous intensity units (int) Value in CG_Null, CG_UserDefined, Candela, Candle, Carcel, Hefner and Violle.
  • Return:
  • None
user_data_read

Returns the name of a given UserDefinedData_t node. You can access the node by using the gopath function.

  • Args:
  • Index : user-defined data id which is necessarily comprised between 1 and the total number of UserDefinedData_t nodes under the current node (int)
  • Return:
  • name of the required UserDefinedData_t node (string)
user_data_write

Creates a new UserDefinedData_t node. You can set the position of the node in the CGNS tree with the gopath function.

  • Args:
  • usn : name of the created node (string)
  • Return:
  • None
version

Returns the CGNS/MLL library version:

v=db.version()
  • Return:
  • The version number as a float, for example 2.400 is CGNS/MLL version 2.4
  • Remarks:
  • The Python print may display a float value without rounding, this may

change with your Python version and the way you actually print the value:

print '%g'%(db.version())
zconn_get

Gets the current ZoneGridConnectivity_t node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • Returns:
  • zone grid connectivity id (int)
zconn_read

Returns the name of the ZoneGridConnectivity_t node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • C : zone grid connectivity id (int)
  • Returns:
  • name of the ZoneGridConnectivity_t node (string)
zconn_set

Gets the current ZoneGridConnectivity_t node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • ZC : zone grid connectivity id (int)
  • Returns:
  • None
zconn_write

Creates a new ZoneGridConnectivity_t node.

  • Args:
  • B : base id (int)
  • Z : zone id (int)
  • name : name of the ZoneGridConnectivity_t node (string)
  • Returns:
  • zone grid connectivity id (int)
zone_id

Returns the zone internal id.

  • Args:
  • B: the CGNS/MLL base id (int)
  • Z: the CGNS/MLL zone id (int) (this is not the internal id)
  • Return:
  • The zone internal id (int)
  • Remarks:
  • This id can be used with the CGNS/ADF or CGNS/HDF5 API. If you don’t

know what this id is... then you should not use it.

zone_read

Returns a tuple with information about the zone.

  • Args:
  • B: base id (int)
  • Z: zone id (int)
  • Return:
  • argument base id (int)
  • argument zone id (int)
  • zone name (string)
  • zone size (numpy.ndarray)
  • Remarks:
  • returned array of zone size is a 1D array, you have to read it taking

into account the cell and physical dimensions of the parent base, see base_read()

zone_type

Returns the CGNS type of a zones.

  • Args:
  • Return:
  • The ZoneType_t of the zone as an integer (int).
zone_write

Creates a new zone:

zsize=numpy.array((i,j,k,i-1,j-1,k-1,0,0,0),dtype=numpy.int32)
zid=db.zone_write(B,'Zone-001',zsize,CGNS.PAT.cgnskeywords.Structured)
  • Args:
  • B: parent base id (int within nbases() ids)
  • zonename: name of the new zone (string should not exceed 32 chars)
  • zsize: numpy array of int
  • zonetype: type of the zone int
  • Return:
  • New zone id
  • Remarks:
  • No zone size check
  • Zone size can be 1D
  • Zone type is an integer that should be one of the CGNS.PAT.cgnskeywords.ZoneType_ keys
  • Zone size depends on base dimensions and zone type (see `CGNS/SIDS 6.3)
zones

Returns all the zones indices of a base:

for Z in db.zones(B):
   print db.zone_read(B,Z)[2]
  • Args:
  • Return:
  • An xrange from 1 to <number of zones> or an empty list if there is no zone at all.
  • Remarks: