summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2025-11-05 13:38:04 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2025-11-05 13:38:04 +0100
commitb9aacd9c2fdc61721c8ca3e1b40ebc92daa3772e (patch)
treebec510bca7b72b8fe63b7f8cec1fd78b7ff03bc2
parentf5c40005f576b5a3416c2cda8c60e5f100810ddb (diff)
downloadlibs-lbm-b9aacd9c2fdc61721c8ca3e1b40ebc92daa3772e.tar.gz
Reworking structure
-rw-r--r--default.nix29
-rw-r--r--examples/poiseulle_3d/poiseulle_3d.cpp75
-rw-r--r--lib/core/.nix/derivation.nix (renamed from .nix/derivation.nix)7
-rw-r--r--lib/core/SConstruct (renamed from lib/SConstruct)0
-rw-r--r--lib/core/c++/SConscript (renamed from lib/c++/SConscript)0
-rw-r--r--lib/core/c++/args.hpp (renamed from lib/c++/args.hpp)0
-rw-r--r--lib/core/c++/boundary.hpp (renamed from lib/c++/boundary.hpp)0
-rw-r--r--lib/core/c++/collision.hpp (renamed from lib/c++/collision.hpp)0
-rw-r--r--lib/core/c++/component.hpp (renamed from lib/c++/component.hpp)0
-rw-r--r--lib/core/c++/config.hpp (renamed from lib/c++/config.hpp)0
-rw-r--r--lib/core/c++/converter.hpp (renamed from lib/c++/converter.hpp)0
-rw-r--r--lib/core/c++/descriptor.hpp (renamed from lib/c++/descriptor.hpp)0
-rw-r--r--lib/core/c++/environment.hpp (renamed from lib/c++/environment.hpp)0
-rw-r--r--lib/core/c++/equilibrium.hpp (renamed from lib/c++/equilibrium.hpp)0
-rw-r--r--lib/core/c++/geometry.hpp (renamed from lib/c++/geometry.hpp)0
-rw-r--r--lib/core/c++/hlbm.hpp (renamed from lib/c++/hlbm.hpp)0
-rw-r--r--lib/core/c++/iterator.hpp (renamed from lib/c++/iterator.hpp)0
-rw-r--r--lib/core/c++/lbm.hpp (renamed from lib/c++/lbm.hpp)0
-rw-r--r--lib/core/c++/lbm_unit.hpp (renamed from lib/c++/lbm_unit.hpp)0
-rw-r--r--lib/core/c++/macroscopic.hpp (renamed from lib/c++/macroscopic.hpp)0
-rw-r--r--lib/core/c++/particle/geometry/circle.hpp (renamed from lib/c++/particle/geometry/circle.hpp)0
-rw-r--r--lib/core/c++/particle/particle.hpp (renamed from lib/c++/particle/particle.hpp)0
-rw-r--r--lib/core/c++/statistics.hpp (renamed from lib/c++/statistics.hpp)0
-rw-r--r--lib/core/c++/term_renderer.hpp (renamed from lib/c++/term_renderer.hpp)0
-rw-r--r--lib/core/c++/util.hpp (renamed from lib/c++/util.hpp)0
-rw-r--r--lib/core/c++/write_json.hpp (renamed from lib/c++/write_json.hpp)0
-rw-r--r--lib/core/c++/write_vtk.hpp (renamed from lib/c++/write_vtk.hpp)0
-rw-r--r--lib/core/tests/SConscript (renamed from lib/tests/SConscript)0
-rw-r--r--lib/core/tests/converter.cpp (renamed from lib/tests/converter.cpp)0
-rw-r--r--lib/core/tests/descriptor.cpp (renamed from lib/tests/descriptor.cpp)0
-rw-r--r--lib/core/tests/equilibrium.cpp (renamed from lib/tests/equilibrium.cpp)0
-rw-r--r--lib/core/tests/iterator.cpp (renamed from lib/tests/iterator.cpp)0
-rw-r--r--lib/core/tests/particle_flow_coupling.cpp (renamed from lib/tests/particle_flow_coupling.cpp)0
-rw-r--r--lib/core/tests/particles.cpp (renamed from lib/tests/particles.cpp)0
-rw-r--r--lib/core/tests/vtk_write.cpp (renamed from lib/tests/vtk_write.cpp)0
-rw-r--r--lib/sycl/.nix/derivation.nix39
36 files changed, 116 insertions, 34 deletions
diff --git a/default.nix b/default.nix
index 287ec0a..13f5953 100644
--- a/default.nix
+++ b/default.nix
@@ -13,7 +13,7 @@ let
forstio = (import ((builtins.fetchTarball {
url = "https://git.keldu.de/forstio-forstio/snapshot/dev.tar.gz";
- sha256 = "sha256:1mbak3ksppkij0325p6gz8mibbss0gfj4w85fs4f1jkz8wpdbkgq";
+ sha256 = "sha256:1za6a9379s1i4wb1lpj6bxd6brs6ivk3zvs3pjys4wmhpsji6csj";
}) + "/default.nix"){
inherit stdenv;
inherit clang-tools;
@@ -21,48 +21,51 @@ let
}).forstio;
pname = "kel-lbm";
- version = "0.0.2";
+ version = "0.0.3";
in rec {
- lbm = pkgs.callPackage ./.nix/derivation.nix {
- inherit forstio;
- inherit stdenv;
- inherit clang-tools;
+ kel-lbm = {
+ core = pkgs.callPackage ./lib/core/.nix/derivation.nix {
+ inherit forstio stdenv clang-tools;
+ };
+ sycl = pkgs.callPackage ./lib/sycl/.nix/derivation.nix {
+ inherit forstio stdenv clang-tools kel-lbm adaptive-cpp;
+ };
};
examples = {
cavity_2d_gpu = pkgs.callPackage ./examples/cavity_2d_gpu/.nix/derivation.nix {
inherit pname version stdenv forstio adaptive-cpp;
- kel-lbm = lbm;
+ inherit kel-lbm;
};
cavity_2d = pkgs.callPackage ./examples/cavity_2d/.nix/derivation.nix {
inherit pname version stdenv forstio;
- kel-lbm = lbm;
+ inherit kel-lbm;
};
poiseulle_particles_channel_2d = pkgs.callPackage ./examples/poiseulle_particles_channel_2d/.nix/derivation.nix {
inherit pname version stdenv forstio;
- kel-lbm = lbm;
+ inherit kel-lbm;
};
meta_2d = pkgs.callPackage ./examples/meta_2d/.nix/derivation.nix {
inherit pname version stdenv forstio;
- kel-lbm = lbm;
+ inherit kel-lbm;
};
planetary_3d = pkgs.callPackage ./examples/planetary_3d/.nix/derivation.nix {
inherit pname version stdenv forstio adaptive-cpp;
- kel-lbm = lbm;
+ inherit kel-lbm;
};
poiseulle_2d = pkgs.callPackage ./examples/poiseulle_3d/.nix/derivation.nix {
inherit pname version stdenv forstio;
- kel-lbm = lbm;
+ inherit kel-lbm;
};
poiseulle_3d = pkgs.callPackage ./examples/poiseulle_3d/.nix/derivation.nix {
inherit pname version stdenv forstio adaptive-cpp;
- kel-lbm = lbm;
+ inherit kel-lbm;
};
};
diff --git a/examples/poiseulle_3d/poiseulle_3d.cpp b/examples/poiseulle_3d/poiseulle_3d.cpp
index e6d0a61..2c268d4 100644
--- a/examples/poiseulle_3d/poiseulle_3d.cpp
+++ b/examples/poiseulle_3d/poiseulle_3d.cpp
@@ -42,6 +42,10 @@ public:
return inner_.at(index);
}
+ ref<data<schema::Array<CellT,Desc::D>, encode::Sycl<Encode> >> inner_data() {
+ return {inner_};
+ }
+
data<schema::UInt64,Encode> internal_size() const {
return inner_.internal_size();
}
@@ -50,55 +54,90 @@ public:
return inner_.internal_data();
}
};
+/*
+template<typename T, uint64_t D, typename Encode>
+class data<schema::Ref<schema::Array<T, D>>, encode::Sycl<Encode>> final {
+public:
+ using Schema = schema::Ref<schema::Array<T, D>>;
+private:
+ data<schema::Ref<schema::Array<CellT,Desc::D>>, encode::Sycl<Encode>>> inner_ref_;
+public:
+ data() = delete;
+ data(ref<data<kel::lbm::sch::CellField<Desc,CellT>,encode::Sycl<Encode>>> inner_ref__):
+ inner_ref_{inner_ref__().inner_data()}
+ {}
+
+ const data<MetaSchema, Encode> meta() const {
+ return inner_ref_().dims();
+ }
+
+ const data<CellT>& operator()(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index)const{
+ return inner_ref_().at(index);
+ }
+
+ data<CellT>& operator()(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index){
+ return inner_ref_().at(index);
+ }
+
+ const data<CellT>& at(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index)const{
+ return inner_ref_().at(index);
+ }
+
+ data<CellT>& at(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index){
+ return inner_ref_().at(index);
+ }
+
+ data<schema::UInt64,Encode> internal_size() const {
+ return inner_ref_().internal_size();
+ }
+
+ data<CellT,Encode>* internal_data() {
+ return inner_ref_().internal_data();
+ }
+};
+
template<typename Desc, typename CellT, typename Encode>
class data<schema::Ref<kel::lbm::sch::CellField<Desc, CellT>>, encode::Sycl<Encode>> final {
public:
using Schema = schema::Ref<kel::lbm::sch::CellField<Desc,CellT>>;
- using MetaSchema = typename meta_schema<Schema>::MetaSchema;
private:
- data<schema::Array<CellT,Desc::D>, Encode>* inner_ref_;
- data<schema::UInt64, Encode> size_;
+ data<schema::Ref<schema::Array<CellT,Desc::D>>, encode::Sycl<Encode>>> inner_ref_;
public:
data() = delete;
- data(data<MetaSchema,Encode>& inner_meta__, acpp::sycl::queue& q):
- inner_{inner_meta__,q}
+ data(ref<data<kel::lbm::sch::CellField<Desc,CellT>,encode::Sycl<Encode>>> inner_ref__):
+ inner_ref_{inner_ref__().inner_data()}
{}
const data<MetaSchema, Encode> meta() const {
- return inner_.dims();
- }
-
- template<uint64_t i>
- data<schema::UInt64,Encode> get_dim_size() const {
- static_assert(i < Desc::D, "Not enough dimensions");
- return inner_.template get_dim_size<i>();
+ return inner_ref_().dims();
}
const data<CellT>& operator()(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index)const{
- return inner_.at(index);
+ return inner_ref_().at(index);
}
data<CellT>& operator()(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index){
- return inner_.at(index);
+ return inner_ref_().at(index);
}
const data<CellT>& at(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index)const{
- return inner_.at(index);
+ return inner_ref_().at(index);
}
data<CellT>& at(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index){
- return inner_.at(index);
+ return inner_ref_().at(index);
}
data<schema::UInt64,Encode> internal_size() const {
- return inner_.internal_size();
+ return inner_ref_().internal_size();
}
data<CellT,Encode>* internal_data() {
- return inner_.internal_data();
+ return inner_ref_().internal_data();
}
};
+*/
}
diff --git a/.nix/derivation.nix b/lib/core/.nix/derivation.nix
index 5d77b56..55a414f 100644
--- a/.nix/derivation.nix
+++ b/lib/core/.nix/derivation.nix
@@ -3,12 +3,13 @@
, scons
, clang-tools
, forstio
+, pname
+, version
}:
stdenv.mkDerivation {
- pname = "kel-lbm";
- version = "0.0.2";
- src = ../lib;
+ inherit pname version;
+ src = ./..;
nativeBuildInputs = [
scons
diff --git a/lib/SConstruct b/lib/core/SConstruct
index 8b3ab01..8b3ab01 100644
--- a/lib/SConstruct
+++ b/lib/core/SConstruct
diff --git a/lib/c++/SConscript b/lib/core/c++/SConscript
index 85a078f..85a078f 100644
--- a/lib/c++/SConscript
+++ b/lib/core/c++/SConscript
diff --git a/lib/c++/args.hpp b/lib/core/c++/args.hpp
index 99c6172..99c6172 100644
--- a/lib/c++/args.hpp
+++ b/lib/core/c++/args.hpp
diff --git a/lib/c++/boundary.hpp b/lib/core/c++/boundary.hpp
index c10784c..c10784c 100644
--- a/lib/c++/boundary.hpp
+++ b/lib/core/c++/boundary.hpp
diff --git a/lib/c++/collision.hpp b/lib/core/c++/collision.hpp
index 73e86ae..73e86ae 100644
--- a/lib/c++/collision.hpp
+++ b/lib/core/c++/collision.hpp
diff --git a/lib/c++/component.hpp b/lib/core/c++/component.hpp
index 1e5dbbf..1e5dbbf 100644
--- a/lib/c++/component.hpp
+++ b/lib/core/c++/component.hpp
diff --git a/lib/c++/config.hpp b/lib/core/c++/config.hpp
index 64f7a0f..64f7a0f 100644
--- a/lib/c++/config.hpp
+++ b/lib/core/c++/config.hpp
diff --git a/lib/c++/converter.hpp b/lib/core/c++/converter.hpp
index 5c19c68..5c19c68 100644
--- a/lib/c++/converter.hpp
+++ b/lib/core/c++/converter.hpp
diff --git a/lib/c++/descriptor.hpp b/lib/core/c++/descriptor.hpp
index c6938e3..c6938e3 100644
--- a/lib/c++/descriptor.hpp
+++ b/lib/core/c++/descriptor.hpp
diff --git a/lib/c++/environment.hpp b/lib/core/c++/environment.hpp
index 4915e3a..4915e3a 100644
--- a/lib/c++/environment.hpp
+++ b/lib/core/c++/environment.hpp
diff --git a/lib/c++/equilibrium.hpp b/lib/core/c++/equilibrium.hpp
index bb55d00..bb55d00 100644
--- a/lib/c++/equilibrium.hpp
+++ b/lib/core/c++/equilibrium.hpp
diff --git a/lib/c++/geometry.hpp b/lib/core/c++/geometry.hpp
index 9802feb..9802feb 100644
--- a/lib/c++/geometry.hpp
+++ b/lib/core/c++/geometry.hpp
diff --git a/lib/c++/hlbm.hpp b/lib/core/c++/hlbm.hpp
index 1c665ce..1c665ce 100644
--- a/lib/c++/hlbm.hpp
+++ b/lib/core/c++/hlbm.hpp
diff --git a/lib/c++/iterator.hpp b/lib/core/c++/iterator.hpp
index 866543a..866543a 100644
--- a/lib/c++/iterator.hpp
+++ b/lib/core/c++/iterator.hpp
diff --git a/lib/c++/lbm.hpp b/lib/core/c++/lbm.hpp
index 39c42af..39c42af 100644
--- a/lib/c++/lbm.hpp
+++ b/lib/core/c++/lbm.hpp
diff --git a/lib/c++/lbm_unit.hpp b/lib/core/c++/lbm_unit.hpp
index 2d90652..2d90652 100644
--- a/lib/c++/lbm_unit.hpp
+++ b/lib/core/c++/lbm_unit.hpp
diff --git a/lib/c++/macroscopic.hpp b/lib/core/c++/macroscopic.hpp
index 51368e9..51368e9 100644
--- a/lib/c++/macroscopic.hpp
+++ b/lib/core/c++/macroscopic.hpp
diff --git a/lib/c++/particle/geometry/circle.hpp b/lib/core/c++/particle/geometry/circle.hpp
index 331f06d..331f06d 100644
--- a/lib/c++/particle/geometry/circle.hpp
+++ b/lib/core/c++/particle/geometry/circle.hpp
diff --git a/lib/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp
index 39aadfb..39aadfb 100644
--- a/lib/c++/particle/particle.hpp
+++ b/lib/core/c++/particle/particle.hpp
diff --git a/lib/c++/statistics.hpp b/lib/core/c++/statistics.hpp
index c07ccb7..c07ccb7 100644
--- a/lib/c++/statistics.hpp
+++ b/lib/core/c++/statistics.hpp
diff --git a/lib/c++/term_renderer.hpp b/lib/core/c++/term_renderer.hpp
index 5cbb551..5cbb551 100644
--- a/lib/c++/term_renderer.hpp
+++ b/lib/core/c++/term_renderer.hpp
diff --git a/lib/c++/util.hpp b/lib/core/c++/util.hpp
index 0bdebd1..0bdebd1 100644
--- a/lib/c++/util.hpp
+++ b/lib/core/c++/util.hpp
diff --git a/lib/c++/write_json.hpp b/lib/core/c++/write_json.hpp
index 19bbfa6..19bbfa6 100644
--- a/lib/c++/write_json.hpp
+++ b/lib/core/c++/write_json.hpp
diff --git a/lib/c++/write_vtk.hpp b/lib/core/c++/write_vtk.hpp
index 0647db5..0647db5 100644
--- a/lib/c++/write_vtk.hpp
+++ b/lib/core/c++/write_vtk.hpp
diff --git a/lib/tests/SConscript b/lib/core/tests/SConscript
index d1b381e..d1b381e 100644
--- a/lib/tests/SConscript
+++ b/lib/core/tests/SConscript
diff --git a/lib/tests/converter.cpp b/lib/core/tests/converter.cpp
index 4fc536f..4fc536f 100644
--- a/lib/tests/converter.cpp
+++ b/lib/core/tests/converter.cpp
diff --git a/lib/tests/descriptor.cpp b/lib/core/tests/descriptor.cpp
index 7f743ce..7f743ce 100644
--- a/lib/tests/descriptor.cpp
+++ b/lib/core/tests/descriptor.cpp
diff --git a/lib/tests/equilibrium.cpp b/lib/core/tests/equilibrium.cpp
index 9201e55..9201e55 100644
--- a/lib/tests/equilibrium.cpp
+++ b/lib/core/tests/equilibrium.cpp
diff --git a/lib/tests/iterator.cpp b/lib/core/tests/iterator.cpp
index 261765a..261765a 100644
--- a/lib/tests/iterator.cpp
+++ b/lib/core/tests/iterator.cpp
diff --git a/lib/tests/particle_flow_coupling.cpp b/lib/core/tests/particle_flow_coupling.cpp
index c3e3769..c3e3769 100644
--- a/lib/tests/particle_flow_coupling.cpp
+++ b/lib/core/tests/particle_flow_coupling.cpp
diff --git a/lib/tests/particles.cpp b/lib/core/tests/particles.cpp
index 277a8d0..277a8d0 100644
--- a/lib/tests/particles.cpp
+++ b/lib/core/tests/particles.cpp
diff --git a/lib/tests/vtk_write.cpp b/lib/core/tests/vtk_write.cpp
index 0df9998..0df9998 100644
--- a/lib/tests/vtk_write.cpp
+++ b/lib/core/tests/vtk_write.cpp
diff --git a/lib/sycl/.nix/derivation.nix b/lib/sycl/.nix/derivation.nix
new file mode 100644
index 0000000..bbe98a4
--- /dev/null
+++ b/lib/sycl/.nix/derivation.nix
@@ -0,0 +1,39 @@
+{ lib
+, stdenv
+, scons
+, clang-tools
+, forstio
+, pname
+, version
+}:
+
+stdenv.mkDerivation {
+ pname = "${pname}-sycl";
+ inherit version;
+ src = ./..;
+
+ nativeBuildInputs = [
+ scons
+ clang-tools
+ ];
+
+ buildInputs = [
+ forstio.core
+ forstio.async
+ forstio.codec
+ forstio.codec-unit
+ forstio.codec-json
+ forstio.remote
+ forstio.remote-sycl
+ ];
+
+ doCheck = true;
+ checkPhase = ''
+ scons test
+ ./bin/tests
+ '';
+
+ preferLocalBuild = true;
+
+ outputs = [ "out" "dev" ];
+}