diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-07-03 15:37:25 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-07-03 15:37:25 +0200 |
commit | 6393b959829a1f7513f3daccbaeb9e275fc4ac0d (patch) | |
tree | 93dcab7399f955cc9a6bc27a91cdb9ad49f2faea /examples | |
parent | 6119b94098385da3983a82a3c1472991e9e2f467 (diff) |
Wrote minor iterator confirmation tests
Diffstat (limited to 'examples')
-rw-r--r-- | examples/SConscript | 6 | ||||
-rw-r--r-- | examples/poiseulle_2d.cpp | 21 |
2 files changed, 19 insertions, 8 deletions
diff --git a/examples/SConscript b/examples/SConscript index 13ed580..9bac1f0 100644 --- a/examples/SConscript +++ b/examples/SConscript @@ -33,11 +33,17 @@ examples_env.cavity_2d = examples_env.Program('#bin/cavity_2d', [env.library_sta #examples_env.add_source_files(examples_objects, ['particle_ibm.cpp'], shared=False); #examples_env.particle_ibm_2d = examples_env.Program('#bin/particle_ibm_2d', [env.library_static, examples_objects]); +# Poiseulle 2D +examples_objects = []; +examples_env.add_source_files(examples_objects, ['poiseulle_2d.cpp'], shared=False); +examples_env.poiseulle_2d = examples_env.Program('#bin/poiseulle_2d', [env.library_static, examples_objects]); + # Set Alias env.examples = [ examples_env.meta_2d, examples_env.cavity_2d, # examples_env.particle_ibm_2d + examples_env.poiseulle_2d ]; env.Alias('examples', env.examples); diff --git a/examples/poiseulle_2d.cpp b/examples/poiseulle_2d.cpp index c933319..2770221 100644 --- a/examples/poiseulle_2d.cpp +++ b/examples/poiseulle_2d.cpp @@ -1,6 +1,7 @@ #include "../c++/lbm.hpp" #include "../c++/collision.hpp" #include "../c++/boundary.hpp" +#include "../c++/iterator.hpp" #include <forstio/codec/data.hpp> @@ -38,6 +39,11 @@ using CellStruct = Struct< Member<CellInfo<Desc>, "info"> >; +template<typename T, uint64_t D> +using MacroStruct = Struct< + Member<FixedArray<T,D>, "velocity">, + Member<T, "pressure"> +>; using CavityFieldD2Q9 = CellField<D2Q9, CellStruct<D2Q9>>; } @@ -48,15 +54,14 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){ using namespace kel::lbm; auto meta = latt.meta(); - for(saw::data<sch::UInt64> i{0u}; i < meta.at(0u); ++i){ - for(saw::data<sch::UInt64> j{0u}; j < meta.at(1u); ++j ){ - auto& cell = latt({{i,j}}); - auto& info = cell.template get<"info">(); - // if() - } - } + iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){ + auto& cell = latt(index); + auto& info = cell.template get<"info">(); + + info({0u}).set(1u); + }, {{0u,0u}}, meta, {1u}); } void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){ @@ -136,7 +141,7 @@ int main(int argc, char** argv){ write_vtk_file(vtk_f_name, macros); } - lbm_step(lattice, even_step, step); + // lbm_step(lattice, i); } return 0; |