4#include <marenv/AtomicSharedPtr.h>
5#include <marenv/wave/WaveField.h>
122 double surface_unit_normal[3],
double particle_velocity[3],
123 double particle_acceleration[3],
double& pressure)
override;
149 struct TransitionSnapshot
151 std::shared_ptr<WaveField> from;
152 std::shared_ptr<WaveField> to;
155 bool transitioning =
false;
157 double frozenAlpha = 0.0;
160 [[nodiscard]] std::shared_ptr<TransitionSnapshot> LoadSnapshot()
const
162 return m_snapshot.
load();
165 void StoreSnapshot(std::shared_ptr<TransitionSnapshot> snap)
167 m_snapshot.
store(std::move(snap));
179 static double ComputeAlpha(
const TransitionSnapshot& snap,
double time);
186 static std::shared_ptr<WaveField> SourceAt(
const TransitionSnapshot& snap,
double time);
189 TransitioningWaveField(std::shared_ptr<WaveField> from, std::shared_ptr<WaveField> to,
double alpha);
Definition AtomicSharedPtr.h:19
void store(std::shared_ptr< T > ptr)
Publishes ptr; readers that loaded the previous one keep it alive.
Definition AtomicSharedPtr.h:35
std::shared_ptr< T > load() const
The current pointer; null before the first store.
Definition AtomicSharedPtr.h:22
Definition TransitioningWaveField.h:42
marenv::Status ComputeTotalPressure(double time, const double pos[3], double &pressureOut) override
Computes total pressure; interpolates between source and destination during a transition.
marenv::Status ComputeDynamicPressure(double time, const double pos[3], double &pressureOut) override
Computes dynamic pressure; interpolates between source and destination during a transition.
double MaxWaveElevation() const override
marenv::Status ComputeParticleVelocity(double time, const double pos[3], double velOut[3]) override
Computes particle velocity; interpolates between source and destination during a transition.
marenv::Status ComputeParticleAcceleration(double time, const double pos[3], double accOut[3]) override
Computes particle acceleration; interpolates between source and destination during a transition.
marenv::Status ComputeSurfaceUnitNormal(double time, const double pos[2], double unitNormalOut[3]) override
Computes surface unit normal; interpolates component-wise and renormalises during a transition.
bool IsSettled(double time) const
std::shared_ptr< WaveField > GetCurrentField() const
marenv::wave::WaveComponentData GetWaveComponentsCopy(double time, size_t maxComponents=0) const override
marenv::Status ComputePointQuery(double time, const double pos[3], double &surface_elevation, double surface_unit_normal[3], double particle_velocity[3], double particle_acceleration[3], double &pressure) override
Computes a full point query; all outputs are interpolated during a transition.
marenv::Status ComputeSurfaceElevation(double time, const double pos[2], double &elevationOut) override
Computes surface elevation; interpolates between source and destination during a transition.
InsecureDatapointers GetWaveComponents() const override
void StartTransition(std::shared_ptr< WaveField > newField, double startTime, double duration)
TransitioningWaveField(std::shared_ptr< WaveField > initial)
marenv::wave::WaveComponentData GetWaveComponentsCopy() const override
std::string WaveTheoryName() const override
Returns the wave theory name of the current destination wave field.
std::string SpectrumName() const override
Returns the spectrum name of the current destination wave field.
Definition WaveField.h:41
Status
Definition marenv.h:44
Details of a wave component.
Definition WaveField.h:23
Pointers to wave component details.
Definition WaveField.h:46