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)
- 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)
- 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.
- B : base id (int)
- Z : zone id (int)
- S : element section id (int)
- number of element connectivity data values (int)
-
ElementPartialSize
Returns the number of element connectivity data values in a range.
- 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)
- 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.
- A : data array id between 1 and the number of arrays
under the current node (int)
- 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
- A : data array id which is comprised between 1 and the number of arrays
under the current node (int)
- data array (numpy.ndarray)
-
array_read_as
Reads a data array as a certain type. Should set the target node
with goto-like function.
- 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)
- data array (numpy.ndarray)
- 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.
- aname : name of the data array (string)
- adata : data array (‘numpy.ndarray`)
- the datatype is guessed from the numpy.ndarray data type
-
base_id
Returns the base internal id.
- B: the CGNS/MLL base id (int) (this is not the internal id)
- The base internal id (int)
- 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.
- 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)
- 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)
-
bases
Returns the bases indices:
for B in db.bases():
print db.base_read(B)
- An xrange from 1 to <number of bases> or an empty list if there is
no base at all.
-
bcdataset_write
Create a new BCDataSet:
db.bcdataset_write("Dataset-1",BCTypeNull,Dirichlet)
-
boco_gridlocation_read
Returns the location of a given boundary condition.
- B : base id (int)
- Z : zone id (int)
- BC: boundary condition id (int)
- grid location used in the definition of the point set (int)
-
boco_gridlocation_write
Writes the boundary condition location.
- B : base id (int)
- Z : zone id (int)
- BC: boundary condition id (int)
- location : grid location of the point set (int)
-
boco_info
Gets info from a given boundary condition. Returns info in a tuple.
- B : base id (int)(numpy.ndarray)
- Z : zone id (int)
- BC: boundary condition id (int)
- 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.
- 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)
-
boco_read
Reads boundary condition data and normals.
- B : base id (int)
- Z : zone id (int)
- BC: boundary condition id (int)
- 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.
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)
- boundary condition id (int)
-
close
Closes the CGNS/MLL file descriptor.
- 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.
- B : base id (int)
- Z : zone id (int)
- I : interface id (int)
- 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.
- 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)
-
conn_info
Generalized connectivity data node info.
- B : base id (int)
- Z : zone id (int)
- I : interface id (int)
- 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.
- B : base id (int)
- Z : zone id (int)
- I : interface id (int)
- 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.
- B : base id (int)
- Z : zone id (int)
- I : interface id (int)
- array of points as the interface in the current zone (numpy.ndarray)
-
conn_write
Creates a new generalized connectivity data node.
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)
-
conn_write_short
Creates a new generalized connectivity data node without donor information.
- 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.
- iter : number of iterations recorded (int)
- ndef : description of the convergence information (string)
-
conversion_info
Returns the conversion factors data type.
- data type of the conversion factors (int)
-
conversion_read
Returns the conversion factors.
- two-element array with scaling and offset factors (numpy.ndarray)
-
conversion_write
Writes the conversion factors in a new node.
- 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)
-
coord_id
Returns the base internal id.
- B: the CGNS/MLL base id (int)
- Z: the CGNS/MLL zone id (int)
- C: the CGNS/MLL coordinates id (int)
- The coordinates internal id (int)
- 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.
- argument base id (int)
- argument zone id (int)
- argument coordinates id (int)
- coordinates array data type (int)
- coordinate name (string)
- 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.
- 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)
- 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.
- B: base id (int)
- Z: zone id (int)
- coordname: coordinate array name to read (string)
- dtype: datatype of the array (int)
- 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)
- 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.
- 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)
- coordinate array id (int)
- 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.
- B: parent base id (int)
- Z: parent zone id (int)
- An xrange from 1 to <number of nodes> or an empty list if there is
no coordinates at all.
-
dataclass_read
Returns the data class.
- dclass : data class for the nodes at this level (int)
-
dataclass_write
Writes the data class in a new node.
- dclass : data class for the nodes at this level (int)
The admissible data classes are Dimensional, NormalizedByDimensional,
NormalizedByUnknownDimensional,
NondimensionalParameter and DimensionlessConstant.
-
dataset_read
Returns a tuple with information about a boundary condition dataset.
- B : base id (int)
- Z : zone id (int)
- BC: boundary condition id (int)
- dataset id (int)
- 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.
- B : base id (int)
- Z : zone id (int)
- BC: boundary condition id (int)
- BCType : boundary condition type (int)
-
descriptor_write
Writes descriptive text.
- dname : name of the descriptor node (string)
- dtext : description contained in the descriptor node (string)
-
descriptors
Returns the descriptors indices:
for D in db.descriptors():
print db.descriptor_read(D)
- An xrange from 1 to <number of descriptors> or an empty list if
there is no descriptor at all.
-
diffusion_read
Reads a diffusion model node.
- flags defining diffusion terms in the governing equations (int)
-
diffusion_write
Creates a diffusion model node.
- 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.
-
discrete_ptset_info
Returns a tuple with information about a given discrete data node.
- 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)
- 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.
- 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)
- array of points defining the interface (‘numpy.ndarray`)
-
discrete_ptset_write
Creates a new point set DiscreteData_t node.
- 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)
- array of points defining the interface (‘numpy.ndarray`)
-
discrete_read
Returns the name of a given DiscreteData_t node.
- 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)
- name of discrete data node (string)
-
discrete_size
Returns the dimensions of a DiscreteData_t node.
- 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)
- 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.
- B : base id (int)
- Z : zone id (int)
- name : name of the created node (string)
-
elements_partial_read
Returns a tuple with the element connectivity data and the parent data
for a given range.
- 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)
- 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.
- 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.
- B : base id (int)
- Z : zone id (int)
- S : element section id (int)
- 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.
- 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.
- 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.
- 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.
- eqdim : dimensionality of the governing equations (int)
Dimensionality is the number of spatial variables describing the flow
-
expfull_read
Reads all eight dimensional exponents.
- 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.
- 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)
-
exponents_info
Returns the exponent data type.
- data type of the exponents (int)
-
exponents_read
Reads the first five dimensional exponents.
- 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.
- 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)
-
fambc_read
Returns a tuple with information about the family BC.
- B: base id (int)
- F: family id (int)
- BC: BC family id (int)
- argument base id (int)
- argument family id (int)
- argument BC family id (int)
- BC family name (string)
- BC type (int)
- 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)
- 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)
- 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)
- An xrange from 1 to <number of families> or an empty list if there is
no family at all.
-
family_read
Returns a tuple with information about the family.
- B: base id (int)
- F: family id (int)
- 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)
- 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')
- B: the parent base id (int) (bases()
and nbases()).
- familyname: name of the new family (string <= 32 chars)
-
geo_read
Returns a tuple with information about the Geometry reference.
- B: base id (int)
- F: family id (int)
- G: geometry reference id (int)
- 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)
-
geo_write
Creates a new Geometry reference.
- 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)
- New Geometry reference id (int)
- The cad should be an enumerate as described in SIDS section 12.7
-
governing_read
Returns type of the governing equations.
- type of governing equations (int)
-
governing_write
Creates type of the governing equations.
- etype: type of governing equations (int)
-
grid_read
Returns a tuple with information about the grid.
- B: base id (int)
- Z: zone id (int)
- G: grid id (int)
- argument base id (int)
- argument zone id (int)
- argument grid id (int)
- grid name (string)
-
grid_write
Creates a new grid.
- B: base id (int)
- Z: zone id (int)
- gridname: name of the new grid (string <= 32 chars) (string)
- 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.
- location in the grid (int)
-
gridlocation_write
Writes the grid location in a new node.
- gloc : location in the grid (int)
The admissible locations are CG_Null, CG_UserDefined, Vertex,
CellCenter, FaceCenter, IFaceCenter, JFaceCenter, KFaceCenter, EdgeCenter
-
grids
Returns the number of grids indices of a zone:
for G in db.grids(B,Z):
print db.grid_read(B,Z,G)
- An xrange from 1 to <number of grids> or an empty list if there is
no grid at all.
-
integral_read
Returns the name of a integral data node.
- idx : integral data id (int)
- name of the integral data node (string)
-
integral_write
Creates a new integral data node.
- name : name of the integral data node (string)
- number of integral data nodes contained in the current node (int)
-
link_read
link_read memory is allocated by CGNS/MLL
-
model_read
Reads auxiliary model types.
- 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)
-
model_write
Writes auxiliary model types.
- 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)
-
n1to1
Returns the number of 1-to-1 interfaces in a zone.
- B : base id (int)
- Z : zone id (int)
- number of 1-to-1 interfaces contained in a GridConnectivity1to1_t
node (int)
- 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.
- 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.
- 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)
- The number of bases as an integer
-
nbocos
Gets number of boundary conditions.
- B : base id (int)
- Z : zone id (int)
- number of boundary conditions in zone Z (int)
-
nconns
Returns the number of generalized connectivity data.
- B : base id (int)
- Z : zone id (int)
- number of interfaces (int)
-
ncoords
Returns the number of coordinates array in the GridCoordinates node.
- B: parent base id (int)
- Z: parent zone id (int)
- The number of coordinates arrays as an integer (int)
-
ndescriptors
Returns the number of descriptor nodes contained in the current node.
- number of descriptor nodes under the current node (int)
-
ndiscrete
Returns the number of DiscreteData_t nodes in a given zone.
- B : base id (int)
- Z : zone id (int)
- number of DiscreteData_t`nodes contained in the zone (`int)
-
nexponents
Returns the number of dimensional exponents.
- 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)
- The number of families as an integer (int)
-
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)
- The number of grids as an integer (int)
-
nintegrals
Returns the number of integral data nodes.
- number of integral data nodes contained in the current node (int)
-
npe
Returns the number of nodes of an element.
- type : type of element (int)
- number of nodes for an element of type type (int)
-
nsections
Returns the number of element sections.
- B : base id (int)
- Z : zone id (int)
- number of element sections (int)
-
nsols
Returns the number of flow solutions.
- B : base id (int)
- Z : zone id (int)
- number of flow solutions for zone Z`(`int)
-
nunits
Returns the number of dimensional units.
- 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.
- number of UserDefinedData_t nodes contained in the current node (int)
-
nzconns
Returns the number of ZoneGridConnectivity_t nodes.
- B : base id (int)
- Z : zone id (int)
- 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]
- Number of zones as an integer (int)
-
ordinal_read
Reads the ordinal value.
-
ordinal_write
Writes the ordinal value in a new node.
- ord : any integer value (int)
-
parent_data_partial_write
Writes subset of parent info for an element section.
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)
-
parent_data_write
Writes parent info for an element section.
- 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.
- B: base id (int)
- F: family id (int)
- G: geometry reference id (int)
- P: geometry reference part id (int)
- 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.
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)
- New Geometry reference part id
-
ptset_info
Returns a tuple with information about the point set.
- 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.
- 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.
-
section_read
Returns a tuple with information about the element section
data.
- B : base id (int)
- Z : zone id (int)
- S : element section id (int)
- 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.
- 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)
-
sol_info
Returns a tuple with contains the name of the flow solution and
the grid location of the solution.
- 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)
- name of the flow solution (string)
- grid location of the solution (int)
-
sol_size
Returns a tuple with information about the flow solution
data.
- B : base id (int)
- Z : zone id (int)
- S : flow solution id (int)
- 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.
- 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.
-
state_write
Creates a reference state node.
- sdes : description of the reference state (string)
-
units_read
Reads the first five dimensional units.
- 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.
- 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.
-
unitsfull_read
Returns all eight dimensional units.
- 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.
- 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.
-
user_data_read
Returns the name of a given UserDefinedData_t node. You can access
the node by using the gopath function.
- Index : user-defined data id which is necessarily comprised
between 1 and the total number of UserDefinedData_t nodes under
the current node (int)
- 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.
- usn : name of the created node (string)
-
version
Returns the CGNS/MLL library version:
- The version number as a float, for example 2.400 is CGNS/MLL version 2.4
- 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.
- B : base id (int)
- Z : zone id (int)
- zone grid connectivity id (int)
-
zconn_read
Returns the name of the ZoneGridConnectivity_t node.
- B : base id (int)
- Z : zone id (int)
- C : zone grid connectivity id (int)
- name of the ZoneGridConnectivity_t node (string)
-
zconn_set
Gets the current ZoneGridConnectivity_t node.
- B : base id (int)
- Z : zone id (int)
- ZC : zone grid connectivity id (int)
-
zconn_write
Creates a new ZoneGridConnectivity_t node.
- B : base id (int)
- Z : zone id (int)
- name : name of the ZoneGridConnectivity_t node (string)
- zone grid connectivity id (int)
-
zone_id
Returns the zone internal id.
- B: the CGNS/MLL base id (int)
- Z: the CGNS/MLL zone id (int) (this is not the internal id)
- The zone internal id (int)
- 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.
- B: base id (int)
- Z: zone id (int)
- argument base id (int)
- argument zone id (int)
- zone name (string)
- zone size (numpy.ndarray)
- 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.
- 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)
- 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
- 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]
- An xrange from 1 to <number of zones> or an empty list if there is
no zone at all.