Trait nyx_space::dynamics::Dynamics
[−]
[src]
pub trait Dynamics: Copy where
Self: Sized, { type StateSize: Dim + DimName; fn time(&self) -> f64; fn state(&self) -> VectorN<f64, Self::StateSize>
where
DefaultAllocator: Allocator<f64, Self::StateSize>; fn eom(
&self,
t: f64,
state: &VectorN<f64, Self::StateSize>
) -> VectorN<f64, Self::StateSize>
where
DefaultAllocator: Allocator<f64, Self::StateSize>; fn set_state(
&mut self,
new_t: f64,
new_state: &VectorN<f64, Self::StateSize>
)
where
DefaultAllocator: Allocator<f64, Self::StateSize>; }
The Dynamics
trait handles and stores any equation of motion and the state is integrated.
Its design is such that several of the provided dynamics can be combined fairly easily. However,
when combining the dynamics (e.g. integrating both the attitude of a spaceraft and its orbital
parameters), it is up to the implementor to handle time and state organization correctly.
For time management, I highly recommend using hifitime
which is thoroughly validated.
Associated Types
type StateSize: Dim + DimName
Defines the state size for these dynamics. It must be imported from nalgebra
.
Required Methods
fn time(&self) -> f64
Returns the time of the current state
fn state(&self) -> VectorN<f64, Self::StateSize> where
DefaultAllocator: Allocator<f64, Self::StateSize>,
DefaultAllocator: Allocator<f64, Self::StateSize>,
Returns the current state of the dynamics so it can be integrated.
fn eom(
&self,
t: f64,
state: &VectorN<f64, Self::StateSize>
) -> VectorN<f64, Self::StateSize> where
DefaultAllocator: Allocator<f64, Self::StateSize>,
&self,
t: f64,
state: &VectorN<f64, Self::StateSize>
) -> VectorN<f64, Self::StateSize> where
DefaultAllocator: Allocator<f64, Self::StateSize>,
Defines the equations of motion for these dynamics, or a combination of provided dynamics. XXX: Is this going to work in derive
?!
fn set_state(&mut self, new_t: f64, new_state: &VectorN<f64, Self::StateSize>) where
DefaultAllocator: Allocator<f64, Self::StateSize>,
DefaultAllocator: Allocator<f64, Self::StateSize>,
Updates the internal state of the dynamics.
NOTE: I do not think that this should be a Boxfn state
would
return a Box