diff options
| author | Crozet Sébastien <developer@crozet.re> | 2021-03-29 17:21:49 +0200 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2021-03-29 17:21:49 +0200 |
| commit | a733f97028f5cd532212572f9561ab64e09f002b (patch) | |
| tree | 7b776c21660f1069ad472dd17e7e6fa9083cbd8f /src/counters | |
| parent | 8173e7ada2e3f5c99de53b532adc085a26c1cefd (diff) | |
| download | rapier-a733f97028f5cd532212572f9561ab64e09f002b.tar.gz rapier-a733f97028f5cd532212572f9561ab64e09f002b.tar.bz2 rapier-a733f97028f5cd532212572f9561ab64e09f002b.zip | |
Implement the ability to run multiple CCD substeps.
Diffstat (limited to 'src/counters')
| -rw-r--r-- | src/counters/collision_detection_counters.rs | 7 | ||||
| -rw-r--r-- | src/counters/mod.rs | 12 | ||||
| -rw-r--r-- | src/counters/stages_counters.rs | 9 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/counters/collision_detection_counters.rs b/src/counters/collision_detection_counters.rs index d164452..90c5141 100644 --- a/src/counters/collision_detection_counters.rs +++ b/src/counters/collision_detection_counters.rs @@ -21,6 +21,13 @@ impl CollisionDetectionCounters { narrow_phase_time: Timer::new(), } } + + /// Resets all the coounters and timers. + pub fn reset(&mut self) { + self.ncontact_pairs = 0; + self.broad_phase_time.reset(); + self.narrow_phase_time.reset(); + } } impl Display for CollisionDetectionCounters { diff --git a/src/counters/mod.rs b/src/counters/mod.rs index c172350..4d4d05d 100644 --- a/src/counters/mod.rs +++ b/src/counters/mod.rs @@ -114,6 +114,18 @@ impl Counters { pub fn set_ncontact_pairs(&mut self, n: usize) { self.cd.ncontact_pairs = n; } + + /// Resets all the counters and timers. + pub fn reset(&mut self) { + if self.enabled { + self.step_time.reset(); + self.custom.reset(); + self.stages.reset(); + self.cd.reset(); + self.solver.reset(); + self.ccd.reset(); + } + } } macro_rules! measure_method { diff --git a/src/counters/stages_counters.rs b/src/counters/stages_counters.rs index 856b759..b61adb7 100644 --- a/src/counters/stages_counters.rs +++ b/src/counters/stages_counters.rs @@ -27,6 +27,15 @@ impl StagesCounters { ccd_time: Timer::new(), } } + + /// Resets all the counters and timers. + pub fn reset(&mut self) { + self.update_time.reset(); + self.collision_detection_time.reset(); + self.island_construction_time.reset(); + self.solver_time.reset(); + self.ccd_time.reset(); + } } impl Display for StagesCounters { |
