blob: e52715e97b33cdceb73a4d3f57a9fb0ed0a1d76e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#pragma once
#include "component.hpp"
#include "equilibrium.hpp"
namespace kel {
namespace lbm {
namespace cmpt {
struct BounceBack {};
}
/**
* Full-Way BounceBack.
*/
template<typename T, typename Descriptor>
class component<T, Descriptor, cmpt::BounceBack> {
private:
public:
component() = default;
using Component = cmpt::BounceBack;
/**
* Thoughts regarding automating order setup
*/
using access = cmpt::access_tuple<
cmpt::access<"dfs", 1, true, true, true>
>;
/**
* Thoughts regarding automating order setup
*/
static constexpr saw::string_literal name = "full_way_bounce_back";
static constexpr saw::string_literal after = "";
static constexpr saw::string_literal before = "streaming";
/**
* Raw setup
*/
template<typename CellFieldSchema>
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);
// This is a ref
auto& cell = field(index);
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_old;
for(uint64_t i = 1u; i < Descriptor::Q; ++i){
dfs_old({i}) = df_cpy({dfi::opposite_index.at(i)});
}
}
};
}
}
|