Virtual Testbed
Ship dynamics simulator for extreme conditions
wavy_surface_generator.hh
1 #ifndef VTESTBED_CORE_WAVY_SURFACE_GENERATOR_HH
2 #define VTESTBED_CORE_WAVY_SURFACE_GENERATOR_HH
3 
4 #include <memory>
5 
6 #include <vtestbed/base/blitz.hh>
7 #include <vtestbed/core/grid.hh>
8 #include <vtestbed/core/types.hh>
9 
10 namespace vtb {
11 
12  namespace core {
13 
25  template <class T, int N>
26  class Wavy_surface_generator {
27 
28  public:
29  using grid_type = Grid<T,N>;
30  using array_type = Array<T,N>;
31 
32  public:
33 
34  Wavy_surface_generator() = default;
35  virtual ~Wavy_surface_generator() = default;
36  Wavy_surface_generator(const Wavy_surface_generator&) = default;
37  Wavy_surface_generator& operator=(const Wavy_surface_generator&) = default;
38 
39  inline array_type
40  generate(const grid_type& grid) {
41  array_type result(grid.shape());
42  this->generate(grid, result);
43  return result;
44  }
45 
46  virtual void
47  generate(const grid_type& grid, array_type& result) = 0;
48 
49  inline array_type
50  operator()(const grid_type& grid) {
51  return this->generate(grid);
52  }
53 
54  inline void
55  operator()(const grid_type& grid, array_type& result) {
56  this->generate(grid, result);
57  }
58 
59  virtual grid_type
60  acf_grid() const {
61  throw std::runtime_error("not implemented");
62  }
63 
64  };
65 
66  }
67 
68 }
69 
70 #endif // vim:filetype=cpp
Main namespace.
Definition: convert.hh:9