/// Create a new model with the given tunable parameters.
Create a new model with the given tunable parameters.
Create a new model with the given tunable parameters .
pub fn new(
        dimensions: u8,
        seeds: usize,
        seed: u64,
        particle_spacing: f64,
        attraction_distance: f64,
        min_move_distance: f64,
        stubbornness: usize,
        stickiness: f64,
    ) -> Model {
        let seed = Model::generate_random_seed_if_not_specified(seed);
        info!("Intializing rng with seed {}", seed);
        if dimensions != 2 {
            warn!("{} dimensions not supported (yet?). Using 2D.", dimensions);
        }
        debug!("Initializing model with parameters <seeds={}, seed={}, particle_spacing={}, attraction_distance={}, min_move_distance={}, stubbornness={}, stickiness={}>",
               seeds,
               seed,
               particle_spacing,
               attraction_distance,
               min_move_distance,
               stubbornness,
               stickiness,
        );
        let mut model = Model {
            particle_graph: Graph::new_undirected(),
            // TODO: Variable dimensionality
            index: KdTree::new(2),
            rng: StdRng::seed_from_u64(seed),
            dimensions: 2,
            bounding_radius: 5.0,
            particle_spacing,
            attraction_distance,
            min_move_distance,
            stubbornness,
            stickiness,
        };
        if seeds == 0 {
            warn!("Cannot run DLA model with no initial seed particles. Using one seed.");
        }
        model.add_seeds(if seeds == 0 { 1 } else { seeds });
        return model;
    }
pub fn new ( dimensions : u8 , seeds : usize , seed : u64 , particle_spacing : f64 , attraction_distance : f64 , min_move_distance : f64 , stubbornness : usize , stickiness : f64 , ) -> Model { let seed = Model :: generate_random_seed_if_not_specified ( seed ) ; info ! ( " " seed ) ; if dimensions != 2 { warn ! ( " " dimensions ) ; } debug ! ( " " seeds seed particle_spacing attraction_distance min_move_distance stubbornness stickiness ) ; let mut model = Model { particle_graph : Graph :: new_undirected ( ) , // TODO: Variable dimensionality index : KdTree :: new ( 2 ) , rng : StdRng :: seed_from_u64 ( seed ) , dimensions : 2 , bounding_radius : 5.0 , particle_spacing , attraction_distance , min_move_distance , stubbornness , stickiness , } ; if seeds == 0 { warn ! ( " " ) ; } model . add_seeds ( if seeds == 0 { 1 } else { seeds } ) ; return model ; }
Create a new model with the given tunable parameters.
Create a new model with the given tunable parameters .
dimensions
u8
seeds
usize
seed
u64
particle_spacing
f64
attraction_distance
f64
min_move_distance
f64
stubbornness
usize
stickiness
f64