@@ -149,6 +149,16 @@ class ForceFunc6d {
149149
150150class ChLoadAddedMass ;
151151
152+ // Lightweight hydrodynamics profiling stats
153+ struct HydroProfileStats {
154+ double hydrostatics_seconds = 0.0 ;
155+ double radiation_seconds = 0.0 ;
156+ double waves_seconds = 0.0 ;
157+ int hydrostatics_calls = 0 ;
158+ int radiation_calls = 0 ;
159+ int waves_calls = 0 ;
160+ };
161+
152162// TODO: Rename TestHydro for clarity, perhaps to HydroForces?
153163// TODO: Split TestHydro class from its helper classes for clearer code structure.
154164class TestHydro {
@@ -220,6 +230,42 @@ class TestHydro {
220230 */
221231 double GetRIRFval (int row, int col, int st);
222232
233+ // Convolution mode selection
234+ enum class RadiationConvolutionMode {
235+ Baseline,
236+ TaperedDirect
237+ };
238+
239+ /* *
240+ * @brief Set the radiation convolution mode. Default is Baseline.
241+ */
242+ void SetRadiationConvolutionMode (RadiationConvolutionMode mode) { convolution_mode_ = mode; }
243+
244+ struct TaperedDirectOptions {
245+ // smoothing: "sg" (Savitzky–Golay) or "moving_average"
246+ std::string smoothing = " sg" ;
247+ int window_length = 5 ; // odd, >= 3
248+
249+ // RIRF truncation
250+ double rirf_end_time = -1.0 ; // end RIRF at this time (seconds), -1.0 = use full length
251+
252+ // Simple taper control - sensible defaults for improved stability
253+ double taper_start_percent = 0.8 ; // start taper at 80% (taper last 20%)
254+ double taper_end_percent = 1.0 ; // end taper at 100% of total time series
255+ double taper_final_amplitude = 0.0 ; // final amplitude as fraction of original (0.0 = zero, 1.0 = no change)
256+ bool export_plot_csv = false ; // dump before/after CSV summaries (false by default)
257+ };
258+
259+ /* *
260+ * @brief Set options for TaperedDirect preprocessing.
261+ */
262+ void SetTaperedDirectOptions (const TaperedDirectOptions& opts) { tapered_opts_ = opts; }
263+
264+ /* *
265+ * @brief Set the directory where diagnostics (e.g., CSVs) should be written.
266+ */
267+ void SetDiagnosticsOutputDirectory (const std::string& dir) { diagnostics_output_dir_ = dir; }
268+
223269 /* *
224270 * @brief Calculates or retrieves the total force on a specific body in a particular degree of freedom.
225271 *
@@ -233,6 +279,9 @@ class TestHydro {
233279 */
234280 double CoordinateFuncForBody (int b, int i);
235281
282+ // Hydrodynamics profiling accessors
283+ HydroProfileStats GetProfileStats () const { return profile_stats_; }
284+
236285 private:
237286 // Class properties related to the body and hydrodynamics
238287 std::vector<std::shared_ptr<ChBody>> bodies_;
@@ -281,6 +330,18 @@ class TestHydro {
281330 * @param index The DOF index, ranging from [0,1,...,5].
282331 */
283332 double SetVelHistory (double val, int step, int b_num, int index);
333+
334+ // Hydrodynamics profiling data (accumulated over run)
335+ HydroProfileStats profile_stats_;
336+
337+ // Convolution kernel preprocessing (optional)
338+ RadiationConvolutionMode convolution_mode_ = RadiationConvolutionMode::Baseline;
339+ bool rirf_processed_ready_ = false ;
340+ std::vector<Eigen::Tensor<double , 3 >> rirf_processed_; // per body [dof x col x step]
341+ TaperedDirectOptions tapered_opts_;
342+ std::string diagnostics_output_dir_;
343+
344+ void EnsureProcessedRIRF ();
284345};
285346
286347#endif
0 commit comments