From c0549d71b2109f10c1238db8b22362e7826ba61b Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 5 Jul 2026 15:59:23 +0200 Subject: Just rename from lib to modules --- lib/core/tests/particles.cpp | 281 ------------------------------------------- 1 file changed, 281 deletions(-) delete mode 100644 lib/core/tests/particles.cpp (limited to 'lib/core/tests/particles.cpp') diff --git a/lib/core/tests/particles.cpp b/lib/core/tests/particles.cpp deleted file mode 100644 index 133c343..0000000 --- a/lib/core/tests/particles.cpp +++ /dev/null @@ -1,281 +0,0 @@ -#include - -#include -#include "../c++/particle/particle.hpp" - -namespace { -namespace sch { -using namespace kel::lbm::sch; - -using T = Float64; -} -SAW_TEST("Verlet step 2D - Planar"){ - using namespace kel; - - saw::data> particle; - auto& body = particle.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - auto& pos_old = body.template get<"position_old">(); - - // auto& rot = body.template get<"rotation">(); - auto& acc = body.template get<"acceleration">(); - - acc.at({{0}}).set({1.0}); - - saw::data> dt; - dt.at({}).set(0.5); - lbm::verlet_step_lambda(particle,dt); - - SAW_EXPECT(pos.at({{0}}).get() == 0.25, std::string{"Incorrect Pos X: "} + std::to_string(pos.at({{0}}).get())); - SAW_EXPECT(pos.at({{1}}).get() == 0.0, std::string{"Incorrect Pos Y: "} + std::to_string(pos.at({{1}}).get())); -} -/* -SAW_TEST("No Collision Spheroid 2D"){ - using namespace kel; - - saw::data> part_a; - { - auto& body = part_a.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - - pos.at({{0u}}) = 0.1; - pos.at({{1u}}) = 0.2; - - } - saw::data> part_b; - { - auto& body = part_b.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - - pos.at({{0u}}) = -2.1; - pos.at({{1u}}) = 0.0; - } - - bool have_collided = lbm::broadphase_collision_check(part_a,part_b); - SAW_EXPECT(not have_collided, "Particles shouldn't collide"); -} -*/ -/* -SAW_TEST("Collision Spheroid 2D"){ - using namespace kel; - - saw::data> part_a; - { - auto& body = part_a.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - auto& coll = part_a.template get<"collision">(); - auto& radius = coll.template get<"radius">(); - - radius.at({}).set(1.0); - - pos.at({{0u}}) = 0.1; - pos.at({{1u}}) = 0.2; - - } - saw::data> part_b; - { - auto& body = part_b.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - auto& coll = part_b.template get<"collision">(); - auto& radius = coll.template get<"radius">(); - - radius.at({}).set(1.0); - - pos.at({{0u}}) = -1.5; - pos.at({{1u}}) = 0.0; - } - - bool have_collided = lbm::broadphase_collision_check(part_a,part_b); - SAW_EXPECT(have_collided, "Particles should collide"); -} -*/ -/* -SAW_TEST("Moving particles 2D"){ - using namespace kel; - - saw::data> part_a; - { - auto& body = part_a.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - auto& pos_old = body.template get<"position_old">(); - auto& coll = part_a.template get<"collision">(); - auto& radius = coll.template get<"radius">(); - auto& acc = body.template get<"acceleration">(); - - radius.at({}).set(1.0); - - pos.at({{0u}}) = -5.0; - pos.at({{1u}}) = 0.2; - pos_old = pos; - acc.at({{0u}}) = 0.1; - - } - saw::data> part_b; - { - auto& body = part_b.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - auto& pos_old = body.template get<"position_old">(); - auto& coll = part_b.template get<"collision">(); - auto& radius = coll.template get<"radius">(); - auto& acc = body.template get<"acceleration">(); - - radius.at({}).set(1.0); - - pos.at({{0u}}) = 5.0; - pos.at({{1u}}) = 0.0; - pos_old = pos; - acc.at({{0u}}) = -0.1; - } - - saw::data> dt; - dt.at({}).set(0.5); - bool has_collided = false; - for(uint64_t i = 0u; i < 32u; ++i){ - lbm::verlet_step_lambda(part_a,dt); - lbm::verlet_step_lambda(part_b,dt); - - has_collided = lbm::broadphase_collision_check(part_a,part_b); - if(has_collided){ - std::cout<<"Collided at: "<> part_a; - { - auto& body = part_a.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - auto& pos_old = body.template get<"position_old">(); - auto& acc = body.template get<"acceleration">(); - - pos.at({{0u}}) = -5.0; - pos.at({{1u}}) = 0.2; - pos_old = pos; - } -} -/* - -SAW_TEST("Particle Collision Impulse"){ - using namespace kel; - - saw::data> part_a; - { - auto& body = part_a.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - auto& pos_old = body.template get<"position_old">(); - auto& coll = part_a.template get<"collision">(); - auto& radius = coll.template get<"radius">(); - auto& acc = body.template get<"acceleration">(); - - radius.at({}).set(1.0); - - pos.at({{0u}}) = -5.0; - pos.at({{1u}}) = 0.2; - pos_old = pos; - acc.at({{0u}}) = 0.1; - - } - saw::data> part_b; - { - auto& body = part_b.template get<"rigid_body">(); - auto& pos = body.template get<"position">(); - auto& pos_old = body.template get<"position_old">(); - auto& coll = part_b.template get<"collision">(); - auto& radius = coll.template get<"radius">(); - auto& acc = body.template get<"acceleration">(); - - radius.at({}).set(1.5); - - pos.at({{0u}}) = 5.0; - pos.at({{1u}}) = 0.0; - pos_old = pos; - acc.at({{0u}}) = -0.1; - } -} -*/ -/* - -SAW_TEST("Minor Test for mask"){ - using namespace kel; - - lbm::particle_circle_geometry geo; - - auto mask = geo.generate_mask(9u,1u); - - auto& grid = mask.template get<"grid">(); - - for(saw::data i{0u}; i < grid.template get_dim_size<0>(); ++i){ - for(saw::data j{0u}; j < grid.template get_dim_size<1>(); ++j){ - std::cout<> reference_mask{{{4+2,4+2}}}; - //reference_mask.at({{0,0}}); -} -*/ -/* -SAW_TEST("Verlet integration test 2D"){ - using namespace kel; - lbm::particle_system> system; - - { - saw::data> 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 i{0u}; i < saw::data{2u}; ++i){ - std::cout<{1e-1}); - - { - auto& p = system.at({0u}); - auto& rb = p.template get<"rigid_body">(); - auto& pos = rb.template get<"position">(); - - for(saw::data i{0u}; i < saw::data{2u}; ++i){ - std::cout<