summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/cavity_2d/cavity_2d.cpp43
-rw-r--r--examples/cavity_2d_gpu/cavity_2d_gpu.cpp61
-rw-r--r--examples/cavity_3d.cpp43
-rw-r--r--examples/dkt/common.hpp1
-rw-r--r--examples/dkt/init.hpp14
-rw-r--r--examples/dkt/sim.cpp38
-rw-r--r--examples/dkt/step.hpp90
-rw-r--r--examples/feature_development/common.hpp1
-rw-r--r--examples/feature_development/init.hpp18
-rw-r--r--examples/feature_development/sim.cpp38
-rw-r--r--examples/feature_development/step.hpp30
-rw-r--r--examples/heterogeneous_computing/sim.cpp19
-rw-r--r--examples/meta/meta.cpp27
-rw-r--r--examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp84
-rw-r--r--examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp80
-rw-r--r--examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp82
-rw-r--r--examples/one_particle_sedimentation_2d/common.hpp1
-rw-r--r--examples/one_particle_sedimentation_2d/init.hpp14
-rw-r--r--examples/one_particle_sedimentation_2d/sim.cpp38
-rw-r--r--examples/one_particle_sedimentation_2d/step.hpp84
-rw-r--r--examples/particles_gpu/particles_gpu.cpp27
-rw-r--r--examples/poiseulle_2d/poiseulle_2d.cpp71
-rw-r--r--examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp83
-rw-r--r--examples/poiseulle_3d/poiseulle_3d.cpp71
-rw-r--r--examples/poiseulle_3d_gpu/sim.cpp64
-rw-r--r--examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp60
-rw-r--r--examples/poiseulle_particles_2d_bgk_gpu/sim.cpp68
-rw-r--r--examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp66
-rw-r--r--examples/poiseulle_particles_2d_gpu/common.hpp1
-rw-r--r--examples/poiseulle_particles_2d_gpu/init.hpp18
-rw-r--r--examples/poiseulle_particles_2d_gpu/sim.cpp38
-rw-r--r--examples/poiseulle_particles_2d_gpu/step.hpp30
-rw-r--r--examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp74
-rw-r--r--examples/poiseulle_particles_2d_ibm_gpu/sim.cpp78
-rw-r--r--examples/poiseulle_particles_2d_psm_gpu/sim.cpp78
-rw-r--r--examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp157
-rw-r--r--examples/schaefer_turek_durst_krause_rannbacher/common.hpp1
-rw-r--r--examples/schaefer_turek_durst_krause_rannbacher/init.hpp14
-rw-r--r--examples/schaefer_turek_durst_krause_rannbacher/sim.cpp38
-rw-r--r--examples/schaefer_turek_durst_krause_rannbacher/step.hpp90
-rw-r--r--examples/settling_cubes_2d_ibm_gpu/sim.cpp82
-rw-r--r--examples/settling_spheres_2d_hlbm_gpu/sim.cpp74
-rw-r--r--examples/stdkr_2d_bgk/common.hpp1
-rw-r--r--examples/stdkr_2d_bgk/init.hpp16
-rw-r--r--examples/stdkr_2d_bgk/sim.cpp34
-rw-r--r--examples/stdkr_2d_bgk/step.hpp28
-rw-r--r--examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp72
-rw-r--r--examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp76
-rw-r--r--examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp80
-rw-r--r--examples/stokes_drag_particle_2d_psm_gpu/sim.cpp74
-rw-r--r--examples/throat_clog_2d/common.hpp1
-rw-r--r--examples/throat_clog_2d/init.hpp34
-rw-r--r--examples/throat_clog_2d/sim.cpp42
-rw-r--r--examples/throat_clog_2d/step.hpp94
54 files changed, 1312 insertions, 1329 deletions
diff --git a/examples/cavity_2d/cavity_2d.cpp b/examples/cavity_2d/cavity_2d.cpp
index af22796..177bf05 100644
--- a/examples/cavity_2d/cavity_2d.cpp
+++ b/examples/cavity_2d/cavity_2d.cpp
@@ -9,7 +9,6 @@
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
/**
* Basic distribution function
@@ -66,9 +65,9 @@ class df_cell_view<sch::Cell<sch::T, Desc, SN, DN, QN>, Encode> {
public:
using Schema = sch::Cell<sch::T,Desc,SN,DN,QN>;
private:
- std::array<std::decay_t<typename saw::native_data_type<sch::T>::type>*, QN> view_;
+ std::array<std::decay_t<typename kel::lbm::native_data_type<sch::T>::type>*, QN> view_;
public:
- df_cell_view(const std::array<std::decay_t<typename saw::native_data_type<sch::T>::type>*, QN>& view):
+ df_cell_view(const std::array<std::decay_t<typename kel::lbm::native_data_type<sch::T>::type>*, QN>& view):
view_{view}
{}
};
@@ -84,11 +83,11 @@ struct MovingWall {};
template<typename Desc>
class component<sch::T, Desc, cmpt::MovingWall> {
public:
- std::array<typename saw::native_data_type<sch::T>::type, Desc::D> lid_vel;
+ std::array<typename kel::lbm::native_data_type<sch::T>::type, Desc::D> lid_vel;
public:
void apply(
- saw::data<sch::DfCell<Desc>>& dfs
+ kel::lbm::data<sch::DfCell<Desc>>& dfs
){
using dfi = df_info<sch::T,Desc>;
@@ -111,18 +110,18 @@ constexpr size_t dim_y = 128;
template<typename Func>
-void apply_for_cells(Func&& func, saw::data<kel::lbm::sch::CavityFieldD2Q9>& dat){
+void apply_for_cells(Func&& func, kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& dat){
for(std::size_t i = 0; i < dat.meta().at({1u}).get(); ++i){
for(std::size_t j = 0; j < dat.meta().at({0u}).get(); ++j){
- saw::data<saw::schema::UInt64> di{i};
- saw::data<saw::schema::UInt64> dj{j};
+ kel::lbm::data<kel::lbm::sch::UInt64> di{i};
+ kel::lbm::data<kel::lbm::sch::UInt64> dj{j};
auto& cell_v = dat({{dj,di}});
func(cell_v, j, i);
}
}
}
-void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+void set_geometry(kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
using namespace kel::lbm;
apply_for_cells([](auto& cell, std::size_t i, std::size_t j){
uint8_t val = 0;
@@ -142,12 +141,12 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
}, latt);
}
-void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+void set_initial_conditions(kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
using namespace kel::lbm;
- saw::data<sch::T> rho{1.0};
+ kel::lbm::data<sch::T> rho{1.0};
{
- saw::data<sch::FixedArray<sch::T,sch::D2Q9::D>> vel{{0.0,0.0}};
+ kel::lbm::data<sch::FixedArray<sch::T,sch::D2Q9::D>> vel{{0.0,0.0}};
auto eq = equilibrium<sch::T,sch::D2Q9>(rho, vel);
apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){
@@ -164,7 +163,7 @@ void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
}
{
- saw::data<sch::FixedArray<sch::T,sch::D2Q9::D>> vel{{0.1,0.0}};
+ kel::lbm::data<sch::FixedArray<sch::T,sch::D2Q9::D>> vel{{0.1,0.0}};
auto eq = equilibrium<sch::T,sch::D2Q9>(rho, vel);
apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){
@@ -184,7 +183,7 @@ void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
}
void lbm_step(
- saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt,
+ kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt,
bool even_step,
uint64_t time_step
){
@@ -203,8 +202,8 @@ void lbm_step(
auto meta = latt.meta();
// Collide
- for(saw::data<sch::UInt64> i{0u}; i < meta.at(0u); ++i){
- for(saw::data<sch::UInt64> j{0u}; j < meta.at(1u); ++j ){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < meta.at(0u); ++i){
+ for(kel::lbm::data<sch::UInt64> j{0u}; j < meta.at(1u); ++j ){
auto& cell = latt({{i,j}});
auto& info = cell.template get<"info">();
@@ -259,9 +258,9 @@ void lbm_step(
int main(){
using namespace kel::lbm;
- saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> dim{{dim_x, dim_y}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> dim{{dim_x, dim_y}};
- saw::data<sch::CavityFieldD2Q9, saw::encode::Native> lattice{dim};
+ kel::lbm::data<sch::CavityFieldD2Q9, kel::lbm::enc::Native> lattice{dim};
converter<sch::T> conv{
{0.1},
@@ -309,19 +308,19 @@ int main(){
uint64_t print_every = 256u;
uint64_t file_no = 0u;
- saw::data<sch::Array<sch::MacroStruct<sch::T,sch::D2Q9::D>,sch::D2Q9::D>> macros{dim};
+ kel::lbm::data<sch::Array<sch::MacroStruct<sch::T,sch::D2Q9::D>,sch::D2Q9::D>> macros{dim};
for(uint64_t step = 0; step < lattice_steps; ++step){
if(step % print_every == 0u){
std::cout<<"\n";
- typename saw::native_data_type<sch::T>::type sum = 0.0;
+ typename kel::lbm::native_data_type<sch::T>::type sum = 0.0;
apply_for_cells([&](auto& cell, std::size_t i, std::size_t j){
auto& dfs = cell.template get<"dfs">();
- typename saw::native_data_type<sch::T>::type rho;
- std::array<typename saw::native_data_type<sch::T>::type, sch::D2Q9::D> vel;
+ typename kel::lbm::native_data_type<sch::T>::type rho;
+ std::array<typename kel::lbm::native_data_type<sch::T>::type, sch::D2Q9::D> vel;
compute_rho_u<sch::T,sch::D2Q9>(dfs,rho,vel);
if(i > 1 && (i+2) < dim_x && j > 1 && (j+2) < dim_y){
diff --git a/examples/cavity_2d_gpu/cavity_2d_gpu.cpp b/examples/cavity_2d_gpu/cavity_2d_gpu.cpp
index fe44baf..ab1ab40 100644
--- a/examples/cavity_2d_gpu/cavity_2d_gpu.cpp
+++ b/examples/cavity_2d_gpu/cavity_2d_gpu.cpp
@@ -12,7 +12,6 @@
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
/**
* Basic distribution function
@@ -71,9 +70,9 @@ class df_cell_view<sch::Cell<sch::T, Desc, SN, DN, QN>, Encode> {
public:
using Schema = sch::Cell<sch::T,Desc,SN,DN,QN>;
private:
- std::array<std::decay_t<typename saw::native_data_type<sch::T>::type>*, QN> view_;
+ std::array<std::decay_t<typename kel::lbm::native_data_type<sch::T>::type>*, QN> view_;
public:
- df_cell_view(const std::array<std::decay_t<typename saw::native_data_type<sch::T>::type>*, QN>& view):
+ df_cell_view(const std::array<std::decay_t<typename kel::lbm::native_data_type<sch::T>::type>*, QN>& view):
view_{view}
{}
};
@@ -89,11 +88,11 @@ struct MovingWall {};
template<typename Desc>
class component<sch::T, Desc, cmpt::MovingWall> {
public:
- std::array<typename saw::native_data_type<sch::T>::type, Desc::D> lid_vel;
+ std::array<typename kel::lbm::native_data_type<sch::T>::type, Desc::D> lid_vel;
public:
void apply(
- saw::data<sch::DfCell<Desc>>& dfs
+ kel::lbm::data<sch::DfCell<Desc>>& dfs
){
using dfi = df_info<sch::T,Desc>;
@@ -113,15 +112,15 @@ constexpr size_t dim_y = 128;
template<typename Desc>
void set_geometry(
- saw::data<sch::CellInfo<Desc>>* info_field
+ kel::lbm::data<sch::CellInfo<Desc>>* info_field
){
using namespace kel::lbm;
using namespace acpp;
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
/**
* Set ghost
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get();
auto& info = info_field[i];
@@ -132,7 +131,7 @@ void set_geometry(
/**
* Set wall
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get();
auto& info = info_field[i];
@@ -143,7 +142,7 @@ void set_geometry(
/**
* Set fluid
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get();
auto& info = info_field[i];
@@ -154,7 +153,7 @@ void set_geometry(
/**
* Set top lid
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get();
auto& info = info_field[i];
info({0u}).set(3u);
@@ -164,27 +163,27 @@ void set_geometry(
template<typename Desc>
void set_initial_conditions(
- saw::data<sch::CellInfo<Desc>>* info_field,
- saw::data<sch::DfCell<Desc>>* dfs_field,
- saw::data<sch::DfCell<Desc>>* dfs_old_field
+ kel::lbm::data<sch::CellInfo<Desc>>* info_field,
+ kel::lbm::data<sch::DfCell<Desc>>* dfs_field,
+ kel::lbm::data<sch::DfCell<Desc>>* dfs_old_field
){
using namespace kel::lbm;
using namespace acpp;
- saw::data<sch::T> rho{1.0};
- saw::data<sch::FixedArray<sch::T,Desc::D>> vel{{0.0,0.0}};
+ kel::lbm::data<sch::T> rho{1.0};
+ kel::lbm::data<sch::FixedArray<sch::T,Desc::D>> vel{{0.0,0.0}};
auto eq = equilibrium<sch::T,Desc>(rho, vel);
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
/**
* Set distribution
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,Desc::D>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>>& index){
size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get();
auto& dfs = dfs_field[i];
auto& dfs_old = dfs_old_field[i];
- for(saw::data<sch::UInt64> k = 0; k < saw::data<sch::UInt64>{Desc::Q}; ++k){
+ for(kel::lbm::data<sch::UInt64> k = 0; k < kel::lbm::data<sch::UInt64>{Desc::Q}; ++k){
dfs(k) = eq.at(k);
dfs_old(k) = eq.at(k);
}
@@ -194,9 +193,9 @@ void set_initial_conditions(
template<typename T, typename Desc>
void lbm_step(
- saw::data<sch::CellInfo<Desc>>* info_r,
- saw::data<sch::DfCell<Desc>>* dfs_r,
- saw::data<sch::DfCell<Desc>>* dfs_r_old,
+ kel::lbm::data<sch::CellInfo<Desc>>* info_r,
+ kel::lbm::data<sch::DfCell<Desc>>* dfs_r,
+ kel::lbm::data<sch::DfCell<Desc>>* dfs_r_old,
bool is_even,
uint64_t time_step,
acpp::sycl::queue& sycl_q
@@ -207,7 +206,7 @@ void lbm_step(
using dfi = df_info<T,Desc>;
//component<T, Desc, cmpt::BGK> coll{0.59};
- constexpr saw::data<T> frequency{1.0 / 0.59};
+ constexpr kel::lbm::data<T> frequency{1.0 / 0.59};
//component<T, Desc, cmpt::BounceBack> bb;
component<T, Desc, cmpt::MovingWall> bb_lid;
bb_lid.lid_vel = {0.1, 0.0};
@@ -243,8 +242,8 @@ void lbm_step(
// coll.apply(latt_acc, {i, j}, time_step);
auto& dfs_old = is_even ? dfs_r_old[acc_id] : dfs_r[acc_id];
- saw::data<T> rho;
- saw::data<sch::FixedArray<T,Desc::D>> vel;
+ kel::lbm::data<T> rho;
+ kel::lbm::data<sch::FixedArray<T,Desc::D>> vel;
compute_rho_u<T,Desc>(dfs_old,rho,vel);
auto eq = equilibrium<T,Desc>(rho,vel);
@@ -302,7 +301,7 @@ int main(){
using namespace kel::lbm;
using namespace acpp;
- saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> meta{{dim_x, dim_y}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> meta{{dim_x, dim_y}};
constexpr size_t dim_size = dim_x * dim_y;
converter<sch::T> conv{
@@ -324,9 +323,9 @@ int main(){
constexpr size_t num_cells = dim_x * dim_y;
// Allocate USM shared memory for your main data
- auto* info = sycl::malloc_shared<saw::data<sch::CellInfo<sch::D2Q9>>>(num_cells, sycl_q);
- auto* dfs = sycl::malloc_shared<saw::data<sch::DfCell<sch::D2Q9>>>(num_cells, sycl_q);
- auto* dfs_old = sycl::malloc_shared<saw::data<sch::DfCell<sch::D2Q9>>>(num_cells, sycl_q);
+ auto* info = sycl::malloc_shared<kel::lbm::data<sch::CellInfo<sch::D2Q9>>>(num_cells, sycl_q);
+ auto* dfs = sycl::malloc_shared<kel::lbm::data<sch::DfCell<sch::D2Q9>>>(num_cells, sycl_q);
+ auto* dfs_old = sycl::malloc_shared<kel::lbm::data<sch::DfCell<sch::D2Q9>>>(num_cells, sycl_q);
/**
* Set meta information describing what this cell is
@@ -347,7 +346,7 @@ int main(){
uint64_t print_every = 256u;
uint64_t file_no = 0u;
- saw::data<sch::Array<sch::MacroStruct<sch::T,sch::D2Q9::D>,sch::D2Q9::D>> macros{meta};
+ kel::lbm::data<sch::Array<sch::MacroStruct<sch::T,sch::D2Q9::D>,sch::D2Q9::D>> macros{meta};
std::cout<<"Start"<<std::endl;
@@ -357,7 +356,7 @@ int main(){
lbm_step<sch::T,sch::D2Q9>(info, dfs, dfs_old, even_step, i, sycl_q);
if(i % 1024u == 0u){
sycl_q.wait();
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>>& index){
size_t j = index.at({0u}).get() * dim_x + index.at({1u}).get();
auto dfs_field = even_step ? dfs_old : dfs;
diff --git a/examples/cavity_3d.cpp b/examples/cavity_3d.cpp
index 5ae4834..e62c017 100644
--- a/examples/cavity_3d.cpp
+++ b/examples/cavity_3d.cpp
@@ -14,7 +14,6 @@
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
/**
* Basic distribution function
@@ -70,9 +69,9 @@ class df_cell_view<sch::Cell<sch::T, Desc, SN, DN, QN>, Encode> {
public:
using Schema = sch::Cell<sch::T,Desc,SN,DN,QN>;
private:
- std::array<std::decay_t<typename saw::native_data_type<sch::T>::type>*, QN> view_;
+ std::array<std::decay_t<typename kel::lbm::native_data_type<sch::T>::type>*, QN> view_;
public:
- df_cell_view(const std::array<std::decay_t<typename saw::native_data_type<sch::T>::type>*, QN>& view):
+ df_cell_view(const std::array<std::decay_t<typename kel::lbm::native_data_type<sch::T>::type>*, QN>& view):
view_{view}
{}
};
@@ -88,11 +87,11 @@ struct MovingWall {};
template<typename Desc>
class component<sch::T, Desc, cmpt::MovingWall> {
public:
- std::array<typename saw::native_data_type<sch::T>::type, Desc::D> lid_vel;
+ std::array<typename kel::lbm::native_data_type<sch::T>::type, Desc::D> lid_vel;
public:
void apply(
- saw::data<sch::DfCell<Desc>>& dfs
+ kel::lbm::data<sch::DfCell<Desc>>& dfs
){
using dfi = df_info<sch::T,Desc>;
@@ -116,18 +115,18 @@ constexpr size_t dim_z = 128;
template<typename Func>
-void apply_for_cells(Func&& func, saw::data<kel::lbm::sch::CavityFieldD3Q27>& dat){
+void apply_for_cells(Func&& func, kel::lbm::data<kel::lbm::sch::CavityFieldD3Q27>& dat){
for(std::size_t i = 0; i < dat.meta().at({1u}).get(); ++i){
for(std::size_t j = 0; j < dat.meta().at({0u}).get(); ++j){
- saw::data<saw::schema::UInt64> di{i};
- saw::data<saw::schema::UInt64> dj{j};
+ kel::lbm::data<kel::lbm::sch::UInt64> di{i};
+ kel::lbm::data<kel::lbm::sch::UInt64> dj{j};
auto& cell_v = dat({{dj,di}});
func(cell_v, j, i);
}
}
}
-void set_geometry(saw::data<kel::lbm::sch::CavityFieldD3Q27>& latt){
+void set_geometry(kel::lbm::data<kel::lbm::sch::CavityFieldD3Q27>& latt){
using namespace kel::lbm;
apply_for_cells([](auto& cell, std::size_t i, std::size_t j){
uint8_t val = 0;
@@ -147,12 +146,12 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD3Q27>& latt){
}, latt);
}
-void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+void set_initial_conditions(kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
using namespace kel::lbm;
- saw::data<sch::T> rho{1.0};
+ kel::lbm::data<sch::T> rho{1.0};
{
- saw::data<sch::FixedArray<sch::T,sch::D3Q27::D>> vel{{0.0,0.0}};
+ kel::lbm::data<sch::FixedArray<sch::T,sch::D3Q27::D>> vel{{0.0,0.0}};
auto eq = equilibrium<sch::T,sch::D3Q27>(rho, vel);
apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){
@@ -169,7 +168,7 @@ void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
}
{
- saw::data<sch::FixedArray<sch::T,sch::D3Q27::D>> vel{{0.1,0.0}};
+ kel::lbm::data<sch::FixedArray<sch::T,sch::D3Q27::D>> vel{{0.1,0.0}};
auto eq = equilibrium<sch::T,sch::D3Q27>(rho, vel);
apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){
@@ -189,7 +188,7 @@ void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
}
void lbm_step(
- saw::data<kel::lbm::sch::CavityFieldD3Q27>& latt,
+ kel::lbm::data<kel::lbm::sch::CavityFieldD3Q27>& latt,
bool even_step,
uint64_t time_step
){
@@ -208,8 +207,8 @@ void lbm_step(
auto meta = latt.meta();
// Collide
- for(saw::data<sch::UInt64> i{0u}; i < meta.at(0u); ++i){
- for(saw::data<sch::UInt64> j{0u}; j < meta.at(1u); ++j ){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < meta.at(0u); ++i){
+ for(kel::lbm::data<sch::UInt64> j{0u}; j < meta.at(1u); ++j ){
auto& cell = latt({{i,j}});
auto& info = cell.template get<"info">();
@@ -264,9 +263,9 @@ void lbm_step(
int main(){
using namespace kel::lbm;
- saw::data<sch::FixedArray<sch::UInt64,sch::D3Q27::D>> dim{{dim_x, dim_y}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,sch::D3Q27::D>> dim{{dim_x, dim_y}};
- saw::data<sch::CavityFieldD3Q27, saw::encode::Native> lattice{dim};
+ kel::lbm::data<sch::CavityFieldD3Q27, kel::lbm::enc::Native> lattice{dim};
converter<sch::T> conv{
{0.1},
@@ -314,19 +313,19 @@ int main(){
uint64_t print_every = 256u;
uint64_t file_no = 0u;
- saw::data<sch::Array<sch::MacroStruct<sch::T,sch::D3Q27::D>,sch::D3Q27::D>> macros{dim};
+ kel::lbm::data<sch::Array<sch::MacroStruct<sch::T,sch::D3Q27::D>,sch::D3Q27::D>> macros{dim};
for(uint64_t step = 0; step < lattice_steps; ++step){
if(step % print_every == 0u){
std::cout<<"\n";
- typename saw::native_data_type<sch::T>::type sum = 0.0;
+ typename kel::lbm::native_data_type<sch::T>::type sum = 0.0;
apply_for_cells([&](auto& cell, std::size_t i, std::size_t j){
auto& dfs = cell.template get<"dfs">();
- typename saw::native_data_type<sch::T>::type rho;
- std::array<typename saw::native_data_type<sch::T>::type, sch::D3Q27::D> vel;
+ typename kel::lbm::native_data_type<sch::T>::type rho;
+ std::array<typename kel::lbm::native_data_type<sch::T>::type, sch::D3Q27::D> vel;
compute_rho_u<sch::T,sch::D3Q27>(dfs,rho,vel);
if(i > 1 && (i+2) < dim_x && j > 1 && (j+2) < dim_y){
diff --git a/examples/dkt/common.hpp b/examples/dkt/common.hpp
index be9a538..6c1dc44 100644
--- a/examples/dkt/common.hpp
+++ b/examples/dkt/common.hpp
@@ -27,7 +27,6 @@ constexpr uint64_t dim_x = static_cast<uint64_t>(dim_y * (220.0 / 41.0));
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
diff --git a/examples/dkt/init.hpp b/examples/dkt/init.hpp
index af7eb89..c52078c 100644
--- a/examples/dkt/init.hpp
+++ b/examples/dkt/init.hpp
@@ -6,11 +6,11 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> init(
+kel::lbm::error_or<void> init(
const converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
(void) conv;
@@ -94,10 +94,10 @@ saw::error_or<void> init(
);
{
- saw::data<sch::Scalar<T>> radius_p;
+ kel::lbm::data<sch::Scalar<T>> radius_p;
radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get());
std::cout<<"RADIUS: "<<radius_p.at({}).get()<<std::endl;
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
particles = create_spheroid_particle_group<T,Desc::D,1u>(radius_p, dense_p, {{64u}});
auto& parts = particles.template get<"particles">();
@@ -114,7 +114,7 @@ saw::error_or<void> init(
}
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/dkt/sim.cpp b/examples/dkt/sim.cpp
index b3422a5..44fd145 100644
--- a/examples/dkt/sim.cpp
+++ b/examples/dkt/sim.cpp
@@ -8,7 +8,6 @@
* For deciding what parameters to use maybe?
*/
namespace args {
-using namespace saw::schema;
using LbmArgsStruct = Struct<
Member<String, "coupling">
@@ -21,7 +20,7 @@ using LbmArgs = Args<
}
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
+kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){
using namespace kel::lbm;
auto& an = args.template get<"args">();
@@ -40,7 +39,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -53,16 +52,17 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
print_lbm_meta<T,Desc>(conv,{1e-3},{1e-4},{0.5 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -94,9 +94,9 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
sycl_q.wait();
{
@@ -122,11 +122,11 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_particle_data);
- saw::data<sch::UInt64> time_steps{64u*1024ul};
+ kel::lbm::data<sch::UInt64> time_steps{64u*1024ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc,Coll>(conv,lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -152,10 +152,10 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -191,16 +191,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
using DescT = kel::lbm::sch::D2Q9;
-saw::error_or<void> k_main(int argc, char** argv){
+kel::lbm::error_or<void> k_main(int argc, char** argv){
using namespace kel::lbm;
- saw::data<args::LbmArgs> args;
+ kel::lbm::data<args::LbmArgs> args;
{
auto eov = saw::parse_args(args,argc,argv);
if(eov.is_error()){
@@ -218,7 +218,7 @@ saw::error_or<void> k_main(int argc, char** argv){
return lbm_main<FloatT,DescT,method::Psm>(args);
}
- return saw::make_error<saw::err::critical>("Invalid coupling");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Invalid coupling");
}
diff --git a/examples/dkt/step.hpp b/examples/dkt/step.hpp
index cbdfd10..879def8 100644
--- a/examples/dkt/step.hpp
+++ b/examples/dkt/step.hpp
@@ -6,15 +6,15 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
const converter<T>& conv,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
- static constexpr saw::data<sch::UInt64> sub_steps{0u};
+ static constexpr kel::lbm::data<sch::UInt64> sub_steps{0u};
auto& q = dev.get_handle();
auto& info_f = fields.template get<"info">();
@@ -24,9 +24,9 @@ saw::error_or<void> step(
if constexpr ( std::is_same_v<Coll, method::Hlbm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmReset,encode::Sycl<saw::encode::Native>> hlbm_reset;
+ component<T,Desc,cmpt::HlbmReset,encode::Sycl<kel::lbm::enc::Native>> hlbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -35,10 +35,10 @@ saw::error_or<void> step(
});
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part;
+ component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> hlbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -48,12 +48,12 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{1.0};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{1.0};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -71,12 +71,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -97,9 +97,9 @@ saw::error_or<void> step(
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::FpLbm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::FpLbmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -109,10 +109,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+ component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -123,13 +123,13 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{1.0};
- component<T,Desc,cmpt::FpLbm,encode::Sycl<saw::encode::Native>> collision{1.0};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{1.0};
+ component<T,Desc,cmpt::FpLbm,encode::Sycl<kel::lbm::enc::Native>> collision{1.0};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -147,12 +147,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -173,9 +173,9 @@ saw::error_or<void> step(
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::Psm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::PsmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -185,10 +185,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+ component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -199,13 +199,13 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{1.0};
- component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{1.0};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{1.0};
+ component<T,Desc,cmpt::Psm,encode::Sycl<kel::lbm::enc::Native>> collision{1.0};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -223,12 +223,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -250,7 +250,7 @@ saw::error_or<void> step(
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/feature_development/common.hpp b/examples/feature_development/common.hpp
index b321344..6806b2c 100644
--- a/examples/feature_development/common.hpp
+++ b/examples/feature_development/common.hpp
@@ -19,7 +19,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
diff --git a/examples/feature_development/init.hpp b/examples/feature_development/init.hpp
index b7fdeb0..a61ef37 100644
--- a/examples/feature_development/init.hpp
+++ b/examples/feature_development/init.hpp
@@ -6,11 +6,11 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> init(
+kel::lbm::error_or<void> init(
const converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
(void) conv;
@@ -95,7 +95,7 @@ saw::error_or<void> init(
iterator<Desc::D>::apply(
[&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle, ind_vec;
middle.at({{0u}}) = dim_x * 0.25;
middle.at({{1u}}) = dim_y * 0.5;
@@ -103,7 +103,7 @@ saw::error_or<void> init(
ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}).get() < dim_y*dim_y*0.01){
porous_f.at(index).at({}) = 0.0;
}
@@ -113,14 +113,14 @@ saw::error_or<void> init(
);
{
- saw::data<sch::Scalar<T>> radius_p;
+ kel::lbm::data<sch::Scalar<T>> radius_p;
radius_p.at({}).set(2);
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
particles = create_spheroid_particle_group<T,Desc::D,1u>(radius_p, dense_p, {{16u}});
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/feature_development/sim.cpp b/examples/feature_development/sim.cpp
index f5b49e9..e852313 100644
--- a/examples/feature_development/sim.cpp
+++ b/examples/feature_development/sim.cpp
@@ -8,7 +8,6 @@
* For deciding what parameters to use maybe?
*/
namespace args {
-using namespace saw::schema;
using LbmArgsStruct = Struct<
Member<UInt8,"use_slip">,
@@ -22,7 +21,7 @@ using LbmArgs = Args<
}
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
+kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){
using namespace kel::lbm;
auto& an = args.template get<"args">();
@@ -41,7 +40,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -54,16 +53,17 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -95,9 +95,9 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
sycl_q.wait();
{
@@ -117,11 +117,11 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_particle_data);
- saw::data<sch::UInt64> time_steps{64u*1024ul};
+ kel::lbm::data<sch::UInt64> time_steps{64u*1024ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc,Coll>(conv,lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -147,10 +147,10 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -186,16 +186,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
using DescT = kel::lbm::sch::D2Q9;
-saw::error_or<void> k_main(int argc, char** argv){
+kel::lbm::error_or<void> k_main(int argc, char** argv){
using namespace kel::lbm;
- saw::data<args::LbmArgs> args;
+ kel::lbm::data<args::LbmArgs> args;
{
auto eov = saw::parse_args(args,argc,argv);
return eov;
@@ -209,7 +209,7 @@ saw::error_or<void> k_main(int argc, char** argv){
// return kmain<FloatT,DescT,coupling::Psm>(args);
}
- return saw::make_error<saw::err::critical>("Invalid coupling");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Invalid coupling");
}
diff --git a/examples/feature_development/step.hpp b/examples/feature_development/step.hpp
index 37eb4e7..ade14ca 100644
--- a/examples/feature_development/step.hpp
+++ b/examples/feature_development/step.hpp
@@ -6,12 +6,12 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
const converter<T>& conv,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -19,9 +19,9 @@ saw::error_or<void> step(
auto& porous_f = macros.template get<"porosity">();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmReset,encode::Sycl<saw::encode::Native>> hlbm_reset;
+ component<T,Desc,cmpt::HlbmReset,encode::Sycl<kel::lbm::enc::Native>> hlbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -31,10 +31,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part;
+ component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> hlbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -45,10 +45,10 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 16u;
if(t_i.get() < target_t_i){
@@ -57,10 +57,10 @@ saw::error_or<void> step(
return 1.01;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -90,7 +90,7 @@ saw::error_or<void> step(
});
}).wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/heterogeneous_computing/sim.cpp b/examples/heterogeneous_computing/sim.cpp
index d074ad8..61058be 100644
--- a/examples/heterogeneous_computing/sim.cpp
+++ b/examples/heterogeneous_computing/sim.cpp
@@ -6,7 +6,6 @@
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
/**
* struct lbm_data {
@@ -44,9 +43,9 @@ using namespace saw::schema;
*
* template<...>
* class data<LbmData<...>,encode::Sycl<Encoding>> final {
- * saw::data<sch::FixedArray<sch::UInt64,Dim>> meta;
- * saw::data<FixedArray<Float32u,9>>* dfs;
- * saw::data<UInt8>* info;
+ * kel::lbm::data<sch::FixedArray<sch::UInt64,Dim>> meta;
+ * kel::lbm::data<FixedArray<Float32u,9>>* dfs;
+ * kel::lbm::data<UInt8>* info;
* };
*/
@@ -59,19 +58,19 @@ using CellStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> simulate(int argc, char** argv,
- const saw::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta
+kel::lbm::error_or<void> simulate(int argc, char** argv,
+ const kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta
{
- constexpr auto cell_size = sizeof(saw::data<sch::CellStruct<T,Desc>>);
+ constexpr auto cell_size = sizeof(kel::lbm::data<sch::CellStruct<T,Desc>>);
- auto lbm_data = saw::heap<saw::data<sch::Chunk<CellStruct<>,Desc::D, 64u>>>{meta};
+ auto lbm_data = kel::lbm::heap<kel::lbm::data<sch::Chunk<CellStruct<>,Desc::D, 64u>>>{meta};
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace lbm;
return simulate<sch::Float64,sch::D2Q9>(argc, argv);
}
diff --git a/examples/meta/meta.cpp b/examples/meta/meta.cpp
index 7232c61..2e2f28c 100644
--- a/examples/meta/meta.cpp
+++ b/examples/meta/meta.cpp
@@ -7,7 +7,6 @@
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
using MetaArgsStruct = Struct<
Member<Float64, "dx">,
@@ -28,7 +27,7 @@ using Prec = Float64;
}
template<typename T, typename Desc>
-saw::error_or<void> meta_lbm_info(const saw::data<kel::lbm::sch::MetaArgsStruct>& args_str){
+kel::lbm::error_or<void> meta_lbm_info(const kel::lbm::data<kel::lbm::sch::MetaArgsStruct>& args_str){
using namespace kel::lbm;
converter<T> conv{
{args_str.template get<"dx">()},
@@ -36,11 +35,11 @@ saw::error_or<void> meta_lbm_info(const saw::data<kel::lbm::sch::MetaArgsStruct>
};
print_lbm_meta<T,Desc>(conv, {args_str.template get<"kin_vis">()},{args_str.template get<"char_vel">()},{args_str.template get<"char_len">()});
- return saw::make_void();
+ return kel::lbm::make_void();
}
-saw::error_or<void> meta_main(int argc, char** argv){
+kel::lbm::error_or<void> meta_main(int argc, char** argv){
using namespace kel::lbm;
std::string_view cfg_file_name = "config.json";
@@ -48,15 +47,15 @@ saw::error_or<void> meta_main(int argc, char** argv){
cfg_file_name = argv[1];
}
- saw::data<sch::MetaArgs> args_dat;
+ kel::lbm::data<sch::MetaArgs> args_dat;
auto& args_str = args_dat.template get<"args">();
{
{
args_str.template get<"dx">().set(1);
args_str.template get<"dt">().set(1);
}
- saw::data<sch::MetaArgs, saw::encode::Args> args_enc{argc,argv};
- saw::codec<sch::MetaArgs, saw::encode::Args> args_codec;
+ kel::lbm::data<sch::MetaArgs, saw::encode::Args> args_enc{argc,argv};
+ kel::lbm::codec<sch::MetaArgs, saw::encode::Args> args_codec;
auto eov = args_codec.decode(args_enc,args_dat);
if(eov.is_error()){
@@ -75,7 +74,7 @@ saw::error_or<void> meta_main(int argc, char** argv){
meta_lbm_info<sch::Prec,sch::Descriptor<1u,3u>>(args_str);
break;
default:
- return saw::make_error<saw::err::critical>("Second positional needs to be a valid momentum set");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Second positional needs to be a valid momentum set");
}
}
break;
@@ -89,7 +88,7 @@ saw::error_or<void> meta_main(int argc, char** argv){
meta_lbm_info<sch::Prec,sch::Descriptor<2u,9u>>(args_str);
break;
default:
- return saw::make_error<saw::err::critical>("Second positional needs to be a valid momentum set");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Second positional needs to be a valid momentum set");
}
}
break;
@@ -97,26 +96,26 @@ saw::error_or<void> meta_main(int argc, char** argv){
{
switch(args_pos.get<1u>().get()){
case 7u:
- return saw::make_error<saw::err::not_implemented>("D3Q7 Velocity Set is not implemented");
+ return kel::lbm::make_error<kel::lbm::err::not_implemented>("D3Q7 Velocity Set is not implemented");
// meta_lbm_info<sch::Prec,sch::Descriptor<3u,19u>>(args_str);
break;
case 19u:
- return saw::make_error<saw::err::not_implemented>("D3Q17 Velocity Set is not implemented");
+ return kel::lbm::make_error<kel::lbm::err::not_implemented>("D3Q17 Velocity Set is not implemented");
// meta_lbm_info<sch::Prec,sch::Descriptor<3u,19u>>(args_str);
break;
case 27u:
meta_lbm_info<sch::Prec,sch::Descriptor<3u,27u>>(args_str);
break;
default:
- return saw::make_error<saw::err::critical>("Second positional needs to be a valid momentum set");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Second positional needs to be a valid momentum set");
}
}
break;
default:
- return saw::make_error<saw::err::critical>("First positional needs to be Dimension 1,2 or 3");
+ return kel::lbm::make_error<kel::lbm::err::critical>("First positional needs to be Dimension 1,2 or 3");
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
int main(int argc, char** argv){
diff --git a/examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp b/examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp
index 4c9c8bd..d8c65fb 100644
--- a/examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp
+++ b/examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp
@@ -17,7 +17,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using LbmArgs = Args<
Struct<
@@ -71,10 +70,10 @@ using ParticleSpheroidGroup = ParticleGroup<T,Desc::D,1u,coll::Spheroid<T>>;
}
template<typename T, typename Desc>
-saw::error_or<void> init(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+kel::lbm::error_or<void> init(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -146,9 +145,9 @@ saw::error_or<void> init(
dfs_f.get_dims()
);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}) = dim_y * 0.1f;
- saw::data<sch::Scalar<T>> dense;
+ kel::lbm::data<sch::Scalar<T>> dense;
dense.at({}) = 1.0f;
particles = create_spheroid_particle_group<T,Desc::D,particle_amount>(rad,dense,{1u});
{
@@ -157,7 +156,7 @@ saw::error_or<void> init(
rbp.at({{0u}}) = 0.25 * dim_x;
rbp.at({{1u}}) = 0.5 * dim_y;
rb.template get<"position_old">() = rbp;
- saw::data<sch::Vector<T,Desc::D>> zero;
+ kel::lbm::data<sch::Vector<T,Desc::D>> zero;
zero.at({{0u}}) = 0.0f;
zero.at({{1u}}) = 0.0f;
rb.template get<"acceleration">() = zero;
@@ -166,15 +165,15 @@ saw::error_or<void> init(
rb.template get<"angular_acceleration">() = {};
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -182,9 +181,9 @@ saw::error_or<void> step(
auto& porous_f = macros.template get<"porosity">();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::FpLbmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -194,10 +193,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+ component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -208,11 +207,11 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{0.8};
- component<T,Desc,cmpt::FpLbm,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
+ component<T,Desc,cmpt::FpLbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
@@ -221,10 +220,10 @@ saw::error_or<void> step(
return 1.01;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -254,18 +253,18 @@ saw::error_or<void> step(
});
}).wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
- saw::data<sch::LbmArgs> args;
+ kel::lbm::data<sch::LbmArgs> args;
{
auto& args_n = args.template get<"args">();
auto& name = args_n.template get<"name">();
@@ -289,7 +288,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -302,17 +301,18 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_parts_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
- //saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_parts_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ //kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -344,9 +344,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_parts_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_parts_data{sycl_q};
sycl_q.wait();
{
@@ -372,10 +372,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_parts_data);
- saw::data<sch::UInt64> time_steps{32u*2048ul};
+ kel::lbm::data<sch::UInt64> time_steps{32u*2048ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -411,10 +411,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -458,7 +458,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float64;
diff --git a/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp b/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp
index bd754bf..86f0ded 100644
--- a/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp
+++ b/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -61,10 +60,10 @@ using ParticleSpheroidGroup = ParticleGroup<T,Desc::D,1u,coll::Spheroid<T>>;
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -145,9 +144,9 @@ saw::error_or<void> setup_initial_conditions(
{{1u,1u}}
);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}) = dim_y * 0.1f;
- saw::data<sch::Scalar<T>> dense;
+ kel::lbm::data<sch::Scalar<T>> dense;
dense.at({}) = 1.0f;
particles = create_spheroid_particle_group<T,Desc::D,particle_amount>(rad,dense,{16u});
{
@@ -156,7 +155,7 @@ saw::error_or<void> setup_initial_conditions(
rbp.at({{0u}}) = 0.25 * dim_x;
rbp.at({{1u}}) = 0.5 * dim_y;
rb.template get<"position_old">() = rbp;
- saw::data<sch::Vector<T,Desc::D>> zero;
+ kel::lbm::data<sch::Vector<T,Desc::D>> zero;
zero.at({{0u}}) = 0.0f;
zero.at({{1u}}) = 0.0f;
rb.template get<"acceleration">() = zero;
@@ -165,15 +164,15 @@ saw::error_or<void> setup_initial_conditions(
rb.template get<"angular_acceleration">() = {};
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -181,9 +180,9 @@ saw::error_or<void> step(
auto& porous_f = macros.template get<"porosity">();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmReset,encode::Sycl<saw::encode::Native>> hlbm_reset;
+ component<T,Desc,cmpt::HlbmReset,encode::Sycl<kel::lbm::enc::Native>> hlbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -193,10 +192,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part;
+ component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> hlbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -207,10 +206,10 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
@@ -219,11 +218,11 @@ saw::error_or<void> step(
return 1.01;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -261,13 +260,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -284,7 +283,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -297,17 +296,18 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_parts_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
- //saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_parts_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ //kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -339,9 +339,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_parts_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_parts_data{sycl_q};
sycl_q.wait();
{
@@ -367,10 +367,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_parts_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -406,10 +406,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -451,7 +451,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float64;
diff --git a/examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp b/examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp
index 2daa452..947407e 100644
--- a/examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp
+++ b/examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -62,10 +61,10 @@ using ParticleSpheroidGroup = ParticleGroup<T,Desc::D,1u,coll::Spheroid<T>>;
}
template<typename T, typename Desc>
-saw::error_or<void> init(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+kel::lbm::error_or<void> init(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -137,9 +136,9 @@ saw::error_or<void> init(
dfs_f.get_dims()
);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}) = dim_y * 0.1f;
- saw::data<sch::Scalar<T>> dense;
+ kel::lbm::data<sch::Scalar<T>> dense;
dense.at({}) = 1.0f;
particles = create_spheroid_particle_group<T,Desc::D,particle_amount>(rad,dense,{1u});
{
@@ -148,7 +147,7 @@ saw::error_or<void> init(
rbp.at({{0u}}) = 0.25 * dim_x;
rbp.at({{1u}}) = 0.5 * dim_y;
rb.template get<"position_old">() = rbp;
- saw::data<sch::Vector<T,Desc::D>> zero;
+ kel::lbm::data<sch::Vector<T,Desc::D>> zero;
zero.at({{0u}}) = 0.0f;
zero.at({{1u}}) = 0.0f;
rb.template get<"acceleration">() = zero;
@@ -157,15 +156,15 @@ saw::error_or<void> init(
rb.template get<"angular_acceleration">() = {};
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -173,9 +172,9 @@ saw::error_or<void> step(
auto& porous_f = macros.template get<"porosity">();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmReset,encode::Sycl<saw::encode::Native>> psm_reset;
+ component<T,Desc,cmpt::PsmReset,encode::Sycl<kel::lbm::enc::Native>> psm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -185,10 +184,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<saw::encode::Native>> psm_one_part;
+ component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<kel::lbm::enc::Native>> psm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -199,11 +198,11 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{0.8};
- component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
+ component<T,Desc,cmpt::Psm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
@@ -212,10 +211,10 @@ saw::error_or<void> step(
return 1.01;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -245,13 +244,13 @@ saw::error_or<void> step(
});
}).wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -268,7 +267,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -281,17 +280,18 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_parts_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
- //saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_parts_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ //kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -323,9 +323,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_parts_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_parts_data{sycl_q};
sycl_q.wait();
{
@@ -351,10 +351,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_parts_data);
- saw::data<sch::UInt64> time_steps{32u*2048ul};
+ kel::lbm::data<sch::UInt64> time_steps{32u*2048ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -390,10 +390,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -437,7 +437,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float64;
diff --git a/examples/one_particle_sedimentation_2d/common.hpp b/examples/one_particle_sedimentation_2d/common.hpp
index ffb7f40..e28622f 100644
--- a/examples/one_particle_sedimentation_2d/common.hpp
+++ b/examples/one_particle_sedimentation_2d/common.hpp
@@ -29,7 +29,6 @@ constexpr uint64_t dim_y = 800ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
diff --git a/examples/one_particle_sedimentation_2d/init.hpp b/examples/one_particle_sedimentation_2d/init.hpp
index 8bcc236..989ec4f 100644
--- a/examples/one_particle_sedimentation_2d/init.hpp
+++ b/examples/one_particle_sedimentation_2d/init.hpp
@@ -6,11 +6,11 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> init(
+kel::lbm::error_or<void> init(
const converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -74,10 +74,10 @@ saw::error_or<void> init(
);
{
- saw::data<sch::Scalar<T>> radius_p;
+ kel::lbm::data<sch::Scalar<T>> radius_p;
radius_p.at({}).set(conv.meter_si_to_lbm({{0.00125}}).handle().get());
std::cout<<"RADIUS: "<<radius_p.at({}).get()<<std::endl;
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
particles = create_spheroid_particle_group<T,Desc::D,1u>(radius_p, dense_p, {{64u}});
auto& parts = particles.template get<"particles">();
@@ -94,7 +94,7 @@ saw::error_or<void> init(
}
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp
index 2daa0b5..7c8456f 100644
--- a/examples/one_particle_sedimentation_2d/sim.cpp
+++ b/examples/one_particle_sedimentation_2d/sim.cpp
@@ -8,7 +8,6 @@
* For deciding what parameters to use maybe?
*/
namespace args {
-using namespace saw::schema;
using LbmArgsStruct = Struct<
Member<String, "coupling">
@@ -21,7 +20,7 @@ using LbmArgs = Args<
}
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
+kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){
using namespace kel::lbm;
auto& an = args.template get<"args">();
@@ -40,7 +39,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -50,23 +49,24 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
// delta_t
{{3e-7}}
};
- saw::data<sch::SiKinematicViscosity<T>> kin_vis_si{1e-3};
+ kel::lbm::data<sch::SiKinematicViscosity<T>> kin_vis_si{1e-3};
auto kin_vis_lbm = conv.kinematic_viscosity_si_to_lbm(kin_vis_si);
auto tau = conv.template kinematic_viscosity_lbm_to_tau<Desc>(kin_vis_lbm);
print_lbm_meta<T,Desc>(conv,kin_vis_si,{1e-4},{2});
std::cout<<"Position: "<<conv.meter_si_to_lbm({{0.01}}).handle().get()<<", "<<conv.meter_si_to_lbm({{0.04}}).handle().get()<<std::endl;
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -98,9 +98,9 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
sycl_q.wait();
{
@@ -134,7 +134,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
std::cout<<"Steps for 1 sec: "<<record_steps.at(10u)<<std::endl;
- for(saw::data<sch::UInt64> i{0u},j{0u}; j.get() < 11u and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u},j{0u}; j.get() < 11u and krun; ++i){
// BC + Collision
{
@@ -170,10 +170,10 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -209,16 +209,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
using DescT = kel::lbm::sch::D2Q9;
-saw::error_or<void> k_main(int argc, char** argv){
+kel::lbm::error_or<void> k_main(int argc, char** argv){
using namespace kel::lbm;
- saw::data<args::LbmArgs> args;
+ kel::lbm::data<args::LbmArgs> args;
{
auto eov = saw::parse_args(args,argc,argv);
if(eov.is_error()){
@@ -237,7 +237,7 @@ saw::error_or<void> k_main(int argc, char** argv){
return lbm_main<FloatT,DescT,method::Psm>(args);
}
- return saw::make_error<saw::err::critical>("Invalid coupling");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Invalid coupling");
}
diff --git a/examples/one_particle_sedimentation_2d/step.hpp b/examples/one_particle_sedimentation_2d/step.hpp
index 4bc9dde..de42dec 100644
--- a/examples/one_particle_sedimentation_2d/step.hpp
+++ b/examples/one_particle_sedimentation_2d/step.hpp
@@ -6,16 +6,16 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
const converter<T>& conv,
- const saw::data<sch::Pure<T>>& tau,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+ const kel::lbm::data<sch::Pure<T>>& tau,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
- static constexpr saw::data<sch::UInt64> sub_steps{0u};
+ static constexpr kel::lbm::data<sch::UInt64> sub_steps{0u};
auto& q = dev.get_handle();
auto& info_f = fields.template get<"info">();
@@ -24,9 +24,9 @@ saw::error_or<void> step(
if constexpr ( std::is_same_v<Coll, method::Hlbm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmReset,encode::Sycl<saw::encode::Native>> hlbm_reset;
+ component<T,Desc,cmpt::HlbmReset,encode::Sycl<kel::lbm::enc::Native>> hlbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -35,10 +35,10 @@ saw::error_or<void> step(
});
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part;
+ component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> hlbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -48,11 +48,11 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{tau};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{tau};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -75,9 +75,9 @@ saw::error_or<void> step(
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::FpLbm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::FpLbmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -90,12 +90,12 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- saw::data<sch::Vector<T,Desc::D>> gf;
+ kel::lbm::data<sch::Vector<T,Desc::D>> gf;
gf.at({{1u}}) = conv.acceleration_si_to_lbm({-9.81}).handle();
- component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part{gf};
+ component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part{gf};
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -106,13 +106,13 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{tau};
- component<T,Desc,cmpt::FpLbm,encode::Sycl<saw::encode::Native>> collision{tau};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{tau};
+ component<T,Desc,cmpt::FpLbm,encode::Sycl<kel::lbm::enc::Native>> collision{tau};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -130,12 +130,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -156,9 +156,9 @@ saw::error_or<void> step(
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::Psm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::PsmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -168,10 +168,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+ component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -182,13 +182,13 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{1.0};
- component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{tau};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{1.0};
+ component<T,Desc,cmpt::Psm,encode::Sycl<kel::lbm::enc::Native>> collision{tau};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -206,12 +206,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -233,7 +233,7 @@ saw::error_or<void> step(
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/particles_gpu/particles_gpu.cpp b/examples/particles_gpu/particles_gpu.cpp
index abbc192..f3edbf2 100644
--- a/examples/particles_gpu/particles_gpu.cpp
+++ b/examples/particles_gpu/particles_gpu.cpp
@@ -8,21 +8,20 @@
namespace kel{
namespace lbm {
namespace sch {
-using namespace saw::schema;
}
}
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
(void) argc;
(void) argv;
using namespace lbm;
using namespace acpp;
- saw::data<sch::Array<sch::Particle<sch::Float32,2u>>> particles{1024u};
+ kel::lbm::data<sch::Array<sch::Particle<sch::Float32,2u>>> particles{1024u};
- for(saw::data<sch::UInt64> i{0u}; i < saw::data<sch::UInt64>{32u}; ++i){
- for(saw::data<sch::UInt64> j{0u}; j < saw::data<sch::UInt64>{32u}; ++j){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < kel::lbm::data<sch::UInt64>{32u}; ++i){
+ for(kel::lbm::data<sch::UInt64> j{0u}; j < kel::lbm::data<sch::UInt64>{32u}; ++j){
auto& part = particles.at(i*32ul+j);
auto& body = part.template get<"rigid_body">();
@@ -42,12 +41,12 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::Scalar<sch::Float32>> time_step;
+ kel::lbm::data<sch::Scalar<sch::Float32>> time_step;
time_step.at({}).set(0.05f);
- for(saw::data<sch::UInt64> dt{0u}; dt < saw::data<sch::UInt64>{32ul}; ++dt){
+ for(kel::lbm::data<sch::UInt64> dt{0u}; dt < kel::lbm::data<sch::UInt64>{32ul}; ++dt){
// Do Verlet Step
- for(saw::data<sch::UInt64> i{0u}; i < particles.size(); ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < particles.size(); ++i){
auto& part_i = particles.at(i);
verlet_step_lambda<sch::Float32,2u>(part_i,time_step);
@@ -59,7 +58,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
//
- for(saw::data<sch::UInt64> i{0u}; i < particles.size(); ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < particles.size(); ++i){
auto& part_i = particles.at(i);
auto& body_i = part_i.template get<"rigid_body">();
auto& pos_i = body_i.template get<"position">();
@@ -67,7 +66,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
/**
* Test against other particles
*/
- for(saw::data<sch::UInt64> j{i+1ul}; j < particles.size(); ++j){
+ for(kel::lbm::data<sch::UInt64> j{i+1ul}; j < particles.size(); ++j){
auto& part_j = particles.at(j);
auto& body_j = part_j.template get<"rigid_body">();
auto& pos_j = body_j.template get<"position">();
@@ -84,12 +83,12 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto vel_rel = vel_i - vel_j;
auto pos_rel = pos_i - pos_j;
- auto vel_pos_rel_dot = saw::math::dot(vel_rel,pos_rel);
+ auto vel_pos_rel_dot = kel::lbm::math::dot(vel_rel,pos_rel);
if(vel_pos_rel_dot.at({}).get() < 0.0){
- auto pos_rel_normed = pos_rel / saw::math::sqrt(res.second);
+ auto pos_rel_normed = pos_rel / kel::lbm::math::sqrt(res.second);
}
- // auto vel_ij = saw::math::dot(vel_i,vel_j);
+ // auto vel_ij = kel::lbm::math::dot(vel_i,vel_j);
}
}
@@ -112,7 +111,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::cout<<pos.at({{0u}}).get()<<" "<<pos.at({{1u}}).get()<<std::endl;
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/poiseulle_2d/poiseulle_2d.cpp b/examples/poiseulle_2d/poiseulle_2d.cpp
index f9db3df..7ade1ca 100644
--- a/examples/poiseulle_2d/poiseulle_2d.cpp
+++ b/examples/poiseulle_2d/poiseulle_2d.cpp
@@ -8,7 +8,6 @@
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
/**
* Basic distribution function
@@ -73,16 +72,16 @@ struct PressureBoundaryRestrictedVelocityTo {};
template<typename FP,typename Descriptor, bool East>
struct component<FP,Descriptor, cmpt::PressureBoundaryRestrictedVelocityTo<East>> {
private:
- saw::data<FP> pressure_setting_;
- saw::data<FP> rho_setting_;
+ kel::lbm::data<FP> pressure_setting_;
+ kel::lbm::data<FP> rho_setting_;
public:
- component(const saw::data<FP>& pressure_setting__):
+ component(const kel::lbm::data<FP>& pressure_setting__):
pressure_setting_{pressure_setting__},
rho_setting_{pressure_setting__ * df_info<FP,Descriptor>::inv_cs2}
{}
template<typename CellFieldSchema>
- void apply(saw::data<CellFieldSchema>& field, saw::data<sch::FixedArray<sch::UInt64,Descriptor::D>> index, uint64_t time_step){
+ void apply(kel::lbm::data<CellFieldSchema>& field, kel::lbm::data<sch::FixedArray<sch::UInt64,Descriptor::D>> index, uint64_t time_step){
using dfi = df_info<FP,Descriptor>;
bool is_even = ((time_step % 2) == 0);
@@ -98,8 +97,8 @@ public:
/**
* Sum all known DFs
*/
- saw::data<FP> sum_df{0};
- for(saw::data<sch::UInt64> k{0u}; k < saw::data<sch::UInt64>{Descriptor::Q}; ++k){
+ kel::lbm::data<FP> sum_df{0};
+ for(kel::lbm::data<sch::UInt64> k{0u}; k < kel::lbm::data<sch::UInt64>{Descriptor::Q}; ++k){
auto c_k = dfi::directions[k.get()];
auto& cell_n = field({{index.at({0u})+c_k[0u], index.at({1u})+c_k[1u]}});
auto& info_n = cell_n.template get<"info">();
@@ -114,9 +113,9 @@ public:
* Get the sum of the unknown dfs and precalculate the direction
*/
constexpr int known_dir = East ? 1 : -1;
- auto sum_unknown_dfs = (rho_setting_ - sum_df) * saw::data<FP>{known_dir};
+ auto sum_unknown_dfs = (rho_setting_ - sum_df) * kel::lbm::data<FP>{known_dir};
- for(saw::data<sch::UInt64> k{0u}; k < saw::data<sch::UInt64>{Descriptor::Q}; ++k){
+ for(kel::lbm::data<sch::UInt64> k{0u}; k < kel::lbm::data<sch::UInt64>{Descriptor::Q}; ++k){
auto c_k = dfi::directions[k.get()];
auto& cell_n = field({{index.at({0u})+c_k[0u], index.at({1u})+c_k[1u]}});
auto& info_n = cell_n.template get<"info">();
@@ -131,20 +130,20 @@ public:
auto vel_x = sum_unknown_dfs / rho_setting_;
if constexpr (East) {
- dfs_old({2u}) = dfs_old({1u}) + saw::data<FP>{2.0 / 3.0} * rho_setting_ * vel_x;
- dfs_old({6u}) = dfs_old({5u}) + saw::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + saw::data<FP>{0.5} * (dfs_old({4u}) - dfs_old({3u}));
- dfs_old({8u}) = dfs_old({7u}) + saw::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + saw::data<FP>{0.5} * (dfs_old({3u}) - dfs_old({4u}));
+ dfs_old({2u}) = dfs_old({1u}) + kel::lbm::data<FP>{2.0 / 3.0} * rho_setting_ * vel_x;
+ dfs_old({6u}) = dfs_old({5u}) + kel::lbm::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data<FP>{0.5} * (dfs_old({4u}) - dfs_old({3u}));
+ dfs_old({8u}) = dfs_old({7u}) + kel::lbm::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data<FP>{0.5} * (dfs_old({3u}) - dfs_old({4u}));
}else if constexpr (not East){
- dfs_old({1u}) = dfs_old({2u}) - saw::data<FP>{2.0 / 3.0} * rho_setting_ * vel_x;
- dfs_old({5u}) = dfs_old({6u}) - saw::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + saw::data<FP>{0.5} * (dfs_old({3u}) - dfs_old({4u}));
- dfs_old({7u}) = dfs_old({8u}) - saw::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + saw::data<FP>{0.5} * (dfs_old({4u}) - dfs_old({3u}));
+ dfs_old({1u}) = dfs_old({2u}) - kel::lbm::data<FP>{2.0 / 3.0} * rho_setting_ * vel_x;
+ dfs_old({5u}) = dfs_old({6u}) - kel::lbm::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data<FP>{0.5} * (dfs_old({3u}) - dfs_old({4u}));
+ dfs_old({7u}) = dfs_old({8u}) - kel::lbm::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data<FP>{0.5} * (dfs_old({4u}) - dfs_old({3u}));
}
}
};
}
}
-void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+void set_geometry(kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
using namespace kel::lbm;
auto meta = latt.meta();
@@ -152,7 +151,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set ghost
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -163,7 +162,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set wall
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -174,7 +173,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set fluid
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -185,7 +184,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set inflow
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -196,7 +195,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set outflow
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -205,11 +204,11 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
}, {{meta.at({0u})-2u,0u}}, {{meta.at({0u})-1u, meta.at({1u})}}, {{0u,2u}});
}
-void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+void set_initial_conditions(kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
using namespace kel::lbm;
- saw::data<sch::T> rho{1.0};
- saw::data<sch::FixedArray<sch::T,sch::D2Q9::D>> vel{{0.0,0.0}};
+ kel::lbm::data<sch::T> rho{1.0};
+ kel::lbm::data<sch::FixedArray<sch::T,sch::D2Q9::D>> vel{{0.0,0.0}};
auto eq = equilibrium<sch::T,sch::D2Q9>(rho, vel);
auto meta = latt.meta();
@@ -217,12 +216,12 @@ void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set distribution
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& dfs = cell.template get<"dfs">();
auto& dfs_old = cell.template get<"dfs_old">();
- for(saw::data<sch::UInt64> k = 0; k < saw::data<sch::UInt64>{sch::D2Q9::Q}; ++k){
+ for(kel::lbm::data<sch::UInt64> k = 0; k < kel::lbm::data<sch::UInt64>{sch::D2Q9::Q}; ++k){
dfs(k) = eq.at(k);
dfs_old(k) = eq.at(k);
}
@@ -231,7 +230,7 @@ void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
}
void lbm_step(
- saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt,
+ kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt,
uint64_t time_step
){
using namespace kel::lbm;
@@ -251,7 +250,7 @@ void lbm_step(
/**
* Collision
*/
- iterator<sch::D2Q9::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>>& index){
+ iterator<sch::D2Q9::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -279,7 +278,7 @@ void lbm_step(
}, {{0u,0u}}, meta);
// Stream
- iterator<sch::D2Q9::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>>& index){
+ iterator<sch::D2Q9::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>>& index){
auto& cell = latt(index);
auto& df_new = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">();
auto& info_new = cell.template get<"info">();
@@ -334,8 +333,8 @@ int main(int argc, char** argv){
print_lbm_meta<sch::Float64,sch::Descriptor<2u,9u>>(conv, {conf.template get<"kinematic_viscosity">()});
- saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> dim{{1024u, 128u}};
- saw::data<sch::CavityFieldD2Q9, saw::encode::Native> lattice{dim};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> dim{{1024u, 128u}};
+ kel::lbm::data<sch::CavityFieldD2Q9, kel::lbm::enc::Native> lattice{dim};
auto meta = lattice.meta();
/**
@@ -345,9 +344,9 @@ int main(int argc, char** argv){
{
- saw::data<sch::Array<sch::GeometryStruct<sch::T>, sch::D2Q9::D>> geo{dim};
+ kel::lbm::data<sch::Array<sch::GeometryStruct<sch::T>, sch::D2Q9::D>> geo{dim};
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = lattice(index);
auto& info = cell.template get<"info">();
@@ -363,21 +362,21 @@ int main(int argc, char** argv){
*/
set_initial_conditions(lattice);
- saw::data<sch::Array<sch::MacroStruct<sch::T,sch::D2Q9::D>,sch::D2Q9::D>> macros{dim};
+ kel::lbm::data<sch::Array<sch::MacroStruct<sch::T,sch::D2Q9::D>,sch::D2Q9::D>> macros{dim};
for(uint64_t i = 0u; i < 4096u*16u; ++i){
bool even_step = ((i % 2u) == 0u);
{
// Stream
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = lattice(index);
auto& dfs = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">();
auto& rho = macros.at(index).template get<"pressure">();
auto& vel = macros.at(index).template get<"momentum">();
compute_rho_u<sch::T,sch::D2Q9>(dfs,rho,vel);
- rho = rho * saw::data<sch::T>{dfi::cs2};
+ rho = rho * kel::lbm::data<sch::T>{dfi::cs2};
}, {{0u,0u}}, meta);
std::string vtk_f_name{"poiseulle_2d_"};
diff --git a/examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp b/examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp
index 9963c59..bece18f 100644
--- a/examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp
+++ b/examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp
@@ -4,12 +4,11 @@
#include <forstio/codec/data.hpp>
template<typename T>
-using SyclHostAlloc = acpp::sycl::usm_allocator<saw::data<T>, acpp::sycl::usm::alloc::host>;
+using SyclHostAlloc = acpp::sycl::usm_allocator<kel::lbm::data<T>, acpp::sycl::usm::alloc::host>;
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
/**
* Basic distribution function
@@ -50,19 +49,19 @@ struct PressureBoundaryRestrictedVelocityTo {};
template<typename FP,typename Desc, bool East>
struct component<FP,Desc, cmpt::PressureBoundaryRestrictedVelocityTo<East>> {
private:
- saw::data<FP> pressure_setting_;
- saw::data<FP> rho_setting_;
+ kel::lbm::data<FP> pressure_setting_;
+ kel::lbm::data<FP> rho_setting_;
public:
- component(const saw::data<FP>& pressure_setting__):
+ component(const kel::lbm::data<FP>& pressure_setting__):
pressure_setting_{pressure_setting__},
rho_setting_{pressure_setting__ * df_info<FP,Desc>::inv_cs2}
{}
template<typename CellFieldSchema>
void apply(
- saw::data<CellFieldSchema>* field,
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index,
- const saw::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta,
+ kel::lbm::data<CellFieldSchema>* field,
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index,
+ const kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta,
uint64_t time_step
) const {
@@ -82,8 +81,8 @@ public:
/**
* Sum all known DFs
*/
- saw::data<FP> sum_df{0u};
- for(saw::data<sch::UInt64> k{0u}; k < saw::data<sch::UInt64>{Desc::Q}; ++k){
+ kel::lbm::data<FP> sum_df{0u};
+ for(kel::lbm::data<sch::UInt64> k{0u}; k < kel::lbm::data<sch::UInt64>{Desc::Q}; ++k){
auto c_k = dfi::directions[k.get()];
auto flat_ind_n = flatten_index<sch::UInt64,Desc::D>::apply({{index.at({0u})+c_k[0u], index.at({1u})+c_k[1u]}},meta);
auto& cell_n = field[flat_ind_n.get()];
@@ -99,9 +98,9 @@ public:
* Get the sum of the unknown dfs and precalculate the direction
*/
constexpr int known_dir = East ? 1 : -1;
- auto sum_unknown_dfs = (rho_setting_ - sum_df) * saw::data<FP>{known_dir};
+ auto sum_unknown_dfs = (rho_setting_ - sum_df) * kel::lbm::data<FP>{known_dir};
- for(saw::data<sch::UInt64> k{0u}; k < saw::data<sch::UInt64>{Desc::Q}; ++k){
+ for(kel::lbm::data<sch::UInt64> k{0u}; k < kel::lbm::data<sch::UInt64>{Desc::Q}; ++k){
auto c_k = dfi::directions[k.get()];
auto flat_ind_n = flatten_index<sch::UInt64,Desc::D>::apply({{index.at({0u})+c_k[0u], index.at({1u})+c_k[1u]}},meta);
auto& cell_n = field[flat_ind_n.get()];
@@ -116,13 +115,13 @@ public:
auto vel_x = sum_unknown_dfs / rho_setting_;
if constexpr (East) {
- dfs_old({2u}) = dfs_old({1u}) + saw::data<FP>{2.0 / 3.0} * rho_setting_ * vel_x;
- dfs_old({6u}) = dfs_old({5u}) + saw::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + saw::data<FP>{0.5} * (dfs_old({4u}) - dfs_old({3u}));
- dfs_old({8u}) = dfs_old({7u}) + saw::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + saw::data<FP>{0.5} * (dfs_old({3u}) - dfs_old({4u}));
+ dfs_old({2u}) = dfs_old({1u}) + kel::lbm::data<FP>{2.0 / 3.0} * rho_setting_ * vel_x;
+ dfs_old({6u}) = dfs_old({5u}) + kel::lbm::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data<FP>{0.5} * (dfs_old({4u}) - dfs_old({3u}));
+ dfs_old({8u}) = dfs_old({7u}) + kel::lbm::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data<FP>{0.5} * (dfs_old({3u}) - dfs_old({4u}));
}else if constexpr (not East){
- dfs_old({1u}) = dfs_old({2u}) - saw::data<FP>{2.0 / 3.0} * rho_setting_ * vel_x;
- dfs_old({5u}) = dfs_old({6u}) - saw::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + saw::data<FP>{0.5} * (dfs_old({3u}) - dfs_old({4u}));
- dfs_old({7u}) = dfs_old({8u}) - saw::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + saw::data<FP>{0.5} * (dfs_old({4u}) - dfs_old({3u}));
+ dfs_old({1u}) = dfs_old({2u}) - kel::lbm::data<FP>{2.0 / 3.0} * rho_setting_ * vel_x;
+ dfs_old({5u}) = dfs_old({6u}) - kel::lbm::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data<FP>{0.5} * (dfs_old({3u}) - dfs_old({4u}));
+ dfs_old({7u}) = dfs_old({8u}) - kel::lbm::data<FP>{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data<FP>{0.5} * (dfs_old({4u}) - dfs_old({3u}));
}
}
};
@@ -141,15 +140,15 @@ public:
*/
template<typename Desc>
-saw::error_or<void> set_geometry(
- saw::data<sch::CellStruct>* cells,
- const saw::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta,
+kel::lbm::error_or<void> set_geometry(
+ kel::lbm::data<sch::CellStruct>* cells,
+ const kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta,
acpp::sycl::queue& sycl_q
){
using namespace kel::lbm;
- saw::data<sch::T> rho{1.0};
- saw::data<sch::FixedArray<sch::T,Desc::D>> vel{{0.0,0.0}};
+ kel::lbm::data<sch::T> rho{1.0};
+ kel::lbm::data<sch::FixedArray<sch::T,Desc::D>> vel{{0.0,0.0}};
auto eq = equilibrium<sch::T,Desc>(rho, vel);
sycl_q.submit([&](acpp::sycl::handler& h){
@@ -178,28 +177,28 @@ saw::error_or<void> set_geometry(
}else {
info.set({0u});
}
- for(saw::data<sch::UInt64> k{0u}; k < saw::data<sch::UInt64>{Desc::Q}; ++k){
+ for(kel::lbm::data<sch::UInt64> k{0u}; k < kel::lbm::data<sch::UInt64>{Desc::Q}; ++k){
dfs(k) = eq.at(k);
dfs_old(k) = eq.at(k);
}
});
}).wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename Desc>
void step(
- saw::data<sch::CellStruct>* cells,
- saw::data<sch::MacroStruct>* macro_cells,
- const saw::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta,
+ kel::lbm::data<sch::CellStruct>* cells,
+ kel::lbm::data<sch::MacroStruct>* macro_cells,
+ const kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta,
uint64_t time_step,
acpp::sycl::queue& sycl_q
){
using namespace kel::lbm;
using dfi = df_info<sch::T,Desc>;
- constexpr saw::data<sch::T> frequency{1.0 / 0.6};
+ constexpr kel::lbm::data<sch::T> frequency{1.0 / 0.6};
bool is_even = ((time_step % 2u) == 0u);
/**
@@ -244,8 +243,8 @@ void step(
auto& macro_c = macro_cells[acc_id];
- saw::data<sch::T>& rho = macro_c.template get<"pressure">();
- saw::data<sch::FixedArray<sch::T,Desc::D>>& vel = macro_c.template get<"momentum">();
+ kel::lbm::data<sch::T>& rho = macro_c.template get<"pressure">();
+ kel::lbm::data<sch::FixedArray<sch::T,Desc::D>>& vel = macro_c.template get<"momentum">();
compute_rho_u<sch::T,Desc>(dfs_old,rho,vel);
auto eq = equilibrium<sch::T,Desc>(rho,vel);
@@ -261,8 +260,8 @@ void step(
auto& macro_c = macro_cells[acc_id];
- saw::data<sch::T>& rho = macro_c.template get<"pressure">();
- saw::data<sch::FixedArray<sch::T,Desc::D>>& vel = macro_c.template get<"momentum">();
+ kel::lbm::data<sch::T>& rho = macro_c.template get<"pressure">();
+ kel::lbm::data<sch::FixedArray<sch::T,Desc::D>>& vel = macro_c.template get<"momentum">();
compute_rho_u<sch::T,Desc>(dfs_old,rho,vel);
auto eq = equilibrium<sch::T,Desc>(rho,vel);
@@ -278,8 +277,8 @@ void step(
auto& macro_c = macro_cells[acc_id];
- saw::data<sch::T>& rho = macro_c.template get<"pressure">();
- saw::data<sch::FixedArray<sch::T,Desc::D>>& vel = macro_c.template get<"momentum">();
+ kel::lbm::data<sch::T>& rho = macro_c.template get<"pressure">();
+ kel::lbm::data<sch::FixedArray<sch::T,Desc::D>>& vel = macro_c.template get<"momentum">();
compute_rho_u<sch::T,Desc>(dfs_old,rho,vel);
auto eq = equilibrium<sch::T,Desc>(rho,vel);
@@ -327,7 +326,7 @@ void step(
}
template<typename T, typename Desc>
-saw::error_or<void> kel_main(int argc, char** argv){
+kel::lbm::error_or<void> kel_main(int argc, char** argv){
using namespace kel;
using dfi = lbm::df_info<T,Desc>;
@@ -350,16 +349,16 @@ saw::error_or<void> kel_main(int argc, char** argv){
uint64_t x_d = 1024u;
uint64_t y_d = 512u;
- saw::data<lbm::sch::FixedArray<lbm::sch::UInt64,Desc::D>> meta{{x_d,y_d}};
+ kel::lbm::data<lbm::sch::FixedArray<lbm::sch::UInt64,Desc::D>> meta{{x_d,y_d}};
acpp::sycl::queue sycl_q;
SyclHostAlloc<lbm::sch::MacroStruct> sycl_host_alloc{sycl_q};
// SyclDeviceAlloc<lbm::sch::CellStruct> sycl_dev_alloc{sycl_q};
- std::vector<saw::data<lbm::sch::MacroStruct>, SyclHostAlloc<lbm::sch::MacroStruct>> host_cells{x_d * y_d,sycl_host_alloc};
+ std::vector<kel::lbm::data<lbm::sch::MacroStruct>, SyclHostAlloc<lbm::sch::MacroStruct>> host_cells{x_d * y_d,sycl_host_alloc};
- saw::data<lbm::sch::CellStruct>* cells = acpp::sycl::malloc_device<saw::data<lbm::sch::CellStruct>>(x_d * y_d,sycl_q);
- saw::data<lbm::sch::MacroStruct>* macro_cells = acpp::sycl::malloc_device<saw::data<lbm::sch::MacroStruct>>(x_d * y_d,sycl_q);
+ kel::lbm::data<lbm::sch::CellStruct>* cells = acpp::sycl::malloc_device<kel::lbm::data<lbm::sch::CellStruct>>(x_d * y_d,sycl_q);
+ kel::lbm::data<lbm::sch::MacroStruct>* macro_cells = acpp::sycl::malloc_device<kel::lbm::data<lbm::sch::MacroStruct>>(x_d * y_d,sycl_q);
{
auto eov = lbm::set_geometry<Desc>(cells,meta,sycl_q);
if(eov.is_error()){
@@ -376,7 +375,7 @@ saw::error_or<void> kel_main(int argc, char** argv){
std::string vtk_f_name{"tmp/poiseulle_2d_gpu_"};
vtk_f_name += std::to_string(i) + ".vtk";
// write_vtk_file(vtk_f_name,host_cells);
- sycl_q.memcpy(&host_cells[0u], macro_cells, x_d * y_d * sizeof(saw::data<lbm::sch::MacroStruct>) ).wait();
+ sycl_q.memcpy(&host_cells[0u], macro_cells, x_d * y_d * sizeof(kel::lbm::data<lbm::sch::MacroStruct>) ).wait();
lbm::write_vtk_file<lbm::sch::MacroStruct,Desc::D>(vtk_f_name, &host_cells[0], meta);
}
}
@@ -386,7 +385,7 @@ saw::error_or<void> kel_main(int argc, char** argv){
acpp::sycl::free(macro_cells, sycl_q);
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
int main(int argc, char** argv){
diff --git a/examples/poiseulle_3d/poiseulle_3d.cpp b/examples/poiseulle_3d/poiseulle_3d.cpp
index 83d1af1..141dc5f 100644
--- a/examples/poiseulle_3d/poiseulle_3d.cpp
+++ b/examples/poiseulle_3d/poiseulle_3d.cpp
@@ -146,7 +146,6 @@ public:
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
using T = Float32;
using Desc = Descriptor<3u,27u>;
@@ -161,21 +160,21 @@ using CellStruct = Struct<
Member<CellInfo, "info">
>;
}
-using SyclKelAllocator = acpp::sycl::usm_allocator<saw::data<sch::CellStruct>, acpp::sycl::usm::alloc::shared>;
+using SyclKelAllocator = acpp::sycl::usm_allocator<kel::lbm::data<sch::CellStruct>, acpp::sycl::usm::alloc::shared>;
-uint64_t to_flat_index(const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index, const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){
+uint64_t to_flat_index(const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index, const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){
auto flat = index.at({2u}) + meta.at({2u})*(index.at({1u}) + index.at({0u})*meta.at({1u}));
return flat.get();
}
template<typename StructFieldSchema>
-saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKelAllocator>& latt, const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){
+kel::lbm::error_or<void> set_geometry(std::vector<kel::lbm::data<StructFieldSchema>,SyclKelAllocator>& latt, const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){
using namespace kel::lbm;
/**
* Set ghost
*/
- iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
+ iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
auto findex = to_flat_index(index,meta);
auto& cell = latt.at(findex);
auto& info = cell.template get<"info">();
@@ -183,17 +182,17 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe
info({0u}).set(0u);
}, {{0u,0u}}, meta);
- saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> distance;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> distance;
/**
* Set wall
*/
- iterator<1u>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,1u>>& index){
+ iterator<1u>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index){
distance.at(index.at({0u})) = {1u};
},{{0u}},{{sch::Desc::D}});
/*
*/
- iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
+ iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
auto findex = to_flat_index(index,meta);
auto& cell = latt.at(findex);
auto& info = cell.template get<"info">();
@@ -204,12 +203,12 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe
/**
* Set fluid
*/
- iterator<1u>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,1u>>& index){
+ iterator<1u>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index){
distance.at(index.at({0u})) = {2u};
},{{0u}},{{sch::Desc::D}});
/*
*/
- iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
+ iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
auto findex = to_flat_index(index,meta);
auto& cell = latt.at(findex);
auto& info = cell.template get<"info">();
@@ -222,14 +221,14 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe
* Set inflow
*/
- saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> shifted_point;
- iterator<1u>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,1u>>& index){
+ kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> shifted_point;
+ iterator<1u>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index){
distance.at(index.at({0u})) = (index.at({0u}).get() == 0u)?1u:2u;
shifted_point.at(index.at({0u})) = (index.at({0u}).get() == 0u)?3u:meta.at({index.at({0u})});
},{{0u}},{{sch::Desc::D}});
/*
*/
- iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
+ iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
auto findex = to_flat_index(index,meta);
auto& cell = latt.at(findex);
auto& info = cell.template get<"info">();
@@ -241,13 +240,13 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe
/**
* Set outflow
*/
- iterator<1u>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,1u>>& index){
+ iterator<1u>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index){
distance.at(index.at({0u})) = (index.at({0u}).get() == 0u)?1u:2u;
shifted_point.at(index.at({0u})) = (index.at({0u}).get() == 0u)?(meta.at({0u})-3u):0u;
},{{0u}},{{sch::Desc::D}});
/*
*/
- iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
+ iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
auto findex = to_flat_index(index,meta);
auto& cell = latt.at(findex);
auto& info = cell.template get<"info">();
@@ -256,51 +255,51 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe
}, shifted_point, meta, distance);
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename StructFieldSchema>
-saw::error_or<void> set_initial_conditions(std::vector<saw::data<StructFieldSchema>,SyclKelAllocator>& latt, const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){
+kel::lbm::error_or<void> set_initial_conditions(std::vector<kel::lbm::data<StructFieldSchema>,SyclKelAllocator>& latt, const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){
- saw::data<sch::T> rho{1.0};
- saw::data<sch::FixedArray<sch::T,sch::Desc::D>> vel{};
+ kel::lbm::data<sch::T> rho{1.0};
+ kel::lbm::data<sch::FixedArray<sch::T,sch::Desc::D>> vel{};
vel.at({0u}) = {0.1f};
auto eq = equilibrium<sch::T,sch::Desc>(rho, vel);
/**
* Set distribution
*/
- iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
+ iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
auto findex = to_flat_index(index,meta);
auto& cell = latt.at(findex);
auto& dfs = cell.template get<"dfs">();
auto& dfs_old = cell.template get<"dfs_old">();
- for(saw::data<sch::UInt64> k = 0; k < saw::data<sch::UInt64>{sch::Desc::Q}; ++k){
+ for(kel::lbm::data<sch::UInt64> k = 0; k < kel::lbm::data<sch::UInt64>{sch::Desc::Q}; ++k){
dfs(k) = eq.at(k);
dfs_old(k) = eq.at(k);
}
}, {}, meta);
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename StructFieldSchema>
-saw::error_or<void> lbm_step(
- std::vector<saw::data<StructFieldSchema>,SyclKelAllocator>& latt,
- const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta,
- saw::data<sch::UInt64> time_step,
+kel::lbm::error_or<void> lbm_step(
+ std::vector<kel::lbm::data<StructFieldSchema>,SyclKelAllocator>& latt,
+ const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta,
+ kel::lbm::data<sch::UInt64> time_step,
acpp::sycl::queue& sycl_q
){
using dfi = df_info<sch::T,sch::Desc>;
bool even_step = ((time_step.get() % 2u) == 0u);
- component<sch::T, sch::Desc, cmpt::BGK, saw::encode::Native> coll{0.5384};
- component<sch::T, sch::Desc, cmpt::BounceBack, saw::encode::Native> bb;
+ component<sch::T, sch::Desc, cmpt::BGK, kel::lbm::enc::Native> coll{0.5384};
+ component<sch::T, sch::Desc, cmpt::BounceBack, kel::lbm::enc::Native> bb;
/**
* Collision
*/
- iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
+ iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
auto findex = to_flat_index(index,meta);
auto& cell = latt.at(findex);
auto& info = cell.template get<"info">();
@@ -329,7 +328,7 @@ saw::error_or<void> lbm_step(
}, {}, meta);
// Stream
- iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
+ iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){
auto findex = to_flat_index(index,meta);
auto& cell = latt.at(findex);
auto& df_new = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">();
@@ -352,10 +351,10 @@ saw::error_or<void> lbm_step(
}
}
}, {}, meta);
- return saw::make_void();
+ return kel::lbm::make_void();
}
-saw::error_or<void> real_main(int argc, char** argv){
+kel::lbm::error_or<void> real_main(int argc, char** argv){
using dfi = df_info<sch::T,sch::Desc>;
converter<sch::T> conv {
@@ -369,10 +368,10 @@ saw::error_or<void> real_main(int argc, char** argv){
/**
* Set the meta and initialize the lattice
*/
- saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> meta{{2048u,128u,128u}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> meta{{2048u,128u,128u}};
SyclKelAllocator sycl_shared_alloc{sycl_q};
- std::vector<saw::data<sch::CellStruct>,SyclKelAllocator> lattice{(meta.at({0u})*meta.at({1u})*meta.at({2u})).get(), sycl_shared_alloc};
+ std::vector<kel::lbm::data<sch::CellStruct>,SyclKelAllocator> lattice{(meta.at({0u})*meta.at({1u})*meta.at({2u})).get(), sycl_shared_alloc};
/**
* Set the geometry
@@ -394,14 +393,14 @@ saw::error_or<void> real_main(int argc, char** argv){
}
}
- for(saw::data<sch::UInt64> ts{0u}; ts < saw::data<sch::UInt64>{1024u*32u}; ++ts){
+ for(kel::lbm::data<sch::UInt64> ts{0u}; ts < kel::lbm::data<sch::UInt64>{1024u*32u}; ++ts){
auto eov = lbm_step(lattice,meta,ts,sycl_q);
if(eov.is_error()){
return eov;
}
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
} // lbm
diff --git a/examples/poiseulle_3d_gpu/sim.cpp b/examples/poiseulle_3d_gpu/sim.cpp
index 167234d..3fe7358 100644
--- a/examples/poiseulle_3d_gpu/sim.cpp
+++ b/examples/poiseulle_3d_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_z = 256ul;
constexpr uint64_t particle_size = 128ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y, dim_z>;
@@ -53,11 +52,11 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
+kel::lbm::error_or<void> setup_initial_conditions(
converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>>& particles
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>>& particles
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -135,19 +134,19 @@ saw::error_or<void> setup_initial_conditions(
{{1u,1u,1u}}
);
- for(saw::data<sch::UInt64> i{0u}; i < saw::data<sch::UInt64>{particle_size}; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < kel::lbm::data<sch::UInt64>{particle_size}; ++i){
auto& part = particles.at(i);
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
converter<T>& conv,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -156,11 +155,11 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
// Need nicer things to handle the flow. I see improvement here
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> collision{conv.template kinematic_viscosity_si_to_tau<Desc>({0.1}).handle()};
- // component<T,Desc,cmpt::HLBM,encode::Sycl<saw::encode::Native>> collision{0.6};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> collision{conv.template kinematic_viscosity_si_to_tau<Desc>({0.1}).handle()};
+ // component<T,Desc,cmpt::HLBM,encode::Sycl<kel::lbm::enc::Native>> collision{0.6};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 256u;
if(t_i.get() < target_t_i){
@@ -169,10 +168,10 @@ saw::error_or<void> step(
return 1.001;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y,dim_z}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -203,10 +202,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y,dim_z}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -226,13 +225,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -249,7 +248,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -262,15 +261,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{0.01},{1024.0});
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>>>();
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -296,9 +296,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
sycl_q.wait();
auto lsd_view = make_view(lbm_sycl_data);
@@ -322,9 +322,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
sycl_q.wait();
- saw::data<sch::UInt64> time_steps{2048ul};
+ kel::lbm::data<sch::UInt64> time_steps{2048ul};
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
{
{
auto eov = write_vtk_file(out_dir,"t",i.get(),*lbm_macro_data_ptr);
@@ -386,7 +386,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
*/
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp b/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp
index 1af0023..793be1f 100644
--- a/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp
+++ b/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp
@@ -17,7 +17,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -59,9 +58,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -159,14 +158,14 @@ saw::error_or<void> setup_initial_conditions(
{{1u,1u}}
);
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -176,20 +175,20 @@ saw::error_or<void> step(
eps.at({}).set(1.5f);
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PSM,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+ component<T,Desc,cmpt::PSM,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<kel::lbm::enc::Native>> abb;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{1.0001};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{1.0001};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
- component<T,Desc,cmpt::OneParticleTwoWay, encode::Sycl<saw::encode::Native>> optw;
+ component<T,Desc,cmpt::OneParticleTwoWay, encode::Sycl<kel::lbm::enc::Native>> optw;
h.parallel_for(acpp::sycl::range<1u>{1u},[=](acpp::sycl::id<1u> idx){
}).wait();
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -233,13 +232,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -256,7 +255,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -269,15 +268,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -309,8 +309,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -329,11 +329,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -376,10 +376,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
*/
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -427,7 +427,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp b/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp
index 9ed1646..e8ae50a 100644
--- a/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp
+++ b/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp
@@ -17,7 +17,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -56,9 +55,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -138,7 +137,7 @@ saw::error_or<void> setup_initial_conditions(
iterator<Desc::D>::apply(
[&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle, ind_vec;
middle.at({{0u}}) = dim_x * 0.25;
middle.at({{1u}}) = dim_y * 0.5;
@@ -146,7 +145,7 @@ saw::error_or<void> setup_initial_conditions(
ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}).get() < dim_y*dim_y*0.01){
info_f.at(index) = 1u;
}
@@ -155,14 +154,14 @@ saw::error_or<void> setup_initial_conditions(
df_f.get_dims()
);
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -171,18 +170,18 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
// Need nicer things to handle the flow. I see improvement here
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<kel::lbm::enc::Native>> abb;
- saw::data<sch::Scalar<T>> rho_b;
+ kel::lbm::data<sch::Scalar<T>> rho_b;
rho_b.at({}) = 1.0;
- saw::data<sch::Vector<T,Desc::D>> vel_b;
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel_b;
vel_b.at({{0u}}) = 0.015;
- component<T,Desc,cmpt::Equilibrium,encode::Sycl<saw::encode::Native>> equi{rho_b,vel_b};
+ component<T,Desc,cmpt::Equilibrium,encode::Sycl<kel::lbm::enc::Native>> equi{rho_b,vel_b};
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 32u;
if(t_i.get() < target_t_i){
@@ -191,11 +190,11 @@ saw::error_or<void> step(
return 1.0002;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -234,13 +233,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
/*
@@ -265,7 +264,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -278,15 +277,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -318,8 +318,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -337,11 +337,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
sycl_q.wait();
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -384,10 +384,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
*/
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -429,7 +429,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp b/examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp
index f45e10e..9d9e32e 100644
--- a/examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp
+++ b/examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -62,9 +61,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -145,14 +144,14 @@ saw::error_or<void> setup_initial_conditions(
{{1u,1u}}
);
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -161,22 +160,22 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8};
- component<T,Desc,cmpt::FpLbmOneParticleNoVelocity,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
+ component<T,Desc,cmpt::FpLbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- saw::data<sch::Scalar<T>> eps;
+ kel::lbm::data<sch::Scalar<T>> eps;
eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}).set(dim_y*0.1);
- saw::data<sch::Vector<T,Desc::D>> p_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p_pos;
{
p_pos.at({{0u}}) = dim_x * 0.25;
p_pos.at({{1u}}) = dim_y * 0.5;
}
- component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps};
+ component<T,Desc,cmpt::OneParticleAt,encode::Sycl<kel::lbm::enc::Native>> opa{p_pos,rad,eps};
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 64u;
if(t_i.get() < target_t_i){
@@ -185,11 +184,11 @@ saw::error_or<void> step(
return 1.0002;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -230,13 +229,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -253,7 +252,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -266,15 +265,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -305,8 +305,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -324,10 +324,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
sycl_q.wait();
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -339,10 +339,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -384,7 +384,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/poiseulle_particles_2d_gpu/common.hpp b/examples/poiseulle_particles_2d_gpu/common.hpp
index b321344..6806b2c 100644
--- a/examples/poiseulle_particles_2d_gpu/common.hpp
+++ b/examples/poiseulle_particles_2d_gpu/common.hpp
@@ -19,7 +19,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
diff --git a/examples/poiseulle_particles_2d_gpu/init.hpp b/examples/poiseulle_particles_2d_gpu/init.hpp
index b7fdeb0..a61ef37 100644
--- a/examples/poiseulle_particles_2d_gpu/init.hpp
+++ b/examples/poiseulle_particles_2d_gpu/init.hpp
@@ -6,11 +6,11 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> init(
+kel::lbm::error_or<void> init(
const converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
(void) conv;
@@ -95,7 +95,7 @@ saw::error_or<void> init(
iterator<Desc::D>::apply(
[&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle, ind_vec;
middle.at({{0u}}) = dim_x * 0.25;
middle.at({{1u}}) = dim_y * 0.5;
@@ -103,7 +103,7 @@ saw::error_or<void> init(
ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}).get() < dim_y*dim_y*0.01){
porous_f.at(index).at({}) = 0.0;
}
@@ -113,14 +113,14 @@ saw::error_or<void> init(
);
{
- saw::data<sch::Scalar<T>> radius_p;
+ kel::lbm::data<sch::Scalar<T>> radius_p;
radius_p.at({}).set(2);
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
particles = create_spheroid_particle_group<T,Desc::D,1u>(radius_p, dense_p, {{16u}});
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp
index f5b49e9..e852313 100644
--- a/examples/poiseulle_particles_2d_gpu/sim.cpp
+++ b/examples/poiseulle_particles_2d_gpu/sim.cpp
@@ -8,7 +8,6 @@
* For deciding what parameters to use maybe?
*/
namespace args {
-using namespace saw::schema;
using LbmArgsStruct = Struct<
Member<UInt8,"use_slip">,
@@ -22,7 +21,7 @@ using LbmArgs = Args<
}
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
+kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){
using namespace kel::lbm;
auto& an = args.template get<"args">();
@@ -41,7 +40,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -54,16 +53,17 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -95,9 +95,9 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
sycl_q.wait();
{
@@ -117,11 +117,11 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_particle_data);
- saw::data<sch::UInt64> time_steps{64u*1024ul};
+ kel::lbm::data<sch::UInt64> time_steps{64u*1024ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc,Coll>(conv,lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -147,10 +147,10 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -186,16 +186,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
using DescT = kel::lbm::sch::D2Q9;
-saw::error_or<void> k_main(int argc, char** argv){
+kel::lbm::error_or<void> k_main(int argc, char** argv){
using namespace kel::lbm;
- saw::data<args::LbmArgs> args;
+ kel::lbm::data<args::LbmArgs> args;
{
auto eov = saw::parse_args(args,argc,argv);
return eov;
@@ -209,7 +209,7 @@ saw::error_or<void> k_main(int argc, char** argv){
// return kmain<FloatT,DescT,coupling::Psm>(args);
}
- return saw::make_error<saw::err::critical>("Invalid coupling");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Invalid coupling");
}
diff --git a/examples/poiseulle_particles_2d_gpu/step.hpp b/examples/poiseulle_particles_2d_gpu/step.hpp
index 37eb4e7..ade14ca 100644
--- a/examples/poiseulle_particles_2d_gpu/step.hpp
+++ b/examples/poiseulle_particles_2d_gpu/step.hpp
@@ -6,12 +6,12 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
const converter<T>& conv,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -19,9 +19,9 @@ saw::error_or<void> step(
auto& porous_f = macros.template get<"porosity">();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmReset,encode::Sycl<saw::encode::Native>> hlbm_reset;
+ component<T,Desc,cmpt::HlbmReset,encode::Sycl<kel::lbm::enc::Native>> hlbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -31,10 +31,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part;
+ component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> hlbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -45,10 +45,10 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 16u;
if(t_i.get() < target_t_i){
@@ -57,10 +57,10 @@ saw::error_or<void> step(
return 1.01;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -90,7 +90,7 @@ saw::error_or<void> step(
});
}).wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp b/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp
index 0061fa2..926086c 100644
--- a/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp
+++ b/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
// constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -59,9 +58,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -145,7 +144,7 @@ saw::error_or<void> setup_initial_conditions(
/*
iterator<Desc::D>::apply(
[&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle, ind_vec;
middle.at({{0u}}) = dim_x * 0.25;
middle.at({{1u}}) = dim_y * 0.5;
@@ -153,7 +152,7 @@ saw::error_or<void> setup_initial_conditions(
ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}).get() < dim_y*dim_y*0.01){
porous_f.at(index).at({}) = 0.0;
}
@@ -163,14 +162,14 @@ saw::error_or<void> setup_initial_conditions(
);
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -179,25 +178,25 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8};
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<kel::lbm::enc::Native>> abb;
- saw::data<sch::Scalar<T>> eps;
+ kel::lbm::data<sch::Scalar<T>> eps;
eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}).set(dim_y*0.1);
- saw::data<sch::Vector<T,Desc::D>> p_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p_pos;
{
p_pos.at({{0u}}) = dim_x * 0.25;
p_pos.at({{1u}}) = dim_y * 0.5;
}
- component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps};
+ component<T,Desc,cmpt::OneParticleAt,encode::Sycl<kel::lbm::enc::Native>> opa{p_pos,rad,eps};
- component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg;
+ component<T,Desc,cmpt::ForceGather, encode::Sycl<kel::lbm::enc::Native>> fg;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 64u;
if(t_i.get() < target_t_i){
@@ -206,11 +205,11 @@ saw::error_or<void> step(
return 1.0002;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -252,13 +251,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -275,7 +274,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -288,15 +287,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -328,8 +328,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -347,10 +347,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
sycl_q.wait();
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -362,10 +362,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -407,7 +407,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp
index d63515d..b051c4e 100644
--- a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp
+++ b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp
@@ -18,7 +18,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
// constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -66,10 +65,10 @@ using ParticleSpheroidGroup = ParticleGroup<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -153,7 +152,7 @@ saw::error_or<void> setup_initial_conditions(
// Particles
{
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
auto& spheroid_grp = particles;
@@ -186,15 +185,15 @@ saw::error_or<void> setup_initial_conditions(
}
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -203,7 +202,7 @@ saw::error_or<void> step(
q.submit([&](acpp::sycl::handler& h){
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -240,7 +239,7 @@ saw::error_or<void> step(
iterator<Desc::D>::apply([&](const auto& index){
/// Calculate the shift from the mask
- saw::data<sch::Vector<T,Desc::D>> index_shift;
+ kel::lbm::data<sch::Vector<T,Desc::D>> index_shift;
for(uint64_t i = 0u; i < Desc::D; ++i){
index_shift.at({{i}}) = index.at({i}).template cast_to<T>() - com.at({}).at({{i}});
// Scale to LBM Grid
@@ -271,18 +270,18 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
// Need nicer things to handle the flow. I see improvement here
- component<T,Desc,cmpt::BGKGuo, encode::Sycl<saw::encode::Native>> collision{0.65};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+ component<T,Desc,cmpt::BGKGuo, encode::Sycl<kel::lbm::enc::Native>> collision{0.65};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<kel::lbm::enc::Native>> abb;
- saw::data<sch::Scalar<T>> rho_b;
+ kel::lbm::data<sch::Scalar<T>> rho_b;
rho_b.at({}) = 1.0;
- saw::data<sch::Vector<T,Desc::D>> vel_b;
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel_b;
vel_b.at({{0u}}) = 0.015;
- component<T,Desc,cmpt::Equilibrium,encode::Sycl<saw::encode::Native>> equi{rho_b,vel_b};
+ component<T,Desc,cmpt::Equilibrium,encode::Sycl<kel::lbm::enc::Native>> equi{rho_b,vel_b};
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 32u;
if(t_i.get() < target_t_i){
@@ -291,11 +290,11 @@ saw::error_or<void> step(
return 1.0002;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -335,13 +334,13 @@ saw::error_or<void> step(
// h.depends_on(collision_ev);
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
/*
@@ -366,7 +365,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -379,16 +378,17 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -420,9 +420,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle{sycl_q};
sycl_q.wait();
{
@@ -447,11 +447,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_particle);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -492,10 +492,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -544,7 +544,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp
index ae15a9a..3fd5579 100644
--- a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp
+++ b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp
@@ -17,7 +17,6 @@ constexpr uint64_t dim_x = dim_y * 20ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -60,9 +59,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -160,11 +159,11 @@ saw::error_or<void> setup_initial_conditions(
{{1u,1u}}
);
- saw::data<sch::Scalar<T>> eps;
+ kel::lbm::data<sch::Scalar<T>> eps;
eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}).set(dim_y*0.1);
- saw::data<sch::Vector<T,Desc::D>> p_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p_pos;
{
p_pos.at({{0u}}) = dim_x * 0.25;
p_pos.at({{1u}}) = dim_y * 0.5;
@@ -184,7 +183,7 @@ saw::error_or<void> setup_initial_conditions(
/*
iterator<Desc::D>::apply(
[&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle, ind_vec;
middle.at({{0u}}) = dim_x * 0.25;
middle.at({{1u}}) = dim_y * 0.5;
@@ -192,7 +191,7 @@ saw::error_or<void> setup_initial_conditions(
ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}).get() < dim_y*dim_y*0.01){
porous_f.at(index).at({}) = 0.0;
}
@@ -202,14 +201,14 @@ saw::error_or<void> setup_initial_conditions(
);
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -217,22 +216,22 @@ saw::error_or<void> step(
auto& porous_f = macros.template get<"porosity">();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8};
- component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
+ component<T,Desc,cmpt::Psm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- saw::data<sch::Scalar<T>> eps;
+ kel::lbm::data<sch::Scalar<T>> eps;
eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}).set(dim_y*0.1);
- saw::data<sch::Vector<T,Desc::D>> p_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p_pos;
{
p_pos.at({{0u}}) = dim_x * 0.25;
p_pos.at({{1u}}) = dim_y * 0.5;
}
- component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps};
+ component<T,Desc,cmpt::OneParticleAt,encode::Sycl<kel::lbm::enc::Native>> opa{p_pos,rad,eps};
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 64u;
if(t_i.get() < target_t_i){
@@ -241,12 +240,12 @@ saw::error_or<void> step(
return 1.0002;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
- component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg;
+ component<T,Desc,cmpt::ForceGather, encode::Sycl<kel::lbm::enc::Native>> fg;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -292,13 +291,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -315,7 +314,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -328,15 +327,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -368,8 +368,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -388,11 +388,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -404,10 +404,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -449,7 +449,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp b/examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp
index 24832f2..aadeb12 100644
--- a/examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp
+++ b/examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp
@@ -13,7 +13,6 @@
namespace kel {
namespace lbm {
namespace sch {
-using namespace saw::schema;
using T = Float32;
@@ -85,7 +84,7 @@ using CavityFieldD2Q9 = CellField<D2Q9, CellStruct<D2Q9>>;
}
}
-void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+void set_geometry(kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
using namespace kel::lbm;
auto meta = latt.meta();
@@ -93,7 +92,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set ghost
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -104,7 +103,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set wall
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -115,7 +114,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set fluid
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -126,7 +125,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set inflow
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -137,7 +136,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set outflow
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -148,11 +147,11 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set channel wall
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
- saw::data<sch::FixedArray<sch::UInt64,2u>> area{{meta.at({0u})-8u, meta.at({1u})-2u}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,2u>> area{{meta.at({0u})-8u, meta.at({1u})-2u}};
double safety_start = 0.1*area.at({0u}).get();
double safety_width = 0.2*area.at({1u}).get();
@@ -160,7 +159,7 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
double ch_width = (area.at({1u}).get()-safety_width) * 0.5;
double ch_length = (area.at({0u}).get()-safety_start) * 0.5;
- saw::data<sch::FixedArray<sch::UInt64,2u>> middle{{meta.at({0u})/2u, meta.at({1u})/2u}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,2u>> middle{{meta.at({0u})/2u, meta.at({1u})/2u}};
// r^2 = (r-w/2)^2 + l^2
double r_c = ch_length * ch_length;
@@ -187,11 +186,11 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set channel circular obstacle
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
- saw::data<sch::FixedArray<sch::UInt64,2u>> area{{meta.at({0u})-4u, meta.at({1u})-4u}};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,2u>> area{{meta.at({0u})-4u, meta.at({1u})-4u}};
double pos_x = 0.8 * area.at({0u}).get();
double pos_y = 0.5 * area.at({1u}).get();
@@ -207,11 +206,11 @@ void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
}, {{0u,0u}}, meta, {{2u,2u}});
}
-void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+void set_initial_conditions(kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
using namespace kel::lbm;
- saw::data<sch::T> rho{1.0};
- saw::data<sch::FixedArray<sch::T,sch::D2Q9::D>> vel{{0.0,0.0}};
+ kel::lbm::data<sch::T> rho{1.0};
+ kel::lbm::data<sch::FixedArray<sch::T,sch::D2Q9::D>> vel{{0.0,0.0}};
auto eq = equilibrium<sch::T,sch::D2Q9>(rho, vel);
auto meta = latt.meta();
@@ -219,12 +218,12 @@ void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
/**
* Set distribution
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& dfs = cell.template get<"dfs">();
auto& dfs_old = cell.template get<"dfs_old">();
- for(saw::data<sch::UInt64> k = 0; k < saw::data<sch::UInt64>{sch::D2Q9::Q}; ++k){
+ for(kel::lbm::data<sch::UInt64> k = 0; k < kel::lbm::data<sch::UInt64>{sch::D2Q9::Q}; ++k){
dfs(k) = eq.at(k);
dfs_old(k) = eq.at(k);
}
@@ -234,7 +233,7 @@ void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
void add_particles(kel::lbm::particle_system<kel::lbm::sch::T,2u>& part_sys){
using namespace kel::lbm;
- saw::data<sch::Particle<sch::T,2u>> part;
+ kel::lbm::data<sch::Particle<sch::T,2u>> part;
auto& p_mask = part.template get<"mask">();
auto& p_mass = part.template get<"mass">();
@@ -243,7 +242,7 @@ void add_particles(kel::lbm::particle_system<kel::lbm::sch::T,2u>& part_sys){
p_mask = geo.template generate_mask<sch::T>(10u,0u);
auto& p_grid = p_mask.template get<"grid">();
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& p_grid_cell = p_grid.at(index);
p_mass = p_mass + p_grid_cell;
}, {{0u,0u}}, p_grid.dims());
@@ -263,8 +262,8 @@ void add_particles(kel::lbm::particle_system<kel::lbm::sch::T,2u>& part_sys){
for(uint64_t i = 0; i < 10; ++i){
for(uint64_t j = 0; j < 15; ++j){
- pos.at({{0u}}) = {static_cast<typename saw::native_data_type<sch::T>::type>(16u + j * 11u)};
- pos.at({{1u}}) = {static_cast<typename saw::native_data_type<sch::T>::type>(16u + i * 11u)};
+ pos.at({{0u}}) = {static_cast<typename kel::lbm::native_data_type<sch::T>::type>(16u + j * 11u)};
+ pos.at({{1u}}) = {static_cast<typename kel::lbm::native_data_type<sch::T>::type>(16u + i * 11u)};
old_pos = pos;
auto eov = part_sys.add_particle(part);
@@ -277,9 +276,9 @@ void add_particles(kel::lbm::particle_system<kel::lbm::sch::T,2u>& part_sys){
void couple_particles_to_lattice(
kel::lbm::particle_system<kel::lbm::sch::T,2u>& part_sys,
- saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt,
- saw::data<kel::lbm::sch::Array<kel::lbm::sch::MacroStruct<kel::lbm::sch::T,kel::lbm::sch::D2Q9::D>,kel::lbm::sch::D2Q9::D>>& macros,
- saw::data<kel::lbm::sch::UInt64> time_step
+ kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt,
+ kel::lbm::data<kel::lbm::sch::Array<kel::lbm::sch::MacroStruct<kel::lbm::sch::T,kel::lbm::sch::D2Q9::D>,kel::lbm::sch::D2Q9::D>>& macros,
+ kel::lbm::data<kel::lbm::sch::UInt64> time_step
){
using namespace kel::lbm;
(void) time_step;
@@ -287,7 +286,7 @@ void couple_particles_to_lattice(
auto meta = latt.meta();
using dfi = df_info<sch::T,sch::D2Q9>;
- for(saw::data<sch::UInt64> i{0u}; i < part_sys.size(); ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < part_sys.size(); ++i){
auto& part = part_sys.at(i);
auto& p_rb = part.template get<"rigid_body">();
@@ -307,15 +306,15 @@ void couple_particles_to_lattice(
// Temporary unused due to me trying to debug freaking particle wall phasing
// Rotated x-dir
- saw::data<sch::FixedArray<sch::T,2u>> x_dir{{
- p_size * saw::data<sch::T>{std::cos(p_rot.get())},
- p_size * saw::data<sch::T>{-std::sin(p_rot.get())}
+ kel::lbm::data<sch::FixedArray<sch::T,2u>> x_dir{{
+ p_size * kel::lbm::data<sch::T>{std::cos(p_rot.get())},
+ p_size * kel::lbm::data<sch::T>{-std::sin(p_rot.get())}
}};
// Rotated y-dir
- saw::data<sch::FixedArray<sch::T,2u>> y_dir{{
- p_size * saw::data<sch::T>{std::sin(p_rot.get())},
- p_size * saw::data<sch::T>{std::cos(p_rot.get())}
+ kel::lbm::data<sch::FixedArray<sch::T,2u>> y_dir{{
+ p_size * kel::lbm::data<sch::T>{std::sin(p_rot.get())},
+ p_size * kel::lbm::data<sch::T>{std::cos(p_rot.get())}
}};
auto& p_mask_grid = p_mask.template get<"grid">();
@@ -328,26 +327,26 @@ void couple_particles_to_lattice(
// Particle to Fluid Coupling
// Spread force to close fluid cells
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
(void)index;
}, {{0u,0u}}, p_mask_grid_dims);
// Fluid to Particle Coupling
// Prepare force sum
- // saw::data<sch::Vector<sch::T,2u>> forces;
+ // kel::lbm::data<sch::Vector<sch::T,2u>> forces;
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
if(p_mask_grid.at(index).get() == 0){
return;
}
- saw::data<sch::Vector<sch::T,2u>> index_shift;
+ kel::lbm::data<sch::Vector<sch::T,2u>> index_shift;
for(uint64_t i = 0u; i < sch::D2Q9::D; ++i){
index_shift.at({{i}}) = index.at({i}).template cast_to<sch::T>() - center_of_mass.at({{i}});
}
- saw::data<sch::Vector<sch::T,2u>> mask_shift;
+ kel::lbm::data<sch::Vector<sch::T,2u>> mask_shift;
for(uint64_t i = 0u; i < sch::D2Q9::D; ++i){
// Technically rotate and adjust here
mask_shift.at({{i}}) = index_shift.at({{i}});
@@ -357,7 +356,7 @@ void couple_particles_to_lattice(
// Cast down to get lower corner.
// Before casting shift by 0.5 for closest pick
- saw::data<sch::FixedArray<sch::UInt64,2u>> p_cell_pos;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,2u>> p_cell_pos;
{
p_cell_pos.at({{0u}}) = {static_cast<uint64_t>(p_pos_lie.at({{0u}}).get()+0.5)};
p_cell_pos.at({{1u}}) = {static_cast<uint64_t>(p_pos_lie.at({{1u}}).get()+0.5)};
@@ -374,7 +373,7 @@ void couple_particles_to_lattice(
// p_pos - p_pos_old
// auto p_vel_rel = closest_u - p_vel;
- saw::data<sch::Vector<sch::T, 2u>> p_vel_rel = closest_u - p_vel;
+ kel::lbm::data<sch::Vector<sch::T, 2u>> p_vel_rel = closest_u - p_vel;
{
p_vel_rel.at({{0u}}) = p_vel_rel.at({{0u}}) / p_mass;
p_vel_rel.at({{1u}}) = p_vel_rel.at({{1u}}) / p_mass;
@@ -385,7 +384,7 @@ void couple_particles_to_lattice(
p_acc = p_acc + p_vel_rel;
/*
- for(saw::data<sch::UInt64> i{0u}; i.get() < 2u; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i.get() < 2u; ++i){
p_cell_pos.at({{1u}}).set(std::max(1ul, std::min(p_cell_pos.at({{1u}}).get(), meta.at({1u}).get()-2ul)));
p_acc.at({{i}}) = p_acc.at({{i}}) + p_vel_rel.at({{i}});
}
@@ -393,20 +392,20 @@ void couple_particles_to_lattice(
}, {{0u,0u}}, p_mask_grid.dims());
- saw::data<sch::Vector<sch::T,2u>> solid_normal;
+ kel::lbm::data<sch::Vector<sch::T,2u>> solid_normal;
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
if(p_mask_grid.at(index).get() == 0){
return;
}
- saw::data<sch::Vector<sch::T,2u>> index_shift;
+ kel::lbm::data<sch::Vector<sch::T,2u>> index_shift;
for(uint64_t i = 0; i < sch::D2Q9::D; ++i){
index_shift.at({{i}}) = index.at({i}).template cast_to<sch::T>() - center_of_mass.at({{i}});
}
- saw::data<sch::Vector<sch::T,2u>> mask_shift;
+ kel::lbm::data<sch::Vector<sch::T,2u>> mask_shift;
/*
{
mask_shift.at({{0u}}) = index_shift.at({{0u}}) * x_dir.at({0u}) + index_shift.at({{1u}}) * y_dir.at({0u});
@@ -422,7 +421,7 @@ void couple_particles_to_lattice(
// Cast down to get lower corner.
// Before casting shift by 0.5 for closest pick
- saw::data<sch::FixedArray<sch::UInt64,2u>> p_cell_pos;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,2u>> p_cell_pos;
for(uint64_t i = 0; i < sch::D2Q9::D; ++i){
p_cell_pos.at({{i}}) = {static_cast<uint64_t>(p_pos_lie.at({{i}}).get()+0.5)};
}
@@ -430,7 +429,7 @@ void couple_particles_to_lattice(
p_cell_pos.at({{i}}).set(std::max(1ul, std::min(p_cell_pos.at({{i}}).get(), meta.at({i}).get()-2ul)));
}
- saw::data<sch::Vector<sch::UInt64,2u>> p_vec_cell_pos;
+ kel::lbm::data<sch::Vector<sch::UInt64,2u>> p_vec_cell_pos;
for(uint64_t i = 0; i < sch::D2Q9::D; ++i){
p_vec_cell_pos.at({{i}}) = p_cell_pos.at({i});
}
@@ -446,13 +445,13 @@ void couple_particles_to_lattice(
auto p_pos_rel_vec = p_pos - p_vec_cell_pos.template cast_to<sch::T>();
solid_normal = solid_normal + p_pos_rel_vec;
- p_pos_rel_vec = saw::math::normalize(p_pos_rel_vec);
+ p_pos_rel_vec = kel::lbm::math::normalize(p_pos_rel_vec);
- // solid_normal = saw::math::normalize(solid_normal);
- // auto v_n = saw::math::dot(solid_normal,p_vel + p_acc);
+ // solid_normal = kel::lbm::math::normalize(solid_normal);
+ // auto v_n = kel::lbm::math::dot(solid_normal,p_vel + p_acc);
{
- saw::data<sch::Scalar<sch::T>> one;
+ kel::lbm::data<sch::Scalar<sch::T>> one;
one.at({}) = {0.05f};
p_pos_rel_vec.at({{0u}}) = p_pos_rel_vec.at({{0u}}) * one.at({});
@@ -470,8 +469,8 @@ void couple_particles_to_lattice(
*/
/*
- for(saw::data<sch::UInt64> k{0u}; k.get() < sch::D2Q9::Q; ++k){
- auto n_p_cell_pos = saw::data<sch::FixedArray<sch::UInt64,2u>> {{
+ for(kel::lbm::data<sch::UInt64> k{0u}; k.get() < sch::D2Q9::Q; ++k){
+ auto n_p_cell_pos = kel::lbm::data<sch::FixedArray<sch::UInt64,2u>> {{
p_cell_pos.at({{0u}}) + dfi::directions[k.get()][0u],
p_cell_pos.at({{1u}}) + dfi::directions[k.get()][1u]
}};
@@ -486,7 +485,7 @@ void couple_particles_to_lattice(
if(n_info.get() <= 1u or (n_macro_cell_particle.get() != (i.get()+1u) and n_macro_cell_particle.get() > 0u) ) {
// add to p_acc
- saw::data<sch::T> dist_dot{
+ kel::lbm::data<sch::T> dist_dot{
(p_pos.at({{0u}})-n_p_cell_pos.at({{0u}}).template cast_to<sch::T>()) * dfi::directions[dfi::opposite_index[k.get()]][0u]+
(p_pos.at({{1u}})-n_p_cell_pos.at({{1u}}).template cast_to<sch::T>()) * dfi::directions[dfi::opposite_index[k.get()]][1u]
};
@@ -495,10 +494,10 @@ void couple_particles_to_lattice(
// TODO add if particle is close
//auto& n_debug_acc = n_macro_cell.template get<"debug_acceleration">();
- saw::data<sch::Vector<sch::T,sch::D2Q9::D>> push_force;
+ kel::lbm::data<sch::Vector<sch::T,sch::D2Q9::D>> push_force;
{
- push_force.at({{0u}}) = saw::data<sch::Int32>{1000000 * dfi::directions[dfi::opposite_index[k.get()]][0u]}.template cast_to<sch::T>();
- push_force.at({{1u}}) = saw::data<sch::Int32>{1000000 * dfi::directions[dfi::opposite_index[k.get()]][1u]}.template cast_to<sch::T>();
+ push_force.at({{0u}}) = kel::lbm::data<sch::Int32>{1000000 * dfi::directions[dfi::opposite_index[k.get()]][0u]}.template cast_to<sch::T>();
+ push_force.at({{1u}}) = kel::lbm::data<sch::Int32>{1000000 * dfi::directions[dfi::opposite_index[k.get()]][1u]}.template cast_to<sch::T>();
}
//n_debug_acc = n_debug_acc + push_force;
@@ -513,10 +512,10 @@ void couple_particles_to_lattice(
}, {{0u,0u}}, p_mask_grid.dims());
- solid_normal = saw::math::normalize(solid_normal);
+ solid_normal = kel::lbm::math::normalize(solid_normal);
// Calculate orientation (Leaving wall or particle "< 0" or not "> 0")
- auto v_n = saw::math::dot(solid_normal, (p_vel + p_acc));
+ auto v_n = kel::lbm::math::dot(solid_normal, (p_vel + p_acc));
if(v_n.at({}).get() < 0.0){
auto v_n_2 = v_n + v_n;
@@ -531,8 +530,8 @@ void couple_particles_to_lattice(
}
void lbm_step(
- saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt,
- saw::data<kel::lbm::sch::Array<kel::lbm::sch::MacroStruct<kel::lbm::sch::T,kel::lbm::sch::D2Q9::D>,kel::lbm::sch::D2Q9::D>>& macros,
+ kel::lbm::data<kel::lbm::sch::CavityFieldD2Q9>& latt,
+ kel::lbm::data<kel::lbm::sch::Array<kel::lbm::sch::MacroStruct<kel::lbm::sch::T,kel::lbm::sch::D2Q9::D>,kel::lbm::sch::D2Q9::D>>& macros,
uint64_t time_step
){
using namespace kel::lbm;
@@ -554,7 +553,7 @@ void lbm_step(
/**
* Collision
*/
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& info = cell.template get<"info">();
@@ -587,7 +586,7 @@ void lbm_step(
}, {{0u,0u}}, meta);
// Stream
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = latt(index);
auto& df_new = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">();
auto& info_new = cell.template get<"info">();
@@ -620,7 +619,7 @@ void lbm_step(
*/
-saw::error_or<void> real_main(int argc, char** argv){
+kel::lbm::error_or<void> real_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<sch::T,sch::D2Q9>;
@@ -632,7 +631,7 @@ saw::error_or<void> real_main(int argc, char** argv){
- saw::data<sch::LbmArgs<sch::T>> args;
+ kel::lbm::data<sch::LbmArgs<sch::T>> args;
auto& conf = args.template get<"args">();
{
conf.template get<"delta_x">() = 1.0f;
@@ -648,8 +647,8 @@ saw::error_or<void> real_main(int argc, char** argv){
*/
}
{
- saw::data<sch::LbmArgs<sch::T>, saw::encode::Args> args_enc{argc,argv};
- saw::codec<sch::LbmArgs<sch::T>, saw::encode::Args> args_codec;
+ kel::lbm::data<sch::LbmArgs<sch::T>, saw::encode::Args> args_enc{argc,argv};
+ kel::lbm::codec<sch::LbmArgs<sch::T>, saw::encode::Args> args_codec;
auto eov = args_codec.decode(args_enc, args);
if(eov.is_error()){
return eov;
@@ -671,8 +670,8 @@ saw::error_or<void> real_main(int argc, char** argv){
print_lbm_meta<sch::T,sch::Descriptor<2u,9u>>(conv, {conf.template get<"kinematic_viscosity">()});
- saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> dim{{1024u, 128u}};
- saw::data<sch::CavityFieldD2Q9, saw::encode::Native> lattice{dim};
+ kel::lbm::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> dim{{1024u, 128u}};
+ kel::lbm::data<sch::CavityFieldD2Q9, kel::lbm::enc::Native> lattice{dim};
auto meta = lattice.meta();
/**
@@ -687,9 +686,9 @@ saw::error_or<void> real_main(int argc, char** argv){
set_geometry(lattice);
{
- saw::data<sch::Array<sch::GeometryStruct<sch::T>, sch::D2Q9::D>> geo{dim};
+ kel::lbm::data<sch::Array<sch::GeometryStruct<sch::T>, sch::D2Q9::D>> geo{dim};
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = lattice(index);
auto& info = cell.template get<"info">();
@@ -705,7 +704,7 @@ saw::error_or<void> real_main(int argc, char** argv){
*/
set_initial_conditions(lattice);
- saw::data<sch::Array<sch::MacroStruct<sch::T,sch::D2Q9::D>,sch::D2Q9::D>> macros{dim};
+ kel::lbm::data<sch::Array<sch::MacroStruct<sch::T,sch::D2Q9::D>,sch::D2Q9::D>> macros{dim};
uint64_t lbm_steps = 10000u;
for(uint64_t i = 0u; i < lbm_steps; ++i){
@@ -714,7 +713,7 @@ saw::error_or<void> real_main(int argc, char** argv){
{
// Stream
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
auto& cell = lattice(index);
auto& dfs = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">();
@@ -726,7 +725,7 @@ saw::error_or<void> real_main(int argc, char** argv){
auto& part_mask = macro_cell.template get<"particle">();
compute_rho_u<sch::T,sch::D2Q9>(dfs,rho,vel);
- rho = rho * saw::data<sch::T>{dfi::cs2};
+ rho = rho * kel::lbm::data<sch::T>{dfi::cs2};
for(uint64_t d = 0u; d < sch::D2Q9::D; ++d){
force.at({d}) = cell.template get<"force">()({d});
@@ -735,7 +734,7 @@ saw::error_or<void> real_main(int argc, char** argv){
part_mask.set(0u);
}, {{0u,0u}}, meta);
- for(saw::data<sch::UInt64> i{0u}; i < particle_sys.size(); ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < particle_sys.size(); ++i){
auto& p = particle_sys.at({i});
auto& p_rb = p.template get<"rigid_body">();
@@ -746,23 +745,23 @@ saw::error_or<void> real_main(int argc, char** argv){
auto p_mask_grid_dims = p_mask_grid.dims();
- saw::data<sch::Vector<sch::T,2u>> p_mask_grid_shift;
+ kel::lbm::data<sch::Vector<sch::T,2u>> p_mask_grid_shift;
p_mask_grid_shift.at({{0u}}) = (p_mask_grid_dims.at({0u}).template cast_to<sch::T>() - 1.0) / 2.0;
p_mask_grid_shift.at({{1u}}) = (p_mask_grid_dims.at({1u}).template cast_to<sch::T>() - 1.0) / 2.0;
// Iterate
- iterate_over([&](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
+ iterate_over([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,2u>>& index){
if(p_mask_grid.at(index).get() == 0){
return;
}
- saw::data<sch::Vector<sch::T,2u>> index_shift;
+ kel::lbm::data<sch::Vector<sch::T,2u>> index_shift;
index_shift.at({{0u}}) = index.at({0u}).template cast_to<sch::T>() - p_mask_grid_shift.at({{0u}});
index_shift.at({{1u}}) = index.at({1u}).template cast_to<sch::T>() - p_mask_grid_shift.at({{1u}});
- saw::data<sch::Vector<sch::T,2u>> mask_shift;
+ kel::lbm::data<sch::Vector<sch::T,2u>> mask_shift;
for(uint64_t i = 0; i < sch::D2Q9::D; ++i){
// Technically rotate and adjust here
mask_shift.at({{i}}) = index_shift.at({{i}});
@@ -772,7 +771,7 @@ saw::error_or<void> real_main(int argc, char** argv){
// Cast down to get lower corner.
// Before casting shift by 0.5 for closest pick
- saw::data<sch::FixedArray<sch::UInt64,2u>> p_cell_pos {{
+ kel::lbm::data<sch::FixedArray<sch::UInt64,2u>> p_cell_pos {{
static_cast<uint64_t>(p_pos_lie.at({{0u}}).get()+0.5),
static_cast<uint64_t>(p_pos_lie.at({{1u}}).get()+0.5)
}};
@@ -801,7 +800,7 @@ saw::error_or<void> real_main(int argc, char** argv){
lbm_step(lattice, macros, i);
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
int main(int argc, char** argv){
diff --git a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp
index ac5c94e..cd5d944 100644
--- a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp
+++ b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp
@@ -41,7 +41,6 @@ constexpr std::array<uint64_t,2u> dims{
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
template<uint64_t N>
using InfoChunk = Chunk<UInt8, 0u, dim_x*N, dim_y*N>;
diff --git a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp
index 45cbaa2..c8e2cc9 100644
--- a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp
+++ b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp
@@ -6,11 +6,11 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll, uint64_t N>
-saw::error_or<void> init(
+kel::lbm::error_or<void> init(
const converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc,N>>& fields,
- saw::data<sch::MacroStruct<T,Desc,N>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+ kel::lbm::data<sch::ChunkStruct<T,Desc,N>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc,N>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
(void) conv;
@@ -94,10 +94,10 @@ saw::error_or<void> init(
);
{
- saw::data<sch::Scalar<T>> radius_p;
+ kel::lbm::data<sch::Scalar<T>> radius_p;
radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get());
std::cout<<"RADIUS: "<<radius_p.at({}).get()<<std::endl;
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
particles = create_spheroid_particle_group<T,Desc::D,1u>(radius_p, dense_p, {{64u}});
auto& parts = particles.template get<"particles">();
@@ -114,7 +114,7 @@ saw::error_or<void> init(
}
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
index 71410b2..2d389d1 100644
--- a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
+++ b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
@@ -8,7 +8,6 @@
* For deciding what parameters to use maybe?
*/
namespace args {
-using namespace saw::schema;
using LbmArgsStruct = Struct<
Member<String, "coupling">
@@ -21,7 +20,7 @@ using LbmArgs = Args<
}
template<typename T, typename Desc, typename Coll, uint64_t N>
-saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
+kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){
using namespace kel::lbm;
auto& an = args.template get<"args">();
@@ -40,7 +39,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -55,16 +54,17 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
std::cout<<"Inflow free flow velocity: "<<conv.velocity_si_to_lbm({0.3}).handle().get()<<std::endl;
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc,N>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc,N>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc,N>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc,N>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc,N>,sch::MacroStruct<T,Desc,N>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -90,9 +90,9 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
- saw::data<sch::ChunkStruct<T,Desc,N>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc,N>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc,N>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc,N>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
sycl_q.wait();
{
@@ -118,11 +118,11 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_particle_data);
- saw::data<sch::UInt64> time_steps{64u*1024ul * N * N};
+ kel::lbm::data<sch::UInt64> time_steps{64u*1024ul * N * N};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc,Coll,N>(conv,lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -148,10 +148,10 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x*N,dim_y*N}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -192,16 +192,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
using DescT = kel::lbm::sch::D2Q9;
-saw::error_or<void> k_main(int argc, char** argv){
+kel::lbm::error_or<void> k_main(int argc, char** argv){
using namespace kel::lbm;
- saw::data<args::LbmArgs> args;
+ kel::lbm::data<args::LbmArgs> args;
{
auto eov = saw::parse_args(args,argc,argv);
if(eov.is_error()){
@@ -219,7 +219,7 @@ saw::error_or<void> k_main(int argc, char** argv){
return lbm_main<FloatT,DescT,method::Psm,1u>(args);
}
- return saw::make_error<saw::err::critical>("Invalid coupling");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Invalid coupling");
}
diff --git a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
index 3e5f9ba..080d27d 100644
--- a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
+++ b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
@@ -6,15 +6,15 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll, uint64_t N>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
const converter<T>& conv,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc,N>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc,N>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc,N>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc,N>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
- static constexpr saw::data<sch::UInt64> sub_steps{0u};
+ static constexpr kel::lbm::data<sch::UInt64> sub_steps{0u};
auto& q = dev.get_handle();
auto& info_f = fields.template get<"info">();
@@ -22,9 +22,9 @@ saw::error_or<void> step(
if constexpr ( std::is_same_v<Coll, method::Hlbm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmReset,encode::Sycl<saw::encode::Native>> hlbm_reset;
+ component<T,Desc,cmpt::HlbmReset,encode::Sycl<kel::lbm::enc::Native>> hlbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x*N,dim_y*N}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -33,10 +33,10 @@ saw::error_or<void> step(
});
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part;
+ component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> hlbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -46,12 +46,12 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.59};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.59};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x*N,dim_y*N}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -69,12 +69,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -95,9 +95,9 @@ saw::error_or<void> step(
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::FpLbm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::FpLbmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x*N,dim_y*N}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -107,10 +107,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+ component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -121,13 +121,13 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{0.59};
- component<T,Desc,cmpt::FpLbm,encode::Sycl<saw::encode::Native>> collision{0.59};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{0.59};
+ component<T,Desc,cmpt::FpLbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.59};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x*N,dim_y*N}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -145,12 +145,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -171,9 +171,9 @@ saw::error_or<void> step(
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::Psm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::PsmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x*N,dim_y*N}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -183,10 +183,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+ component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -197,13 +197,13 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{0.59};
- component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{0.59};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{0.59};
+ component<T,Desc,cmpt::Psm,encode::Sycl<kel::lbm::enc::Native>> collision{0.59};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x*N,dim_y*N}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -221,12 +221,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -248,7 +248,7 @@ saw::error_or<void> step(
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/settling_cubes_2d_ibm_gpu/sim.cpp b/examples/settling_cubes_2d_ibm_gpu/sim.cpp
index d7c51bc..50e6ce5 100644
--- a/examples/settling_cubes_2d_ibm_gpu/sim.cpp
+++ b/examples/settling_cubes_2d_ibm_gpu/sim.cpp
@@ -17,7 +17,6 @@ constexpr uint64_t dim_y = dim_x * 2ul;
constexpr uint64_t particle_amount = 16ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -66,10 +65,10 @@ using ParticleGroups = Tuple<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -111,7 +110,7 @@ saw::error_or<void> setup_initial_conditions(
// Particles
{
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
// auto& spheroid_group = particles.template get<0u>();
auto& spheroid_group = particles;
@@ -147,15 +146,15 @@ saw::error_or<void> setup_initial_conditions(
// Particle in hacky flavour
{}
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& p_group,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& p_group,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -170,7 +169,7 @@ saw::error_or<void> step(
q.submit([&](acpp::sycl::handler& h){
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -183,14 +182,14 @@ saw::error_or<void> step(
q.submit([&](acpp::sycl::handler& h){
h.parallel_for(acpp::sycl::range<1u>{p_meta.at({0u}).get()}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
auto& p = parts.at(index);
auto& p_rb = p.template get<"rigid_body">();
- saw::data<sch::Scalar<T>> delta_t;
+ kel::lbm::data<sch::Scalar<T>> delta_t;
delta_t.at({}).set(1.0f);
auto& p_pos = p_rb.template get<"position">();
@@ -200,12 +199,12 @@ saw::error_or<void> step(
iterator<Desc::D>::apply(
[&](auto& m_ind){
- saw::data<sch::Vector<T,Desc::D>> index_shift;
+ kel::lbm::data<sch::Vector<T,Desc::D>> index_shift;
for(uint64_t i{0u}; i < Desc::D; ++i){
index_shift.at({{i}}) = m_ind.at({i}).template cast_to<T>() - (vels.meta().at({i})+1u).template cast_to<T>() * 0.5;
}
- saw::data<sch::Vector<T,Desc::D>> transformed_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> transformed_pos;
for(uint64_t i{0u}; i < Desc::D; ++i){
// TODO add rotation, scaling here.
transformed_pos.at({{i}}) = index_shift.at({{i}});
@@ -215,8 +214,8 @@ saw::error_or<void> step(
auto p_pos_lag = p_pos + transformed_pos;
// Pick the closest momentum and clamp it
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> p_cell_pos;
- saw::data<sch::Vector<sch::UInt64,Desc::D>> p_cell_pos_vec;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> p_cell_pos;
+ kel::lbm::data<sch::Vector<sch::UInt64,Desc::D>> p_cell_pos_vec;
for(uint64_t i{0u}; i < Desc::D; ++i){
p_cell_pos.at({{i}}) = (p_pos_lag.at({{i}}) + 0.5).template cast_to<sch::UInt64>();
p_cell_pos.at({{i}}).set(std::max(0ul,std::min(p_cell_pos.at({{i}}).get(), vels.meta().at({{i}}).get() - 2ul)));
@@ -230,7 +229,7 @@ saw::error_or<void> step(
auto p_vel = (p_pos - p_rb.template get<"position_old">()) * delta_t;
- auto u_solid = p_vel + saw::math::cross(p_rot,rel_cell_to_part_pos);
+ auto u_solid = p_vel + kel::lbm::math::cross(p_rot,rel_cell_to_part_pos);
// Force
auto force = (u_solid - u_fluid) / delta_t;
@@ -252,11 +251,11 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
// Need nicer things to handle the flow. I see improvement here
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -285,13 +284,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -308,7 +307,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -321,18 +320,19 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.05},{0.01},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
- // auto lbm_particles_ptr = saw::heap<saw::data<sch::FixedArray<sch::ParticleRigidBody<T,Desc::D>,part_count>>>();
- // saw::data<sch::Array<T,Desc::D>> p_mask;
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // auto lbm_particles_ptr = kel::lbm::heap<kel::lbm::data<sch::FixedArray<sch::ParticleRigidBody<T,Desc::D>,part_count>>>();
+ // kel::lbm::data<sch::Array<T,Desc::D>> p_mask;
std::cout<<"Estimated Bytes of LBM Fields: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -364,9 +364,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
{
auto eov = dev.copy_to_device(*lbm_data_ptr,lbm_sycl_data);
@@ -398,11 +398,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
return eov;
}
}
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -443,10 +443,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
*/
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -482,7 +482,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/settling_spheres_2d_hlbm_gpu/sim.cpp b/examples/settling_spheres_2d_hlbm_gpu/sim.cpp
index 5913a1f..26c2ed8 100644
--- a/examples/settling_spheres_2d_hlbm_gpu/sim.cpp
+++ b/examples/settling_spheres_2d_hlbm_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_y = dim_x * 2ul;
constexpr uint64_t particle_amount = 16ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -64,10 +63,10 @@ using ParticleSpheroidGroup = ParticleGroup<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& p_group
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& p_group
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -109,7 +108,7 @@ saw::error_or<void> setup_initial_conditions(
// Particles
{
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
// auto& spheroid_group = particles.template get<0u>();
auto& spheroid_group = particles;
@@ -133,7 +132,7 @@ saw::error_or<void> setup_initial_conditions(
auto& p_rb = p_ind.template get<"rigid_body">();
auto& p_pos = p_rb.template get<"position">();
- saw::data<sch::Vector<T,Desc::D>> p;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p;
uint64_t x = index.at({0u}).get() % 8u;
uint64_t y = index.at({1u}).get() / 8u;
p.at({{0u}}).set( 0.2 + 0.6 / (x-1u) );
@@ -152,15 +151,15 @@ saw::error_or<void> setup_initial_conditions(
// Particle in hacky flavour
{}
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& p_group,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& p_group,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -175,7 +174,7 @@ saw::error_or<void> step(
q.submit([&](acpp::sycl::handler& h){
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -185,7 +184,7 @@ saw::error_or<void> step(
q.submit([&](acpp::sycl::handler& h){
h.parallel_for(acpp::sycl::range<1u>{p_meta.at({0u}).get()}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -197,7 +196,7 @@ saw::error_or<void> step(
auto& p_rot = pirb.template get<"rotation">();
auto& p_acc = pirb.template get<"acceleration">();
- saw::data<sch::Scalar<T>> delta_t;
+ kel::lbm::data<sch::Scalar<T>> delta_t;
delta_t.at({}).set(1.0f);
verlet_step_lambda<T,Desc::D>(p,delta_t);
});
@@ -206,11 +205,11 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
// Need nicer things to handle the flow. I see improvement here
- component<T,Desc,cmpt::Hlbm, encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::Hlbm, encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -239,13 +238,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -262,7 +261,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -275,18 +274,19 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.05},{0.01},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
- // auto lbm_particles_ptr = saw::heap<saw::data<sch::FixedArray<sch::ParticleRigidBody<T,Desc::D>,part_count>>>();
- // saw::data<sch::Array<T,Desc::D>> p_mask;
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // auto lbm_particles_ptr = kel::lbm::heap<kel::lbm::data<sch::FixedArray<sch::ParticleRigidBody<T,Desc::D>,part_count>>>();
+ // kel::lbm::data<sch::Array<T,Desc::D>> p_mask;
std::cout<<"Estimated Bytes of LBM Fields: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -318,9 +318,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
{
auto eov = dev.copy_to_device(*lbm_data_ptr,lbm_sycl_data);
@@ -352,11 +352,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
return eov;
}
}
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -397,10 +397,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
*/
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -436,7 +436,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/stdkr_2d_bgk/common.hpp b/examples/stdkr_2d_bgk/common.hpp
index 0b597c0..cac01fd 100644
--- a/examples/stdkr_2d_bgk/common.hpp
+++ b/examples/stdkr_2d_bgk/common.hpp
@@ -30,7 +30,6 @@ constexpr uint64_t dim_x = 220u;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
diff --git a/examples/stdkr_2d_bgk/init.hpp b/examples/stdkr_2d_bgk/init.hpp
index 3127c88..10edd9c 100644
--- a/examples/stdkr_2d_bgk/init.hpp
+++ b/examples/stdkr_2d_bgk/init.hpp
@@ -6,10 +6,10 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> init(
+kel::lbm::error_or<void> init(
const converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
(void) conv;
@@ -92,12 +92,12 @@ saw::error_or<void> init(
iterator<Desc::D>::apply(
[&](const auto& index){
auto& info = info_f.at(index);
- saw::data<sch::Scalar<T>> radius_p;
+ kel::lbm::data<sch::Scalar<T>> radius_p;
radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get());
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
- saw::data<sch::Vector<T,Desc::D>> middle,ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle,ind_vec;
middle.at({{0u}}) = conv.meter_si_to_lbm({{0.16}}).handle();
middle.at({{1u}}) = conv.meter_si_to_lbm({{0.2}}).handle();
@@ -106,7 +106,7 @@ saw::error_or<void> init(
}
auto dist = ind_vec - middle;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}) < radius_p.at({}) * radius_p.at({})){
info_f.at(index) = 1u;
@@ -115,7 +115,7 @@ saw::error_or<void> init(
{},// 0-index
df_f.get_dims()
);
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/stdkr_2d_bgk/sim.cpp b/examples/stdkr_2d_bgk/sim.cpp
index 36147d5..9b9b5a7 100644
--- a/examples/stdkr_2d_bgk/sim.cpp
+++ b/examples/stdkr_2d_bgk/sim.cpp
@@ -9,7 +9,6 @@
* For deciding what parameters to use maybe?
*/
namespace args {
-using namespace saw::schema;
using LbmArgsStruct = Struct<
>;
@@ -21,7 +20,7 @@ using LbmArgs = Args<
}
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
+kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){
using namespace kel::lbm;
auto& an = args.template get<"args">();
@@ -40,7 +39,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -53,15 +52,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
print_lbm_meta<T,Desc>(conv,{1e-3},{1e-4},{0.5 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -93,8 +93,8 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -113,11 +113,11 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{64u*1024ul};
+ kel::lbm::data<sch::UInt64> time_steps{64u*1024ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc,Coll>(conv,lsd_view,lsdm_view,i,dev);
@@ -143,10 +143,10 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -182,16 +182,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
using DescT = kel::lbm::sch::D2Q9;
-saw::error_or<void> k_main(int argc, char** argv){
+kel::lbm::error_or<void> k_main(int argc, char** argv){
using namespace kel::lbm;
- saw::data<args::LbmArgs> args;
+ kel::lbm::data<args::LbmArgs> args;
{
auto eov = saw::parse_args(args,argc,argv);
if(eov.is_error()){
@@ -201,7 +201,7 @@ saw::error_or<void> k_main(int argc, char** argv){
return lbm_main<FloatT,DescT,method::Bgk>(args);
- return saw::make_error<saw::err::critical>("Invalid coupling");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Invalid coupling");
}
diff --git a/examples/stdkr_2d_bgk/step.hpp b/examples/stdkr_2d_bgk/step.hpp
index cbf9f43..67f8486 100644
--- a/examples/stdkr_2d_bgk/step.hpp
+++ b/examples/stdkr_2d_bgk/step.hpp
@@ -6,26 +6,26 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
const converter<T>& conv,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
- static constexpr saw::data<sch::UInt64> sub_steps{0u};
+ static constexpr kel::lbm::data<sch::UInt64> sub_steps{0u};
auto& q = dev.get_handle();
auto& info_f = fields.template get<"info">();
{
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> collision{1.0};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHePressureX<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> collision{1.0};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHePressureX<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -43,12 +43,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -69,7 +69,7 @@ saw::error_or<void> step(
}).wait();
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp b/examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp
index bbe8cfd..ffa921f 100644
--- a/examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp
+++ b/examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 2ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -60,9 +59,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -159,7 +158,7 @@ saw::error_or<void> setup_initial_conditions(
iterator<Desc::D>::apply(
[&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle, ind_vec;
middle.at({{0u}}) = dim_x * 0.5;
middle.at({{1u}}) = dim_y * 0.5;
@@ -167,7 +166,7 @@ saw::error_or<void> setup_initial_conditions(
ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}).get() < dim_y*dim_y*0.01 / 16.0){
info_f.at(index).set(5u);
}
@@ -176,14 +175,14 @@ saw::error_or<void> setup_initial_conditions(
df_f.get_dims()
);
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -191,23 +190,23 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8};
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
auto& collision = bgk;
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<kel::lbm::enc::Native>> abb;
- saw::data<sch::Scalar<T>> eps;
+ kel::lbm::data<sch::Scalar<T>> eps;
eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}).set(dim_y*0.1);
- saw::data<sch::Vector<T,Desc::D>> p_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p_pos;
{
p_pos.at({{0u}}) = dim_x * 0.5;
p_pos.at({{1u}}) = dim_y * 0.5;
}
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>>{
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>>{
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get();
@@ -217,11 +216,11 @@ saw::error_or<void> step(
return vel;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -264,13 +263,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -287,7 +286,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -300,15 +299,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -339,8 +339,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -358,10 +358,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
sycl_q.wait();
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -373,10 +373,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -418,7 +418,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp
index 9cf974a..90a73cd 100644
--- a/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp
+++ b/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 2ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -62,9 +61,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -162,7 +161,7 @@ saw::error_or<void> setup_initial_conditions(
/*
iterator<Desc::D>::apply(
[&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle, ind_vec;
middle.at({{0u}}) = dim_x * 0.25;
middle.at({{1u}}) = dim_y * 0.5;
@@ -170,7 +169,7 @@ saw::error_or<void> setup_initial_conditions(
ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}).get() < dim_y*dim_y*0.01){
porous_f.at(index).at({}) = 1.0;
}
@@ -180,14 +179,14 @@ saw::error_or<void> setup_initial_conditions(
);
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -196,25 +195,25 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8};
- component<T,Desc,cmpt::FpLbmOneParticleNoVelocity,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
+ component<T,Desc,cmpt::FpLbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<kel::lbm::enc::Native>> abb;
- saw::data<sch::Scalar<T>> eps;
+ kel::lbm::data<sch::Scalar<T>> eps;
eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}).set(dim_y*0.1/4.0);
- saw::data<sch::Vector<T,Desc::D>> p_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p_pos;
{
p_pos.at({{0u}}) = dim_x * 0.5;
p_pos.at({{1u}}) = dim_y * 0.5;
}
- component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps};
+ component<T,Desc,cmpt::OneParticleAt,encode::Sycl<kel::lbm::enc::Native>> opa{p_pos,rad,eps};
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>>{
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>>{
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get();
@@ -224,10 +223,10 @@ saw::error_or<void> step(
return vel;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -271,13 +270,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -294,7 +293,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -307,15 +306,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -346,8 +346,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -366,11 +366,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -382,10 +382,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -427,7 +427,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
index b63a003..0fe76cb 100644
--- a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
+++ b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
@@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 2ul;
// constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -59,9 +58,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -159,7 +158,7 @@ saw::error_or<void> setup_initial_conditions(
/*
iterator<Desc::D>::apply(
[&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
+ kel::lbm::data<sch::Vector<T,Desc::D>> middle, ind_vec;
middle.at({{0u}}) = dim_x * 0.25;
middle.at({{1u}}) = dim_y * 0.5;
@@ -167,7 +166,7 @@ saw::error_or<void> setup_initial_conditions(
ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
+ auto dist_2 = kel::lbm::math::dot(dist,dist);
if(dist_2.at({}).get() < dim_y*dim_y*0.01){
porous_f.at(index).at({}) = 0.0;
}
@@ -177,14 +176,14 @@ saw::error_or<void> setup_initial_conditions(
);
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -193,28 +192,28 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8};
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::HlbmOneParticleMomentumExchange,encode::Sycl<saw::encode::Native>> one_part_moment;
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> one_part_moment;
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<kel::lbm::enc::Native>> abb;
- saw::data<sch::Scalar<T>> eps;
+ kel::lbm::data<sch::Scalar<T>> eps;
eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}).set(dim_y*0.1/4.0);
- saw::data<sch::Vector<T,Desc::D>> p_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p_pos;
{
p_pos.at({{0u}}) = dim_x * 0.5;
p_pos.at({{1u}}) = dim_y * 0.5;
}
- component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps};
+ component<T,Desc,cmpt::OneParticleAt,encode::Sycl<kel::lbm::enc::Native>> opa{p_pos,rad,eps};
- component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg;
+ component<T,Desc,cmpt::ForceGather, encode::Sycl<kel::lbm::enc::Native>> fg;
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>>{
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>>{
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get();
@@ -224,10 +223,10 @@ saw::error_or<void> step(
return vel;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -272,13 +271,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -295,7 +294,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -308,15 +307,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -348,8 +348,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -368,11 +368,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -383,10 +383,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
sycl_q.wait();
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -427,7 +427,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp
index 6b86c68..652309c 100644
--- a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp
+++ b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp
@@ -17,7 +17,6 @@ constexpr uint64_t dim_x = dim_y * 2ul;
// constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
@@ -60,9 +59,9 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros
+kel::lbm::error_or<void> setup_initial_conditions(
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros
){
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
@@ -159,14 +158,14 @@ saw::error_or<void> setup_initial_conditions(
{{1u,1u}}
);
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+kel::lbm::error_or<void> step(
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -174,25 +173,25 @@ saw::error_or<void> step(
auto& porous_f = macros.template get<"porosity">();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8};
- component<T,Desc,cmpt::PSM,encode::Sycl<saw::encode::Native>> collision{0.8};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> bgk{0.8};
+ component<T,Desc,cmpt::PSM,encode::Sycl<kel::lbm::enc::Native>> collision{0.8};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<kel::lbm::enc::Native>> abb;
- saw::data<sch::Scalar<T>> eps;
+ kel::lbm::data<sch::Scalar<T>> eps;
eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
+ kel::lbm::data<sch::Scalar<T>> rad;
rad.at({}).set(dim_y*0.1 / 4.0);
- saw::data<sch::Vector<T,Desc::D>> p_pos;
+ kel::lbm::data<sch::Vector<T,Desc::D>> p_pos;
{
p_pos.at({{0u}}) = dim_x * 0.5;
p_pos.at({{1u}}) = dim_y * 0.5;
}
- component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps};
+ component<T,Desc,cmpt::OneParticleAt,encode::Sycl<kel::lbm::enc::Native>> opa{p_pos,rad,eps};
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>>{
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>>{
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get();
@@ -202,12 +201,12 @@ saw::error_or<void> step(
return vel;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
- component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg;
+ component<T,Desc,cmpt::ForceGather, encode::Sycl<kel::lbm::enc::Native>> fg;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -253,13 +252,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -276,7 +275,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -289,15 +288,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{1e-4},{0.4 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -329,8 +329,8 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
sycl_q.wait();
{
@@ -349,11 +349,11 @@ saw::error_or<void> lbm_main(int argc, char** argv){
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+ kel::lbm::data<sch::UInt64> time_steps{16u*4096ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc>(lsd_view,lsdm_view,i,dev);
@@ -396,10 +396,10 @@ saw::error_or<void> lbm_main(int argc, char** argv){
*/
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -441,7 +441,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
diff --git a/examples/throat_clog_2d/common.hpp b/examples/throat_clog_2d/common.hpp
index 15fe08a..d74b2f9 100644
--- a/examples/throat_clog_2d/common.hpp
+++ b/examples/throat_clog_2d/common.hpp
@@ -28,7 +28,6 @@ constexpr uint64_t dim_x = dim_y * 4ul;
constexpr uint64_t particle_amount = 1ul;
namespace sch {
-using namespace saw::schema;
using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>;
diff --git a/examples/throat_clog_2d/init.hpp b/examples/throat_clog_2d/init.hpp
index 68b2aaa..f76cd67 100644
--- a/examples/throat_clog_2d/init.hpp
+++ b/examples/throat_clog_2d/init.hpp
@@ -6,11 +6,11 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> init(
+kel::lbm::error_or<void> init(
const converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>& particles
){
(void) conv;
@@ -44,11 +44,11 @@ saw::error_or<void> init(
auto w2 = w * 0.5;
auto h4 = h * 0.25;
- saw::data<T> e{0.1};
- saw::data<T> c = w * (saw::data<T>{1.0} - e) * 0.5;
+ kel::lbm::data<T> e{0.1};
+ kel::lbm::data<T> c = w * (kel::lbm::data<T>{1.0} - e) * 0.5;
- saw::data<T> d{0.2};
- auto b = h * (saw::data<T>{1.0} - d) * 0.5;
+ kel::lbm::data<T> d{0.2};
+ auto b = h * (kel::lbm::data<T>{1.0} - d) * 0.5;
auto p_r = (c*c + b*b) / (b*2);
auto p_r_2 = p_r * p_r;
@@ -56,14 +56,14 @@ saw::error_or<void> init(
auto p_i = p_r - b;
// Circle Top
- saw::data<sch::FixedArray<sch::Int64,Desc::D>> top_pos;
+ kel::lbm::data<sch::FixedArray<sch::Int64,Desc::D>> top_pos;
{
top_pos.at({0u}) = w2.get();
top_pos.at({1u}) = (h + p_i).get();
}
// Circle Bot
- saw::data<sch::FixedArray<sch::Int64,Desc::D>> bot_pos;
+ kel::lbm::data<sch::FixedArray<sch::Int64,Desc::D>> bot_pos;
{
bot_pos.at({0u}) = w2.get();
bot_pos.at({1u}) = -p_i.get();
@@ -80,11 +80,11 @@ saw::error_or<void> init(
bp_diff.at(i) = bot_pos.at(i) - index.at(i).template cast_to<sch::Int64>();
}
- auto tpd_v = saw::math::vectorize_data(tp_diff);
- auto tpd_dot = saw::math::dot(tpd_v,tpd_v);
+ auto tpd_v = kel::lbm::math::vectorize_data(tp_diff);
+ auto tpd_dot = kel::lbm::math::dot(tpd_v,tpd_v);
- auto bpd_v = saw::math::vectorize_data(bp_diff);
- auto bpd_dot = saw::math::dot(bpd_v,bpd_v);
+ auto bpd_v = kel::lbm::math::vectorize_data(bp_diff);
+ auto bpd_dot = kel::lbm::math::dot(bpd_v,bpd_v);
if(
(tpd_dot.at({}).template cast_to<T>() <= p_r_2 ) or
@@ -157,10 +157,10 @@ saw::error_or<void> init(
);
{
- saw::data<sch::Scalar<T>> radius_p;
+ kel::lbm::data<sch::Scalar<T>> radius_p;
radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get());
std::cout<<"RADIUS: "<<radius_p.at({}).get()<<std::endl;
- saw::data<sch::Scalar<T>> dense_p;
+ kel::lbm::data<sch::Scalar<T>> dense_p;
dense_p.at({}).set(1);
particles = create_spheroid_particle_group<T,Desc::D,1u>(radius_p, dense_p, {{64u}});
auto& parts = particles.template get<"particles">();
@@ -177,7 +177,7 @@ saw::error_or<void> init(
}
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
diff --git a/examples/throat_clog_2d/sim.cpp b/examples/throat_clog_2d/sim.cpp
index 4084353..118e1b1 100644
--- a/examples/throat_clog_2d/sim.cpp
+++ b/examples/throat_clog_2d/sim.cpp
@@ -8,7 +8,6 @@
* For deciding what parameters to use maybe?
*/
namespace args {
-using namespace saw::schema;
using LbmArgsStruct = Struct<
Member<String, "coupling">
@@ -22,7 +21,7 @@ using LbmArgs = Args<
}
template<typename T, typename Desc, typename Coll, uint64_t N>
-saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
+kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){
using namespace kel::lbm;
auto& an = args.template get<"args">();
@@ -41,7 +40,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
std::error_code ec;
std::filesystem::create_directories(out_dir,ec);
if(ec != std::errc{}){
- return saw::make_error<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -54,16 +53,17 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
print_lbm_meta<T,Desc>(conv,{1e-3},{1e-4},{0.2 * dim_y});
- // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::ParticleSpheroidGroup<T,Desc>>>();
+ // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ std::string{eo_aio.get_error().get_message()});
}
auto& aio = eo_aio.get_value();
saw::wait_scope wait{aio.event_loop};
@@ -101,9 +101,9 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
sycl_q.wait();
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::ParticleSpheroidGroup<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
sycl_q.wait();
{
@@ -129,11 +129,11 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_particle_data);
- saw::data<sch::UInt64> time_steps{256u*512ul};
+ kel::lbm::data<sch::UInt64> time_steps{256u*512ul};
auto& info_f = lsd_view.template get<"info">();
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
// BC + Collision
{
auto eov = step<T,Desc,Coll>(conv,lsd_view,lsdm_view,lsdp_view,i,dev);
@@ -159,10 +159,10 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
// Stream
sycl_q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -203,16 +203,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;
using DescT = kel::lbm::sch::D2Q9;
-saw::error_or<void> k_main(int argc, char** argv){
+kel::lbm::error_or<void> k_main(int argc, char** argv){
using namespace kel::lbm;
- saw::data<args::LbmArgs> args;
+ kel::lbm::data<args::LbmArgs> args;
{
auto eov = saw::parse_args(args,argc,argv);
if(eov.is_error()){
@@ -222,11 +222,11 @@ saw::error_or<void> k_main(int argc, char** argv){
auto& an = args.template get<"args">();
auto& coupling = an.template get<"coupling">();
- auto resolution_resolve = [&]<typename Cpl>() -> saw::error_or<void>{
+ auto resolution_resolve = [&]<typename Cpl>() -> kel::lbm::error_or<void>{
return lbm_main<FloatT,DescT,Cpl,1u>(args);
};
- auto coupling_resolve = [&]() -> saw::error_or<void> {
+ auto coupling_resolve = [&]() -> kel::lbm::error_or<void> {
if(coupling.stl_view() == "hlbm"){
return resolution_resolve.template operator()<method::Hlbm>();
} else if(coupling.stl_view() == "fplbm"){
@@ -238,7 +238,7 @@ saw::error_or<void> k_main(int argc, char** argv){
return coupling_resolve();
- return saw::make_error<saw::err::critical>("Invalid coupling");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Invalid coupling");
}
diff --git a/examples/throat_clog_2d/step.hpp b/examples/throat_clog_2d/step.hpp
index dab9178..840f8ba 100644
--- a/examples/throat_clog_2d/step.hpp
+++ b/examples/throat_clog_2d/step.hpp
@@ -6,15 +6,15 @@ namespace kel {
namespace lbm {
template<typename T, typename Desc, typename Coll>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
const converter<T>& conv,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
- saw::data<sch::UInt64> t_i,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& particles,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
- static constexpr saw::data<sch::UInt64> sub_steps{0u};
+ static constexpr kel::lbm::data<sch::UInt64> sub_steps{0u};
auto& q = dev.get_handle();
auto& info_f = fields.template get<"info">();
@@ -22,9 +22,9 @@ saw::error_or<void> step(
if constexpr ( std::is_same_v<Coll, method::Hlbm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmReset,encode::Sycl<saw::encode::Native>> hlbm_reset;
+ component<T,Desc,cmpt::HlbmReset,encode::Sycl<kel::lbm::enc::Native>> hlbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -33,10 +33,10 @@ saw::error_or<void> step(
});
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part;
+ component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> hlbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -46,12 +46,12 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.8201};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8201};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -69,10 +69,10 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
- saw::data<T> scale;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
+ kel::lbm::data<T> scale;
{
scale.set([&](){
if(t_i.get() > 1024u){
@@ -84,7 +84,7 @@ saw::error_or<void> step(
}
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((0.1 / 0.64) * y_si.get() - (0.1 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle() * scale;
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((0.1 / 0.64) * y_si.get() - (0.1 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle() * scale;
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -105,9 +105,9 @@ saw::error_or<void> step(
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::FpLbm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::FpLbmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -117,11 +117,11 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- saw::data<sch::Vector<T,Desc::D>> grav;
- component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part{grav};
+ kel::lbm::data<sch::Vector<T,Desc::D>> grav;
+ component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part{grav};
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -132,13 +132,13 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{0.8201};
- component<T,Desc,cmpt::FpLbm,encode::Sycl<saw::encode::Native>> collision{0.8201};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{0.8201};
+ component<T,Desc,cmpt::FpLbm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8201};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -156,12 +156,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((0.01 / 0.64) * y_si.get() - (0.01 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((0.01 / 0.64) * y_si.get() - (0.01 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -182,9 +182,9 @@ saw::error_or<void> step(
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::Psm> ){
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ component<T,Desc,cmpt::PsmReset,encode::Sycl<kel::lbm::enc::Native>> fplbm_reset;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -194,10 +194,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+ component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part;
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
- saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,1u>> index;
for(uint64_t i = 0u; i < 1u; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -208,13 +208,13 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{0.8201};
- component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{0.8201};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> bgk{0.8201};
+ component<T,Desc,cmpt::Psm,encode::Sycl<kel::lbm::enc::Native>> collision{0.8201};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -232,12 +232,12 @@ saw::error_or<void> step(
break;
case 3u:
{
- component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&]() -> saw::data<sch::Vector<T,Desc::D>> {
- saw::data<sch::Vector<T,Desc::D>> vel;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
+ [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> {
+ kel::lbm::data<sch::Vector<T,Desc::D>> vel;
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.64) * y_si.get() - (1.2 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.64) * y_si.get() - (1.2 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle();
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -259,7 +259,7 @@ saw::error_or<void> step(
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
}