summaryrefslogtreecommitdiff
path: root/c++
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2025-06-25 15:01:48 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2025-06-25 15:01:48 +0200
commit210b04098cfc12e0fdcff0578d39cc9ccafb3b37 (patch)
tree888a291cc8b37382f68ad147783a5202e94da203 /c++
parent3403b07823d9f1ade288ff8c6a6774c81c63c262 (diff)
Debugging commit
Diffstat (limited to 'c++')
-rw-r--r--c++/boundary.hpp30
-rw-r--r--c++/collision.hpp2
-rw-r--r--c++/descriptor.hpp4
3 files changed, 21 insertions, 15 deletions
diff --git a/c++/boundary.hpp b/c++/boundary.hpp
index 77542c5..e52715e 100644
--- a/c++/boundary.hpp
+++ b/c++/boundary.hpp
@@ -9,14 +9,14 @@ namespace cmpt {
struct BounceBack {};
}
+/**
+ * Full-Way BounceBack.
+ */
template<typename T, typename Descriptor>
class component<T, Descriptor, cmpt::BounceBack> {
private:
- typename saw::native_data_type<T>::type relaxation_;
public:
- component(typename saw::native_data_type<T>::type relaxation__):
- relaxation_{relaxation__}
- {}
+ component() = default;
using Component = cmpt::BounceBack;
@@ -30,7 +30,7 @@ public:
/**
* Thoughts regarding automating order setup
*/
- static constexpr saw::string_literal name = "collision";
+ static constexpr saw::string_literal name = "full_way_bounce_back";
static constexpr saw::string_literal after = "";
static constexpr saw::string_literal before = "streaming";
@@ -38,20 +38,22 @@ public:
* Raw setup
*/
template<typename CellFieldSchema>
- void apply(saw::data<CellFieldSchema>& field, saw::data<sch::FixedArray<sch::UInt64,Descriptor::D>> index, uint64_t time_step){
- bool is_even = ((time_step % 2) == 0);
- auto& cell = field.at(index);
+ void apply(saw::data<CellFieldSchema>& field, const saw::data<sch::FixedArray<sch::UInt64,Descriptor::D>>& index, uint64_t time_step){
+ bool is_even = ((time_step % 2u) == 0u);
- auto& dfs_old = is_even ? cell.template get<"dfs_old">() : cell.template get<"dfs">();
- auto& dfs = (!is_even) ? cell.template get<"dfs_old">() : cell.template get<"dfs">();
+ // This is a ref
+ auto& cell = field(index);
- using dfi = df_info<sch::T,Desc>;
+ auto& dfs_old = (is_even) ? cell.template get<"dfs_old">() : cell.template get<"dfs">();
+ auto& dfs = (not is_even) ? cell.template get<"dfs_old">() : cell.template get<"dfs">();
+
+ using dfi = df_info<T,Descriptor>;
// Technically use .copy()
- auto df_cpy = dfs;
+ auto df_cpy = dfs_old;
- for(uint64_t i = 1u; i < Desc::Q; ++i){
- dfs({i}) = df_cpy({dfi::opposite_index.at(i)});
+ for(uint64_t i = 1u; i < Descriptor::Q; ++i){
+ dfs_old({i}) = df_cpy({dfi::opposite_index.at(i)});
}
}
};
diff --git a/c++/collision.hpp b/c++/collision.hpp
index 128a499..451e4bb 100644
--- a/c++/collision.hpp
+++ b/c++/collision.hpp
@@ -51,7 +51,7 @@ public:
auto eq = equilibrium<T,Descriptor>(rho,vel);
for(uint64_t i = 0u; i < Descriptor::Q; ++i){
- dfs({i}).set(dfs({i}).get() + (1.0 / relaxation_) * (eq.at(i).get() - dfs({i}).get()));
+ dfs_old({i}).set(dfs_old({i}).get() + (1.0 / relaxation_) * (eq.at(i).get() - dfs_old({i}).get()));
}
}
diff --git a/c++/descriptor.hpp b/c++/descriptor.hpp
index b1ee5b1..23c82f2 100644
--- a/c++/descriptor.hpp
+++ b/c++/descriptor.hpp
@@ -205,6 +205,10 @@ public:
const data<Sch, Encode>& operator()(const data<schema::UInt64>& index)const{
return inner_.at(index);
}
+
+ const data<kel::lbm::sch::Cell<Sch, Desc, S, D, Q>, Encode> copy() const {
+ return *this;
+ }
};
template<typename Desc, typename CellT, typename Encode>