summaryrefslogtreecommitdiff
path: root/lib/core/tests
diff options
context:
space:
mode:
Diffstat (limited to 'lib/core/tests')
-rw-r--r--lib/core/tests/flatten.cpp22
-rw-r--r--lib/core/tests/particle_flow_coupling.cpp23
-rw-r--r--lib/core/tests/particles.dummy (renamed from lib/core/tests/particles.cpp)11
-rw-r--r--lib/core/tests/vtk_write.cpp28
4 files changed, 60 insertions, 24 deletions
diff --git a/lib/core/tests/flatten.cpp b/lib/core/tests/flatten.cpp
new file mode 100644
index 0000000..84b3fa4
--- /dev/null
+++ b/lib/core/tests/flatten.cpp
@@ -0,0 +1,22 @@
+#include <forstio/test/suite.hpp>
+
+#include "../c++/flatten.hpp"
+
+namespace {
+namespace sch {
+using namespace saw::schema;
+}
+
+SAW_TEST("Flatten Index Stride"){
+ using namespace kel;
+
+ constexpr saw::data<sch::UInt64> zero = lbm::flatten_index<sch::UInt64,3u>::stride<0u>({{2u,4u,3u}});
+ constexpr saw::data<sch::UInt64> one = lbm::flatten_index<sch::UInt64,3u>::stride<1u>({{2u,4u,3u}});
+ constexpr saw::data<sch::UInt64> two = lbm::flatten_index<sch::UInt64,3u>::stride<2u>({{2u,4u,3u}});
+
+ SAW_EXPECT(zero.get() == 1u, "Zero is correct");
+ SAW_EXPECT(one.get() == 2u, "Zero is correct");
+ SAW_EXPECT(two.get() == 8u, "Zero is correct");
+}
+
+}
diff --git a/lib/core/tests/particle_flow_coupling.cpp b/lib/core/tests/particle_flow_coupling.cpp
deleted file mode 100644
index c3e3769..0000000
--- a/lib/core/tests/particle_flow_coupling.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <forstio/test/suite.hpp>
-
-#include <iostream>
-#include "../c++/particle/geometry/circle.hpp"
-
-
-namespace {
-namespace sch {
-using namespace kel::lbm::sch;
-
-using T = Float64;
-}
-
-SAW_TEST("Particle Coupling"){
- using namespace kel;
- lbm::particle_system<sch::T,2,sch::Particle<sch::T,2>> system;
-
- /// What are the steps?#
- ///
- /// Collide and Stream
-
-}
-}
diff --git a/lib/core/tests/particles.cpp b/lib/core/tests/particles.dummy
index 79a6471..cbbeefa 100644
--- a/lib/core/tests/particles.cpp
+++ b/lib/core/tests/particles.dummy
@@ -1,7 +1,7 @@
#include <forstio/test/suite.hpp>
#include <iostream>
-#include "../c++/particle/geometry/circle.hpp"
+//#include "../c++/particle/geometry/circle.hpp"
namespace {
@@ -11,6 +11,7 @@ using namespace kel::lbm::sch;
using T = Float64;
}
SAW_TEST("Verlet step 2D - Planar"){
+/*
using namespace kel;
@@ -28,6 +29,14 @@ SAW_TEST("Verlet step 2D - Planar"){
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("Collision spheroid Test"){
+ using namespace kel;
+
+ saw::data<sch::Particle<sch::T,2u> part_a;
+ saw::data<sch::Particle<sch::T,2u> part_b;
}
/*
diff --git a/lib/core/tests/vtk_write.cpp b/lib/core/tests/vtk_write.cpp
index 0df9998..231fd37 100644
--- a/lib/core/tests/vtk_write.cpp
+++ b/lib/core/tests/vtk_write.cpp
@@ -61,4 +61,32 @@ SAW_TEST("VTK Write test example"){
// using Type = typename parameter_pack_type<i,T...>::type;
}
+
+SAW_TEST("VTK Write raw test example"){
+ using namespace kel;
+
+ // write_vtk();
+
+ std::stringstream sstream;
+
+ saw::data<sch::Array<sch::MacroStruct<sch::T,2>, 2>> cells{{{2u,2u}}};
+
+ auto meta = cells.dims();
+
+ auto& cell_0 = cells.at({{{0,0}}});
+ cell_0.template get<"velocity">()= {{0.5,-0.1}};
+ cell_0.template get<"pressure">().set(1.1);
+
+ auto eov = lbm::impl::lbm_vtk_writer_raw<sch::MacroStruct<sch::T,2u>,2u>::apply(sstream, &cell_0, meta);
+ 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;
+}
+
}