Skip to content

Commit

Permalink
Merge branch 'master' into demo/linear-wave-body (#83)
Browse files Browse the repository at this point in the history
* Waves: enable wave direction in the sinusoid wave model (#80)

* Waves: enable wave direction in the sinusoid wave model

- Allow wave direction to be set for regular waves.
- Add test for a wave direction not parallel to the x-axis

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: rename monochromatic_waves model

- Rename to regular waves.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves simulation optimisation - part 1 (#82)

* Waves: add classes for spreading functions

- Add classes for directional spreading functions.
- Add vectorised calculations using Eigen.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: update classes for spreading functions

- Update classes for directional spreading functions - use Eigen::MatrixXd rather than VectorXd.
- Update tests including broadcasting to arrays.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add classes for omni-directional spectrum functions

- Add classes for omni-directional wave spectra.
- Add test case for vectorised spectrum calculation using Eigen.
- Add regression test and check limits (k = 0, u19 = 0)

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: update classes for omni-directional spectrum functions

- Implement ECVK omni-directional spectra.
- Add test case for vectorised spectrum calculation using Eigen.
- Add regression test and check limits (k = 0, u10 = 0)

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add regression tests for spectra.

- Add regression test against spectrum calculation used in  FFT2.
- Make spectrum functions in FFT2 static.
- Add ECKV spectrum tests.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: fix spreading function test.

- Fix segfault caused by missing arg.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove unused wave simulation classes

- Remove FFTW and OpenCL simulation classes.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: reset test values after physical constant updates.

- Update buoyancy regression values after fluid density and gravity value update.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: fix failing static test in gz_waves_bridge

- Disable flake8 and fix docstring.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: replace std::vector with Eigen in WaveSimulation

- Migration from std::vector to Eigen::VectorXf. Not efficient as involved heap allocation each update.
- Replace std::vector for interface calls in OceanTile.
- Remove unused code from WaveSpectrum.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: fixes post cherry-pick

- Revert interface change in WaveSimulation.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: replace std::vector with Eigen in WaveSimulation

- Remove interface using std::vector<double> from WaveSimulation classes.
- Update waves plugin classes to use new interfaces.
- Update test

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: replace std::vector with Eigen in WaveSimulation

- Remove internal interface using std::vector<double> from WaveSimulation classes.
- Update tests

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: replace std::vector with Eigen in FFT WaveSimulation

- Remove internal interface using std::vector<double> from WaveSimulation classes.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: correct typos in derivative calculations for sinusoid and
trochoid waves

- Ensure Eigen vector workspace is initialised in WavesVisual.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: visual lighting workaround

- Tangent space calculation not correct - environment mapping looks incorrect unless dhdx <---> dhdx?

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: update sinusoid wave interface

- Allow x and y to be set independently in wave grid.
- Streamline class declarations.
- Update tests.
- Add vectorise option for sinusoid waves.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove unused functions.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add tests for vectorised sinusoid wave sim

- Cross check vectorised code against non-vectorised version.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove unused include from WaveSimulationSinusoid

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: refactor WaveSimulation method names.

- Rename ComputeHeights to ComputeElevation.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: refactor update indentation formatting.

- Add vectorisation method to FFT wave simulation.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: refactor update member variable names in FFT wave simulation

- Standardise caps convention for naming member variables (using underscores).
- Update interface to allow different nx and ny for grid.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: temp workaround for wave derivatives used in lighting tangent space

- Workaround mixed conventions for matrix-ij vs matrix-xy storage in tangent space calcs.

Signed-off-by: Rhys Mainwaring <[email protected]>

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves simulation optimisation - part 2 (#84)

* Waves: update FFT wave simulation tests for non-square grids (nx != ny)

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: apply google coding standards

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: apply google coding standards

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: apply google coding standards

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: apply google coding standards

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: apply google coding standards

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: apply google coding standards

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: update FFT test namesWaves

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: preparation for vectorising FFT wave simulation update

- Add placeholders for vectorised versions of functions
- Replace hardcoded gravity constants with params.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: preparation for vectorising FFT wave simulation update

- Add cross-check tests for vectorised versions of base and current amplitude calculations.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: progress vectorising FFT wave simulation update

- Change capitalisation of Cos2sSpreadingFunction.
- Update comments in WaveSpectrum.
- WaveSimulationFFT
 	- Consolidate initialisation code.
	- Update variable names (nyquist)
	- Delay allocation of storage for Eigen member variables.
	- Update tests to use nearest for cross checks on vectorised version.
	- Remove use of auto for Eigen references (use Eigen::Ref instead)
	- Factor out wavenumber initialisation.
	- Partial vectorisation.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: vectorise base amplitude calc for FFT wave simulation

- Leave initialisation of IID random normals un-vectorised for testing against original versions.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add unit test for Eigen and FFTW

- Add test skeleton.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add unit test for Eigen and FFTW

- Add examples using different storage choices.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add unit test for Eigen and FFTW

- Add examples for row vs column major storage.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add Eigen alignment macro

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: use Eigen types for FFTW storage - reduce copies

- Use Eigen types instead of fftw_complex* for FFT workspace.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove unused code from FFWT wave simulation

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: use row-major Eigen matrix storage for FFT wave simulation

- Intermediate step moving from Eigen::VectorXcd to Eigen::MatrixXcdRowMajor.
- FFTW requires row-major ordering, Eigen is column major by default.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: use row-major Eigen matrix storage for FFT wave simulation

- Change to matrix indexing in FFT wave storage (from a single column).

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: update output mapping from row to col major storage in FFT wave simulation

- Replace loops with vector calls using reshaped to flatten.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Set up CI using GitHub Actions (#85)

- CI: remove travis integration
- Add codeowners and gazebo ci.yml
- Minimal version - checkout only.
- Change checkout actions/checkout@v3
- Add CI workflows for ubuntu and macos
- Rename and split macOS into separate workflow.
- Install Gazebo Garden.
- Test caching
- Add brew install script.
- Add build script.
- Update macos-ci
- Add test step.
- Add GitHub Actions status badge, remove travis badges.
- Update ci install scripts
- Update the brew installation script to force relinking on all dependencies of the installed packages.
- Fix relink step.
- Update ubunti-ci workflow.
- Add install, build and test steps.
- Rename macos scripts.
- Update ubunti-ci workflow.
- Install additional build dependencies.
- Update ubunti-ci workflow.
- Fix colcon build command line.
- Move macOS to colcon build.
- Update workflow for ubuntu 20.04
- Ensure cgal etc are linked as well as deps.
- Split Ubuntu jobs to separate workflow
- Update macos workflow - add build tools
- Fix EigenFFTW breaking on Ubuntu.
- Update macos workflow - reenable build and test
- Fix timer in CGAL test and disable triangulation tests failing on Ubuntu.
- Fix errors in WaveSimulationFFT2 tests and set tolerances for variance comparisons.
- Check colcon install on macOS workflow
- Disable trochoid wave test
- Investigate why colcon not found in macOS CI workflow
- Add workflow to check build tools are installed.
- Use pip3
- Use full path to colcon
- Add pip install checks
- Update path to Python scripts
- Update path to Python scripts
- Pip install colcon and vcstool with --user flag

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves simulation optimisation - part 3 (#87)

* Waves: optimise current amplitude calculation for FFT wave simulation

- Investigate optimisation options for the current amplitude calculation.
- vectorised assignment to fft worlspace is not faster than a single loop.
- pre-calculate the fourier amplitude coefficients (reduce index lookup) - marginal gain?

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: label indices in ocean tile to distinguish between vertex indices and wave indices

- Vertex array index: v_idx_cm: v - vertex, cm - column major
- Wave array index: w_idx_cm: v - vertex, cm - column major
- Wave array index: w_idx_rm: v - vertex, rm - row major

Signed-off-by: Rhys Mainwaring <[email protected]>

* CI: only run macOS workflow on PR

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: rename FFT wave simulation class

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: duplicate FFT wave simulation class to factor out reference version

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: duplicate FFT wave simulation class to factor out reference version

- Complete split of reference implementation into separate class.
- Remove unused code from the separated FFT wave simulation classes.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove commented code

- Remove code referring to reference versions of the spectrum calculations.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add performance checks for spectrum and FFT amplitude calculations

- Initial performance tests. Contain debugging and timing info.
- Eigen component-wise array versions are not performant...

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: replace slow array versions of spectrum calcs.

- Eigen component-wise array versions are not performant - replace with calls using std::transform on unary / binary versions.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: refactor wave simulation and spectrum test names

- Functions are not truly vectorised - use Eigen array type to label tests instead.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: satisfy Eigen check that range iterators in STL algorithms are from the same expression.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves simulation optimisation - part 4 (#88)

* Waves: restructure wave spectrum performance test for instrumenting

- Move initialisation into test fixture

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove c-wise amplitude update

- Remove inefficient component wise amplitude update and associated data.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove c-wise cos / sin update in current amplitude calc

- Remove inefficient component wise amplitude update.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: restructure FFT wave amplitude performance test for instrumenting

- Move initialisation into test fixture.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: update FFT wave simulation

- Consolidate storage (shape depends whether loop is flattened or not).
-  Make test fixture class names consistent.
- Remove array allocation in current amplitude update

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: use previously calculated wave numbers

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove two loops from FFT base amplitude calculation

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove component-wise array amplitude calculations

- Abandon using c-wise amplitude calculations as the loop based update has better performance.
- Remove unnecessary storage from the FFT class to reduce memory footprint.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: remove WaveSimulationFFTRef from public interface

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: add performance checks for elevation and displacement calculations

- Add performance check for main update loop - elevations, displacements and derivatives.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves simulation optimisation - part 5 (#89)

* Waves: update FFTW check

- Modify check to transform hermitian amplitudes back to real values.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: create FFTW plans before initialising arrays

- FFTW may overwrite data in arrays while planning. Allocate, plan, initialise.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: use complex to real version of FFTW

- Change outputs to real arrays.
- Change size of input complex arrays to nx * ny/2+1
- Output in Compute* functions is now real.
- Add example in the Eigen FFTW test using a c2r plan.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: use complex to real version of FFTW

- Flattened index must be calculated as loops do not cover full range.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: use complex to real version of FFTW

- Disable hermitian tests for optimised FFT wave sim (arrays truncated using symmetry)

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: temp disable tests broken because of switch to real DFT

The following tests require further review - restructuring
- ParsevalsIdentityTimeZero
- ParsevalsIdentityTimeNonZero
- Displacement

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: additional Hermitian tests

- Add placeholder tests to check derivative and displacement amplitudes are Hermitian.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Waves: fix Hermitian symmetry for derivatives (#90)

- Correct Nyquist term in derivative amplitudes (must be zero).
- Enable tests to check derivative and displacement amplitudes are Hermitian.

Signed-off-by: Rhys Mainwaring <[email protected]>

* CI: clean build warnings (#91)

* CI: enable all warnings and enforce as errors

- Clean build of all warnings.
- Disable unused variables from tests (primarily present for printing info).
- Comment unused parameters in function sigs.
- Fix int type comparison warnings in loops.
- Fix initialisation order errors in constructors.

Signed-off-by: Rhys Mainwaring <[email protected]>

* CI: enable all warnings and enforce as errors

- Remove GZ_ASSERT raising a warning on Ubuntu

Signed-off-by: Rhys Mainwaring <[email protected]>

* CI: enable all warnings and enforce as errors

- Renaming shadowing variables.

Signed-off-by: Rhys Mainwaring <[email protected]>

* Wave Body: update cmake dependencies

- Use FetchContent to retrieve dependency HighFive.
- Fix typo in documentation.
- Remove cpp style header for mlinterp

Signed-off-by: Rhys Mainwaring <[email protected]>

* Wave Body: update ci workflow

- Add build flag for HighFive dependency

Signed-off-by: Rhys Mainwaring <[email protected]>

* Wave Body: update waves bridge tests

- Remove breaking tests inherited from ROS project template.

Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Dec 8, 2022
1 parent cc712df commit def9379
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 76 deletions.
6 changes: 3 additions & 3 deletions gz-waves-models/world_models/regular_waves_3s_1m/model.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<?xml version='1.0'?>
<model>
<name>Regular Waves 3s 1m</name>
<name>Regular Waves</name>
<version>1.0</version>
<sdf version='1.6'>model.sdf</sdf>

Expand All @@ -11,8 +11,8 @@
</author>

<description>
Regular surface waves T=3s, H=1m.

Regular surface waves. i.e. plane progressive waves of a single frequency.
This model uses the materials from the `waves`
model to prevent duplicating the large mesh files.
</description>
Expand Down
25 changes: 0 additions & 25 deletions gz_waves_bridge/test/test_copyright.py

This file was deleted.

25 changes: 0 additions & 25 deletions gz_waves_bridge/test/test_flake8.py

This file was deleted.

23 changes: 0 additions & 23 deletions gz_waves_bridge/test/test_pep257.py

This file was deleted.

0 comments on commit def9379

Please sign in to comment.