World Ocean Simulation System (WOSS) library
woss::Pressure Class Reference

Complex attenuated pressure class. More...

#include <pressure-definitions.h>

Collaboration diagram for woss::Pressure:
Collaboration graph

Public Member Functions

 Pressure (double real=0.0, double imag=0.0)
 
 Pressure (const ::std::complex< double > &complex_press)
 
 Pressure (const TimeArr &time_arr)
 
 Pressure (const Pressure &copy)
 
virtual Pressurecreate (double real=0.0, double imag=0.0) const
 
virtual Pressurecreate (const ::std::complex< double > &complex_press) const
 
virtual Pressurecreate (const TimeArr &time_arr) const
 
virtual Pressurecreate (const Pressure &copy) const
 
virtual Pressureclone () const
 
virtual PressurecreateArray (unsigned int array_size) const
 
 operator::std::complex () const
 
double real () const
 
double imag () const
 
double abs () const
 
double phase () const
 
Pressure sqrt () const
 
virtual bool isValid () const
 
double getTxLossDb () const
 
virtual bool checkAttenuation (double distance, double frequency)
 
Pressureoperator= (const Pressure &x)
 
friend::std::ostream & operator<< (::std::ostream &os, const Pressure &instance)
 

Static Public Member Functions

static const ::std::complex< double > createNotValid ()
 
static double getTxLossDb (const ::std::complex< double > &val)
 
static void setDebug (bool flag)
 

Protected Member Functions

virtual double getAttenuation (double dist, double freq)
 
double getThorpAtt (double frequency)
 

Protected Attributes

::std::complex< double > complex_pressure
 

Static Protected Attributes

static bool debug = false
 

Friends

const Pressure operator+ (const Pressure &left, const Pressure &right)
 
const Pressure operator- (const Pressure &left, const Pressure &right)
 
const Pressure operator/ (const Pressure &left, const Pressure &right)
 
const Pressure operator* (const Pressure &left, const Pressure &right)
 
Pressureoperator+= (Pressure &left, const Pressure &right)
 
Pressureoperator-= (Pressure &left, const Pressure &right)
 
Pressureoperator/= (Pressure &left, const Pressure &right)
 
Pressureoperator*= (Pressure &left, const Pressure &right)
 
bool operator== (const Pressure &left, const Pressure &right)
 
bool operator!= (const Pressure &left, const Pressure &right)
 

Detailed Description

Complex attenuated pressure class.

The Pressure class stores a complex<double> acoustic pressure value for attenuation purposes. Pressure values are adimensional: complex pressure represented has to be considered in conjunction with transmitted pressure. Pressure also provides full arithmetic capability and a attenuation coherency check

Constructor & Destructor Documentation

◆ Pressure() [1/4]

Pressure::Pressure ( double  real = 0.0,
double  imag = 0.0 
)

Pressure constructor

Parameters
realreal part
imagimaginary part

◆ Pressure() [2/4]

woss::Pressure::Pressure ( const ::std::complex< double > &  complex_press)

Pressure constructor

Parameters
complex_presscomplex<double> value

◆ Pressure() [3/4]

Pressure::Pressure ( const TimeArr time_arr)

Constructs a Pressure from a TimeArr

Parameters
time_arrvalid TimeArr const reference

References woss::TimeArr::begin(), complex_pressure, createNotValid(), woss::TimeArr::end(), and woss::TimeArr::isValid().

Here is the call graph for this function:

◆ Pressure() [4/4]

Pressure::Pressure ( const Pressure copy)

Pressure copy constructor

Parameters
copyPressure to be copied

References complex_pressure.

Member Function Documentation

◆ abs()

double woss::Pressure::abs ( ) const
inline

Gets the absolute value

Returns
double absolute value

References complex_pressure.

Referenced by WossMPropagation::computeGain(), getTxLossDb(), and WossMPhyBpsk::getTxPower().

◆ checkAttenuation()

bool Pressure::checkAttenuation ( double  distance,
double  frequency 
)
virtual

Checks if the attuenuation provided by the complex pressure is truly an attenuation, e.g. if abs < 1. If not, replace the pressure with the attenuation provided by Thorp absorption process at given frequency along the given distance

Parameters
distancedistance value in meters
frequencyfrequency value in hertz
Returns
true if correction was applied, false otherwise

References complex_pressure, debug, getAttenuation(), and phase().

Referenced by woss::TimeArr::checkPressureAttenuation(), and WossMPropagation::computeGain().

Here is the call graph for this function:

◆ clone()

virtual Pressure * woss::Pressure::clone ( ) const
inlinevirtual

Pressure virtual factory method

Returns
a heap-created copy of this instance

Referenced by woss::DefHandler::operator=().

◆ create() [1/4]

virtual Pressure * woss::Pressure::create ( const ::std::complex< double > &  complex_press) const
inlinevirtual

Pressure virtual factory method

Parameters
complex_presscomplex<double> value
Returns
a heap-created Pressure object

◆ create() [2/4]

virtual Pressure * woss::Pressure::create ( const Pressure copy) const
inlinevirtual

Pressure virtual factory method

Parameters
copyPressure to be copied
Returns
a heap-created Pressure object

◆ create() [3/4]

virtual Pressure * woss::Pressure::create ( const TimeArr time_arr) const
inlinevirtual

Pressure virtual factory method

Parameters
time_arrvalid TimeArr const reference
Returns
a heap-created Pressure object

◆ create() [4/4]

virtual Pressure * woss::Pressure::create ( double  real = 0.0,
double  imag = 0.0 
) const
inlinevirtual

◆ createArray()

virtual Pressure * woss::Pressure::createArray ( unsigned int  array_size) const
inlinevirtual

Pressure virtual factory method

Parameters
array_sizesize of array
Returns
a heap-created array of size array_size

◆ createNotValid()

◆ getAttenuation()

double Pressure::getAttenuation ( double  dist,
double  freq 
)
protectedvirtual

Gets the linear acoustic attenuation incurred at given frequency along the given distance

Parameters
distdistance in meters
freqfrequency in hertz
Returns
linear attenuation

References getThorpAtt().

Referenced by checkAttenuation(), and WossMPropagation::computeGain().

Here is the call graph for this function:

◆ getThorpAtt()

double Pressure::getThorpAtt ( double  frequency)
protected

Gets the acoustic attenuation (in db re uPa / m ) given by Thorp absorption process incurred at given frequency

Parameters
freqfrequency in hertz
Returns
attenuation in db re uPa / m

Referenced by getAttenuation().

◆ getTxLossDb() [1/2]

double woss::Pressure::getTxLossDb ( ) const
inline

Returns the Transmission Loss measured in db

Returns
the Transmission Loss [db]

References abs(), complex_pressure, and isValid().

Referenced by WossMPropagation::computeGain(), woss::ArrAscResReader::getArrAscFile(), woss::ArrBinResReader::getArrBinFile(), woss::ShdResReader::getShdFile(), and woss::TimeArr::lowerBoundTxLoss().

Here is the call graph for this function:

◆ getTxLossDb() [2/2]

static double woss::Pressure::getTxLossDb ( const ::std::complex< double > &  val)
inlinestatic

Returns the Transmission Loss measured in db

Returns
the Transmission Loss [db]

◆ imag()

double woss::Pressure::imag ( ) const
inline

Gets the imaginary part

Returns
double imaginary part

References complex_pressure.

Referenced by create().

◆ isValid()

virtual bool woss::Pressure::isValid ( ) const
inlinevirtual

Checks the validity of complex pressure provided

Returns
true if complex pressure is valid, false otherwise

References complex_pressure.

Referenced by getTxLossDb(), woss::WossManagerResDb::getWossPressure(), woss::WossManagerResDbMT::getWossPressure(), woss::TimeArr::insertValue(), woss::TimeArr::sumValue(), and woss::TimeArr::TimeArr().

◆ operator::std::complex()

woss::Pressure::operator::std::complex ( ) const
inline

complex<double> operator for implicit casting

Returns
a copy of complex_pressure

◆ operator<<()

friend::std::ostream & woss::Pressure::operator<< ( ::std::ostream &  os,
const Pressure instance 
)

<< operator

Parameters
osleft operand ostream reference
instanceright operand const Pressure reference
Returns
os reference after the operation

◆ operator=()

Pressure & Pressure::operator= ( const Pressure x)

Assignment operator

Parameters
copyconst reference to a Pressure object to be copied
Returns
Pressure reference to this

References complex_pressure.

◆ phase()

double woss::Pressure::phase ( ) const
inline

Gets the phase (arg) value

Returns
double phase (arg) value

References complex_pressure.

Referenced by checkAttenuation().

◆ real()

double woss::Pressure::real ( ) const
inline

Gets the real part

Returns
double real part

References complex_pressure.

Referenced by create().

◆ setDebug()

static void woss::Pressure::setDebug ( bool  flag)
inlinestatic

Sets debug for the whole class

Parameters
flagdebug value

References debug.

◆ sqrt()

Pressure woss::Pressure::sqrt ( ) const
inline

Gets the square root of a complex number

Returns
double square root value

References complex_pressure.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const Pressure left,
const Pressure right 
)
friend

Inequality operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left != right, false otherwise

◆ operator*

const Pressure operator* ( const Pressure left,
const Pressure right 
)
friend

Multiplication operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator*=

Pressure & operator*= ( Pressure left,
const Pressure right 
)
friend

Compound assignment multiplication operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator+

const Pressure operator+ ( const Pressure left,
const Pressure right 
)
friend

Sum operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator+=

Pressure & operator+= ( Pressure left,
const Pressure right 
)
friend

Compound assignment sum operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator-

const Pressure operator- ( const Pressure left,
const Pressure right 
)
friend

Subtraction operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator-=

Pressure & operator-= ( Pressure left,
const Pressure right 
)
friend

Compound assignment subtraction operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator/

const Pressure operator/ ( const Pressure left,
const Pressure right 
)
friend

Division operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
a new const instance holding the operation result

◆ operator/=

Pressure & operator/= ( Pressure left,
const Pressure right 
)
friend

Compound assignment division operator

Parameters
leftleft operand reference
rightright operand const reference
Returns
left reference after the operation

◆ operator==

bool operator== ( const Pressure left,
const Pressure right 
)
friend

Equality operator

Parameters
leftleft operand const reference
rightright operand const reference
Returns
true if left == right, false otherwise

Member Data Documentation

◆ complex_pressure

::std::complex< double > woss::Pressure::complex_pressure
protected

◆ debug

bool Pressure::debug = false
staticprotected

Debug flag

Referenced by checkAttenuation(), and setDebug().


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