Struct TallyResult
pub struct TallyResult {
pub value: f64,
pub error: f64,
}
Expand description
Tally result containing a value and relative error
All tally results are output as <value>
<error>
pairs. Each pair is
stored as a TallyResult to avoid maintiaing multiple arrays and indexing
both to retrieve data that should be linked.
For example:
vals
1.00000E+00 0.1230 2.00000E+00 0.4560 3.00000E+00 0.7890 ...
[
TallyResult {
value: 1.00000E+00,
error: 0.1230,
},
TallyResult {
value: 2.00000E+00,
error: 0.4560,
},
TallyResult {
value: 3.00000E+00,
error: 0.7890,
},
...
]
Fields§
§value: f64
Tally result value
error: f64
Relative uncertainty
Implementations§
§impl TallyResult
impl TallyResult
pub fn absolute_error(&self) -> f64
pub fn absolute_error(&self) -> f64
Absolute error on the result
For example:
let result = TallyResult {
value: 50.0,
error: 0.10,
};
/// 10% relative error => 50.0 +/-5.0
assert_eq!(result.absolute_error(), 5.0);
pub fn relative_error(&self) -> f64
pub fn relative_error(&self) -> f64
Relative error on the result
The MCNP tally outputs are provided and stored as the relative uncertainty anyway. However, having both absolute_error() and relative_error() methods makes intent explicit.
For example:
let result = TallyResult {
value: 50.0,
error: 0.10,
};
/// 10% relative error => 50.0 +/-5.0
assert_eq!(result.relative_error(), 0.1);
Trait Implementations§
§impl Debug for TallyResult
impl Debug for TallyResult
§impl Default for TallyResult
impl Default for TallyResult
§fn default() -> TallyResult
fn default() -> TallyResult
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TallyResult
impl RefUnwindSafe for TallyResult
impl Send for TallyResult
impl Sync for TallyResult
impl Unpin for TallyResult
impl UnwindSafe for TallyResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more