summaryrefslogtreecommitdiff
path: root/lib/core/c++/boundary.hpp
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-02-09 11:21:55 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-02-09 11:21:55 +0100
commit6b10cae1ffa2521ce3c7e6aec85513a24d25934b (patch)
tree97f9b3662df3d689da2a21d68723a60cceeb6b54 /lib/core/c++/boundary.hpp
parent22659a4a4af8be137bcd702b89f1f44cd0fe2455 (diff)
downloadlibs-lbm-6b10cae1ffa2521ce3c7e6aec85513a24d25934b.tar.gz
Set equilibrium boundary for sim
Diffstat (limited to 'lib/core/c++/boundary.hpp')
-rw-r--r--lib/core/c++/boundary.hpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp
index b70ffbf..d5f3022 100644
--- a/lib/core/c++/boundary.hpp
+++ b/lib/core/c++/boundary.hpp
@@ -69,22 +69,28 @@ public:
template<typename FP, typename Descriptor, typename Encode>
class component<FP, Descriptor, cmpt::Equilibrium, Encode> final {
private:
- saw::data<FP> density_;
- saw::data<FP> velocity_;
+ saw::data<sch::Scalar<FP>> density_;
+ saw::data<sch::Vector<FP,Descriptor::D>> velocity_;
public:
component(
- saw::data<FP> density__,
- saw::Data<FP> velocity__
+ saw::data<sch::Scalar<FP>> density__,
+ saw::data<sch::Vector<FP,Descriptor::D>> velocity__
):
density_{density__},
velocity_{velocity__}
{}
template<typename CellFieldSchema>
- void apply(const saw::data<CellFieldSchema, Encode>& field, const saw::data<sch::FixedArray<sch::UInt64,Descriptor::D>>& index, saw::data<sch::UInt64> time_step)const{
- using dfi = df_info<T,Descriptor>;
+ void apply(const saw::data<CellFieldSchema, Encode>& field, const saw::data<sch::FixedArray<sch::UInt64,Descriptor::D>>& index, saw::data<sch::UInt64> time_step) const {
+
+ bool is_even = ((time_step.get() % 2u) == 0u);
+ using dfi = df_info<FP,Descriptor>;
auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">();
+
+ auto eq = equilibrium<FP,Descriptor>(density_,velocity_);
+
+ dfs_old_f.at(index) = eq;
}
};