1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use crate::counters::Timer;
use std::fmt::{Display, Formatter, Result};
#[derive(Default, Clone, Copy)]
pub struct SolverCounters {
pub nconstraints: usize,
pub ncontacts: usize,
pub velocity_resolution_time: Timer,
pub assembly_time: Timer,
pub velocity_update_time: Timer,
pub position_resolution_time: Timer,
}
impl SolverCounters {
pub fn new() -> Self {
SolverCounters {
nconstraints: 0,
ncontacts: 0,
assembly_time: Timer::new(),
velocity_resolution_time: Timer::new(),
velocity_update_time: Timer::new(),
position_resolution_time: Timer::new(),
}
}
}
impl Display for SolverCounters {
fn fmt(&self, f: &mut Formatter) -> Result {
writeln!(f, "Number of contacts: {}", self.ncontacts)?;
writeln!(f, "Number of constraints: {}", self.nconstraints)?;
writeln!(f, "Assembly time: {}", self.assembly_time)?;
writeln!(
f,
"Velocity resolution time: {}",
self.velocity_resolution_time
)?;
writeln!(f, "Velocity update time: {}", self.velocity_update_time)?;
writeln!(
f,
"Position resolution time: {}",
self.position_resolution_time
)
}
}