Virtual Testbed
Ship dynamics simulator for extreme conditions
arma_wind_solver.hh
1 #ifndef VTESTBED_CORE_ARMA_WIND_SOLVER_HH
2 #define VTESTBED_CORE_ARMA_WIND_SOLVER_HH
3 
4 #include <memory>
5 #include <vector>
6 
7 #include <vtestbed/core/types.hh>
8 #include <vtestbed/geometry/polyline.hh>
9 #include <vtestbed/geometry/types.hh>
10 #include <vtestbed/core/wind_generator.hh>
11 
12 namespace vtb {
13 
14  namespace core {
15 
16  template <class T>
18 
19  public:
20  using array_type = Array<T,4>;
22  using wind_field_type = Array<blitz::TinyVector<T,3>, 3>;
23  using grid_type = Grid<T,4>;
24  using shape_type = blitz::TinyVector<int,4>;
26  using panel_array = Array<panel_type,1>;
27 
28  private:
29  T _c1, _c2;
30  T _sigma;
31  grid_type _grid;
32  shape_type _order;
33  std::vector<generator_type> _wind_generators;
35  wind_field_type _wind_field;
36 
37  public:
38 
39  inline
41  for (int i = 0; i < 3; i++) {
42  _wind_generators.push_back(generator_type());
43  _params.push_back(Wind_param<T>());
44  }
45  }
46 
47  ~ARMA_wind_solver() = default;
48 
49  inline wind_field_type& wind_field() { return this->_wind_field; }
50 
51  void step(panel_array panels);
52 
53  void initialize();
54 
55  inline void
56  setGrid(const grid_type& grid) {
57  for (int i=0; i<3; ++i) {
58  _params[i]._grid = grid;
59  }
60  }
61 
62  inline const grid_type& grid() const { return _params[0]._grid; }
63 
64  inline void
65  setSigma(T sigma) {
66  for (int i=0; i<3; ++i) {
67  _params[i]._sigma = sigma;
68  }
69  }
70 
71  inline T sigma() const { return _params[0]._sigma; }
72  inline void setC1(T c1, int ext) { _params[ext]._c1 = c1; }
73  inline T c1(int ext) { return _params[ext]._c1; }
74  inline void setC2(T c2, int ext) { _params[ext]._c2 = c2; }
75  inline T c2(int ext) { return _params[ext]._c2; }
76 
77  inline void
78  setOrder(shape_type order) {
79  for (int i=0; i<3; ++i) {
80  _params[i]._order = order;
81  }
82  }
83 
84  inline const shape_type& order() const { return _params[0]._order; }
85 
86  };
87 
88  }
89 
90 }
91 
92 #endif // vim:filetype=cpp
Triangular ship hull panel (face).
Main namespace.
Definition: convert.hh:9