From f50bf98a4a39dfcfb5ad2690d0adaa851d3dc69a Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 20 Apr 2025 19:13:16 +0200 Subject: Build conversion for basic types --- c++/converter.hpp | 16 +++++++++++++++- c++/lbm.hpp | 11 ++++++----- c++/lbm_unit.hpp | 5 ++++- 3 files changed, 25 insertions(+), 7 deletions(-) (limited to 'c++') diff --git a/c++/converter.hpp b/c++/converter.hpp index 2ad5185..6e0a7a6 100644 --- a/c++/converter.hpp +++ b/c++/converter.hpp @@ -20,6 +20,20 @@ public: second_conv_{second_conv__} {} + /** + * Get the conversion parameter with the conversion type + */ + auto conversion_x() const { + return meter_conv_; + } + + /** + * Get the conversion parameter with the conversion type + */ + auto conversion_t() const { + return second_conv_; + } + auto delta_x() const { return meter_conv_*saw::data>{1.0}; } @@ -45,7 +59,7 @@ public: } saw::data> kinematic_viscosity_si_to_lbm (const saw::data>& kin_si) const { - return kin_si * second_conv_ / (meter_conv_ * meter_conv_); + return kin_si / (meter_conv_ * meter_conv_) * second_conv_; } }; diff --git a/c++/lbm.hpp b/c++/lbm.hpp index ddfa948..9cd7296 100644 --- a/c++/lbm.hpp +++ b/c++/lbm.hpp @@ -8,15 +8,16 @@ namespace kel { namespace lbm { -template -void print_lbm_meta(const converter& conv){ +template +void print_lbm_meta(const converter& conv, const saw::data>& kin_vis_si){ std::cout <<"[LBM Meta]\n" <<"==========\n" <<"\n" - <<"Δx: "<, sch::LbmKinematicViscosity>::Schema >{df_info::inv_cs2} * conv.kinematic_viscosity_si_to_lbm(kin_vis_si) + saw::data>{0.5})<<"\n" ; } } diff --git a/c++/lbm_unit.hpp b/c++/lbm_unit.hpp index e69323f..2d90652 100644 --- a/c++/lbm_unit.hpp +++ b/c++/lbm_unit.hpp @@ -1,4 +1,7 @@ #pragma once + /** + * Get the conversion parameter with the conversion type + */ #include @@ -39,7 +42,7 @@ template using LbmMeter = Unit>; template -using SiSecond = Unit>; +using SiSecond = Unit>; template using LbmSecond = Unit>; -- cgit v1.2.3