Contributing¶
Guidelines for contributing to OASIS.
Getting Started¶
- Fork the repository on GitHub
- Clone your fork locally
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Build and test:
compile.batorcompile.sh - Run the functional tests:
cd examples && run_all_examples.bat - Push your branch and open a Pull Request
Code Style¶
OASIS uses clang-format for consistent formatting. The configuration is in .clang-format at the repository root.
Key conventions:
- 4-space indentation, no tabs
- Allman brace style (opening braces on new lines)
- 120-column line width limit
- C++17 standard
- No automatic include sorting
Format your code before committing:
The .editorconfig file ensures consistent settings across editors (UTF-8, LF line endings, trailing whitespace trimming).
Project Structure¶
src/ # C++ source code
├── Simulations/ # Simulation orchestrator
├── Bodies/ # Rigid body dynamics
├── Lines/ # Mooring lines
├── BCPs/ # Boundary condition points
├── Waves/ # Wave kinematics
├── Hydro/ # Hydrodynamic forces
├── ODE_solvers/ # Time integration
├── Spring/ # Spring elements
└── ...
examples/ # Functional test suite
docs/ # MkDocs documentation
resources/ # Python utilities
See Code Structure for the full class hierarchy and simulation lifecycle.
Adding a New Subsystem¶
- Create a new directory under
src/with header and source files - Add the source files to
CMakeLists.txtin theSOURCESlist - Integrate with
Simulationclass:- Add pointer member(s) to
Simulation.hpp - Add
Read*ASCII()andRead*YAML()methods - Wire into
LoadCase(),Initialize(),CalculateSystemDynamics(), andCloseCase()
- Add pointer member(s) to
- Add input format documentation to
docs/user-manual/ - Create a functional test in
examples/
Adding Input Format Support¶
Both ASCII and YAML readers must be implemented for every input file. The Simulation class uses function pointers to dispatch:
// In constructor, based on data_format:
pReadMyFeature = &Simulation::ReadMyFeatureASCII; // or ReadMyFeatureYAML
Testing¶
The functional test suite in examples/ covers all subsystems. After making changes:
- Build in Release mode
- Run all examples:
cd examples && run_all_examples.bat - Verify output against expected results
There are currently no unit tests. The examples serve as integration tests.
Documentation¶
- User documentation: MkDocs files in
docs/ - API documentation: Generated by Doxygen from source comments
- Theory manual: LaTeX in
docs/theory-manual/OASIS_TheoryManual.tex
Build the docs locally:
Commit Messages¶
Use clear, concise commit messages: