pub struct PolyDispersePacking {
pub distribution: SizeDistribution,
pub params: SizeDistributionParams,
pub domain: [f64; 3],
pub spheres: Vec<PackingSphere>,
pub max_attempts: usize,
}Expand description
Polydisperse sphere packing with various size distributions.
Fields§
§distribution: SizeDistributionDistribution type.
params: SizeDistributionParamsDistribution parameters.
domain: [f64; 3]Domain dimensions.
spheres: Vec<PackingSphere>Placed spheres.
max_attempts: usizeMaximum placement attempts.
Implementations§
Source§impl PolyDispersePacking
impl PolyDispersePacking
Sourcepub fn new(
distribution: SizeDistribution,
params: SizeDistributionParams,
domain: [f64; 3],
max_attempts: usize,
) -> Self
pub fn new( distribution: SizeDistribution, params: SizeDistributionParams, domain: [f64; 3], max_attempts: usize, ) -> Self
Create a new polydisperse packing.
Sourcepub fn sample_radius(&self, rng: &mut impl Rng) -> f64
pub fn sample_radius(&self, rng: &mut impl Rng) -> f64
Sample a radius from the configured distribution.
Sourcepub fn is_valid_placement(&self, center: [f64; 3], radius: f64) -> bool
pub fn is_valid_placement(&self, center: [f64; 3], radius: f64) -> bool
Check if a sphere with given center and radius can be placed.
Sourcepub fn run(&mut self, n_spheres: usize) -> usize
pub fn run(&mut self, n_spheres: usize) -> usize
Run RSA with polydisperse radii.
Returns the number of spheres placed.
Sourcepub fn packing_fraction(&self) -> f64
pub fn packing_fraction(&self) -> f64
Compute the packing fraction.
Sourcepub fn radius_statistics(&self) -> (f64, f64, f64, f64)
pub fn radius_statistics(&self) -> (f64, f64, f64, f64)
Return radius statistics: (mean, std, min, max).
Sourcepub fn polydispersity_index(&self) -> f64
pub fn polydispersity_index(&self) -> f64
Compute the polydispersity index (PDI): std/mean.
Auto Trait Implementations§
impl Freeze for PolyDispersePacking
impl RefUnwindSafe for PolyDispersePacking
impl Send for PolyDispersePacking
impl Sync for PolyDispersePacking
impl Unpin for PolyDispersePacking
impl UnsafeUnpin for PolyDispersePacking
impl UnwindSafe for PolyDispersePacking
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.