diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-09-23 15:12:32 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-09-23 15:12:32 +0200 |
commit | 221354e16c50114a9dea00643c0136abc8b71a67 (patch) | |
tree | 35e2cb3a9db33dcca58d7748cfddb62f5d54a633 /c++ | |
parent | 434d18d0317a62fe85304c48baf419a21f120462 (diff) |
Changed the util handling around. Added mass to the simulation and
changed the mass handling for wall expulsion.
Diffstat (limited to 'c++')
-rw-r--r-- | c++/particle/particle.hpp | 1 | ||||
-rw-r--r-- | c++/util.hpp | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/c++/particle/particle.hpp b/c++/particle/particle.hpp index 24757c1..38d0484 100644 --- a/c++/particle/particle.hpp +++ b/c++/particle/particle.hpp @@ -28,6 +28,7 @@ template<typename T, uint64_t D> using Particle = Struct< Member<ParticleRigidBody<T,D>, "rigid_body">, Member<ParticleMask<T,D>, "mask">, + Member<T, "mass">, Member<T, "size"> >; } diff --git a/c++/util.hpp b/c++/util.hpp index c5b6a05..0bdebd1 100644 --- a/c++/util.hpp +++ b/c++/util.hpp @@ -54,9 +54,9 @@ void print_progress_bar(const uint32_t progress, const uint32_t progress_target) // <<((100 * progress) / progress_target) // <<"% ["; - uint64_t perc_prog = (100ul*progress) / progress_target; + const uint32_t progress_min = std::min(progress,progress_target); constexpr uint64_t max_perc_progress = 100u; - perc_prog = std::min(perc_prog, max_perc_progress); + uint64_t perc_prog = (max_perc_progress*progress_min) / progress_target; std::string_view prog_str{"Progress: "}; // Progress string + (100 width and perc char) + ([] brackets) + space + pointer @@ -76,7 +76,7 @@ void print_progress_bar(const uint32_t progress, const uint32_t progress_target) return w.ws_col; }(); max_display = std::max(max_display,i) - i; - uint64_t progress_display = (max_display * progress) / progress_target; + uint64_t progress_display = (max_display * progress_min) / progress_target; for(i = 0u; i < progress_display; ++i){ std::cout<<"#"; |