From e6e9cc9ce84539813e7e14fae5cdf3d4466fdeaf Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 26 Jun 2026 15:21:26 +0200 Subject: Added runs and script --- .../SConscript | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 examples/poiseulle_moving_particle_2d_psm_gpu/SConscript (limited to 'examples/poiseulle_moving_particle_2d_psm_gpu/SConscript') diff --git a/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript b/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript new file mode 100644 index 0000000..eb856b6 --- /dev/null +++ b/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript @@ -0,0 +1,34 @@ +#!/bin/false + +import os +import os.path +import glob + + +Import('env') + +dir_path = Dir('.').abspath + +# Environment for base library +examples_env = env.Clone(); +examples_env['CXX'] = 'syclcc-clang'; +examples_env['CXXFLAGS'] += ['-O3']; + +examples_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) +examples_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) + +env.sources += examples_env.sources; +env.headers += examples_env.headers; + +# Cavity2D +examples_objects = []; +examples_env.add_source_files(examples_objects, ['sim.cpp'], shared=False); +examples_env.poiseulle_2d_gpu = examples_env.Program('#bin/poiseulle_particles_2d_psm_gpu', [examples_objects]); + +# Set Alias +env.examples = [ + examples_env.poiseulle_2d_gpu +]; +env.Alias('examples', env.examples); +env.targets += ['examples']; +env.Install('$prefix/bin/', env.examples); -- cgit v1.3.1 From 7a7d681ce70133ef0bc47a701f5b8448b15b3a29 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 28 Jun 2026 19:17:52 +0200 Subject: Dangling --- default.nix | 5 +++++ .../poiseulle_moving_particle_2d_psm_gpu/SConscript | 2 +- .../poiseulle_moving_particle_2d_psm_gpu/sim.cpp | 2 +- lib/core/c++/particle/particle.hpp | 1 + lib/core/c++/particle/particle_opa.hpp | 20 ++++++++++++++++++-- 5 files changed, 26 insertions(+), 4 deletions(-) (limited to 'examples/poiseulle_moving_particle_2d_psm_gpu/SConscript') diff --git a/default.nix b/default.nix index 29f4ba4..dc75b57 100644 --- a/default.nix +++ b/default.nix @@ -151,6 +151,11 @@ in rec { inherit pname version stdenv forstio adaptive-cpp; inherit kel; }; + + poiseulle_moving_particle_2d_psm_gpu = pkgs.callPackage ./examples/poiseulle_moving_particle_2d_psm_gpu/.nix/derivation.nix { + inherit pname version stdenv forstio adaptive-cpp; + inherit kel; + }; poiseulle_particles_2d_gpu = pkgs.callPackage ./examples/poiseulle_particles_2d_gpu/.nix/derivation.nix { inherit pname version stdenv forstio adaptive-cpp; diff --git a/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript b/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript index eb856b6..b062091 100644 --- a/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript +++ b/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript @@ -23,7 +23,7 @@ env.headers += examples_env.headers; # Cavity2D examples_objects = []; examples_env.add_source_files(examples_objects, ['sim.cpp'], shared=False); -examples_env.poiseulle_2d_gpu = examples_env.Program('#bin/poiseulle_particles_2d_psm_gpu', [examples_objects]); +examples_env.poiseulle_2d_gpu = examples_env.Program('#bin/poiseulle_moving_particle_2d_psm_gpu', [examples_objects]); # Set Alias env.examples = [ diff --git a/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp b/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp index 3001ba9..0c10d38 100644 --- a/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp +++ b/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp @@ -199,7 +199,7 @@ saw::error_or step( component,encode::Sycl> flow_in{1.0}; component,encode::Sycl> flow_out{1.0}; - component> opa; + component> opa{{},{}}; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ saw::data> index; diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp index 13ed37b..8e75e5a 100644 --- a/lib/core/c++/particle/particle.hpp +++ b/lib/core/c++/particle/particle.hpp @@ -8,6 +8,7 @@ #include "schema.hpp" #include "aabb.hpp" +#include "particle_opa.hpp" namespace kel { namespace lbm { diff --git a/lib/core/c++/particle/particle_opa.hpp b/lib/core/c++/particle/particle_opa.hpp index 470c4e9..4588a55 100644 --- a/lib/core/c++/particle/particle_opa.hpp +++ b/lib/core/c++/particle/particle_opa.hpp @@ -1,6 +1,7 @@ #pragma once -#include "component.hpp" +#include "common.hpp" +#include "../component.hpp" namespace kel { namespace lbm { @@ -12,8 +13,19 @@ template class component final { private: + saw::data> pos_; + saw::data> rad_; + saw::data> eps_; public: - component() = default; + component( + const saw::data> pos__, + const saw::data> rad__, + const saw::data> eps__ + ): + pos_{pos__}, + rad_{rad__}, + eps_{eps__} + {} template void apply(const saw::data& macros, const saw::data> index, saw::data time_step) const { @@ -24,6 +36,10 @@ public: auto& porous = porous_f.at(index); + auto pos_ind = saw::math::vectorize_data(index); + + auto diff = pos_ind - pos_; + auto diff_dot = saw::math::dot(diff,diff); } }; } -- cgit v1.3.1