Marine systems simulation
Loading...
Searching...
No Matches
marenv::wave::WaveField Class Referenceabstract

The interface for an representing waves.

#include <WaveField.h>

+ Inheritance diagram for marenv::wave::WaveField:
+ Collaboration diagram for marenv::wave::WaveField:

Classes

struct  InsecureDatapointers
 Pointers to wave component details. More...
 

Public Member Functions

virtual ~WaveField ()=default
 Virtual destructor.
 
virtual std::string SpectrumName () const =0
 
virtual std::string WaveTheoryName () const =0
 
virtual marenv::Status ComputeSurfaceElevation (double time, const double pos[2], double &elevationOut)=0
 
virtual marenv::Status ComputeDynamicPressure (double time, const double pos[3], double &pressureOut)=0
 
virtual marenv::Status ComputeTotalPressure (double time, const double pos[3], double &pressureOut)=0
 
virtual marenv::Status ComputeSurfaceUnitNormal (double time, const double pos[2], double unitNormalOut[3])=0
 
virtual marenv::Status ComputeParticleVelocity (double time, const double pos[3], double velOut[3])=0
 
virtual marenv::Status ComputeParticleAcceleration (double time, const double pos[3], double accOut[3])=0
 
virtual 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)=0
 
virtual InsecureDatapointers GetWaveComponents () const =0
 
virtual marenv::wave::WaveComponentData GetWaveComponentsCopy () const =0
 
virtual marenv::wave::WaveComponentData GetWaveComponentsCopy (double time, size_t maxComponents=0) const
 
virtual void BlendInPlace (WaveComponentData &other, double alpha)=0
 

Protected Member Functions

 WaveField ()=default
 Constructor.
 

Member Function Documentation

◆ BlendInPlace()

virtual void marenv::wave::WaveField::BlendInPlace ( WaveComponentData other,
double  alpha 
)
pure virtual

Interpolates the wave components towards another set of wave components

Parameters
[in]otherThe other set of wave components
[in]alphaThe blend factor, the relative weight of the other wave components

Implemented in marenv::wave::AiryWavesSimd, marenv::wave::LinearWaveTheory, and marenv::wave::NullWaveField.

◆ ComputeDynamicPressure()

virtual marenv::Status marenv::wave::WaveField::ComputeDynamicPressure ( double  time,
const double  pos[3],
double &  pressureOut 
)
pure virtual

Returns the dynamic pressure at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y,z) for which the pressure is desired.
[out]pressureOutThe pressure at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implemented in marenv::wave::AiryWavesScalar, marenv::wave::AiryWavesSimd, marenv::wave::GerstnerWaves, and marenv::wave::NullWaveField.

◆ ComputeParticleAcceleration()

virtual marenv::Status marenv::wave::WaveField::ComputeParticleAcceleration ( double  time,
const double  pos[3],
double  accOut[3] 
)
pure virtual

Returns the particle acceleration at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y,z) for which the particle acceleration is desired.
[out]accOutThe particle acceleration at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Includes effects of both current and waves.

Implemented in marenv::wave::AiryWavesScalar, marenv::wave::AiryWavesSimd, marenv::wave::GerstnerWaves, and marenv::wave::NullWaveField.

◆ ComputeParticleVelocity()

virtual marenv::Status marenv::wave::WaveField::ComputeParticleVelocity ( double  time,
const double  pos[3],
double  velOut[3] 
)
pure virtual

Returns the particle velocity at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y,z) for which the particle velocity is desired.
[out]velOutThe particle velocity at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Includes effects of both current and waves.

Implemented in marenv::wave::AiryWavesScalar, marenv::wave::AiryWavesSimd, marenv::wave::GerstnerWaves, and marenv::wave::NullWaveField.

◆ ComputePointQuery()

virtual marenv::Status marenv::wave::WaveField::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 
)
pure virtual

Calculates multiple properties of the environment in one call.

Parameters
[in]timeSimulation time.
[in]posPosition.
[out]surface_elevationThe surface elevation above this point.
[out]surface_unit_normalThe surface unit normal above this point.
[out]particle_velocityThe particle velocity in this point.
[out]particle_accelerationThe particle acceleration in this point.
[out]pressureThe pressure. The pressure in this point.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implemented in marenv::wave::AiryWavesScalar, marenv::wave::AiryWavesSimd, marenv::wave::GerstnerWaves, and marenv::wave::NullWaveField.

◆ ComputeSurfaceElevation()

virtual marenv::Status marenv::wave::WaveField::ComputeSurfaceElevation ( double  time,
const double  pos[2],
double &  elevationOut 
)
pure virtual

Returns the surface elevation at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y) for which surface elevation is desired.
[out]elevationOutSurface elevation at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implemented in marenv::wave::AiryWavesScalar, marenv::wave::AiryWavesSimd, marenv::wave::GerstnerWaves, and marenv::wave::NullWaveField.

◆ ComputeSurfaceUnitNormal()

virtual marenv::Status marenv::wave::WaveField::ComputeSurfaceUnitNormal ( double  time,
const double  pos[2],
double  unitNormalOut[3] 
)
pure virtual

Returns the unit normal vector of the surface at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y) for which the unit normal surface vector is desired.
[out]unitNormalOutThe unit normal surface vector at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implemented in marenv::wave::AiryWavesScalar, marenv::wave::AiryWavesSimd, marenv::wave::GerstnerWaves, and marenv::wave::NullWaveField.

◆ ComputeTotalPressure()

virtual marenv::Status marenv::wave::WaveField::ComputeTotalPressure ( double  time,
const double  pos[3],
double &  pressureOut 
)
pure virtual

Returns the total pressure at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y,z) for which the pressure is desired.
[out]pressureOutThe pressure at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implemented in marenv::wave::AiryWavesScalar, marenv::wave::AiryWavesSimd, marenv::wave::GerstnerWaves, and marenv::wave::NullWaveField.

◆ GetWaveComponents()

virtual InsecureDatapointers marenv::wave::WaveField::GetWaveComponents ( ) const
pure virtual

Getter for wave component pointers.

Returns
A structure with pointers to wave component data.

Their use focus on efficiency. Care should be taken to only use these pointers while they are valid.

Implemented in marenv::wave::LinearWaveTheory, and marenv::wave::NullWaveField.

◆ GetWaveComponentsCopy() [1/2]

virtual marenv::wave::WaveComponentData marenv::wave::WaveField::GetWaveComponentsCopy ( ) const
pure virtual

Getter for a copy of wave component specifications.

Returns
A structure with wave component data.

Implemented in marenv::wave::LinearWaveTheory, and marenv::wave::NullWaveField.

◆ GetWaveComponentsCopy() [2/2]

virtual marenv::wave::WaveComponentData marenv::wave::WaveField::GetWaveComponentsCopy ( double  time,
size_t  maxComponents = 0 
) const
virtual

Getter for a copy of wave component specifications at a given time.

Parameters
[in]timeSimulation time used to evaluate the interpolation factor.
[in]maxComponentsMaximum number of components to return (0 = all).
Returns
A structure with wave component data.

During a transition this may return the merged components from both source and destination fields with amplitudes scaled by the interpolation factor. The default implementation ignores time and delegates to the time-independent overload. When limited, the components with the largest amplitudes are kept.

◆ SpectrumName()

virtual std::string marenv::wave::WaveField::SpectrumName ( ) const
pure virtual

Getter for the name of the wave spectrum used for the realisation of the waves.

Returns
Ittc or Jonswap.

Implemented in marenv::wave::LinearWaveTheory, and marenv::wave::NullWaveField.

◆ WaveTheoryName()

virtual std::string marenv::wave::WaveField::WaveTheoryName ( ) const
pure virtual

Getter for the name of the wave theory used for the realisation of the waves.

Returns
Airy or Gerstner.

Implemented in marenv::wave::LinearWaveTheory, and marenv::wave::NullWaveField.


The documentation for this class was generated from the following file: