World Ocean Simulation System (WOSS) library
woss::Woss Class Referenceabstract

Abstract class that provides the interface for initializing and running a channel simulator. More...

#include <woss.h>

Inheritance diagram for woss::Woss:
Inheritance graph
Collaboration diagram for woss::Woss:
Collaboration graph

Public Member Functions

 Woss ()
 
 Woss (const CoordZ &tx, const CoordZ &rx, const Time &start_t, const Time &end_t, double start_freq, double end_freq, double freq_step)
 
virtual bool initialize ()=0
 
virtual bool run ()=0
 
virtual bool timeEvolve (const Time &time_value)=0
 
virtual bool isValid () const =0
 
virtual PressuregetAvgPressure (double frequency, double tx_depth, double start_rx_depth=WOSS_MIN_DEPTH, double start_rx_range=WOSS_MIN_RANGE, double end_rx_depth=WOSS_MAX_DEPTH, double end_rx_range=WOSS_MAX_RANGE) const =0
 
virtual PressuregetPressure (double frequency, double tx_depth, double rx_depth, double rx_range) const =0
 
virtual TimeArrgetTimeArr (double frequency, double tx_depth, double rx_depth, double rx_range) const =0
 
WosssetDebug (bool flag)
 
WosssetCleanWorkDir (bool flag)
 
WosssetWorkDirPath (const ::std::string &path)
 
WosssetWossDbManager (const WossDbManager *const ptr)
 
WossinsertFrequency (double freq)
 
WossinsertFrequencies (double freq_start, double freq_end, double freq_step)
 
WosssetFrequencies (const FreqSet &freq_set)
 
WosseraseFrequency (double freq)
 
WossclearFrequencies ()
 
WosssetTotalRuns (int runs)
 
WosssetTxCoordZ (const CoordZ &coordz)
 
WosssetRxCoordZ (const CoordZ &coordz)
 
WosssetStartTime (const Time &start_t)
 
WosssetEndTime (const Time &end_t)
 
WosssetEvolutionTimeQuantum (double value)
 
int getWossId () const
 
::std::string getWorkDirPath () const
 
const FreqSetgetFrequencies () const
 
double getMinFrequency () const
 
double getMaxFrequency () const
 
FreqSCIt freq_begin () const
 
FreqSCIt freq_end () const
 
FreqSCRIt freq_rbegin () const
 
FreqSCRIt freq_rend () const
 
FreqSCIt freq_lower_bound (double frequency) const
 
FreqSCIt freq_upper_bound (double frequency) const
 
int getTotalRuns () const
 
CoordZ getTxCoordZ () const
 
CoordZ getRxCoordZ () const
 
Time getStartTime () const
 
Time getCurrentTime () const
 
Time getEndTime () const
 
double getEvolutionTimeQuantum () const
 
double getGreatCircleDistance () const
 
double getDistance () const
 
double getBearing () const
 
bool usingDebug () const
 
virtual bool isRunning () const
 

Protected Member Functions

virtual bool mkWorkDir (double curr_frequency, int curr_run=0)
 
virtual bool rmWorkDir (double curr_frequency, int curr_run=0)
 
virtual bool rmWorkDir ()
 

Protected Attributes

int woss_id
 
::std::string work_dir_path
 
const WossDbManagerdb_manager
 
Time start_time
 
Time current_time
 
Time end_time
 
double evolution_time_quantum
 
CoordZ tx_coordz
 
CoordZ rx_coordz
 
FreqSet frequencies
 
double bearing
 
double total_great_circle_distance
 
double total_distance
 
int total_runs
 
bool debug
 
bool has_run_once
 
volatile bool is_running
 
bool clean_workdir
 

Static Protected Attributes

static pthread_spinlock_t woss_mutex = woss::initWossSpinlock( &Woss::woss_mutex , 0 )
 
static int woss_counter = 0
 

Friends

void destroyWossSpinlock ()
 

Detailed Description

Abstract class that provides the interface for initializing and running a channel simulator.

Woss class has the task to properly initialize and run a channel simulator and to provide its results ( with the optional aid of ResReader class ).

Constructor & Destructor Documentation

◆ Woss() [1/2]

Woss::Woss ( )

Woss default constructor. Default constructed objects are not valid

References woss_counter, woss_id, and woss_mutex.

◆ Woss() [2/2]

Woss::Woss ( const CoordZ tx,
const CoordZ rx,
const Time start_t,
const Time end_t,
double  start_freq,
double  end_freq,
double  freq_step 
)

Woss constructor

Parameters
txconst reference to a valid CoordZ object ( transmitter )
rxconst reference to a valid CoordZ object ( receiver )
start_tconst reference to a valid Time object for SSP's averaging purposes ( start date time )
end_tconst reference to a valid Time object for SSP's averaging purposes ( end date time )
start_freqstart frequency [Hz]
end_freqend frequency [Hz]
freq_stepfrequency step [Hz]

References end_time, insertFrequencies(), woss::CoordZ::isValid(), woss::Time::isValid(), start_time, woss_counter, woss_id, and woss_mutex.

Here is the call graph for this function:

Member Function Documentation

◆ clearFrequencies()

Woss & woss::Woss::clearFrequencies ( )
inline

Erases all frequencies

Returns
reference to *this

References frequencies.

◆ eraseFrequency()

Woss & woss::Woss::eraseFrequency ( double  freq)
inline

Erases the given frequency from the FreqSet

Parameters
freqfrequency value [Hz]
Returns
reference to *this

References frequencies.

◆ freq_begin()

FreqSCIt woss::Woss::freq_begin ( ) const
inline

Returns a const iterator to the beginning of FreqSet in use

Returns
const FreqSet iterator

References frequencies.

◆ freq_end()

FreqSCIt woss::Woss::freq_end ( ) const
inline

Returns a const iterator to the end of FreqSet in use

Returns
const FreqSet iterator

References frequencies.

Referenced by insertFrequencies().

◆ freq_lower_bound()

FreqSCIt woss::Woss::freq_lower_bound ( double  frequency) const
inline

Returns a const iterator to the value >= frequency parameter

Parameters
frequencyconst reference to a frequency value [Hz]
Returns
const iterator to end() if frequency is not found

References frequencies.

Referenced by woss::WossManagerResDb::getWossPressure(), woss::WossManagerResDbMT::getWossPressure(), woss::WossManager::getWossPressure(), woss::WossManagerResDb::getWossTimeArr(), woss::WossManagerResDbMT::getWossTimeArr(), and woss::WossManager::getWossTimeArr().

◆ freq_rbegin()

FreqSCRIt woss::Woss::freq_rbegin ( ) const
inline

Returns a const iterator to the reverse beginning of FreqSet in use

Returns
const FreqSet reverse iterator

References frequencies.

◆ freq_rend()

FreqSCRIt woss::Woss::freq_rend ( ) const
inline

Returns a const iterator to the reverse of FreqSet in use

Returns
const FreqSet reverse iterator

References frequencies.

◆ freq_upper_bound()

FreqSCIt woss::Woss::freq_upper_bound ( double  frequency) const
inline

Returns a const iterator to the value > frequency parameter

Parameters
frequencyconst reference to a frequency value [Hz]
Returns
const iterator to end() if frequency is not found

References frequencies.

◆ getAvgPressure()

virtual Pressure * woss::Woss::getAvgPressure ( double  frequency,
double  tx_depth,
double  start_rx_depth = WOSS_MIN_DEPTH,
double  start_rx_range = WOSS_MIN_RANGE,
double  end_rx_depth = WOSS_MAX_DEPTH,
double  end_rx_range = WOSS_MAX_RANGE 
) const
pure virtual

Gets the average Pressure value in given rx range-depth box

Parameters
frequencyfrequency [Hz]
tx_depthtransmitter depth [m]
start_rx_depthstart receiver depth [m]
start_rx_rangestart receiver range [m]
end_rx_depthend receiver depth [m]
end_rx_rangeend receiver range [m]
Returns
a valid Pressure value

Implemented in woss::BellhopWoss.

Referenced by woss::WossManagerResDb::getWossPressure(), woss::WossManagerResDbMT::getWossPressure(), and woss::WossManager::getWossPressure().

◆ getBearing()

double woss::Woss::getBearing ( ) const
inline

Gets the bearing between transmitter and receiver

Returns
bearing [radians]

References bearing.

◆ getCurrentTime()

Time woss::Woss::getCurrentTime ( ) const
inline

Gets start date time

Returns
a valid Time object

References current_time.

◆ getDistance()

double woss::Woss::getDistance ( ) const
inline

Gets the distance between transmitter and receiver

Returns
distance value [m]

References total_distance.

◆ getEndTime()

Time woss::Woss::getEndTime ( ) const
inline

Gets end date time

Returns
a valid Time object

References end_time.

◆ getEvolutionTimeQuantum()

double woss::Woss::getEvolutionTimeQuantum ( ) const
inline

Gets the evolution time threshold

Returns
time [s]

References evolution_time_quantum.

◆ getFrequencies()

const FreqSet & woss::Woss::getFrequencies ( ) const
inline

Returns the FreqSet in use

Returns
const reference to frequencies

References frequencies.

◆ getGreatCircleDistance()

double woss::Woss::getGreatCircleDistance ( ) const
inline

Gets the surface great-circle distance between transmitter and receiver

Returns
distance value [m]
See also
Coord::getGreatCircleDistance()

References total_great_circle_distance.

◆ getMaxFrequency()

double woss::Woss::getMaxFrequency ( ) const
inline

Returns the maximum frequency in use

Returns
frequency value [Hz]

References frequencies.

◆ getMinFrequency()

double woss::Woss::getMinFrequency ( ) const
inline

Returns the minimum frequency in use

Returns
frequency value [Hz]

References frequencies.

◆ getPressure()

virtual Pressure * woss::Woss::getPressure ( double  frequency,
double  tx_depth,
double  rx_depth,
double  rx_range 
) const
pure virtual

Gets a Pressure value of given range, depths

Parameters
frequencyfrequency [Hz]
tx_depthtransmitter depth [m]
rx_depthreceiver depth [m]
rx_rangereceiver range [m]
Returns
a valid Pressure value

Implemented in woss::BellhopWoss.

Referenced by woss::WossManager::getWossPressure().

◆ getRxCoordZ()

CoordZ woss::Woss::getRxCoordZ ( ) const
inline

Gets receiver CoordZ

Returns
valid CoordZ object

References rx_coordz.

Referenced by woss::BellhopCreator::initializeBhWoss(), and woss::WossCreator::initializeWoss().

◆ getStartTime()

Time woss::Woss::getStartTime ( ) const
inline

Gets start date time

Returns
a valid Time object

References start_time.

◆ getTimeArr()

virtual TimeArr * woss::Woss::getTimeArr ( double  frequency,
double  tx_depth,
double  rx_depth,
double  rx_range 
) const
pure virtual

Gets a TimeArr value of given range, depths

Parameters
frequencyfrequency [Hz]
tx_depthtransmitter depth [m]
rx_depthreceiver depth [m]
rx_rangereceiver range [m]
Returns
a valid Pressure value

Implemented in woss::BellhopWoss.

Referenced by woss::WossManagerResDb::getWossTimeArr(), woss::WossManagerResDbMT::getWossTimeArr(), and woss::WossManager::getWossTimeArr().

◆ getTotalRuns()

int woss::Woss::getTotalRuns ( ) const
inline

Gets the total number of channel simulator's runs

Returns
total number of runs

References total_runs.

◆ getTxCoordZ()

CoordZ woss::Woss::getTxCoordZ ( ) const
inline

Gets transmitter CoordZ

Returns
valid CoordZ object

References tx_coordz.

Referenced by woss::BellhopCreator::initializeBhWoss(), and woss::WossCreator::initializeWoss().

◆ getWorkDirPath()

::std::string woss::Woss::getWorkDirPath ( ) const
inline

Returns the work pathname

Returns
string

References work_dir_path.

◆ getWossId()

◆ initialize()

bool Woss::initialize ( )
pure virtual

Initializes the channel simulator

Returns
true if method was successful, false otherwise

Implemented in woss::ACToolboxWoss, and woss::BellhopWoss.

References bearing, debug, woss::CoordZ::getCartDistance(), woss::Coord::getGreatCircleDistance(), woss::Coord::getInitialBearing(), rx_coordz, total_distance, total_great_circle_distance, tx_coordz, and woss_id.

Referenced by woss::ACToolboxWoss::initialize(), and woss::BellhopCreator::initializeWoss().

Here is the call graph for this function:

◆ insertFrequencies()

Woss & Woss::insertFrequencies ( double  freq_start,
double  freq_end,
double  freq_step 
)

Insert a range of valid frequencies

Parameters
freq_starta valid frequency value [Hz]
freq_enda valid frequency value [Hz] >= freq_start
freq_stepa valid frequency value [Hz]
Returns
reference to *this

References freq_end(), and frequencies.

Referenced by Woss().

Here is the call graph for this function:

◆ insertFrequency()

Woss & woss::Woss::insertFrequency ( double  freq)
inline

Insert a frequency value into the FreqSet

Parameters
freqa valid frequency value [Hz]
Returns
reference to *this

References frequencies.

◆ isRunning()

bool Woss::isRunning ( ) const
virtual

Checks if instance is already running the channel simulator

References is_running, and woss_mutex.

Referenced by woss::WossManagerResDbMT::getWossPressure(), and woss::WossManagerResDbMT::getWossTimeArr().

◆ isValid()

virtual bool woss::Woss::isValid ( ) const
pure virtual

Checks the validity of Woss

Returns
true if it's valid, false otherwise

Implemented in woss::ACToolboxWoss, and woss::BellhopWoss.

◆ mkWorkDir()

bool Woss::mkWorkDir ( double  curr_frequency,
int  curr_run = 0 
)
protectedvirtual

Creates the temporary work directory

Parameters
curr_frequencyfrequency in use [Hz]
curr_runcurrent run value < total_runs
Returns
true if method succeeded, false otherwise

References current_time, debug, work_dir_path, and woss_id.

Referenced by woss::BellhopWoss::writeCfgFiles().

◆ rmWorkDir()

bool Woss::rmWorkDir ( double  curr_frequency,
int  curr_run = 0 
)
protectedvirtual

Removes the temporary work directory

Parameters
curr_frequencyfrequency in use [Hz]
curr_runcurrent run value < total_runs
Returns
true if method succeeded, false otherwise

References current_time, work_dir_path, and woss_id.

Referenced by woss::BellhopWoss::removeCfgFiles().

◆ run()

virtual bool woss::Woss::run ( )
pure virtual

Runs the channel simulator. It is mandatory to set is_running to true at the beginning of this function and set it to false before returning.

Returns
true if method was successful, false otherwise

Implemented in woss::BellhopWoss.

Referenced by woss::WossManagerResDb::getWossPressure(), woss::WossManagerResDbMT::getWossPressure(), woss::WossManager::getWossPressure(), woss::WossManagerResDb::getWossTimeArr(), woss::WossManagerResDbMT::getWossTimeArr(), and woss::WossManager::getWossTimeArr().

◆ setCleanWorkDir()

Woss & woss::Woss::setCleanWorkDir ( bool  flag)
inline

Sets clean work dir flag

Parameters
flagdebug flag
Returns
reference to *this

References clean_workdir.

Referenced by woss::WossCreator::initializeWoss().

◆ setDebug()

Woss & woss::Woss::setDebug ( bool  flag)
inline

Sets debug flag

Parameters
flagdebug flag
Returns
reference to *this

References debug.

Referenced by woss::WossCreator::initializeWoss().

◆ setEndTime()

Woss & woss::Woss::setEndTime ( const Time end_t)
inline

Sets end date time

Parameters
coordzconst reference to a valid Time object
Returns
reference to *this

References end_time.

◆ setEvolutionTimeQuantum()

Woss & woss::Woss::setEvolutionTimeQuantum ( double  value)
inline

Sets time evolution threshold

Parameters
valuetime threshold in seconds.
Returns
reference to *this

References evolution_time_quantum.

Referenced by woss::WossCreator::initializeWoss().

◆ setFrequencies()

Woss & woss::Woss::setFrequencies ( const FreqSet freq_set)
inline

Copys the given FreqSet

Parameters
freq_setconst reference to a FreqSet
Returns
reference to *this

References frequencies.

◆ setRxCoordZ()

Woss & woss::Woss::setRxCoordZ ( const CoordZ coordz)
inline

Sets receiver CoordZ

Parameters
coordzconst reference to a valid CoordZ object
Returns
reference to *this

References rx_coordz.

◆ setStartTime()

Woss & woss::Woss::setStartTime ( const Time start_t)
inline

Sets start date time

Parameters
coordzconst reference to a valid Time object
Returns
reference to *this

References start_time.

◆ setTotalRuns()

Woss & woss::Woss::setTotalRuns ( int  runs)
inline

Sets the total number of channel simulator's runs

Parameters
runsnumber of runs
Returns
reference to *this

References total_runs.

Referenced by woss::WossCreator::initializeWoss().

◆ setTxCoordZ()

Woss & woss::Woss::setTxCoordZ ( const CoordZ coordz)
inline

Sets transmitter CoordZ

Parameters
coordzconst reference to a valid CoordZ object
Returns
reference to *this

References tx_coordz.

◆ setWorkDirPath()

Woss & woss::Woss::setWorkDirPath ( const ::std::string &  path)
inline

Sets the work pathname

Parameters
pathvalid pathname
Returns
reference to *this

References work_dir_path.

Referenced by woss::WossCreator::initializeWoss().

◆ setWossDbManager()

Woss & woss::Woss::setWossDbManager ( const WossDbManager *const  ptr)
inline

Sets the WossDbManager pointer

Parameters
pathconst pointer to a const WossDbManager object
Returns
reference to *this

References db_manager.

Referenced by woss::WossCreator::initializeWoss().

◆ timeEvolve()

virtual bool woss::Woss::timeEvolve ( const Time time_value)
pure virtual

Performs a time evoulion of all time-dependant parameters

Parameters
time_valueconstant reference to a valid Time object ( between start_time and end_time)
Returns
true if method was successful, false otherwise

Implemented in woss::BellhopWoss.

Referenced by woss::WossManagerResDb::getWossPressure(), woss::WossManagerResDbMT::getWossPressure(), woss::WossManager::getWossPressure(), woss::WossManagerResDb::getWossTimeArr(), woss::WossManagerResDbMT::getWossTimeArr(), and woss::WossManager::getWossTimeArr().

◆ usingDebug()

Friends And Related Function Documentation

◆ destroyWossSpinlock

void destroyWossSpinlock ( )
friend

Function used to destroy the static pthread_spin_t woss_mutex

Member Data Documentation

◆ bearing

double woss::Woss::bearing
protected

Initial bearing between tx_coordz and rx_coordz [radians]

See also
Coord::getInitialBearing()

Referenced by getBearing(), woss::ACToolboxWoss::initCoordZVector(), and initialize().

◆ clean_workdir

bool woss::Woss::clean_workdir
protected

flag for removing working dir

Referenced by setCleanWorkDir().

◆ current_time

Time woss::Woss::current_time
protected

◆ db_manager

◆ debug

◆ end_time

Time woss::Woss::end_time
protected

Valid end date time value, for SSP averaging purposes

Referenced by getEndTime(), woss::ACToolboxWoss::isValid(), setEndTime(), woss::BellhopWoss::timeEvolve(), and Woss().

◆ evolution_time_quantum

double woss::Woss::evolution_time_quantum
protected

Time threshold in seconds. For time evolution purposes. A value < 0 ==> evoulion is off A value == 0 ==> no threshold

Referenced by getEvolutionTimeQuantum(), setEvolutionTimeQuantum(), and woss::BellhopWoss::timeEvolve().

◆ frequencies

◆ is_running

volatile bool woss::Woss::is_running
protected

Running flag

Referenced by isRunning(), and woss::BellhopWoss::run().

◆ rx_coordz

◆ start_time

Time woss::Woss::start_time
protected

Valid start date time value, for SSP averaging purposes

Referenced by getStartTime(), woss::ACToolboxWoss::isValid(), setStartTime(), woss::BellhopWoss::timeEvolve(), and Woss().

◆ total_distance

double woss::Woss::total_distance
protected

Cartesian distance between tx_coordz and rx_coordz [m]

See also
CoordZ::getDistance()

Referenced by woss::BellhopWoss::checkAngles(), getDistance(), woss::BellhopWoss::initialize(), and initialize().

◆ total_great_circle_distance

◆ total_runs

◆ tx_coordz

◆ work_dir_path

::std::string woss::Woss::work_dir_path
protected

Directory path for temporary files (e.g. channel simulator files)

Referenced by getWorkDirPath(), woss::BellhopWoss::initCfgFiles(), mkWorkDir(), rmWorkDir(), and setWorkDirPath().

◆ woss_counter

int Woss::woss_counter = 0
staticprotected

Unique instances id-counter

Referenced by Woss().

◆ woss_id

◆ woss_mutex

pthread_spinlock_t Woss::woss_mutex = woss::initWossSpinlock( &Woss::woss_mutex , 0 )
staticprotected

Spinlock for syncronization purposes

Referenced by isRunning(), and Woss().


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