armi.nuclearDataIO.cccc.dif3d module

Module for reading from and writing to DIF3D files, which are module dependent binary inputs for the DIF3D code.

class armi.nuclearDataIO.cccc.dif3d.Dif3dData[source]

Bases: DataContainer

class armi.nuclearDataIO.cccc.dif3d.Dif3dStream(data: DataContainer, fileName: str, fileMode: str)[source]

Bases: StreamWithDataContainer

Tool to read and write DIF3D files.

readWrite()[source]

Reads or writes metadata and data from the five records of the DIF3D binary file.

Implementation: Tool to read and write DIF3D files. I_ARMI_NUCDATA_DIF3D
signature: readWrite
requirements: R_ARMI_NUCDATA_DIF3D

The reading and writing of the DIF3D binary file is performed using StreamWithDataContainer from the cccc package. This class allows for the reading and writing of CCCC binary files, processing one record at a time using subclasses of the IORecord. Each record in a CCCC binary file consists of words that represent integers (short or long), floating-point numbers (single or double precision), or strings of data. One or more of these words are parsed one at a time by the reader. Multiple words processed together have meaning, such as such as groupwise overrelaxation factors. While reading, the data is stored in a Python dictionary as an attribute on the object, one for each record. The keys in each dictionary represent the parsed grouping of words in the records; for example, for the 4D record (stored as the attribute fourD), each groupwise overrelaxation factor is stored as the key OMEGA{i}, where i is the group number. See I_ARMI_NUCDATA for more details on the general implementation.

Each record is also embedded with the record size at the beginning and end of the record (always assumed to be present), which is used for error checking at the end of processing each record.

The DIF3D reader processes the file identification record (stored as the attribute _metadata) and the five data records for the DIF3D file, as defined in the specification for the file distributed with the DIF3D software.

This class can also read and write an ASCII version of the DIF3D file. While this format is not used by the DIF3D software, it can be a useful representation for users to access the file in a human-readable format.