Virtual Testbed
Ship dynamics simulator for extreme conditions
opencl/derivative.hh
1 #ifndef VTESTBED_OPENCL_DERIVATIVE_HH
2 #define VTESTBED_OPENCL_DERIVATIVE_HH
3 
4 #include <fstream>
5 #include <sstream>
6 
7 #include <vtestbed/base/blitz.hh>
8 #include <vtestbed/core/grid.hh>
9 #include <vtestbed/core/types.hh>
10 #include <vtestbed/opencl/opencl.hh>
11 #include <vtestbed/opencl/pipeline.hh>
12 
13 namespace vtb {
14 
15  namespace opencl {
16 
17  template <class T, int N>
18  class Derivative: public Context_base {
19 
20  public:
22  using buffer_type = Buffer<T>;
23 
24  private:
25  clx::kernel _derivative, _local_derivative;
26 
27  public:
28  using Context_base::context;
29 
30  void context(Context* rhs) override;
31 
32  void solve(const buffer_type& func,
33  const grid_type& grid,
34  int dimension,
35  buffer_type& result);
36 
37  inline void operator()(
38  const buffer_type& func,
39  const grid_type& grid,
40  int dimension,
41  buffer_type& result
42  ) { this->solve(func, grid, dimension, result); }
43 
44  };
45 
46  }
47 
48 }
49 
50 #endif // vim:filetype=cpp
A region defined by start and end index and lower and upper bound for each dimension.
Definition: core/grid.hh:25
Main namespace.
Definition: convert.hh:9