pub fn simulate(
    mut sim_bodies: Vec<bodies::SimobjT>,
    mut env: bodies::Environment,
    mut output_controller: Box<dyn output::SimulationOutput>,
    sim_params: input::SimulationParameters,
) {
    // Allocate large buffer for holding perturbations
    let mut perturbation_vec: Vec<Perturbation> =
        Vec::with_capacity(sim_bodies.len() * MAX_NUM_OF_PERTURBATIONS);

    loop {
        // Calculate and apply perturbations for every object
        // TODO parallelize this
        for sim_obj in sim_bodies.iter_mut() {
            apply_perturbations(
                sim_obj,
                &env,
                sim_params.sim_time_step as f64,
                &mut Some(&mut perturbation_vec),
            );

            // TODO only call this every so often
            env.check_switch_soi(sim_obj);
        }

        output::write_out_all_object_parameters(&env, &sim_bodies, output_controller.as_mut());
        output::write_out_all_solar_objects(&env, output_controller.as_mut());
        output::write_out_all_perturbations(&mut perturbation_vec, output_controller.as_mut());

        env.advance_simulation_environment(&sim_params);

        perturbation_vec.clear();
    }
}
/// Main entry point into the cpu_sim module, gathers all needed data for orbit modeling
/// using Cowell's method.
Main entry point into the cpu_sim module, gathers all needed data for orbit modeling
using Cowell's method.
Main entry point into the cpu_sim module gathers all needed data for orbit modeling using Cowell ' s method .
pub fn simulate(
    mut sim_bodies: Vec<bodies::SimobjT>,
    mut env: bodies::Environment,
    mut output_controller: Box<dyn output::SimulationOutput>,
    sim_params: input::SimulationParameters,
) {
    // Allocate large buffer for holding perturbations
    let mut perturbation_vec: Vec<Perturbation> =
        Vec::with_capacity(sim_bodies.len() * MAX_NUM_OF_PERTURBATIONS);
    loop {
        // Calculate and apply perturbations for every object
        // TODO parallelize this
        for sim_obj in sim_bodies.iter_mut() {
            apply_perturbations(
                sim_obj,
                &env,
                sim_params.sim_time_step as f64,
                &mut Some(&mut perturbation_vec),
            );
            // TODO only call this every so often
            env.check_switch_soi(sim_obj);
        }
        output::write_out_all_object_parameters(&env, &sim_bodies, output_controller.as_mut());
        output::write_out_all_solar_objects(&env, output_controller.as_mut());
        output::write_out_all_perturbations(&mut perturbation_vec, output_controller.as_mut());
        env.advance_simulation_environment(&sim_params);
        perturbation_vec.clear();
    }
}
pub fn simulate ( mut sim_bodies : Vec < bodies :: SimobjT > , mut env : bodies :: Environment , mut output_controller : Box < dyn output :: SimulationOutput > , sim_params : input :: SimulationParameters , ) { // Allocate large buffer for holding perturbations let mut perturbation_vec : Vec < Perturbation > = Vec :: with_capacity ( sim_bodies . len ( ) * MAX_NUM_OF_PERTURBATIONS ) ; loop { // Calculate and apply perturbations for every object // TODO parallelize this for sim_obj in sim_bodies . iter_mut ( ) { apply_perturbations ( sim_obj , & env , sim_params . sim_time_step as f64 , & mut Some ( & mut perturbation_vec ) , ) ; // TODO only call this every so often env . check_switch_soi ( sim_obj ) ; } output :: write_out_all_object_parameters ( & env , & sim_bodies , output_controller . as_mut ( ) ) ; output :: write_out_all_solar_objects ( & env , output_controller . as_mut ( ) ) ; output :: write_out_all_perturbations ( & mut perturbation_vec , output_controller . as_mut ( ) ) ; env . advance_simulation_environment ( & sim_params ) ; perturbation_vec . clear ( ) ; } }
Main entry point into the cpu_sim module, gathers all needed data for orbit modeling
using Cowell's method.
Main entry point into the cpu_sim module gathers all needed data for orbit modeling using Cowell ' s method .
sim_bodies
Vec<bodies::SimobjT>
env
bodies::Environment
output_controller
Box<dyn output::SimulationOutput>
sim_params
input::SimulationParameters