Skip to content

Commit 13c3f40

Browse files
committed
Unify documentation style in core HydroChrono headers and sources
1 parent 086ceef commit 13c3f40

12 files changed

Lines changed: 78 additions & 160 deletions

File tree

include/hydroc/config/hydro_config.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
/*********************************************************************
22
* @file hydro_config.h
3-
*
4-
* @brief Public configuration types for HydroChrono YAML configuration.
5-
*
6-
* This header defines the data structures used to represent parsed
7-
* hydro.yaml configuration files. Users and library consumers should
8-
* include this header to work with hydrodynamic configuration data.
3+
* @brief Public configuration types for parsed YAML hydro settings.
94
*
105
* MAIN TYPES:
11-
* - HydroBody: Configuration for a single hydrodynamic body
12-
* - WaveSettings: Configuration for wave conditions
13-
* - YAMLHydroData: Top-level container for all configuration
14-
*
15-
* USAGE:
16-
* Include <hydroc/config/hydro_config.h> to access these types.
17-
* Use hydrochrono::hydro::LoadHydroConfigFromYaml() to parse YAML files.
6+
* - HydroBody: Per-body hydrodynamic settings (H5 file, flags)
7+
* - WaveSettings: Wave type, height, period, spectrum
8+
* - YAMLHydroData: Top-level container for hydro.yaml data
189
*********************************************************************/
1910

2011
#ifndef HYDROC_CONFIG_HYDRO_CONFIG_H

include/hydroc/core/force_component.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/*********************************************************************
22
* @file force_component.h
33
* @brief Interface for hydrodynamic force components.
4+
*
5+
* MAIN TYPES:
6+
* - IHydroForceComponent: Abstract interface for force computation
7+
* - HydroComponentType: Enum for profiling (Hydrostatics/Radiation/Excitation)
8+
*
9+
* ROLE: All force components implement IHydroForceComponent. HydroSystem
10+
* owns a collection of components and calls Compute() on each.
411
*********************************************************************/
512

613
#ifndef HYDROC_CORE_FORCE_COMPONENT_H

include/hydroc/core/hydro_system.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/*********************************************************************
22
* @file hydro_system.h
3-
* @brief HydroSystem façade: orchestrates force components to compute total forces.
3+
* @brief HydroSystem: Chrono-free core that orchestrates force components.
4+
*
5+
* MAIN TYPES:
6+
* - HydroSystem: Owns force components, computes total BodyForces
7+
* - HydroSystemProfileStats: Timing/call counts per component type
8+
*
9+
* ROLE: This is the Chrono-free hydrodynamics core. HydroForces (façade)
10+
* and ChronoHydroCoupler delegate force computation to HydroSystem.
411
*********************************************************************/
512

613
#ifndef HYDROC_CORE_HYDRO_SYSTEM_H

include/hydroc/core/hydro_types.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/*********************************************************************
22
* @file hydro_types.h
3-
* @brief Canonical type definitions for hydrodynamic force types.
3+
* @brief Core type aliases for hydrodynamic forces.
4+
*
5+
* MAIN TYPES:
6+
* - GeneralizedForce: 6-DOF force vector for one body (Eigen::VectorXd)
7+
* - BodyForces: Vector of GeneralizedForce for all bodies
8+
*
9+
* ROLE: Canonical definitions used throughout the hydrodynamics core.
410
*********************************************************************/
511

612
#ifndef HYDROC_CORE_HYDRO_TYPES_H

include/hydroc/core/system_state.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/*********************************************************************
22
* @file system_state.h
3-
* @brief Common structs for body and system hydrodynamic state.
3+
* @brief Chrono-free state structs for hydrodynamic computation.
4+
*
5+
* MAIN TYPES:
6+
* - BodyState: Position, orientation, velocities for one body
7+
* - SystemState: Vector of BodyState for all bodies
8+
*
9+
* ROLE: Input to HydroSystem and force components. Decouples core
10+
* hydrodynamics from Chrono's ChBody representation.
411
*********************************************************************/
512

613
#ifndef HYDROC_CORE_SYSTEM_STATE_H

include/hydroc/coupling/chrono_coupler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/*********************************************************************
22
* @file chrono_coupler.h
33
* @brief ChronoHydroCoupler: bridges Chrono bodies and HydroSystem.
4+
*
5+
* MAIN TYPES:
6+
* - ChronoHydroCoupler: Adapter between Chrono and HydroSystem
7+
*
8+
* ROLE: Extracts SystemState from Chrono bodies, invokes HydroSystem
9+
* to compute forces. Used internally by HydroForces façade.
410
*********************************************************************/
511

612
#ifndef HYDROC_COUPLING_CHRONO_COUPLER_H

include/hydroc/hydro_forces.h

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,22 @@
1-
#ifndef HYDRO_FORCES_H
2-
#define HYDRO_FORCES_H
3-
41
/*********************************************************************
52
* @file hydro_forces.h
3+
* @brief HydroForces façade: attaches hydrodynamic forces to Chrono bodies.
64
*
7-
* @brief Header file of HydroForces main class and helper classes
8-
* ComponentFunc and ForceFunc6d.
9-
*
10-
* ARCHITECTURE:
11-
* HydroForces is a thin adapter over HydroSystem + ChronoHydroCoupler.
12-
* Force computation is handled internally by HydroSystem, which owns:
13-
* - HydrostaticsComponent (restoring forces + buoyancy)
14-
* - RadiationComponent (RIRF convolution, owns velocity history)
15-
* - ExcitationComponent (wave forcing)
16-
*
17-
* The sign convention is: total = hydrostatics - radiation + waves.
18-
* (RadiationComponent applies the negative sign internally since damping
19-
* opposes motion.)
5+
* MAIN TYPES:
6+
* - HydroForces: Primary hydrodynamics façade (adapter over HydroSystem)
7+
* - ForceFunc6d: Wraps 6-DOF force/torque callbacks per body
8+
* - ComponentFunc: Per-DOF force function for Chrono's ChForce system
209
*
21-
* MAIN RESPONSIBILITIES:
22-
* - HydroForces: Façade over HydroSystem; provides Chrono force callbacks
23-
* - ForceFunc6d: Wraps 6-DOF force/torque callbacks for Chrono bodies
24-
* - ComponentFunc: Per-DOF force function for Chrono's ChForce system
10+
* ROLE: This is the main entry point for C++ usage. Internally delegates
11+
* to HydroSystem (Chrono-free core) and ChronoHydroCoupler. Used by both
12+
* C++ tests/demos and the YAML runner (hydrochrono.exe).
2513
*
26-
* COMPONENT CONSTRUCTION:
27-
* Force components are constructed via factory methods:
28-
* - CreateHydrostaticsComponent()
29-
* - CreateRadiationComponent()
30-
* - CreateExcitationComponent()
31-
* These are the single source of truth for component configuration.
32-
*
33-
* INTERACTIONS:
34-
* - Used by setup_hydro_from_yaml to create and configure HydroForces instances
35-
* - Called by Chrono during simulation via ChForce callbacks
36-
* - Reads HDF5 data through H5FileInfo (not directly exposed here)
37-
* - Uses WaveBase hierarchy for wave excitation (passed in constructor)
38-
*
39-
* KEY ASSUMPTIONS:
40-
* - Bodies are 1-indexed in CoordinateFuncForBody (legacy, from ForceFunc6d)
41-
* - All bodies share same H5 file (multibody data in single file)
42-
* - 6 DOF per body (surge, sway, heave, roll, pitch, yaw)
43-
* - Forces computed once per time step and cached via prev_time check
14+
* KEY ASSUMPTIONS: 6 DOF per body, bodies named "body1", "body2", etc.
4415
*********************************************************************/
4516

17+
#ifndef HYDRO_FORCES_H
18+
#define HYDRO_FORCES_H
19+
4620
// Include hydro_types.h FIRST to ensure BodyForces and GeneralizedForce are available
4721
// before any other includes that might conflict (e.g., config/hydro_config.h)
4822
#include <hydroc/core/hydro_types.h>

include/hydroc/radiation/radiation_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
/*********************************************************************
22
* @file radiation_types.h
33
* @brief Public types for radiation damping configuration.
4+
*
5+
* MAIN TYPES:
6+
* - RadiationConvolutionMode: Baseline vs TaperedDirect RIRF processing
7+
* - TaperedDirectOptions: Smoothing, tapering, and export settings
48
*********************************************************************/
59

610
#ifndef HYDROC_RADIATION_TYPES_H

src/hydro/config/setup_from_yaml.cpp

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11
/*********************************************************************
22
* @file setup_from_yaml.cpp
3+
* @brief Creates HydroForces from parsed YAML configuration.
34
*
4-
* @brief Implementation of hydrodynamic setup from YAML data.
5-
*
6-
* OVERVIEW:
7-
* Implements the SetupHydroFromYAML function that connects YAML configuration
8-
* to Chrono bodies and creates a configured HydroForces instance. Handles body
9-
* matching, wave model creation, and convolution mode setup.
10-
*
11-
* MAIN RESPONSIBILITIES:
12-
* - Match bodies by name between YAML config and Chrono system
13-
* - Factory function for WaveBase implementations (RegularWave, IrregularWaves, NoWave)
14-
* - HydroForces initialization with matched bodies and H5 file path
15-
* - Configuration of radiation convolution options from YAML
16-
*
17-
* INTERACTIONS:
18-
* - Reads hydro_data (YAMLHydroData) from parser
19-
* - Accesses Chrono bodies from simulation system
20-
* - Creates WaveBase instances via factory pattern
21-
* - Configures HydroForces with convolution settings
22-
*
23-
* KEY ASSUMPTIONS:
24-
* - All bodies use same H5 file (takes first body's h5_file)
25-
* - Body names match exactly between YAML and Chrono
26-
* - Wave parameters are valid (height > 0 for regular waves, etc.)
27-
* - Simulation timestep/duration provided for irregular waves
28-
*
29-
* KNOWN LIMITATIONS:
30-
* - Single H5 file per system (no per-body files)
31-
* - Body matching fails silently if name not found (logs warning)
32-
* - No validation that matched body count matches H5 file structure
5+
* Implements SetupHydroFromYAML(): matches YAML body configs to Chrono
6+
* bodies, creates wave models, and returns a configured HydroForces.
337
*********************************************************************/
348

359
#include "setup_from_yaml.h"

src/hydro/config/setup_from_yaml.h

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,9 @@
11
/*********************************************************************
22
* @file setup_from_yaml.h
3+
* @brief Factory function to create HydroForces from YAML configuration.
34
*
4-
* @brief Setup hydrodynamic forces from parsed YAML data.
5-
*
6-
* OVERVIEW:
7-
* This file provides the main entry point for configuring hydrodynamic
8-
* forces from YAML configuration files. It bridges parsed configuration
9-
* data to the HydroForces force computation system.
10-
*
11-
* MAIN RESPONSIBILITIES:
12-
* - Match Chrono bodies with YAML body configurations by name
13-
* - Create appropriate WaveBase implementations from wave settings
14-
* - Initialize HydroForces with matched bodies and wave models
15-
* - Configure radiation convolution options (Baseline/TaperedDirect)
16-
*
17-
* INTERACTIONS:
18-
* - Takes parsed YAMLHydroData from yaml_parser
19-
* - Takes Chrono bodies from the simulation system
20-
* - Returns configured HydroForces instance ready for simulation
21-
* - Uses wave_types.h for wave model creation
22-
*
23-
* KEY ASSUMPTIONS:
24-
* - All bodies share the same H5 file (uses first body's h5_file)
25-
* - Body names in YAML match Chrono body names exactly
26-
* - Bodies are matched in order found in YAML (not sorted)
27-
* - Wave settings apply system-wide (not per-body)
28-
*
29-
* KNOWN LIMITATIONS:
30-
* - Single H5 file assumption (no per-body H5 files)
31-
* - No validation of body count vs H5 file contents
32-
* - Wave configuration is system-wide only
33-
* - Body matching is simple string equality (no fuzzy matching)
5+
* Provides SetupHydroFromYAML() which matches YAML body configs to Chrono
6+
* bodies, creates wave models, and returns a configured HydroForces.
347
*********************************************************************/
358

369
#ifndef HYDRO_CONFIG_SETUP_FROM_YAML_H

0 commit comments

Comments
 (0)