pub struct PackingOptimizer {
pub config: OptimizerConfig,
pub spheres: Vec<PackingSphere>,
pub domain: [f64; 3],
pub convergence: Vec<f64>,
pub converged: bool,
}Expand description
Force-based packing optimizer.
Uses a soft-sphere repulsive potential to relax overlapping spheres toward a mechanically stable configuration.
Fields§
§config: OptimizerConfigOptimizer configuration.
spheres: Vec<PackingSphere>Spheres being optimized.
domain: [f64; 3]Domain bounds.
convergence: Vec<f64>Convergence history (max overlap at each iteration).
converged: boolWhether the optimizer has converged.
Implementations§
Source§impl PackingOptimizer
impl PackingOptimizer
Sourcepub fn new(
spheres: Vec<PackingSphere>,
domain: [f64; 3],
config: OptimizerConfig,
) -> Self
pub fn new( spheres: Vec<PackingSphere>, domain: [f64; 3], config: OptimizerConfig, ) -> Self
Create a new optimizer.
Sourcepub fn step(&mut self) -> f64
pub fn step(&mut self) -> f64
Perform one optimization step.
Returns the maximum overlap after the step.
Sourcepub fn potential_energy(&self) -> f64
pub fn potential_energy(&self) -> f64
Compute the total potential energy of the packing.
Sourcepub fn packing_fraction(&self) -> f64
pub fn packing_fraction(&self) -> f64
Compute the packing fraction after optimization.
Sourcepub fn max_overlap(&self) -> f64
pub fn max_overlap(&self) -> f64
Return the maximum overlap in the current configuration.
Auto Trait Implementations§
impl Freeze for PackingOptimizer
impl RefUnwindSafe for PackingOptimizer
impl Send for PackingOptimizer
impl Sync for PackingOptimizer
impl Unpin for PackingOptimizer
impl UnsafeUnpin for PackingOptimizer
impl UnwindSafe for PackingOptimizer
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.