Skip to main content

Simulation

Struct Simulation 

Source
pub struct Simulation { /* private fields */ }
Expand description

Owned REBOUND simulation. Freed on drop.

Not Send/Sync — each thread must create its own simulation.

Implementations§

Source§

impl Simulation

Source

pub fn new() -> Result<Simulation, Error>

Create a new, empty REBOUND simulation.

Source

pub fn as_ptr(&self) -> *const reb_simulation

Raw const pointer to the underlying REBOUND simulation. Downstream -sys crates layered on top of REBOUND use this to call ASSIST / other C APIs that take *const reb_simulation.

Source

pub fn as_mut_ptr(&mut self) -> *mut reb_simulation

Raw mutable pointer to the underlying REBOUND simulation. Required by C APIs that take *mut reb_simulation (assist_attach, assist_detach, etc.) and by benchmark probes.

Source

pub fn t(&self) -> f64

Source

pub fn set_t(&mut self, t: f64)

Source

pub fn dt(&self) -> f64

Source

pub fn set_dt(&mut self, dt: f64)

Source

pub fn n_particles(&self) -> usize

Source

pub fn steps_done(&self) -> u64

Total IAS15 steps (accepted + rejected) since this simulation was created. Useful for diagnosing adaptive-timestep behavior.

Source

pub fn n_var(&self) -> i32

Source

pub fn status(&self) -> i32

Source

pub fn set_exact_finish_time(&mut self, v: bool)

Source

pub fn ias15_epsilon(&self) -> f64

IAS15 precision parameter (REBOUND r->ri_ias15.epsilon). Default 1e-9. Larger values are looser but faster.

Source

pub fn set_ias15_epsilon(&mut self, eps: f64)

Source

pub fn ias15_min_dt(&self) -> f64

IAS15 minimum timestep floor (REBOUND r->ri_ias15.min_dt). When the adaptive step would shrink below this, it clamps instead of grinding. Default 0 = no floor.

Source

pub fn set_ias15_min_dt(&mut self, min_dt: f64)

Source

pub fn ias15_adaptive_mode(&self) -> Ias15AdaptiveMode

IAS15 adaptive-timestep selector. Default Prs23 (REBOUND default since 2024-01).

Source

pub fn set_ias15_adaptive_mode(&mut self, mode: Ias15AdaptiveMode)

Source

pub fn ias15_iterations_max_exceeded(&self) -> u64

Diagnostic counter: how many IAS15 steps hit the predictor-corrector iteration cap without converging. Monotone-increasing across the simulation lifetime; nonzero indicates the integrator was working at the edge of convergence (typically a hint to tighten epsilon or raise min_dt).

Source

pub fn add_particle(&mut self, p: reb_particle)

Add a particle to the simulation.

Source

pub fn add_test_particle( &mut self, x: f64, y: f64, z: f64, vx: f64, vy: f64, vz: f64, )

Add a test particle with given position and velocity (mass = 0).

Source

pub fn particles(&self) -> &[reb_particle]

Read-only access to the particle array.

Source

pub fn integrate(&mut self, tmax: f64) -> Result<(), Error>

Integrate to target time. Returns the status code.

Source

pub fn add_variation_1st_order(&mut self, testparticle: i32) -> i32

Add first-order variational particles for a test particle. Returns the index of the first variational particle.

Trait Implementations§

Source§

impl Drop for Simulation

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.