From 109a98d7d8b77628934e9288f01c64d5b3cdc7f8 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 25 Aug 2025 10:34:29 +0200 Subject: Added progress bar. Best feature so far --- c++/util.hpp | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/c++/util.hpp b/c++/util.hpp index 1a54541..441ffc8 100644 --- a/c++/util.hpp +++ b/c++/util.hpp @@ -1,10 +1,15 @@ #pragma once +#include +#include + +#include + namespace kel { namespace lbm { +/* template struct is_neighbour { - template static bool operator()(saw::data& latt, saw::data& index) { using dfi = df_info; @@ -20,5 +25,47 @@ struct is_neighbour { auto& cell = latt(index); } }; +*/ + +/* Might be stupidly complex +class cell_info_registry final { +public: + static uint8_t next_reg_id = 0u; + + template + static uint8_t get_registration_id() { + static uint8_t reg_id = std::numeric_limit::max(); + + if(reg_id == std::numeric_limit::max()){ + reg_id = next_reg_id; + ++next_reg_id; + } + + return reg_id; + } +}; +*/ + +void print_progress_bar(uint32_t progress, uint32_t progress_target){ + std::cout + <<"\r" + <<"Progress: " + <<((100 * progress) / progress_target) + <<"% ["; + + uint64_t i{0u}; + + uint64_t max_display = 64u; + uint64_t progress_display = (max_display * progress) / progress_target; + for(; i < progress_display; ++i){ + std::cout<<"#"; + } + for(; i < max_display; ++i){ + std::cout<<"-"; + } + + std::cout<<"]"; + std::cout<