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

Textual WossDb for Pressure. More...

#include <res-pressure-txt-db.h>

Inheritance diagram for woss::ResPressureTxtDb:
Inheritance graph
Collaboration diagram for woss::ResPressureTxtDb:
Collaboration graph

Public Member Functions

 ResPressureTxtDb (const ::std::string &name)
 
virtual bool closeConnection ()
 
virtual bool finalizeConnection ()
 
virtual PressuregetValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value) const
 
virtual bool insertValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value, const Pressure &pressure)
 
- Public Member Functions inherited from woss::WossTextualDb
 WossTextualDb (const ::std::string &name)
 
virtual bool openConnection ()
 
virtual bool closeConnection ()
 
- Public Member Functions inherited from woss::WossDb
 WossDb (const ::std::string &name)
 
void setDbName (const ::std::string &pathname)
 
::std::string getDbName () const
 
void setDebug (double flag=true)
 
bool isUsingDebug () const
 
virtual bool isValid ()
 
virtual bool openConnection ()=0
 
virtual bool finalizeConnection ()=0
 
virtual bool closeConnection ()=0
 
virtual PressuregetValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value) const =0
 
virtual bool insertValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value, const Pressure &pressure)=0
 

Static Public Member Functions

static void setSpaceSampling (double value)
 
static double getSpaceSampling ()
 

Protected Types

typedef ::std::map< time_t, ::std::complex< double > > TimeMap
 
typedef TimeMap::iterator TMIter
 
typedef TimeMap::const_iterator TMCIter
 
typedef TimeMap::reverse_iterator TMRIter
 
typedef ::std::map< PDouble, TimeMap > FreqMap
 
typedef FreqMap::iterator FMIter
 
typedef FreqMap::reverse_iterator FMRIter
 
typedef ::std::map< CoordZ, FreqMap, CoordComparator< ResPressureTxtDb, CoordZ > > RxMap
 
typedef RxMap::iterator RxMIter
 
typedef RxMap::reverse_iterator RxMRIter
 
typedef ::std::map< CoordZ, RxMap, CoordComparator< ResPressureTxtDb, CoordZ > > PressureMatrix
 
typedef PressureMatrix::iterator PMIter
 
typedef PressureMatrix::const_iterator PMCIter
 
typedef PressureMatrix::reverse_iterator PMRIter
 
typedef PressureMatrix::const_reverse_iterator PMCRIter
 

Protected Member Functions

void printScreenMap ()
 
virtual bool writeMap ()
 
virtual bool importMap ()
 
::std::complex< double > readMap (const CoordZ &tx, const CoordZ &rx, const double frequency, const Time &time_value) const
 
- Protected Member Functions inherited from woss::WossDb
PathName getPathName (const ::std::string &complete_path)
 

Protected Attributes

PressureMatrix pressure_map
 
int initial_pressmap_size
 
bool has_been_modified
 
- Protected Attributes inherited from woss::WossTextualDb
::std::fstream textual_db
 
- Protected Attributes inherited from woss::WossDb
::std::string db_name
 
bool debug
 

Static Protected Attributes

static double space_sampling = 0.0
 

Detailed Description

Textual WossDb for Pressure.

ResPressureTxtDb implements WossTextualDb and WossResPressDb for storing calculated Pressure into a text file

Member Typedef Documentation

◆ PressureMatrix

Multidimensional map that links a transmitter CoordZ to a receiver CoordZ to a frequency PDouble value and finally to a Pressure value

Constructor & Destructor Documentation

◆ ResPressureTxtDb()

ResPressureTxtDb::ResPressureTxtDb ( const ::std::string &  name)

ResPressureTxtDb constructor

Parameters
namepathname of database

Member Function Documentation

◆ closeConnection()

bool ResPressureTxtDb::closeConnection ( )
virtual

Closes the connection to the text file provided

Returns
true if method was successful, false otherwise

Reimplemented from woss::WossTextualDb.

References woss::WossTextualDb::closeConnection(), and writeMap().

Here is the call graph for this function:

◆ finalizeConnection()

bool ResPressureTxtDb::finalizeConnection ( )
virtual

Post openConnection() actions

Returns
true if method was successful, false otherwise

Implements woss::WossDb.

References importMap().

Here is the call graph for this function:

◆ getValue()

Pressure * ResPressureTxtDb::getValue ( const CoordZ coord_tx,
const CoordZ coord_rx,
const double  frequency,
const Time time_value 
) const
virtual

Returns a pointer to a heap-created Pressure for given frequency, transmitter and receiver coordinates if present in the database. User is responsible of pointer's ownership

Parameters
coord_txconst reference to a valid CoordZ object
coord_rxconst reference to a valid CoordZ object
frequencyused frequency [hz]
time_valueconst reference to a valid Time object
Returns
valid Pressure if parameters are found, not valid otherwise

Implements woss::WossResPressDb.

References woss::Pressure::createNotValid(), woss::Singleton< T >::instance(), woss::Time::isValid(), pressure_map, and readMap().

Here is the call graph for this function:

◆ importMap()

bool ResPressureTxtDb::importMap ( )
protectedvirtual

Imports the formatted textual files into pressure_map. The column format is the following:
tx latitude, tx longitude, tx depth, rx latitude, rx longitude, rx depth, frequency, real pressure, imag pressure

Returns
true if operation succeeds, false otherwise

Reimplemented in woss::ResPressureBinDb.

References woss::WossDb::db_name, and woss::WossTextualDb::textual_db.

Referenced by finalizeConnection().

◆ insertValue()

bool ResPressureTxtDb::insertValue ( const CoordZ coord_tx,
const CoordZ coord_rx,
const double  frequency,
const Time time_value,
const Pressure pressure 
)
virtual

Inserts the given Pressure value in the pressure_map at given frequency, transmitter and receiver coordinates

Parameters
coord_txconst reference to a valid CoordZ object
coord_rxconst reference to a valid CoordZ object
frequencyused frequency [hz]
time_valueconst reference to a valid Time object
pressurecomputed Pressure

Implements woss::WossResPressDb.

References woss::WossDb::debug, and pressure_map.

◆ printScreenMap()

void ResPressureTxtDb::printScreenMap ( )
protected

Prints pressure_map to screen. The columns format is the following:
tx latitude, tx longitude, tx depth, rx latitude, rx longitude, rx depth, frequency, real pressure, imag pressure

Returns
true if operation succeeds, false otherwise

Referenced by woss::ResPressureBinDb::importMap().

◆ readMap()

std::complex< double > ResPressureTxtDb::readMap ( const CoordZ tx,
const CoordZ rx,
const double  frequency,
const Time time_value 
) const
protected

Reads given values from pressure_map

Parameters
txvalid transmitter coordinates
rxvalid receiver coordinates
frequencyfrequency [hz]
time_valueconst reference to a valid time_value
Returns
valid Pressure if parameters are found, not valid otherwise

References woss::Pressure::createNotValid(), and pressure_map.

Referenced by getValue().

Here is the call graph for this function:

◆ writeMap()

bool ResPressureTxtDb::writeMap ( )
protectedvirtual

Writes pressure_map to textual files. The columns format is the following:
tx latitude, tx longitude, tx depth, rx latitude, rx longitude, rx depth, frequency, real pressure, imag pressure

Returns
true if operation succeeds, false otherwise

Reimplemented in woss::ResPressureBinDb.

References woss::WossDb::db_name, and woss::WossTextualDb::textual_db.

Referenced by closeConnection().

Member Data Documentation

◆ initial_pressmap_size

int woss::ResPressureTxtDb::initial_pressmap_size
protected

pressure_map's initial size. If pressure_map's size is greater on closeConnection() the map will be written to disk

Referenced by woss::ResPressureBinDb::importMap().

◆ pressure_map

PressureMatrix woss::ResPressureTxtDb::pressure_map
protected

PressureMatrix map for storing imported and user inserted Pressure values

Referenced by getValue(), woss::ResPressureBinDb::importMap(), insertValue(), readMap(), and woss::ResPressureBinDb::writeMap().


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