use astrodyn_dynamics::{
Abm4State as RawAbm4State, GaussJacksonConfig as RawGaussJacksonConfig,
GaussJacksonState as RawGaussJacksonState, IntegratorType as RawIntegratorType,
};
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub enum IntegratorType {
#[default]
Rk4,
Rkf45,
GaussJackson(GaussJacksonConfig),
Abm4,
}
impl From<IntegratorType> for RawIntegratorType {
fn from(value: IntegratorType) -> Self {
match value {
IntegratorType::Rk4 => RawIntegratorType::Rk4,
IntegratorType::Rkf45 => RawIntegratorType::Rkf45,
IntegratorType::GaussJackson(cfg) => RawIntegratorType::GaussJackson(cfg.into()),
IntegratorType::Abm4 => RawIntegratorType::Abm4,
}
}
}
impl From<RawIntegratorType> for IntegratorType {
fn from(value: RawIntegratorType) -> Self {
match value {
RawIntegratorType::Rk4 => IntegratorType::Rk4,
RawIntegratorType::Rkf45 => IntegratorType::Rkf45,
RawIntegratorType::GaussJackson(cfg) => IntegratorType::GaussJackson(cfg.into()),
RawIntegratorType::Abm4 => IntegratorType::Abm4,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub struct GaussJacksonConfig(RawGaussJacksonConfig);
impl GaussJacksonConfig {
pub fn with_order(order: usize) -> Self {
Self(RawGaussJacksonConfig::with_order(order))
}
pub fn standard() -> Self {
Self(RawGaussJacksonConfig::standard())
}
pub fn check(&self) -> Vec<String> {
self.0.check()
}
pub fn validate(&self) {
self.0.validate()
}
}
impl From<GaussJacksonConfig> for RawGaussJacksonConfig {
#[inline]
fn from(value: GaussJacksonConfig) -> Self {
value.0
}
}
impl From<RawGaussJacksonConfig> for GaussJacksonConfig {
#[inline]
fn from(value: RawGaussJacksonConfig) -> Self {
Self(value)
}
}
#[derive(Debug, Clone)]
pub struct GaussJacksonState(RawGaussJacksonState);
impl GaussJacksonState {
pub fn new(config: GaussJacksonConfig) -> Self {
Self(RawGaussJacksonState::new(config.into()))
}
pub fn reset(&mut self) {
self.0.reset()
}
pub fn reset_for_topology_change(&mut self) {
self.0.reset_for_topology_change()
}
pub fn mark_topology_dirty(&mut self) {
self.0.mark_topology_dirty()
}
pub fn is_topology_dirty(&self) -> bool {
self.0.is_topology_dirty()
}
pub fn config(&self) -> GaussJacksonConfig {
GaussJacksonConfig(*self.0.config())
}
pub fn is_priming(&self) -> bool {
self.0.is_priming()
}
pub fn bootstrap_unconverged_iterations(&self) -> u32 {
self.0.bootstrap_unconverged_iterations()
}
#[inline]
pub fn inner_mut(&mut self) -> &mut RawGaussJacksonState {
&mut self.0
}
#[inline]
pub fn inner(&self) -> &RawGaussJacksonState {
&self.0
}
}
impl From<RawGaussJacksonState> for GaussJacksonState {
#[inline]
fn from(value: RawGaussJacksonState) -> Self {
Self(value)
}
}
impl From<GaussJacksonState> for RawGaussJacksonState {
#[inline]
fn from(value: GaussJacksonState) -> Self {
value.0
}
}
#[derive(Debug, Clone, Default)]
pub struct Abm4State(RawAbm4State);
impl Abm4State {
pub fn new() -> Self {
Self(RawAbm4State::new())
}
pub fn reset(&mut self) {
self.0.reset()
}
pub fn reset_for_topology_change(&mut self) {
self.0.reset_for_topology_change()
}
pub fn mark_topology_dirty(&mut self) {
self.0.mark_topology_dirty()
}
pub fn is_topology_dirty(&self) -> bool {
self.0.is_topology_dirty()
}
pub fn is_priming(&self) -> bool {
self.0.is_priming()
}
#[inline]
pub fn inner_mut(&mut self) -> &mut RawAbm4State {
&mut self.0
}
#[inline]
pub fn inner(&self) -> &RawAbm4State {
&self.0
}
}
impl From<RawAbm4State> for Abm4State {
#[inline]
fn from(value: RawAbm4State) -> Self {
Self(value)
}
}
impl From<Abm4State> for RawAbm4State {
#[inline]
fn from(value: Abm4State) -> Self {
value.0
}
}