diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-11-09 22:32:31 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-11-09 22:32:31 +0100 |
| commit | 2e63c4a31f946a8bafa92c49c1a0a116c0eb6dae (patch) | |
| tree | 9d9b1022350a21d106a954513cc9567fd974e781 /modules/core/c++ | |
| parent | 5c708bb3a0c9faec82a0deb32478370f9d780ea8 (diff) | |
| download | libs-lbm-2e63c4a31f946a8bafa92c49c1a0a116c0eb6dae.tar.gz | |
Fixing rocm up
Diffstat (limited to 'modules/core/c++')
| -rw-r--r-- | modules/core/c++/abstract/args.hpp | 354 | ||||
| -rw-r--r-- | modules/core/c++/common.hpp | 8 | ||||
| -rw-r--r-- | modules/core/c++/environment.hpp | 2 | ||||
| -rw-r--r-- | modules/core/c++/fplbm.hpp | 5 | ||||
| -rw-r--r-- | modules/core/c++/hlbm.hpp | 10 | ||||
| -rw-r--r-- | modules/core/c++/lbm.hpp | 4 | ||||
| -rw-r--r-- | modules/core/c++/particle.hpp | 14 | ||||
| -rw-r--r-- | modules/core/c++/particle/aabb.hpp | 35 | ||||
| -rw-r--r-- | modules/core/c++/particle/cell_list.hpp | 1 | ||||
| -rw-r--r-- | modules/core/c++/particle/common.hpp | 7 | ||||
| -rw-r--r-- | modules/core/c++/particle/contact.hpp | 1 | ||||
| -rw-r--r-- | modules/core/c++/particle/integrate.hpp | 1 | ||||
| -rw-r--r-- | modules/core/c++/particle/mask.hpp | 2 | ||||
| -rw-r--r-- | modules/core/c++/particle/particle.hpp | 10 | ||||
| -rw-r--r-- | modules/core/c++/particle/porosity.hpp | 1 | ||||
| -rw-r--r-- | modules/core/c++/particle/schema.hpp | 1 | ||||
| -rw-r--r-- | modules/core/c++/psm.hpp | 14 | ||||
| -rw-r--r-- | modules/core/c++/util.hpp | 2 |
18 files changed, 428 insertions, 44 deletions
diff --git a/modules/core/c++/abstract/args.hpp b/modules/core/c++/abstract/args.hpp new file mode 100644 index 0000000..65be782 --- /dev/null +++ b/modules/core/c++/abstract/args.hpp @@ -0,0 +1,354 @@ +#pragma once + +#include <charconv> +#include <cstdlib> +#include <string> +#include <string_view> + +#include "data.hpp" +#include "data_math.hpp" +#include "encode.hpp" +#include "error.hpp" +#include "schema.hpp" +#include "unit.hpp" + +namespace kel { +namespace lbm { + +namespace enc { +/** + * Command line arguments as an encoding. + * + * Keeping this schema driven rather than hand parsed is what lets a program's + * argument list carry the same type information as the rest of the data model + * -- so a united quantity stays united and a mixed precision value keeps its + * storage type, instead of every call site reinventing a double. + */ +struct Args { + static constexpr string_literal name = "enc::Args"; +}; +} + +namespace sch { +/** + * `program` is argv[0], `args` the named `--name value` pairs, `positionals` + * the bare words in order. + */ +template<typename InnerSchemaStruct, typename InnerSchemaTuple> +using Args = Struct< + Member<String, "program">, + Member<InnerSchemaStruct, "args">, + Member<InnerSchemaTuple, "positionals"> +>; +} + +template<typename T> +class data<T, enc::Args> { + static_assert(always_false<T>, + "Not supported. Use the sch::Args alias or check how it's defined."); +}; + +template<typename... Str, string_literal... Lits, typename... Tup> +class data<sch::Args<sch::Struct<sch::Member<Str,Lits>...>, sch::Tuple<Tup...>>, enc::Args> final { +private: + int argc_; + char** argv_; + +public: + data(int argc, char** argv): + argc_{argc}, + argv_{argv} + {} + + uint64_t size() const { + if(argc_ < 0){ + return 0u; + } + static_assert(sizeof(int) <= sizeof(uint64_t), "int is wider than uint64_t"); + return static_cast<uint64_t>(argc_); + } + + std::string_view arg_view(uint64_t i) const { + if(i < size()){ + return std::string_view{argv_[i]}; + } + return ""; + } +}; + +namespace impl { + +/** + * Decodes one argument value into one leaf of the schema. + * + * Specialize this to teach the argument parser a new leaf type; everything + * above it -- name matching, positional ordering -- is shared. + */ +template<typename T, typename ToDec> +struct args_decode { + static_assert(always_false<T,ToDec>, + "No argument decoding for this schema. Add an args_decode specialization."); +}; + +template<typename K, uint64_t N, typename ToDec> +struct args_decode<sch::Primitive<K,N>, ToDec> { + using Schema = sch::Primitive<K,N>; + using Native = typename native_data_type<Schema>::type; + + static error_or<void> decode(data<Schema, ToDec>& to, std::string_view view){ + if(view.empty()){ + return make_error<err::invalid_state>("Can't decode empty data."); + } + + if constexpr ( std::is_floating_point_v<Native> ){ + /** + * strtod rather than from_chars: the floating point overload of + * from_chars is not available on every toolchain this builds with. + */ + std::string buf{view}; + char* end = nullptr; + auto val = std::strtod(buf.c_str(), &end); + if(end == buf.c_str() || *end != '\0'){ + return make_error<err::invalid_state>( + std::string{"Expected a number, got '"} + std::string{view} + "'"); + } + to.set(static_cast<Native>(val)); + }else{ + Native val{}; + auto first = view.data(); + auto last = view.data() + view.size(); + auto res = std::from_chars(first, last, val); + if(res.ec != std::errc{} || res.ptr != last){ + return make_error<err::invalid_state>( + std::string{"Expected an integer, got '"} + std::string{view} + "'"); + } + to.set(val); + } + + return make_void(); + } +}; + +template<typename ToDec> +struct args_decode<sch::Bool, ToDec> { + static error_or<void> decode(data<sch::Bool, ToDec>& to, std::string_view view){ + if(view == "true" || view == "1" || view == "yes" || view == "on"){ + to.set(true); + return make_void(); + } + if(view == "false" || view == "0" || view == "no" || view == "off"){ + to.set(false); + return make_void(); + } + return make_error<err::invalid_state>( + std::string{"Expected a boolean, got '"} + std::string{view} + "'"); + } +}; + +template<typename ToDec> +struct args_decode<sch::String, ToDec> { + static error_or<void> decode(data<sch::String, ToDec>& to, std::string_view view){ + try { + to.set(std::string{view}); + } catch(const std::exception&){ + return make_error<err::out_of_memory>(); + } + return make_void(); + } +}; + +/** + * A mixed precision value is written and read as its interface type, so that + * is what the command line parses into; the narrowing to storage happens in + * the data class exactly as it does everywhere else. + */ +template<typename S, typename I, typename ToDec> +struct args_decode<sch::MixedPrecision<S,I>, ToDec> { + using Schema = sch::MixedPrecision<S,I>; + + static error_or<void> decode(data<Schema, ToDec>& to, std::string_view view){ + data<I, ToDec> interface_value; + auto eov = args_decode<I, ToDec>::decode(interface_value, view); + if(eov.is_error()){ + return eov; + } + to.set(interface_value.get()); + return make_void(); + } +}; + +/** + * A united quantity parses as its underlying value and keeps its unit. + * + * The unit is a property of the schema, not of the text, so there is nothing + * to read for it -- but the result is still typed, which is the whole point: + * a length argument cannot be handed to something expecting a time. + */ +template<typename BaseSchema, typename... Elements, typename ToDec> +struct args_decode<sch::Unit<BaseSchema, Elements...>, ToDec> { + using Schema = sch::Unit<BaseSchema, Elements...>; + + static error_or<void> decode(data<Schema, ToDec>& to, std::string_view view){ + data<BaseSchema, ToDec> base; + auto eov = args_decode<BaseSchema, ToDec>::decode(base, view); + if(eov.is_error()){ + return eov; + } + to = data<Schema, ToDec>{base}; + return make_void(); + } +}; + +/** + * A Tensor of rank zero is a single value, so it decodes like one. This is + * what makes sch::Scalar<T> usable as an argument. + */ +template<typename Inner, typename ToDec> +struct args_decode<sch::Tensor<Inner>, ToDec> { + using Schema = sch::Tensor<Inner>; + + static error_or<void> decode(data<Schema, ToDec>& to, std::string_view view){ + data<Inner, ToDec> inner; + auto eov = args_decode<Inner, ToDec>::decode(inner, view); + if(eov.is_error()){ + return eov; + } + to.flat_at(0u) = inner; + return make_void(); + } +}; + +template<typename... Str, string_literal... Lits, typename... Tup, typename ToDec> +struct args_decode<sch::Args<sch::Struct<sch::Member<Str,Lits>...>, sch::Tuple<Tup...>>, ToDec> { + using Schema = sch::Args< + sch::Struct<sch::Member<Str,Lits>...>, + sch::Tuple<Tup...> + >; + + using SchemaStruct = sch::Struct<sch::Member<Str,Lits>...>; + using SchemaTuple = sch::Tuple<Tup...>; + + template<uint64_t i> + static error_or<void> decode_struct_member( + data<SchemaStruct, ToDec>& to, + std::string_view name, + std::string_view value + ){ + if constexpr ( i < sizeof...(Str) ){ + static constexpr string_literal Literal = parameter_key_pack_type<i,Lits...>::literal; + using StrT = typename parameter_pack_type<i,Str...>::type; + + if(Literal.view() == name){ + return args_decode<StrT, ToDec>::decode(to.template get<Literal>(), value); + } + + return decode_struct_member<i+1u>(to, name, value); + }else{ + (void) to; + (void) value; + /** + * Named rather than generic: an unrecognised flag is almost always + * a typo, and saying which one turns a puzzled re-run into a fix. + */ + return make_error<err::not_found>( + std::string{"Unknown argument --"} + std::string{name}); + } + } + + template<uint64_t i> + static error_or<void> decode_tuple_member( + data<SchemaTuple, ToDec>& to, + uint64_t ptr_i, + std::string_view value + ){ + if constexpr ( i < sizeof...(Tup) ){ + if( i == ptr_i ){ + using TupT = typename parameter_pack_type<i,Tup...>::type; + return args_decode<TupT, ToDec>::decode(to.template get<i>(), value); + } + return decode_tuple_member<i+1u>(to, ptr_i, value); + }else{ + (void) to; + (void) ptr_i; + return make_error<err::invalid_state>( + std::string{"Too many positional arguments, did not expect '"} + + std::string{value} + "'"); + } + } + + static error_or<void> decode( + const data<Schema, enc::Args>& from, + data<Schema, ToDec>& to + ){ + if(from.size() == 0u){ + return make_error<err::invalid_state>("No arguments at all, not even argv[0]"); + } + + to.template get<"program">().set(std::string{from.arg_view(0u)}); + uint64_t tuple_pos = 0u; + + for(uint64_t i = 1u; i < from.size(); ++i){ + auto view = from.arg_view(i); + + if(view.starts_with("--")){ + view.remove_prefix(2u); + ++i; + + if(i >= from.size()){ + return make_error<err::invalid_state>( + std::string{"Missing value for --"} + std::string{view}); + } + + auto eov = decode_struct_member<0u>( + to.template get<"args">(), view, from.arg_view(i)); + if(eov.is_error()){ + return eov; + } + continue; + } + + auto eov = decode_tuple_member<0u>( + to.template get<"positionals">(), tuple_pos, view); + if(eov.is_error()){ + return eov; + } + ++tuple_pos; + } + + if(tuple_pos != sizeof...(Tup)){ + return make_error<err::invalid_state>( + std::string{"Expected "} + std::to_string(sizeof...(Tup)) + + " positional arguments, got " + std::to_string(tuple_pos)); + } + + return make_void(); + } +}; + +} // namespace impl + +template<typename Schema, typename Encoding> class codec; + +template<typename Schema> +class codec<Schema, enc::Args> final { +public: + codec() = default; + + template<typename ToDec> + error_or<void> decode(const data<Schema, enc::Args>& from, data<Schema, ToDec>& to){ + return impl::args_decode<Schema,ToDec>::decode(from,to); + } +}; + +/** + * Parses argv straight into a schema instance. + */ +template<typename ArgSch> +error_or<void> parse_args(data<ArgSch>& dec_dat, int argc, char** argv){ + data<ArgSch, enc::Args> arg_dat{argc, argv}; + codec<ArgSch, enc::Args> arg_cod; + return arg_cod.decode(arg_dat, dec_dat); +} + +} // namespace lbm +} // namespace kel diff --git a/modules/core/c++/common.hpp b/modules/core/c++/common.hpp index 52265e2..7fab2a1 100644 --- a/modules/core/c++/common.hpp +++ b/modules/core/c++/common.hpp @@ -1,6 +1,14 @@ #pragma once +/** + * Base include for this layer. + * + * Headers in c++/ take this rather than reaching into abstract/ themselves, so + * the data model arrives from one place and the layering stays visible. + */ #include "abstract/data.hpp" +#include "abstract/data_math.hpp" +#include "abstract/data_ptr.hpp" #include "abstract/math.hpp" namespace kel { diff --git a/modules/core/c++/environment.hpp b/modules/core/c++/environment.hpp index 0e2f6b9..7778d6a 100644 --- a/modules/core/c++/environment.hpp +++ b/modules/core/c++/environment.hpp @@ -62,7 +62,7 @@ kel::lbm::error_or<environment> init_lbm_env(const kel::lbm::data<ArgSch>& args) * Located outside the project dir because dispatching build jobs with output data in the git directory * also copies simulated data which takes a long time. */ -kel::lbm::error_or<std::filesystem::path> output_directory(){ +inline kel::lbm::error_or<std::filesystem::path> output_directory(){ namespace fs = std::filesystem; const char* home_dir = std::getenv("HOME"); diff --git a/modules/core/c++/fplbm.hpp b/modules/core/c++/fplbm.hpp index 4f9c81d..f961bc9 100644 --- a/modules/core/c++/fplbm.hpp +++ b/modules/core/c++/fplbm.hpp @@ -183,11 +183,10 @@ public: - auto eo_aabb = particle_aabb<typename ParticleSchema::ValueType>::calculate(pg,index,mom_f.meta()); - if(eo_aabb.is_error()){ + kel::lbm::data<typename particle_aabb<typename ParticleSchema::ValueType>::AABB> aabb; + if(not particle_aabb<typename ParticleSchema::ValueType>::try_calculate(pg,index,mom_f.meta(),aabb)){ return; } - auto& aabb = eo_aabb.get_value(); kel::lbm::data<sch::Scalar<T>> three; three.at({}).set(3.0f); diff --git a/modules/core/c++/hlbm.hpp b/modules/core/c++/hlbm.hpp index b7bf003..acb2121 100644 --- a/modules/core/c++/hlbm.hpp +++ b/modules/core/c++/hlbm.hpp @@ -151,11 +151,10 @@ public: / static_cast<typename kel::lbm::native_data_type<T>::type>(steps) ); - auto eo_aabb = particle_aabb<typename ParticleSchema::ValueType>::calculate(part_spheroid_group,index,mvel_f.meta()); - if(eo_aabb.is_error()){ + kel::lbm::data<typename particle_aabb<typename ParticleSchema::ValueType>::AABB> aabb; + if(not particle_aabb<typename ParticleSchema::ValueType>::try_calculate(part_spheroid_group,index,mvel_f.meta(),aabb)){ return; } - auto& aabb = eo_aabb.get_value(); auto start = aabb.template get<"a">(); auto stop = aabb.template get<"b">(); @@ -258,11 +257,10 @@ public: / static_cast<typename kel::lbm::native_data_type<T>::type>(steps) ); - auto eo_aabb = particle_aabb<typename ParticleSchema::ValueType>::calculate(part_group,index,mvel_f.meta()); - if(eo_aabb.is_error()){ + kel::lbm::data<typename particle_aabb<typename ParticleSchema::ValueType>::AABB> aabb; + if(not particle_aabb<typename ParticleSchema::ValueType>::try_calculate(part_group,index,mvel_f.meta(),aabb)){ return; } - auto& aabb = eo_aabb.get_value(); auto vel_p = (pirb_pos-pirb_pos_old) / ts; diff --git a/modules/core/c++/lbm.hpp b/modules/core/c++/lbm.hpp index 042bad4..0631c79 100644 --- a/modules/core/c++/lbm.hpp +++ b/modules/core/c++/lbm.hpp @@ -17,8 +17,8 @@ #include "macroscopic.hpp" #include "momentum_gather.hpp" #include "memory.hpp" -#include "particle/contact.hpp" -#include "particle/integrate.hpp" +#include "particle.hpp" +#include "abstract/args.hpp" #include "psm.hpp" #include "component/psm.hpp" #include "stream.hpp" diff --git a/modules/core/c++/particle.hpp b/modules/core/c++/particle.hpp index 30c5005..6546f8d 100644 --- a/modules/core/c++/particle.hpp +++ b/modules/core/c++/particle.hpp @@ -1,7 +1,21 @@ #pragma once #include "component.hpp" + +/** + * Folder aggregator for particle/. Anything that wants the particle layer + * takes this, rather than reaching for individual headers. + */ #include "particle/particle.hpp" +#include "particle/aabb.hpp" +#include "particle/porosity.hpp" +#include "particle/mask.hpp" +#include "particle/particle_opa.hpp" +#include "particle/integrate.hpp" +#include "particle/contact.hpp" +#include "particle/cell_list.hpp" +#include "particle/couple.hpp" +#include "particle/voxel_narrow.hpp" namespace kel { namespace lbm { diff --git a/modules/core/c++/particle/aabb.hpp b/modules/core/c++/particle/aabb.hpp index caf3210..e207ad8 100644 --- a/modules/core/c++/particle/aabb.hpp +++ b/modules/core/c++/particle/aabb.hpp @@ -22,14 +22,30 @@ public: sch::Member<sch::FixedArray<sch::UInt64,D>,"b"> >; public: + /** + * Device-side entry point: reports success as a bool rather than an + * error_or. + * + * This matters more than it looks. error_or carries an `error`, and + * building one reaches get_template_error_id -> a function-local static + * (__cxa_guard_acquire) -> the error registry -> heap<> (operator new) -> + * std::vector (__throw_length_error) -> std::string (strlen). Returning + * error_or from a function called inside a kernel therefore pulls the + * whole host allocator and exception machinery into device code, which + * AdaptiveCpp's LoopSplitterInlining pass then has to walk -- it reports + * each of those symbols as undefined and chokes on the call graph. + * + * Nothing is lost: the only failure here is an out of range particle + * index, which a caller can act on just as well from a bool. + */ template<typename Sch, typename Encode> - static constexpr kel::lbm::error_or<kel::lbm::data<AABB>> calculate(const kel::lbm::data<Sch,Encode>& p_grp, const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index, const kel::lbm::data<sch::FixedArray<sch::UInt64,D>>& meta){ + static constexpr bool try_calculate(const kel::lbm::data<Sch,Encode>& p_grp, const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index, const kel::lbm::data<sch::FixedArray<sch::UInt64,D>>& meta, kel::lbm::data<AABB>& out){ static_assert(PC > 0u, "Can't calculate from no particles"); if(not (index.at({{0u}}).get() < PC) ){ - return kel::lbm::make_error<kel::lbm::err::critical>("Too large i in particle_aabb"); + return false; } - kel::lbm::data<AABB> aabb; + kel::lbm::data<AABB>& aabb = out; auto& parts = p_grp.template get<"particles">(); auto& pi = parts.at(index); @@ -64,6 +80,19 @@ public: b.at({i}) = (b_i < meta.at({i})) ? b_i : meta.at({i}); } + return true; + } + + /** + * Host-side convenience wrapper. Keeps the error_or interface for callers + * that are not inside a kernel. + */ + template<typename Sch, typename Encode> + static kel::lbm::error_or<kel::lbm::data<AABB>> calculate(const kel::lbm::data<Sch,Encode>& p_grp, const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index, const kel::lbm::data<sch::FixedArray<sch::UInt64,D>>& meta){ + kel::lbm::data<AABB> aabb; + if(not try_calculate(p_grp,index,meta,aabb)){ + return kel::lbm::make_error<kel::lbm::err::critical>("Too large i in particle_aabb"); + } return aabb; } }; diff --git a/modules/core/c++/particle/cell_list.hpp b/modules/core/c++/particle/cell_list.hpp index d1d1537..a43e1df 100644 --- a/modules/core/c++/particle/cell_list.hpp +++ b/modules/core/c++/particle/cell_list.hpp @@ -1,7 +1,6 @@ #pragma once #include "../component.hpp" -#include "../iterator.hpp" #include "common.hpp" #include "schema.hpp" #include "particle.hpp" diff --git a/modules/core/c++/particle/common.hpp b/modules/core/c++/particle/common.hpp index 9e673c2..019c29f 100644 --- a/modules/core/c++/particle/common.hpp +++ b/modules/core/c++/particle/common.hpp @@ -1,3 +1,10 @@ #pragma once +/** + * Base include for particle/. + * + * Chains to the layer above, and adds what every header in this folder needs, + * so the headers themselves only have to name their siblings. + */ #include "../common.hpp" +#include "../iterator.hpp" diff --git a/modules/core/c++/particle/contact.hpp b/modules/core/c++/particle/contact.hpp index 2e7973a..857e116 100644 --- a/modules/core/c++/particle/contact.hpp +++ b/modules/core/c++/particle/contact.hpp @@ -1,7 +1,6 @@ #pragma once #include "../component.hpp" -#include "../abstract/math.hpp" #include "common.hpp" #include "schema.hpp" #include "particle.hpp" diff --git a/modules/core/c++/particle/integrate.hpp b/modules/core/c++/particle/integrate.hpp index f83465a..a84cd37 100644 --- a/modules/core/c++/particle/integrate.hpp +++ b/modules/core/c++/particle/integrate.hpp @@ -35,7 +35,6 @@ inline uint64_t particle_sub_steps(kel::lbm::data<sch::UInt64> sub_steps){ template<uint64_t D> constexpr bool particle_angular_supported = (D == 2u); - /** * Turns the accumulated force/torque into acceleration and advances the body. * diff --git a/modules/core/c++/particle/mask.hpp b/modules/core/c++/particle/mask.hpp index 246c31f..44dd74b 100644 --- a/modules/core/c++/particle/mask.hpp +++ b/modules/core/c++/particle/mask.hpp @@ -2,8 +2,6 @@ #include <cmath> -#include "../abstract/math.hpp" -#include "../iterator.hpp" #include "common.hpp" #include "schema.hpp" diff --git a/modules/core/c++/particle/particle.hpp b/modules/core/c++/particle/particle.hpp index d9b5444..00e401a 100644 --- a/modules/core/c++/particle/particle.hpp +++ b/modules/core/c++/particle/particle.hpp @@ -1,15 +1,10 @@ #pragma once -#include "../abstract/math.hpp" -#include "../abstract/data_math.hpp" -#include "../abstract/data.hpp" - -#include "../iterator.hpp" +#include "common.hpp" #include "schema.hpp" #include "aabb.hpp" #include "mask.hpp" -#include "../abstract/data_ptr.hpp" #include "particle_opa.hpp" namespace kel { @@ -232,7 +227,6 @@ constexpr auto handle_collision = []( } }; - /** * Bounding-sphere overlap test. * @@ -281,7 +275,5 @@ constexpr auto particle_dem_lambda = [](kel::lbm::data<sch::ParticleGroup<T,D,Pa } }; - - } } diff --git a/modules/core/c++/particle/porosity.hpp b/modules/core/c++/particle/porosity.hpp index 593b15e..cd4e804 100644 --- a/modules/core/c++/particle/porosity.hpp +++ b/modules/core/c++/particle/porosity.hpp @@ -88,7 +88,6 @@ public: } }; - template<typename T, uint64_t D, uint64_t PC> class particle_porosity<T, D, PC, coll::Spheroid<T>> final { public: diff --git a/modules/core/c++/particle/schema.hpp b/modules/core/c++/particle/schema.hpp index fe7a33c..39e1a36 100644 --- a/modules/core/c++/particle/schema.hpp +++ b/modules/core/c++/particle/schema.hpp @@ -75,7 +75,6 @@ using ParticleRigidBody = Struct< Member<Scalar<T>, "density"> >; - /** * CollisionType is defaulted so the plain `Particle<T,D>` spelling used by the * integrator and the tests keeps working. diff --git a/modules/core/c++/psm.hpp b/modules/core/c++/psm.hpp index 19c3524..b540f38 100644 --- a/modules/core/c++/psm.hpp +++ b/modules/core/c++/psm.hpp @@ -186,21 +186,11 @@ void apply( * -------------------------------------------------------- */ - auto eo_aabb = - particle_aabb< - typename ParticleSchema::ValueType - >::calculate( - pg, - index, - vel_f.meta() - ); - - if(eo_aabb.is_error()){ + kel::lbm::data<typename particle_aabb<typename ParticleSchema::ValueType>::AABB> aabb; + if(not particle_aabb<typename ParticleSchema::ValueType>::try_calculate(pg,index,vel_f.meta(),aabb)){ return; } - auto& aabb = eo_aabb.get_value(); - kel::lbm::data<sch::FixedArray<sch::UInt64,Descriptor::D>> start; kel::lbm::data<sch::FixedArray<sch::UInt64,Descriptor::D>> stop; diff --git a/modules/core/c++/util.hpp b/modules/core/c++/util.hpp index 8bafc16..b3c9217 100644 --- a/modules/core/c++/util.hpp +++ b/modules/core/c++/util.hpp @@ -48,7 +48,7 @@ public: }; */ -void print_progress_bar(const uint32_t progress, const uint32_t progress_target){ +inline void print_progress_bar(const uint32_t progress, const uint32_t progress_target){ std::cout<<"\r"; // <<"Progress: " // <<((100 * progress) / progress_target) |
