extern crate hyperdual;
use self::hyperdual::{OHyperdual, Owned};
use crate::cosmic::Orbit;
use crate::linalg::allocator::Allocator;
use crate::linalg::{DefaultAllocator, DimName, Matrix3, OMatrix, OVector, Vector3};
use crate::State;
use std::fmt;
pub use crate::errors::NyxError;
pub mod orbital;
pub use self::orbital::*;
pub mod spacecraft;
pub use self::spacecraft::*;
pub mod guidance;
pub mod deltavctrl;
pub mod solarpressure;
pub use self::solarpressure::*;
pub mod drag;
pub use self::drag::*;
pub mod sph_harmonics;
pub use self::sph_harmonics::*;
#[allow(clippy::type_complexity)]
pub trait Dynamics: Clone + Sync + Send
where
DefaultAllocator: Allocator<f64, <Self::StateType as State>::Size>
+ Allocator<f64, <Self::StateType as State>::VecLength>
+ Allocator<f64, <Self::StateType as State>::Size, <Self::StateType as State>::Size>,
{
type HyperdualSize: DimName;
type StateType: State;
fn eom(
&self,
delta_t: f64,
state_vec: &OVector<f64, <Self::StateType as State>::VecLength>,
state_ctx: &Self::StateType,
) -> Result<OVector<f64, <Self::StateType as State>::VecLength>, NyxError>
where
DefaultAllocator: Allocator<f64, <Self::StateType as State>::VecLength>;
fn dual_eom(
&self,
_delta_t: f64,
_osculating_state: &Self::StateType,
) -> Result<
(
OVector<f64, <Self::StateType as State>::Size>,
OMatrix<f64, <Self::StateType as State>::Size, <Self::StateType as State>::Size>,
),
NyxError,
>
where
DefaultAllocator: Allocator<f64, Self::HyperdualSize>
+ Allocator<f64, <Self::StateType as State>::Size>
+ Allocator<f64, <Self::StateType as State>::Size, <Self::StateType as State>::Size>
+ Allocator<OHyperdual<f64, Self::HyperdualSize>, <Self::StateType as State>::Size>,
Owned<f64, Self::HyperdualSize>: Copy,
{
unimplemented!()
}
fn finally(&self, next_state: Self::StateType) -> Result<Self::StateType, NyxError> {
Ok(next_state)
}
}
pub trait ForceModel<X: SpacecraftExt>: Send + Sync + fmt::Display {
fn eom(&self, ctx: &BaseSpacecraft<X>) -> Result<Vector3<f64>, NyxError>;
fn dual_eom(
&self,
osc_ctx: &BaseSpacecraft<X>,
) -> Result<(Vector3<f64>, Matrix3<f64>), NyxError>;
}
pub trait AccelModel: Send + Sync + fmt::Display {
fn eom(&self, osc: &Orbit) -> Result<Vector3<f64>, NyxError>;
fn dual_eom(&self, osc_ctx: &Orbit) -> Result<(Vector3<f64>, Matrix3<f64>), NyxError>;
}