summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/cavity_2d_gpu/.nix/derivation.nix9
-rw-r--r--examples/cavity_2d_gpu/SConscript21
-rw-r--r--examples/cavity_2d_gpu/cavity_2d_gpu.cpp14
3 files changed, 17 insertions, 27 deletions
diff --git a/examples/cavity_2d_gpu/.nix/derivation.nix b/examples/cavity_2d_gpu/.nix/derivation.nix
index a98795b..876bcb7 100644
--- a/examples/cavity_2d_gpu/.nix/derivation.nix
+++ b/examples/cavity_2d_gpu/.nix/derivation.nix
@@ -3,12 +3,15 @@
, scons
, clang-tools
, forstio
+, adaptive-cpp
, pname
, version
+, kel-lbm
}:
stdenv.mkDerivation {
- inherit pname version;
+ pname = pname + "-examples-" + "cavity_2d_gpu";
+ inherit version;
src = ./..;
nativeBuildInputs = [
@@ -21,7 +24,9 @@ stdenv.mkDerivation {
forstio.async
forstio.codec
forstio.codec-unit
- forstio.codec-json
+ forstio.codec-json
+ adaptive-cpp
+ kel-lbm
];
doCheck = true;
diff --git a/examples/cavity_2d_gpu/SConscript b/examples/cavity_2d_gpu/SConscript
index 077fb99..15b013d 100644
--- a/examples/cavity_2d_gpu/SConscript
+++ b/examples/cavity_2d_gpu/SConscript
@@ -10,7 +10,7 @@ Import('env')
dir_path = Dir('.').abspath
# Environment for base library
-cavity2d_env = examples_env.Clone();
+examples_env = env.Clone();
examples_env.sources = sorted(glob.glob(dir_path + "/*.cpp"))
examples_env.headers = sorted(glob.glob(dir_path + "/*.hpp"))
@@ -20,22 +20,13 @@ env.headers += examples_env.headers;
# Cavity2D
examples_objects = [];
-examples_env.add_source_files(examples_objects, ['cavity_2d.cpp'], shared=False);
-examples_env.cavity_2d = examples_env.Program('#bin/cavity_2d', [env.library_static, examples_objects]);
+examples_env.add_source_files(examples_objects, ['cavity_2d_gpu.cpp'], shared=False);
+examples_env.cavity_2d_gpu = examples_env.Program('#bin/cavity_2d_gpu', [examples_objects]);
# Set Alias
env.examples = [
- examples_env.meta_2d,
-# examples_env.cavity_2d,
-# examples_env.cavity_3d,
-# examples_env.particle_ibm_2d
- examples_env.poiseulle_2d,
- examples_env.poiseulle_channel_2d,
- examples_env.poiseulle_particles_channel_2d
+ examples_env.cavity_2d_gpu
];
env.Alias('examples', env.examples);
-
-if env["build_examples"]:
- env.targets += ['examples'];
- env.Install('$prefix/bin/', env.examples);
-#endif
+env.targets += ['examples'];
+env.Install('$prefix/bin/', env.examples);
diff --git a/examples/cavity_2d_gpu/cavity_2d_gpu.cpp b/examples/cavity_2d_gpu/cavity_2d_gpu.cpp
index a72cc6a..dc022a1 100644
--- a/examples/cavity_2d_gpu/cavity_2d_gpu.cpp
+++ b/examples/cavity_2d_gpu/cavity_2d_gpu.cpp
@@ -1,9 +1,4 @@
-#include "../c++/descriptor.hpp"
-#include "../c++/macroscopic.hpp"
-#include "../c++/lbm.hpp"
-#include "../c++/component.hpp"
-#include "../c++/collision.hpp"
-#include "../c++/boundary.hpp"
+#include <kel/lbm/lbm.hpp>
#include <forstio/codec/data.hpp>
// #include <forstio/remote/
@@ -27,14 +22,13 @@ using namespace saw::schema;
* Q factor
*/
using T = Float32;
-using D2Q5 = Descriptor<2u,5u>;
using D2Q9 = Descriptor<2u,9u>;
template<typename Desc>
using DfCell = Cell<T, Desc, 0u, 0u, 1u>;
template<typename Desc>
-using CellInfo = Cell<UInt8, D2Q9, 1u, 0u, 0u>;
+using CellInfo = Cell<UInt8, Desc, 1u, 0u, 0u>;
/**
* Basic type for simulation
@@ -217,11 +211,11 @@ void lbm_step(
switch(info({0u}).get()){
case 1u: {
- coll.apply(latt, index, time_step);
+ bb.apply(latt, index, time_step);
break;
}
case 2u: {
- bb.apply(latt, index, time_step);
+ coll.apply(latt, index, time_step);
break;
}
default: