pub struct Shield {
pub linear_attenuation_coefficient: f64,
pub thickness: f64,
}Expand description
A simple slab shield with a linear attenuation coefficient and thickness.
Fields§
§linear_attenuation_coefficient: f64Linear attenuation coefficient in inverse meters.
thickness: f64Shield thickness in meters.
Implementations§
Source§impl Shield
impl Shield
Sourcepub fn new(linear_attenuation_coefficient: f64, thickness: f64) -> Option<Self>
pub fn new(linear_attenuation_coefficient: f64, thickness: f64) -> Option<Self>
Creates a shield from non-negative finite attenuation and thickness values.
Examples found in repository?
examples/basic_usage.rs (line 7)
5fn main() -> Result<(), &'static str> {
6 let beam = RadiationBeam::new(10.0, 2.0).ok_or("expected valid beam")?;
7 let shield = Shield::new(core::f64::consts::LN_2, 1.0).ok_or("expected valid shield")?;
8 let dose = Dose::new(2.0).ok_or("expected valid dose")?;
9 let weighting = default_radiation_weighting_factor(RadiationKind::Gamma)
10 .ok_or("expected gamma weighting")?;
11
12 assert_eq!(beam.intensity(), Some(5.0));
13 assert_eq!(beam.photon_flux(2.0), Some(5.0));
14 assert!(
15 (shield
16 .transmitted_fraction()
17 .ok_or("expected transmitted fraction")?
18 - 0.5)
19 .abs()
20 < 1.0e-12
21 );
22 assert_eq!(dose.equivalent(weighting), Some(2.0));
23
24 Ok(())
25}Sourcepub fn transmitted_fraction(&self) -> Option<f64>
pub fn transmitted_fraction(&self) -> Option<f64>
Computes transmitted fraction for this shield.
Examples found in repository?
examples/basic_usage.rs (line 16)
5fn main() -> Result<(), &'static str> {
6 let beam = RadiationBeam::new(10.0, 2.0).ok_or("expected valid beam")?;
7 let shield = Shield::new(core::f64::consts::LN_2, 1.0).ok_or("expected valid shield")?;
8 let dose = Dose::new(2.0).ok_or("expected valid dose")?;
9 let weighting = default_radiation_weighting_factor(RadiationKind::Gamma)
10 .ok_or("expected gamma weighting")?;
11
12 assert_eq!(beam.intensity(), Some(5.0));
13 assert_eq!(beam.photon_flux(2.0), Some(5.0));
14 assert!(
15 (shield
16 .transmitted_fraction()
17 .ok_or("expected transmitted fraction")?
18 - 0.5)
19 .abs()
20 < 1.0e-12
21 );
22 assert_eq!(dose.equivalent(weighting), Some(2.0));
23
24 Ok(())
25}Sourcepub fn attenuated_intensity(&self, initial_intensity: f64) -> Option<f64>
pub fn attenuated_intensity(&self, initial_intensity: f64) -> Option<f64>
Computes attenuated intensity through this shield.
§Examples
use use_radiation::Shield;
let shield = Shield::new(core::f64::consts::LN_2, 1.0).ok_or("expected shield")?;
let attenuated = shield
.attenuated_intensity(100.0)
.ok_or("expected attenuated intensity")?;
assert!((attenuated - 50.0).abs() < 1.0e-12);Trait Implementations§
impl Copy for Shield
impl StructuralPartialEq for Shield
Auto Trait Implementations§
impl Freeze for Shield
impl RefUnwindSafe for Shield
impl Send for Shield
impl Sync for Shield
impl Unpin for Shield
impl UnsafeUnpin for Shield
impl UnwindSafe for Shield
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