1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#include <forstio/test/suite.hpp>
#include "../c++/iterator.hpp"
#include <iostream>
namespace {
namespace sch {
using namespace kel::lbm::sch;
}
SAW_TEST("Old Iterate"){
using namespace kel;
saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}};
saw::data<sch::FixedArray<sch::UInt64,2u>> end{{3u,3u}};
lbm::iterate_over([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl;
}, start, end);
}
SAW_TEST("CT Tuple Iterator"){
using namespace kel;
saw::data<
sch::Tuple<
sch::Float32,
sch::Int16,
sch::Float64,
sch::UInt32
>
> tup;
lbm::ct_tuple_iterator<std::decay_t<decltype(tup)>::Schema>::apply([](auto& val) -> saw::error_or<void> {
return saw::make_void();
},tup);
}
SAW_TEST("Old Iterate with Distance 1"){
using namespace kel;
saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}};
saw::data<sch::FixedArray<sch::UInt64,2u>> end{{4u,4u}};
lbm::iterate_over([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl;
}, start, end, {{1u,1u}});
}
SAW_TEST("Iterate - 2D"){
using namespace kel;
saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}};
saw::data<sch::FixedArray<sch::UInt64,2u>> end{{3u,3u}};
lbm::iterator<2u>::apply([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl;
}, start, end);
}
SAW_TEST("Iterate with Distance 1 - 2D"){
using namespace kel;
saw::data<sch::FixedArray<sch::UInt64,2u>> start{{0u,0u}};
saw::data<sch::FixedArray<sch::UInt64,2u>> end{{4u,4u}};
lbm::iterator<2u>::apply([](const saw::data<sch::FixedArray<sch::UInt64,2u>>& index){
std::cout<<"Index: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl;
}, start, end, {{1u,1u}});
}
}
|