88
99#include < Eigen/Dense>
1010
11+ // // RADU - why is this not in some namespace?
12+ // // - should these classes be DLL-exported (e.g., to allow AddWave(NoWave))?
13+ // // if not, why is this a public headers?
14+
1115enum class WaveMode {
1216 noWaveCIC = 0 ,
1317 regular = 1 ,
@@ -34,48 +38,38 @@ class WaveBase {
3438 public:
3539 virtual ~WaveBase () = default ;
3640
37- virtual void Initialize () = 0;
38- virtual Eigen::VectorXd GetForceAtTime (double t) = 0;
39- virtual WaveMode GetWaveMode () = 0;
40- virtual double GetElevation (const Eigen::Vector3d& position, double time) = 0;
41- virtual Eigen::Vector3d GetVelocity (const Eigen::Vector3d& position, double time) = 0;
42- virtual Eigen::Vector3d GetAcceleration (const Eigen::Vector3d& position, double time) = 0;
41+ virtual void Initialize () = 0;
42+ virtual Eigen::VectorXd GetForceAtTime (double t) = 0;
43+ virtual WaveMode GetWaveMode () = 0;
44+ virtual double GetElevation (const Eigen::Vector3d& position, double time) = 0;
45+ virtual Eigen::Vector3d GetVelocity (const Eigen::Vector3d& position, double time, double elevation) = 0;
46+ virtual Eigen::Vector3d GetAcceleration (const Eigen::Vector3d& position, double time, double elevation) = 0;
47+
48+ Eigen::Vector3d GetVelocity (const Eigen::Vector3d& position, double time);
49+ Eigen::Vector3d GetAcceleration (const Eigen::Vector3d& position, double time);
4350
44- /* *
45- * @brief Returns the free-surface gradient (∂η/∂x, ∂η/∂y) at the given position and time.
46- *
47- * Used for computing surface normals in visualization. The normal vector can be
48- * constructed as: n = normalize(−∂η/∂x, −∂η/∂y, 1).
49- *
50- * @param position World coordinates (x, y, z) in meters. Only x, y are used.
51- * @param time Simulation time in seconds.
52- * @return Eigen::Vector2d containing (∂η/∂x, ∂η/∂y), dimensionless.
53- *
54- * @note Default implementation returns (0, 0) for flat surface (NoWave).
55- * @note Current wave models are unidirectional (+X), so ∂η/∂y = 0.
56- */
57- virtual Eigen::Vector2d GetElevationGradientXY (const Eigen::Vector3d& position, double time) const {
58- (void )position;
59- (void )time;
60- return Eigen::Vector2d::Zero ();
61- }
51+ double mwl_ = 0.0 ;
52+ double g_ = 9.81 ;
53+ double water_depth_ = 0.0 ;
54+ bool wave_stretching_ = true ;
55+ };
6256
63- double mwl_ = 0.0 ;
64- double g_ = 9.81 ;
65- double water_depth_ = 0.0 ;
57+ struct NoWaveParams {
58+ unsigned int num_bodies_;
6659};
6760
6861class NoWave : public WaveBase {
6962 public:
7063 NoWave ();
7164 explicit NoWave (unsigned int num_b);
65+ explicit NoWave (const NoWaveParams& params);
7266
7367 void Initialize () override {}
7468 Eigen::VectorXd GetForceAtTime (double t) override ;
7569 WaveMode GetWaveMode () override { return mode_; }
7670 double GetElevation (const Eigen::Vector3d&, double ) override { return 0.0 ; }
77- Eigen::Vector3d GetVelocity (const Eigen::Vector3d&, double ) override { return Eigen::Vector3d (0.0 , 0.0 , 0.0 ); }
78- Eigen::Vector3d GetAcceleration (const Eigen::Vector3d&, double ) override { return Eigen::Vector3d (0.0 , 0.0 , 0.0 ); }
71+ Eigen::Vector3d GetVelocity (const Eigen::Vector3d&, double , double ) override { return Eigen::Vector3d (0.0 , 0.0 , 0.0 ); }
72+ Eigen::Vector3d GetAcceleration (const Eigen::Vector3d&, double , double ) override { return Eigen::Vector3d (0.0 , 0.0 , 0.0 ); }
7973
8074 private:
8175 unsigned int num_bodies_ = 0 ;
0 commit comments