diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-07-21 01:31:33 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-07-21 01:31:33 +0200 |
commit | a8f3da04b7d924d6bc8a38b15c7f0def4240a76a (patch) | |
tree | b6239d8f2ecab577beafb083983cb49dc0a949b7 | |
parent | c30924f6f9f14949720f01fafc463dde95d1ffab (diff) |
c++: Flipped template parameter positions
-rw-r--r-- | c++/descriptor.h | 2 | ||||
-rw-r--r-- | c++/examples/cavity_2d.cpp | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/c++/descriptor.h b/c++/descriptor.h index f0f7f28..c09b312 100644 --- a/c++/descriptor.h +++ b/c++/descriptor.h @@ -24,7 +24,7 @@ using CellData = Struct< /** * T is an array of CellData */ -template<size_t D, typename T> +template<typename T, size_t D> using Lattice = Array<T, D>; } } diff --git a/c++/examples/cavity_2d.cpp b/c++/examples/cavity_2d.cpp index afa6a91..0f96a65 100644 --- a/c++/examples/cavity_2d.cpp +++ b/c++/examples/cavity_2d.cpp @@ -2,8 +2,9 @@ #include <forstio/codec/data.h> +namespace kel { +namespace lbm { namespace schema { -using namespace kel::lbm::schema; /** * Basic distribution function @@ -27,12 +28,14 @@ using Cell = CellData< >; } +} +} template<typename Func, typename Schema, size_t Dim> -void apply_for_cells(Func&& func, saw::data<schema::Array<Schema, Dim>, saw::encode::Native>& dat ){ +void apply_for_cells(Func&& func, saw::data<saw::schema::Array<Schema, Dim>, saw::encode::Native>& dat ){ for(std::size_t i = 0; i < dat.get_dim_size(0); ++i){ - for(std::size_t j = 0; j < data.get_dim_size(1); ++j){ - func(data.at(i,j), i, j); + for(std::size_t j = 0; j < dat.get_dim_size(1); ++j){ + func(dat.at(i,j), i, j); } } } @@ -40,10 +43,10 @@ void apply_for_cells(Func&& func, saw::data<schema::Array<Schema, Dim>, saw::enc int main(){ using namespace kel::lbm; - saw::data<schema::Lattice<schema::Cell,2>>, saw::encode::Native> lattice{512, 512}; + saw::data<schema::Lattice<kel::lbm::schema::Cell,2>, saw::encode::Native> lattice{512, 512}; apply_for_cells([](auto& cell, std::size_t i, std::size_t j){ - + // cell.get<"info">(); }, lattice); return 0; |