FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
LinearWaveTheory.h
1#pragma once
3
4#include <marenv/wave/WaveComponents.h>
5
6#include <atomic>
7#include <memory>
8#include <string>
9
10namespace marenv::wave
11{
12
25{
26 std::shared_ptr<WaveComponents> waveComponents;
27
33 explicit WaveSnapshot(std::shared_ptr<WaveComponents> wc)
34 : waveComponents(std::move(wc))
35 { }
36 virtual ~WaveSnapshot() = default;
37};
39
41
43{
44public:
51 LinearWaveTheory(std::shared_ptr<WaveComponents> waveComponents,
52 std::string waveTheoryName);
54
55 [[nodiscard]] WaveField::InsecureDatapointers GetWaveComponents() const override;
57
58 [[nodiscard]] std::string SpectrumName() const override;
60
61 [[nodiscard]] std::string WaveTheoryName() const override;
63
64 [[nodiscard]] WaveComponentData GetWaveComponentsCopy() const override;
65
67 [[nodiscard]] double MaxWaveElevation() const override;
68
69 void BlendInPlace(WaveComponentData& other, double alpha) override;
70
71protected:
78 [[nodiscard]] std::shared_ptr<WaveSnapshot> LoadSnapshot() const
79 {
80 return m_snapshot.load();
81 }
82
88 void StoreSnapshot(std::shared_ptr<WaveSnapshot> snap)
89 {
90 m_snapshot.store(std::move(snap));
91 }
92
93 std::string m_spectrumName;
94 std::string m_waveTheoryName;
95
96private:
97 std::atomic<std::shared_ptr<WaveSnapshot>> m_snapshot;
98};
99} // namespace marenv::wave
Parent class for linear wave theories used to simulate gravity waves.
Definition LinearWaveTheory.h:43
void BlendInPlace(WaveComponentData &other, double alpha) override
std::string m_waveTheoryName
The name of the wave theory.
Definition LinearWaveTheory.h:94
std::shared_ptr< WaveSnapshot > LoadSnapshot() const
Definition LinearWaveTheory.h:78
WaveField::InsecureDatapointers GetWaveComponents() const override
void StoreSnapshot(std::shared_ptr< WaveSnapshot > snap)
Definition LinearWaveTheory.h:88
WaveComponentData GetWaveComponentsCopy() const override
std::string SpectrumName() const override
double MaxWaveElevation() const override
Sum of |zeta_A| over the published components, times 1 + 1e-10 (see WaveField::MaxWaveElevation).
std::string WaveTheoryName() const override
std::string m_spectrumName
The name of the wave spectrum.
Definition LinearWaveTheory.h:93
LinearWaveTheory(std::shared_ptr< WaveComponents > waveComponents, std::string waveTheoryName)
The interface for an representing waves.
Definition WaveField.h:35
Details of a wave component.
Definition WaveField.h:23
Pointers to wave component details.
Definition WaveField.h:40
Definition LinearWaveTheory.h:25
WaveSnapshot(std::shared_ptr< WaveComponents > wc)
Definition LinearWaveTheory.h:33
std::shared_ptr< WaveComponents > waveComponents
Shared pointer to wave component data.
Definition LinearWaveTheory.h:26