summaryrefslogtreecommitdiff
path: root/tests/particles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/particles.cpp')
-rw-r--r--tests/particles.cpp44
1 files changed, 43 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;
+ }
+ }
+
+ }
}
}