diff options
-rw-r--r-- | c++/util.hpp | 49 |
1 files changed, 48 insertions, 1 deletions
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 <forstio/string_literal.hpp> +#include <forstio/codec/data.hpp> + +#include <iostream> + namespace kel { namespace lbm { +/* template<typename T, typename Descriptor, typename CellFieldSchema> struct is_neighbour { - template<typename CellFieldSchema> static bool operator()(saw::data<CellFieldSchema>& latt, saw::data<sch::FixedArray<sch::UInt64, Descriptor::D>& index) { using dfi = df_info<T,Descriptor>; @@ -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<string_literal T> + static uint8_t get_registration_id() { + static uint8_t reg_id = std::numeric_limit<uint8_t>::max(); + + if(reg_id == std::numeric_limit<uint8_t>::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<<std::flush; +} } } |