Skip to main content

Stack

Struct Stack 

Source
pub struct Stack { /* private fields */ }
Expand description

A 1D layered target: finite layers front to back, optionally ending in a semi-infinite substrate.

Implementations§

Source§

impl Stack

Source

pub fn new( layers: Vec<(Material, f64)>, substrate: Option<Material>, ) -> Result<Self, GeometryError>

Build from (material, thickness in m) pairs, front first, and an optional semi-infinite substrate behind them.

Source

pub fn semi_infinite(material: Material) -> Self

A single semi-infinite material.

Source

pub fn layers(&self) -> &[Layer]

Layers front to back.

Source

pub fn back_face_m(&self) -> Option<f64>

Depth of the back face, m, or None if the last layer is semi-infinite.

Source

pub fn layer_at(&self, x: f64) -> Option<usize>

Index of the layer containing depth x, or None outside the target. A depth exactly on an interface belongs to the deeper layer.

Trait Implementations§

Source§

impl Clone for Stack

Source§

fn clone(&self) -> Stack

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Stack

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Geometry for Stack

Source§

fn material_index(&self, region: usize) -> usize

Each layer is its own material entry, so layer data is cached per layer.

Source§

fn as_stack(&self) -> Option<&Stack>

This geometry as a layered Stack, if it is one. Tallies defined per layer (dose, depth-dose, interface transmission) need it.
Source§

fn n_materials(&self) -> usize

Number of distinct materials.
Source§

fn material(&self, index: usize) -> &Material

Material index (0..n_materials()).
Source§

fn n_regions(&self) -> usize

Number of regions.
Source§

fn locate(&self, pos: [f64; 3]) -> Option<usize>

The region containing pos, or None outside the target (or for a non-finite position). Ownership of shared faces: see the module docs.
Source§

fn entry_point(&self) -> [f64; 3]

Where a beam enters by default: the origin for a Stack, the centre of the front face for a VoxelGrid.
Source§

fn exit( &self, region: usize, pos: [f64; 3], dir: [f64; 3], limit: f64, ) -> Option<Exit>

The first event along the straight flight from pos (inside region, or on one of its faces) in the unit direction dir, if it happens at a path length of at most limit; otherwise None. The event is a change of material, a periodic wrap, or leaving the target. Read more
Source§

fn in_vacuum(&self, pos: [f64; 3]) -> bool

Whether pos lies outside the target in vacuum, used to skip weak- collision partners that would lie beyond a surface. For a Stack this is in front of the front face only (as in the M0 engine).
Source§

fn flight( &self, region: usize, pos: [f64; 3], dir: [f64; 3], limit: f64, ) -> Flight

Geometry::exit, also reporting the region the flight ends in when there is no event, so a transport engine can keep its particle’s region consistent with its position after crossing same-material faces. The default suits a geometry whose regions are each a whole material run along every flight (a Stack, where leaving a layer is always an event): without an event the region is unchanged.
Source§

impl PartialEq for Stack

Source§

fn eq(&self, other: &Stack) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Stack

Auto Trait Implementations§

§

impl Freeze for Stack

§

impl RefUnwindSafe for Stack

§

impl Send for Stack

§

impl Sync for Stack

§

impl Unpin for Stack

§

impl UnsafeUnpin for Stack

§

impl UnwindSafe for Stack

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V