nyx_space/od/process/solution/
display.rs

1/*
2    Nyx, blazing fast astrodynamics
3    Copyright (C) 2018-onwards Christopher Rabotin <christopher.rabotin@gmail.com>
4
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU Affero General Public License as published
7    by the Free Software Foundation either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU Affero General Public License for more details.
14
15    You should have received a copy of the GNU Affero General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.
17*/
18
19use crate::linalg::allocator::Allocator;
20use crate::linalg::{DefaultAllocator, DimName};
21use crate::md::trajectory::Interpolatable;
22pub use crate::od::estimate::*;
23pub use crate::od::*;
24use msr::sensitivity::TrackerSensitivity;
25use std::fmt;
26use std::ops::Add;
27
28use super::ODSolution;
29
30impl<StateType, EstType, MsrSize, Trk> fmt::Display for ODSolution<StateType, EstType, MsrSize, Trk>
31where
32    StateType: Interpolatable + Add<OVector<f64, <StateType as State>::Size>, Output = StateType>,
33    EstType: Estimate<StateType>,
34    MsrSize: DimName,
35    Trk: TrackerSensitivity<StateType, StateType>,
36    <DefaultAllocator as Allocator<<StateType as State>::VecLength>>::Buffer<f64>: Send,
37    DefaultAllocator: Allocator<<StateType as State>::Size>
38        + Allocator<<StateType as State>::VecLength>
39        + Allocator<MsrSize>
40        + Allocator<MsrSize, <StateType as State>::Size>
41        + Allocator<MsrSize, MsrSize>
42        + Allocator<<StateType as State>::Size, <StateType as State>::Size>
43        + Allocator<<StateType as State>::Size, MsrSize>,
44{
45    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46        if self.results().count() == 0 {
47            writeln!(f, "Empty OD solution")
48        } else {
49            let kind = if self.is_filter_run() {
50                "Filter"
51            } else {
52                "Smoother"
53            };
54            writeln!(
55                f,
56                "{kind} OD solution from {:?}, spanning {}-{}, with {} estimates, including {} accepted residuals",
57                self.unique(),
58                self.estimates.first().unwrap().epoch(),
59                self.estimates.last().unwrap().epoch(),
60                self.estimates.len(),
61                self.accepted_residuals().len()
62            )
63        }
64    }
65}