use anise::{
analysis::AnalysisError,
errors::{AlmanacError, MathError},
};
use snafu::prelude::*;
use std::fmt;
pub mod error_ctrl;
pub use self::error_ctrl::*;
mod event;
mod instance;
pub use instance::*;
mod propagator;
pub use propagator::*;
mod rk_methods;
pub use rk_methods::*;
mod options;
use crate::{dynamics::DynamicsError, io::ConfigError, md::trajectory::TrajError, time::Duration};
pub use options::*;
use serde::{Deserialize, Serialize};
#[cfg(feature = "python")]
mod python;
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
pub struct IntegrationDetails {
pub step: Duration,
pub error: f64,
pub attempts: u8,
}
impl fmt::Display for IntegrationDetails {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"IntegrationDetails {{step: {}, error: {:.3e}, attempts: {}}}",
self.step, self.error, self.attempts
)
}
}
#[derive(Debug, PartialEq, Snafu)]
pub enum PropagationError {
#[snafu(display("encountered a dynamics error {source}"))]
Dynamics { source: DynamicsError },
#[snafu(display("when propagating until an event: {source}"))]
TrajectoryEventError { source: TrajError },
#[snafu(display("requested propagation until event #{nth} but only {found} found"))]
NthEventError { nth: usize, found: usize },
#[snafu(display("propagation failed because {source}"))]
PropConfigError { source: ConfigError },
#[snafu(display("propagation encountered a math error {source}"))]
PropMathError { source: MathError },
#[snafu(display("propagation encountered an analysis error {source}"))]
PropAnalysisError {
#[snafu(source(from(AnalysisError, Box::new)))]
source: Box<AnalysisError>,
},
#[snafu(display("propagation encountered an almanac error {source}"))]
PropAlmanacError {
#[snafu(source(from(AlmanacError, Box::new)))]
source: Box<AlmanacError>,
},
#[snafu(display("propagation encountered an error: {msg}"))]
PropGenericError { msg: String },
}