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
66 void BlendInPlace(WaveComponentData& other, double alpha) override;
67
68protected:
75 [[nodiscard]] std::shared_ptr<WaveSnapshot> LoadSnapshot() const
76 {
77 return m_snapshot.load();
78 }
79
85 void StoreSnapshot(std::shared_ptr<WaveSnapshot> snap)
86 {
87 m_snapshot.store(std::move(snap));
88 }
89
90 std::string m_spectrumName;
91 std::string m_waveTheoryName;
92
93private:
94 std::atomic<std::shared_ptr<WaveSnapshot>> m_snapshot;
95};
96} // 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:91
std::shared_ptr< WaveSnapshot > LoadSnapshot() const
Definition LinearWaveTheory.h:75
WaveField::InsecureDatapointers GetWaveComponents() const override
void StoreSnapshot(std::shared_ptr< WaveSnapshot > snap)
Definition LinearWaveTheory.h:85
WaveComponentData GetWaveComponentsCopy() const override
std::string SpectrumName() const override
std::string WaveTheoryName() const override
std::string m_spectrumName
The name of the wave spectrum.
Definition LinearWaveTheory.h:90
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