diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-06-05 13:09:07 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-06-05 13:09:07 +0200 |
commit | 9e37ff62b668694f705a8d132469f40ead9f6f0f (patch) | |
tree | ac486a9b93376fb10ae966e65b9724e46f1b00d2 /tests | |
parent | 4a291705f46086d5adcf68de6d6d1441c4b9e4f9 (diff) |
Dangling changes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/particles.cpp | 44 | ||||
-rw-r--r-- | tests/vtk_write.cpp | 4 |
2 files changed, 47 insertions, 1 deletions
diff --git a/tests/particles.cpp b/tests/particles.cpp index 873b8ad..260caf0 100644 --- a/tests/particles.cpp +++ b/tests/particles.cpp @@ -36,7 +36,49 @@ SAW_TEST("Verlet integration test"){ using namespace kel; lbm::particle_system<sch::T,2,sch::Particle<sch::T,2>> system; - // system.step(); + { + saw::data<sch::Particle<sch::T,2>> particle; + auto& rb = particle.template get<"rigid_body">(); + auto& acc = rb.template get<"acceleration">(); + auto& pos = rb.template get<"position">(); + auto& pos_old = rb.template get<"position_old">(); + pos = {{1e-1,1e-1}}; + pos_old = {{0.0, 0.0}}; + acc = {{0.0,-1e1}}; + + auto eov = system.add_particle(std::move(particle)); + SAW_EXPECT(eov.is_value(), "Expected no error :)"); + } + { + auto& p = system.at({0u}); + auto& rb = p.template get<"rigid_body">(); + auto& pos = rb.template get<"position">(); + + for(saw::data<sch::UInt64> i{0u}; i < saw::data<sch::UInt64>{2u}; ++i){ + std::cout<<pos.at(i).get()<<" "; + } + std::cout<<std::endl; + } + + for(uint64_t i = 0u; i < 360u; ++i){ + system.step(saw::data<sch::T>{1e-2}); + + { + auto& p = system.at({0u}); + auto& rb = p.template get<"rigid_body">(); + auto& pos = rb.template get<"position">(); + + for(saw::data<sch::UInt64> i{0u}; i < saw::data<sch::UInt64>{2u}; ++i){ + std::cout<<pos.at(i).get()<<" "; + } + std::cout<<"\n"; + + if(pos.at({1u}).get() < 0.0){ + break; + } + } + + } } } diff --git a/tests/vtk_write.cpp b/tests/vtk_write.cpp index 49c9c52..b2e30f0 100644 --- a/tests/vtk_write.cpp +++ b/tests/vtk_write.cpp @@ -53,8 +53,12 @@ SAW_TEST("VTK Write test example"){ auto eov = lbm::impl::lbm_vtk_writer<sch::Array<sch::MacroStruct<sch::T,2>, 2>>::apply(sstream, cells); SAW_EXPECT(eov.is_value(), "vtk writer failed to write"); + // I want to print it to see it for myself. For now I have no tooling to more easily view associated and potentially generated files std::cout<<sstream.str()<<std::endl; + static std::string_view comparison_str = "# vtk DataFile Version 3.0\nLBM File\nASCII\nDATASET STRUCTURED_POINTS\nSPACING 1.0 1.0 1.0\nORIGIN 0.0 0.0 0.0\nDIMENSIONS 2 2 1\nPOINT_DATA 4\n\nVECTORS velocity float\n0.5 -0.1 0\n0 0 0\n0 0 0\n0 0 0\nSCALARS pressure float\nLOOKUP_TABLE default\n1.1\n0\n0\n0\n"; + SAW_EXPECT(sstream.str() == comparison_str, "Expected different encoding"); + // using Type = typename parameter_pack_type<i,T...>::type; } } |