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 ~ResPressureTxtDb () override=default
 
virtual bool closeConnection () override
 
virtual bool finalizeConnection () override
 
virtual std::unique_ptr< PressuregetValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value) const override
 
virtual bool insertValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value, const Pressure &pressure) override
 
- Public Member Functions inherited from woss::WossTextualDb
 WossTextualDb (const std::string &name)
 
virtual ~WossTextualDb () override
 
virtual bool openConnection () override
 
- Public Member Functions inherited from woss::WossDb
 WossDb (const std::string &name)
 
virtual ~WossDb ()=default
 
void setDbName (const std::string &pathname)
 
std::string getDbName () const
 
void setDebug (double flag=true)
 
bool isUsingDebug () const
 
virtual bool isValid () const
 
- Public Member Functions inherited from woss::WossResPressDb
 WossResPressDb ()=default
 
virtual ~WossResPressDb ()=default
 

Static Public Member Functions

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

Protected Types

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

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) const
 

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

◆ FMCIter

using woss::ResPressureTxtDb::FMCIter = FreqMap::const_iterator
protected

◆ FMIter

using woss::ResPressureTxtDb::FMIter = FreqMap::iterator
protected

◆ FMRIter

using woss::ResPressureTxtDb::FMRIter = FreqMap::reverse_iterator
protected

◆ FreqMap

using woss::ResPressureTxtDb::FreqMap = std::map< PDouble, TimeMap >
protected

◆ PMCIter

using woss::ResPressureTxtDb::PMCIter = PressureMatrix::const_iterator
protected

◆ PMCRIter

using woss::ResPressureTxtDb::PMCRIter = PressureMatrix::const_reverse_iterator
protected

◆ PMIter

using woss::ResPressureTxtDb::PMIter = PressureMatrix::iterator
protected

◆ PMRIter

using woss::ResPressureTxtDb::PMRIter = PressureMatrix::reverse_iterator
protected

◆ PressureMatrix

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

◆ RxCIter

using woss::ResPressureTxtDb::RxCIter = RxMap::const_iterator
protected

◆ RxMap

◆ RxMIter

using woss::ResPressureTxtDb::RxMIter = RxMap::iterator
protected

◆ RxMRIter

using woss::ResPressureTxtDb::RxMRIter = RxMap::reverse_iterator
protected

◆ TimeMap

using woss::ResPressureTxtDb::TimeMap = std::map< time_t, std::complex< double > >
protected

◆ TMCIter

using woss::ResPressureTxtDb::TMCIter = TimeMap::const_iterator
protected

◆ TMIter

using woss::ResPressureTxtDb::TMIter = TimeMap::iterator
protected

◆ TMRIter

using woss::ResPressureTxtDb::TMRIter = TimeMap::reverse_iterator
protected

Constructor & Destructor Documentation

◆ ResPressureTxtDb()

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

ResPressureTxtDb constructor

Parameters
namepathname of database

◆ ~ResPressureTxtDb()

virtual woss::ResPressureTxtDb::~ResPressureTxtDb ( )
overridevirtualdefault

Member Function Documentation

◆ closeConnection()

bool ResPressureTxtDb::closeConnection ( )
overridevirtual

Closes the connection to the text file provided

Returns
true if method was successful, false otherwise

Reimplemented from woss::WossTextualDb.

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

Here is the call graph for this function:

◆ finalizeConnection()

bool ResPressureTxtDb::finalizeConnection ( )
overridevirtual

Post openConnection() actions

Returns
true if method was successful, false otherwise

Implements woss::WossDb.

References importMap().

Here is the call graph for this function:

◆ getSpaceSampling()

static double woss::ResPressureTxtDb::getSpaceSampling ( )
inlinestatic

References space_sampling.

◆ getValue()

std::unique_ptr< Pressure > ResPressureTxtDb::getValue ( const CoordZ coord_tx,
const CoordZ coord_rx,
const double  frequency,
const Time time_value 
) const
overridevirtual

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 std::unique_ptr with a 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, woss::WossDb::debug, initial_pressmap_size, pressure_map, printScreenMap(), and woss::WossTextualDb::textual_db.

Referenced by finalizeConnection().

Here is the call graph for this function:

◆ insertValue()

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

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, has_been_modified, 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

References pressure_map, and woss::WossTextualDb::textual_db.

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

◆ 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:

◆ setSpaceSampling()

static void woss::ResPressureTxtDb::setSpaceSampling ( double  value)
inlinestatic

References space_sampling.

◆ 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, woss::WossDb::debug, pressure_map, printScreenMap(), and woss::WossTextualDb::textual_db.

Referenced by closeConnection().

Here is the call graph for this function:

Member Data Documentation

◆ has_been_modified

bool woss::ResPressureTxtDb::has_been_modified
protected

Referenced by closeConnection(), and insertValue().

◆ 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 importMap(), and woss::ResPressureBinDb::importMap().

◆ pressure_map

PressureMatrix woss::ResPressureTxtDb::pressure_map
protected

PressureMatrix map for storing imported and user inserted Pressure values

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

◆ space_sampling

double ResPressureTxtDb::space_sampling = 0.0
staticprotected

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