diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/SConscript | 32 | ||||
| -rw-r--r-- | tests/converter.cpp | 26 | ||||
| -rw-r--r-- | tests/descriptor.cpp | 35 | ||||
| -rw-r--r-- | tests/equilibrium.cpp | 40 | ||||
| -rw-r--r-- | tests/iterator.cpp | 33 | ||||
| -rw-r--r-- | tests/particle_flow_coupling.cpp | 23 | ||||
| -rw-r--r-- | tests/particles.cpp | 85 | ||||
| -rw-r--r-- | tests/vtk_write.cpp | 64 |
8 files changed, 0 insertions, 338 deletions
diff --git a/tests/SConscript b/tests/SConscript deleted file mode 100644 index d1b381e..0000000 --- a/tests/SConscript +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/false - -import os -import os.path -import glob - - -Import('env') - -dir_path = Dir('.').abspath - -# Environment for base library -test_cases_env = env.Clone(); - -test_cases_env.Append(LIBS=['forstio-test']); - -test_cases_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) -test_cases_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) - -env.sources += test_cases_env.sources; -env.headers += test_cases_env.headers; - -objects_static = [] -test_cases_env.add_source_files(objects_static, test_cases_env.sources, shared=False); -test_cases_env.program = test_cases_env.Program('#bin/tests', [objects_static]); -# , env.library_static]); - -# Set Alias -env.Alias('test', test_cases_env.program); -env.Alias('check', test_cases_env.program); - -env.targets += ['test','check']; diff --git a/tests/converter.cpp b/tests/converter.cpp deleted file mode 100644 index 4fc536f..0000000 --- a/tests/converter.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include <forstio/test/suite.hpp> - -#include "../c++/converter.hpp" - - -namespace { -namespace sch { -using namespace kel::lbm::sch; - -using T = Float64; -} - -SAW_TEST("Si Meter to Lbm Meter"){ - using namespace kel; - - lbm::converter<sch::T> converter{ - {0.1}, - {0.1} - }; - - saw::data<sch::SiMeter<sch::T>> si_m{1.0}; - - auto lbm_m = converter.meter_si_to_lbm(si_m); - SAW_EXPECT(lbm_m.handle().get() == 10.0, "Correct si to lbm conversion"); -} -} diff --git a/tests/descriptor.cpp b/tests/descriptor.cpp deleted file mode 100644 index a8337e6..0000000 --- a/tests/descriptor.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include <forstio/test/suite.hpp> - -#include "../c++/descriptor.hpp" - - -namespace { -template<typename Descriptor> -void check_opposite_dirs(){ - using namespace kel; - - using dfi = lbm::df_info<lbm::sch::Float32, Descriptor>; - - for(uint64_t k = 0u; k < Descriptor::Q; ++k){ - auto k_inv = dfi::opposite_index[k]; - - for(uint64_t i = 0u; i < Descriptor::D; ++i){ - SAW_EXPECT(dfi::directions[k][i] == (-1*dfi::directions[k_inv][i]), "Opposites are inconsistent"); - } - } -} - -SAW_TEST("Opposites and Dirs D1Q3"){ - using namespace kel; - check_opposite_dirs<lbm::sch::Descriptor<1,3>>(); -} - -SAW_TEST("Opposites and Dirs D2Q5"){ - using namespace kel; - check_opposite_dirs<lbm::sch::Descriptor<2,5>>(); -} -SAW_TEST("Opposites and Dirs D2Q9"){ - using namespace kel; - check_opposite_dirs<lbm::sch::Descriptor<2,9>>(); -} -} diff --git a/tests/equilibrium.cpp b/tests/equilibrium.cpp deleted file mode 100644 index 9201e55..0000000 --- a/tests/equilibrium.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include <forstio/test/suite.hpp> - -#include "../c++/equilibrium.hpp" - - -namespace { - -template<typename Descriptor> -void check_equilibrium(){ - using namespace kel; - - using dfi = lbm::df_info<lbm::sch::Float64,Descriptor>; - - saw::data<lbm::sch::Float64> rho{1.0}; - saw::data<lbm::sch::FixedArray<lbm::sch::Float64,Descriptor::D>> vel; - for(saw::data<lbm::sch::UInt64> i{0u}; i.get() < Descriptor::D; ++i){ - vel.at(i) = {0.0}; - } - auto eq = lbm::equilibrium<lbm::sch::Float64,Descriptor>(rho,vel); - - for(saw::data<lbm::sch::UInt64> i{0u}; i.get() < Descriptor::Q; ++i){ - SAW_EXPECT(eq.at(i).get() == dfi::weights[i.get()], std::string{"No velocity and normalized rho should be exactly the weights: "} + std::to_string(eq.at(i).get()) + std::string{" "} + std::to_string(dfi::weights[i.get()])); - } -} - -SAW_TEST("Equilibrium at rest D1Q3"){ - using namespace kel; - check_equilibrium<lbm::sch::Descriptor<1,3>>(); -} - -SAW_TEST("Equilibrium at rest D2Q5"){ - using namespace kel; - check_equilibrium<lbm::sch::Descriptor<2,5>>(); -} - -SAW_TEST("Equilibrium at rest D2Q9"){ - using namespace kel; - check_equilibrium<lbm::sch::Descriptor<2,9>>(); -} -} diff --git a/tests/iterator.cpp b/tests/iterator.cpp deleted file mode 100644 index cd1cb7c..0000000 --- a/tests/iterator.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include <forstio/test/suite.hpp> - -#include "../c++/iterator.hpp" - -#include <iostream> - -namespace { -namespace sch { -using namespace kel::lbm::sch; -} - -SAW_TEST("Iterate"){ - using namespace kel; - - saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}}; - saw::data<sch::FixedArray<sch::UInt64,2u>> end{{3u,3u}}; - - lbm::iterate_over([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){ - std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl; - }, start, end); -} - -SAW_TEST("Iterate with Distance 1"){ - using namespace kel; - - saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}}; - saw::data<sch::FixedArray<sch::UInt64,2u>> end{{4u,4u}}; - - lbm::iterate_over([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){ - std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl; - }, start, end, {{1u,1u}}); -} -} diff --git a/tests/particle_flow_coupling.cpp b/tests/particle_flow_coupling.cpp deleted file mode 100644 index c3e3769..0000000 --- a/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/tests/particles.cpp b/tests/particles.cpp deleted file mode 100644 index 277a8d0..0000000 --- a/tests/particles.cpp +++ /dev/null @@ -1,85 +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("Minor Test for mask"){ - using namespace kel; - - lbm::particle_circle_geometry<sch::T> geo; - - auto mask = geo.generate_mask<sch::T>(9u,1u); - - auto& grid = mask.template get<"grid">(); - - for(saw::data<sch::UInt64> i{0u}; i < grid.template get_dim_size<0>(); ++i){ - for(saw::data<sch::UInt64> j{0u}; j < grid.template get_dim_size<1>(); ++j){ - std::cout<<grid.at({{i,j}}).get()<<" "; - } - std::cout<<"\n"; - } - std::cout<<std::endl; - - //saw::data<sch::Array<sch::T,2>> reference_mask{{{4+2,4+2}}}; - //reference_mask.at({{0,0}}); -} - -SAW_TEST("Verlet integration test"){ - using namespace kel; - lbm::particle_system<sch::T,2,sch::Particle<sch::T,2>> system; - - { - 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 < 36u; ++i){ - system.step(saw::data<sch::T>{1e-1}); - - { - 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 deleted file mode 100644 index 0df9998..0000000 --- a/tests/vtk_write.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include <forstio/test/suite.hpp> - -#include <iostream> -#include "../c++/write_vtk.hpp" - -#include <sstream> - -namespace { -namespace sch { -using namespace kel::lbm::sch; - -using T = Float64; -using D2Q5 = Descriptor<2,5>; -using D2Q9 = Descriptor<2,9>; - -template<typename Desc> -using DfCell = Cell<T, Desc, 0, 0, 1>; - -template<typename Desc> -using CellInfo = Cell<UInt8, D2Q9, 1, 0, 0>; - -/** - * Basic type for simulation - */ -template<typename Desc> -using CellStruct = Struct< - Member<DfCell<Desc>, "dfs">, - Member<DfCell<Desc>, "dfs_old">, - Member<CellInfo<Desc>, "info"> ->; - -template<typename T, uint64_t D> -using MacroStruct = Struct< - Member<FixedArray<T,D>, "velocity">, - Member<T, "pressure"> ->; - -} - -SAW_TEST("VTK Write test example"){ - using namespace kel; - - // write_vtk(); - - std::stringstream sstream; - - saw::data<sch::Array<sch::MacroStruct<sch::T,2>, 2>> cells{{{2u,2u}}}; - - 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<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; -} -} |
