pub struct ConfiningGeometry {
pub config: ConfinementConfig,
pub spheres: Vec<PackingSphere>,
pub n_rejected: usize,
}Expand description
Sphere packing inside various confining geometries.
Wall effects (reduced packing near walls) and boundary layers are naturally captured by the placement algorithm.
Fields§
§config: ConfinementConfigConfinement configuration.
spheres: Vec<PackingSphere>Placed spheres.
n_rejected: usizeNumber of rejected attempts.
Implementations§
Source§impl ConfiningGeometry
impl ConfiningGeometry
Sourcepub fn new(config: ConfinementConfig) -> Self
pub fn new(config: ConfinementConfig) -> Self
Create a new confined packing.
Sourcepub fn point_inside_container(&self, center: [f64; 3], radius: f64) -> bool
pub fn point_inside_container(&self, center: [f64; 3], radius: f64) -> bool
Check if a point is inside the container (accounting for sphere radius).
Sourcepub fn random_point_in_container(&self, rng: &mut impl Rng) -> [f64; 3]
pub fn random_point_in_container(&self, rng: &mut impl Rng) -> [f64; 3]
Sample a random point inside the container.
Sourcepub fn try_place(&mut self, rng: &mut impl Rng) -> bool
pub fn try_place(&mut self, rng: &mut impl Rng) -> bool
Try to place a sphere at a random location inside the container.
Sourcepub fn container_volume(&self) -> f64
pub fn container_volume(&self) -> f64
Compute the container volume.
Sourcepub fn packing_fraction(&self) -> f64
pub fn packing_fraction(&self) -> f64
Compute the packing fraction.
Sourcepub fn boundary_layer_fraction(&self) -> f64
pub fn boundary_layer_fraction(&self) -> f64
Compute the boundary layer fraction.
Returns the fraction of spheres within one sphere diameter of the wall.
Auto Trait Implementations§
impl Freeze for ConfiningGeometry
impl RefUnwindSafe for ConfiningGeometry
impl Send for ConfiningGeometry
impl Sync for ConfiningGeometry
impl Unpin for ConfiningGeometry
impl UnsafeUnpin for ConfiningGeometry
impl UnwindSafe for ConfiningGeometry
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.