Struct Mctal
pub struct Mctal {
pub header: Header,
pub tallies: Vec<Tally>,
pub tmesh: Vec<Tmesh>,
pub kcode: Option<Kcode>,
}Expand description
Data structure to store MCTAL file content
This Mctal is the primary data structure containing the parsed file data.
The MCNP MCTAL file contains all tally results of one dump of a RUNTAPE file in a relatively fixed-format.
There are many data collections available, but can be broken into one of the following blocks:
| Data block | Description |
|---|---|
| Header | file metadata and run information |
| Tally | all standard F tallies, including tally fluctuation chart |
| Tmesh | superimposed Mesh Tally Type A (a.k.a TMESH) |
| Kcode | criticality results (KCODE) |
Note that TMESH mesh tallies are written to the MCTAL file, while FMESH
mesh tallies are not. Tools for reading FMESH data are available in other
ntools crates (See mesh).
Fields§
§header: HeaderHeader information and metadata
tallies: Vec<Tally>Collection of standard tallies
tmesh: Vec<Tmesh>Collection of TMESH tallies (MCNPv6.3 only)
kcode: Option<Kcode>Kcode run information
Implementations§
§impl Mctal
impl Mctal
pub fn new() -> Self
pub fn new() -> Self
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Read a MCTAL file
Parses the file at path into the Mctal data structure for
post-processing.
The path may be a &str, String, Path, etc.
Parameters
path: A reference to a path that points to the MCTAL file.
Returns
A Result which is Ok if the file was successfully read and parsed,
or an Err if an error occurred.
Example
// Read every tally contained in the MCTAL file
let mctal: Mctal = Mctal::from_file("path/to/mctal_file").unwrap();pub fn get_header(&self) -> &Header
pub fn get_header(&self) -> &Header
pub fn get_tally(&self, id: u32) -> Option<&Tally>
pub fn get_tally(&self, id: u32) -> Option<&Tally>
Find a specific tally
Parameters
id: The ID of the tally to find.
Returns
An Option containing a reference to the Tally if found, otherwise None.
Example
// Dummy tally with id=104
let mut tally = Tally::default();
tally.id = 104;
// Add the dummy tally to a MCTAL
let mut mctal = Mctal::default();
mctal.tallies = vec![tally];
// Will return `Some(&Tally)` if it exists, otherwise `None`
assert!(mctal.get_tally(104).is_some());
assert!(mctal.get_tally(114).is_none());pub fn get_tmesh(&self, id: u32) -> Option<&Tmesh>
pub fn get_tmesh(&self, id: u32) -> Option<&Tmesh>
Find a specific tmesh
Parameters
id: The ID of the tmesh to find.
Returns
An Option containing a reference to the Tmesh if found, otherwise None.
Example
// Dummy mesh with id=104
let mut tmesh = Tmesh::default();
tmesh.id = 104;
// Add the dummy mesh to a MCTAL
let mut mctal = Mctal::default();
mctal.tmesh = vec![tmesh];
// Will return `Some(&Tmesh)` if it exists, otherwise `None`
assert!(mctal.get_tmesh(104).is_some());
assert!(mctal.get_tmesh(114).is_none());§impl Mctal
impl Mctal
pub fn get_version(&self) -> &str
pub fn get_version(&self) -> &str
Code version, e.g. “6.3”
pub fn get_probid(&self) -> &str
pub fn get_probid(&self) -> &str
Message from the input deck
pub fn get_randoms(&self) -> u64
pub fn get_randoms(&self) -> u64
Number of pseudo-random numbers
pub fn get_tally_list(&self) -> &[u32]
pub fn get_tally_list(&self) -> &[u32]
List of tally numbers available in in the the MCTAL file
pub fn get_tmesh_list(&self) -> Vec<u32>
pub fn get_tmesh_list(&self) -> Vec<u32>
List of tally numbers available in in the the MCTAL file