3 #include "compensation_signal/compile_time.h" 5 #include "core/cl/common.h" 6 #include "core/program_wrapper.h" 8 #include "utilities/aligned/vector.h" 20 auto get_compressed_waveguide_kernel()
const {
21 return program_wrapper_.get_kernel<cl::Buffer, cl::Buffer>(
22 "compressed_waveguide");
25 auto get_zero_buffer_kernel()
const {
26 return program_wrapper_.get_kernel<cl::Buffer>(
"zero_buffer");
29 template <cl_program_info T>
30 auto get_info()
const {
31 return program_wrapper_.get_info<T>();
34 cl::Device get_device()
const {
return program_wrapper_.get_device(); }
44 using compressed_waveguide_kernel =
45 decltype(std::declval<compressed_rectangular_waveguide_program>()
46 .get_compressed_waveguide_kernel());
47 using zero_buffer_kernel =
48 decltype(std::declval<compressed_rectangular_waveguide_program>()
49 .get_zero_buffer_kernel());
54 template <
typename It,
typename T>
55 util::aligned::vector<float> run_hard_source(It begin,
60 [](
auto& queue,
auto& buffer,
float input) {
61 core::write_value(queue, buffer, 0, input);
66 template <
typename It,
typename T>
67 util::aligned::vector<float> run_soft_source(It begin,
72 [](
auto& queue,
auto& buffer,
float input) {
74 core::read_value<cl_float>(queue, buffer, 0);
75 core::write_value(queue, buffer, 0, c + input);
81 template <
typename It,
typename T,
typename U>
82 util::aligned::vector<float> run(It begin,
87 const auto buffer_size = tetrahedron(dimension_);
89 cl::EnqueueArgs{queue_,
90 cl::NDRange{previous_.getInfo<CL_MEM_SIZE>() /
94 cl::EnqueueArgs{queue_,
95 cl::NDRange{current_.getInfo<CL_MEM_SIZE>() /
99 util::aligned::vector<float> ret{};
100 ret.reserve(std::distance(begin, end));
102 for (
auto count = 0ul; count != dimension_ * 2; ++count) {
103 writer(queue_, current_, begin == end ? 0.0f : *begin++);
106 compressed_waveguide_kernel_(
107 cl::EnqueueArgs{queue_, cl::NDRange{buffer_size}},
113 swap(previous_, current_);
116 ret.emplace_back(core::read_value<cl_float>(queue_, current_, 0));
124 cl::CommandQueue queue_;
125 compressed_waveguide_kernel compressed_waveguide_kernel_;
126 zero_buffer_kernel zero_buffer_kernel_;
130 cl::Buffer previous_;
Definition: waveguide.h:42
Definition: program_wrapper.h:8
Definition: capsule_base.h:9
invariant: device is a valid device for the context
Definition: common.h:13
Definition: waveguide.h:15