Physical DataΒΆ

CGNS Mid-Level Library - Physical Data

Physical Data

  • Data Arrays
    • cg_array_write - Write data array
    • cg_array_general_write - Write shaped array to a subset of data array
    • cg_narrays - Get number of data arrays under current node
    • cg_array_info - Get data array info
    • cg_array_read - Read data array
    • cg_array_read_as - Read data array as a certain type
    • cg_array_general_read - Read subset of data array to a shaped array
  • Data Class
    • cg_dataclass_write - Write data class
    • cg_dataclass_read - Read data class
  • Data Conversion Factors
    • cg_conversion_write - Write conversion factors
    • cg_conversion_info - Get conversion factors data type
    • cg_conversion_read - Read conversion factors
  • Dimensional Units
    • cg_units_write - Write first five dimensional units
    • cg_unitsfull_write - Write all eight dimensional units
    • cg_nunits - Get number of dimensional units
    • cg_units_read - Read first five dimensional units
    • cg_unitsfull_read - Read all eight dimensional units
  • Dimensional Exponents
    • cg_exponents_write - Write first five dimensional exponents
    • cg_expfull_write - Write all eight dimensional exponents
    • cg_nexponents - Get number of dimensional exponents
    • cg_exponents_info - Get exponent data type
    • cg_exponents_read - Read first five dimensional exponents
    • cg_expfull_read - Read all eight dimensional exponents

Data Arrays

Node: DataArray_t (SIDS, File Mapping)

Functions Modes
ier = cg_array_write(char *arrayname, DataType_t datatype,
      int rank, cgsize_t *dimensions, void *data);
- w m
ier = cg_array_general_write(char *arrayname,
      DataType_t datatype, int rank, cgsize_t *dimensions,
      cgsize_t *range_min, cgsize_t *range_max,
      DataType_t mem_datatype, int mem_rank, cgsize_t *mem_dimensions,
      cgsize_t *mem_range_min, cgsize_t *mem_range_max,
      void *data);
- w m
ier = cg_narrays(int *narrays); r - m
ier = cg_array_info(int A, char *arrayname, DataType_t *datatype,
      int *rank, cgsize_t *dimensions);
r - m
ier = cg_array_read(int A, void *data); r - m
ier = cg_array_read_as(int A, DataType_t datatype, void *data); r - m
ier = cg_array_general_read(int A,
      cgsize_t *range_min, cgsize_t *range_max,
      DataType_t mem_datatype, int mem_rank, cgsize_t *mem_dimensions,
      cgsize_t *mem_range_min, cgsize_t *mem_range_max,
      void *data);
r - m
call cg_array_write_f(arrayname, datatype, rank,
     dimensions, data, ier)
- w m
call cg_array_general_write_f(arrayname, datatype, rank, dimensions
     range_min, range_max, mem_datatype, mem_rank, mem_dimensions,
     mem_range_min, mem_range_max, data, ier);
- w m
call cg_narrays_f(narrays, ier) r - m
call cg_array_info_f(A, arrayname, datatype, rank,
     dimensions, ier)
r - m
call cg_array_read_f(A, data, ier) r - m
call cg_array_read_as_f(A, datatype, data, ier) r - m
call cg_array_general_read_f(A, range_min, range_max, mem_datatype,
     mem_rank, mem_dimensions, mem_range_min, mem_range_max,
     data, ier);
r - m

Input/Output

    narrays   Number of DataArray_t nodes under the current node.
A Data array index, where 1 ≤ Anarrays.
arrayname Name of the DataArray_t node.
datatype Type of data held in the DataArray_t node. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
rank Number of dimensions of array in file (max 12). See Node Management Routines in CGIO User's Guide.
dimensions Dimensions of array in file.
range_min Lower range index in file (eg., imin, jmin, kmin).
range_max Upper range index in file (eg., imax, jmax, kmax).
mem_datatype The type of data held in memory. The admissible types are Integer, LongInteger, RealSingle, RealDouble, and Character.
mem_rank Number of dimensions of array in memory (max 12).
mem_dimensions Dimensions of array in memory.
mem_range_min Lower range index in memory (eg., imin, jmin, kmin).
mem_range_max Upper range index in memory (eg., imax, jmax, kmax).
data The data array in memory.
ier Error status.

The function cg_array_general_write may be used to write from a subset of the array in memory to a subset of the array in the file. When using the partial write, any existing data from range_min to range_max will be overwritten by the new values. All other values will not be affected.

The functions cg_array_general_read and cg_array_general_write allow for type conversion when both reading from and writing to the file.

When using cg_array_general_write and cg_array_general_read, the lower core elements in the file have index 1 for defining range_min and range_max; whereas for the array in memory, defined by mem_rank and mem_dimensions, the lower array elements in memory have index 1 for defining mem_range_min and mem_range_max. The actual lower and upper bounds of the array in memory can be anything. For example, to fully read a two-dimensional 6 × 6 data array with 1 rind plane on each side in the file to an 8 × 8 array in memory (mem_rank = 2 and mem_dimensions = (8,8)), set range_min and range_max to (0,0) and (7,7), and set mem_range_min and mem_range_max to (1,1) and (8,8).

Data Class

Node: DataClass_t (SIDS, File Mapping)

Functions Modes
ier = cg_dataclass_write(DataClass_t dataclass); - w m
ier = cg_dataclass_read(DataClass_t *dataclass); r - m
call cg_dataclass_write_f(dataclass, ier) - w m
call cg_dataclass_read_f(dataclass, ier) r - m

Input/Output

    dataclass   Data class for the nodes at this level. See below for the data classes currently supported in CGNS.
ier Error status.

The data classes currently supported in CGNS are:

    Dimensional   Regular dimensional data.
NormalizedByDimensional Nondimensional data that is normalized by dimensional reference quantities.
NormalizedByUnknownDimensional All fields and reference data are nondimensional.
NondimensionalParameter Nondimensional parameters such as Mach number and lift coefficient.
DimensionlessConstant Constant such as π.

These classes are declared within typedef DataClass_t in cgnslib.h, and as parameters in cgnslib_f.h.

Data Conversion Factors

Node: DataConversion_t (SIDS, File Mapping)

Functions Modes
ier = cg_conversion_write(DataType_t DataType,
      void *ConversionFactors);
- w m
ier = cg_conversion_info(DataType_t *DataType); r - m
ier = cg_conversion_read(void *ConversionFactors); r - m
call cg_conversion_write_f(DataType, ConversionFactors, ier) - w m
call cg_conversion_info_f(DataType, ier) r - m
call cg_conversion_read_f(ConversionFactors, ier) r - m

Input/Output

    DataType   Data type in which the conversion factors are recorded. Admissible data types for conversion factors are RealSingle and RealDouble.
ConversionFactors Two-element array containing the scaling and offset factors.
ier Error status.

The DataConversion_t data structure contains factors to convert the nondimensional data to "raw" dimensional data. The scaling and offset factors are contained in the two-element array ConversionFactors. In pseudo-Fortran, the conversion process is as follows:

   ConversionScale  = ConversionFactors(1)
   ConversionOffset = ConversionFactors(2)
   Data(raw) = Data(nondimensional)*ConversionScale + ConversionOffset

Dimensional Units

Nodes: DimensionalUnits_t (SIDS, File Mapping)

Functions Modes
ier = cg_units_write(MassUnits_t mass, LengthUnits_t length,
      TimeUnits_t time, TemperatureUnits_t temperature,
      AngleUnits_t angle);
- w m
ier = cg_unitsfull_write(MassUnits_t mass, LengthUnits_t length,
      TimeUnits_t time, TemperatureUnits_t temperature,
      AngleUnits_t angle, ElectricCurrentUnits_t current,
      SubstanceAmountUnits_t amount,
      LuminousIntensityUnits_t intensity);
- w m
ier = cg_nunits(int *nunits); r - m
ier = cg_units_read(MassUnits_t *mass, LengthUnits_t *length,
      TimeUnits_t *time, TemperatureUnits_t *temperature,
      AngleUnits_t *angle);
r - m
ier = cg_unitsfull_read(MassUnits_t *mass, LengthUnits_t *length,
      TimeUnits_t *time, TemperatureUnits_t *temperature,
      AngleUnits_t *angle, ElectricCurrentUnits_t *current,
      SubstanceAmountUnits_t *amount,
      LuminousIntensityUnits_t *intensity);
r - m
call cg_units_write_f(mass, length, time, temperature, angle, ier) - w m
call cg_unitsfull_write_f(mass, length, time, temperature, angle,
     current, amount, intensity, ier)
- w m
call cg_nunits_f(nunits, ier) r - m
call cg_units_read_f(mass, length, time, temperature, angle, ier) r - m
call cg_unitsfull_read_f(mass, length, time, temperature, angle,
     current, amount, intensity, ier)
r - m

Input/Output

    mass   Mass units. Admissible values are CG_Null, CG_UserDefined, Kilogram, Gram, Slug, and PoundMass.
length Length units. Admissible values are CG_Null, CG_UserDefined, Meter, Centimeter, Millimeter, Foot, and Inch.
time Time units. Admissible values are CG_Null, CG_UserDefined, and Second.
temperature Temperature units. Admissible values are CG_Null, CG_UserDefined, Kelvin, Celsius, Rankine, and Fahrenheit.
angle Angle units. Admissible values are CG_Null, CG_UserDefined, Degree, and Radian.
current Electric current units. Admissible values are CG_Null, CG_UserDefined, Ampere, Abampere, Statampere, Edison, and auCurrent.
amount Substance amount units. Admissible values are CG_Null, CG_UserDefined, Mole, Entities, StandardCubicFoot, and StandardCubicMeter.
intensity Luminous intensity units. Admissible values are CG_Null, CG_UserDefined, Candela, Candle, Carcel, Hefner, and Violle.
nunits Number of units used in the file (i.e., either 5 or 8).
ier Error status.

The supported units are declared within typedefs in cgnslib.h and as parameters in cgnslib_f.h.

When reading units data, either cg_units_read or cg_unitsfull_read may be used, regardless of the number of units used in the file. If cg_unitsfull_read is used, but only five units are used in the file, the returned values of current, amount, and intensity will be CG_Null.

Dimensional Exponents

Node: DimensionalExponents_t (SIDS, File Mapping)

Functions Modes
ier = cg_exponents_write(DataType_t DataType, void *exponents); - w m
ier = cg_expfull_write(DataType_t DataType, void *exponents); - w m
ier = cg_nexponents(int *nexponents); r - m
ier = cg_exponents_info(DataType_t *DataType); r - m
ier = cg_exponents_read(void *exponents); r - m
ier = cg_expfull_read(void *exponents); r - m
call cg_exponents_write_f(DataType, exponents, ier) - w m
call cg_expfull_write_f(DataType, exponents, ier) - w m
call cg_nexponents_f(nexponents, ier) r - m
call cg_exponents_info_f(DataType, ier) r - m
call cg_exponents_read_f(exponents, ier) r - m
call cg_expfull_read_f(exponents, ier) r - m

Input/Output

    DataType   Data type in which the exponents are recorded. Admissible data types for the exponents are RealSingle and RealDouble.
exponents Exponents for the dimensional units for mass, length, time, temperature, angle, electric current, substance amount, and luminous intensity, in that order.
nexponents Number of exponents used in the file (i.e., either 5 or 8).
ier Error status.

When reading exponent data, either cg_exponents_read or cg_expfull_read may be used, regardless of the number of exponents used in the file. If cg_exponents_read is used, but all eight exponents are used in the file, only the first five exponents are returned. If cg_expfull_read is used, but only five exponents are used in the file, the returned values of the exponents for electric current, substance amount, and luminous intensity will be zero.