diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-02-18 12:57:07 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-02-18 12:57:07 +0100 |
| commit | f69f6e297a34678de0e1f209d196dd7bef2a4273 (patch) | |
| tree | 9d6508a743b67b98e8a6c0ea3cd804469e480786 /lib/core/c++ | |
| parent | dcee24278ed28d21cd3addffeeb8e5f9f7248602 (diff) | |
| download | libs-lbm-f69f6e297a34678de0e1f209d196dd7bef2a4273.tar.gz | |
Diffstat (limited to 'lib/core/c++')
| -rw-r--r-- | lib/core/c++/common.hpp | 1 | ||||
| -rw-r--r-- | lib/core/c++/memory.hpp | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/core/c++/common.hpp b/lib/core/c++/common.hpp index 5f7129f..280d953 100644 --- a/lib/core/c++/common.hpp +++ b/lib/core/c++/common.hpp @@ -1,6 +1,7 @@ #pragma once #include <forstio/codec/data.hpp> +#include <forstio/codec/math.hpp> namespace kel { namespace lbm { diff --git a/lib/core/c++/memory.hpp b/lib/core/c++/memory.hpp index b6a089e..e97c7fc 100644 --- a/lib/core/c++/memory.hpp +++ b/lib/core/c++/memory.hpp @@ -21,11 +21,31 @@ struct memory_size_helper<sch::FixedArray<Sch,N...>> { static constexpr uint64_t bytes = saw::ct_multiply<uint64_t,N...>::value * memory_size_helper<Sch>::bytes; }; +template<typename Sch, uint64_t... N> +struct memory_size_helper<sch::Tensor<Sch,N...>> { + static constexpr uint64_t bytes = saw::ct_multiply<uint64_t,N...>::value * memory_size_helper<Sch>::bytes; +}; + template<typename Sch, uint64_t Ghost, uint64_t... N> struct memory_size_helper<sch::Chunk<Sch,Ghost,N...>> { static constexpr uint64_t bytes = memory_size_helper<typename sch::Chunk<Sch,Ghost,N...>::InnerSchema>::bytes; }; +template<typename... Members> +struct memory_size_helper<sch::Struct<Members...>> { + + template<uint64_t i> + static constexpr uint64_t apply_i() { + if constexpr ( i < sizeof...(Members) ){ + using M_I = typename saw::parameter_pack_type<i,Members...>::type; + return apply_i<i+1u>() + memory_size_helper<typename M_I::ValueType>::bytes; + } + return 0u; + } + + static constexpr uint64_t bytes = apply_i<0u>(); +}; + template<typename... T> class memory_estimate_helper final { private: |
