FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
LinearWaveTheory.h
1#pragma once
3
4#include <marenv/AtomicSharedPtr.h>
5#include <marenv/wave/WaveComponents.h>
6
7#include <atomic>
8#include <memory>
9#include <string>
10
11namespace marenv::wave
12{
13
26{
27 std::shared_ptr<WaveComponents> waveComponents;
28
34 explicit WaveSnapshot(std::shared_ptr<WaveComponents> wc)
35 : waveComponents(std::move(wc))
36 { }
37 virtual ~WaveSnapshot() = default;
38};
40
42
44{
45public:
52 LinearWaveTheory(std::shared_ptr<WaveComponents> waveComponents,
53 std::string waveTheoryName);
55
56 [[nodiscard]] WaveField::InsecureDatapointers GetWaveComponents() const override;
58
59 [[nodiscard]] std::string SpectrumName() const override;
61
62 [[nodiscard]] std::string WaveTheoryName() const override;
64
65 [[nodiscard]] WaveComponentData GetWaveComponentsCopy() const override;
66
68 [[nodiscard]] double MaxWaveElevation() const override;
69
70 void BlendInPlace(WaveComponentData& other, double alpha) override;
71
72protected:
79 [[nodiscard]] std::shared_ptr<WaveSnapshot> LoadSnapshot() const
80 {
81 return m_snapshot.load();
82 }
83
89 void StoreSnapshot(std::shared_ptr<WaveSnapshot> snap)
90 {
91 m_snapshot.store(std::move(snap));
92 }
93
94 std::string m_spectrumName;
95 std::string m_waveTheoryName;
96
97private:
99};
100} // namespace marenv::wave
Definition AtomicSharedPtr.h:19
Parent class for linear wave theories used to simulate gravity waves.
Definition LinearWaveTheory.h:44
void BlendInPlace(WaveComponentData &other, double alpha) override
std::string m_waveTheoryName
The name of the wave theory.
Definition LinearWaveTheory.h:95
std::shared_ptr< WaveSnapshot > LoadSnapshot() const
Definition LinearWaveTheory.h:79
WaveField::InsecureDatapointers GetWaveComponents() const override
void StoreSnapshot(std::shared_ptr< WaveSnapshot > snap)
Definition LinearWaveTheory.h:89
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:94
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:26
WaveSnapshot(std::shared_ptr< WaveComponents > wc)
Definition LinearWaveTheory.h:34
std::shared_ptr< WaveComponents > waveComponents
Shared pointer to wave component data.
Definition LinearWaveTheory.h:27