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

WossDb for NetCDF DECK41 Sediment database. More...

#include <sediment-deck41-db.h>

Inheritance diagram for woss::SedimDeck41Db:
Inheritance graph
Collaboration diagram for woss::SedimDeck41Db:
Collaboration graph

Public Member Functions

 SedimDeck41Db (const ::std::string &name)
 
virtual bool openConnection ()
 
virtual bool finalizeConnection ()
 
virtual bool closeConnection ()
 
virtual bool insertValue (const Coord &coordinates, const Sediment &sediment_value)
 
virtual SedimentgetValue (const CoordZ &coordz) const
 
virtual SedimentgetValue (const CoordZVector &coordz_vector) const
 
- 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 bool insertValue (const Coord &coordinates, const Sediment &sediment_value)=0
 
virtual SedimentgetValue (const CoordZ &coords) const =0
 
virtual SedimentgetValue (const CoordZVector &coordz_vector) const =0
 

Protected Member Functions

double calculateAvgDepth (const CoordZVector &coordz_vector) const
 
Deck41Types getDeck41TypesFromCoords (const CoordZVector &coordz_vector) const
 
Deck41Types getDeck41TypesFromMarsdenCoords (const CoordZVector &coordz_vector) const
 
Deck41Types getDeck41TypesFromMarsdenSquare (const CoordZVector &coordz_vector) const
 
Deck41Types calculateDeck41Types (const CoordZVector &coordz_vector) const
 
SedimentcalculateSediment (const Deck41Types &floor_types, double avg_depth) const
 
SedimentcreateSediment (int deck41_type, double depth) const
 
int getMaxAppereanceFrequencyValue (const FrequencyMap &frequency_map) const
 
bool doTestA (const Deck41TypeTests &test) const
 
bool doTestB (const Deck41TypeTests &test) const
 
bool doTestC (const Deck41TypeTests &test) const
 
- Protected Member Functions inherited from woss::WossDb
PathName getPathName (const ::std::string &complete_path)
 

Static Protected Member Functions

static SedimWeightMap initSedimWeightMap ()
 

Protected Attributes

SedimDeck41CoordDb sediment_coord_db
 
SedimDeck41MarsdenDb sediment_marsden_db
 
SedimDeck41MarsdenOneDb sediment_marsden_one_db
 
Deck41TypeTests curr_tests_state
 
Deck41TypeTests prev_tests_state
 
- Protected Attributes inherited from woss::WossDb
::std::string db_name
 
bool debug
 

Static Protected Attributes

static SedimWeightMap sediment_weight_map = SedimDeck41Db::initSedimWeightMap()
 

Friends

class SedimDeck41DbCreator
 

Detailed Description

WossDb for NetCDF DECK41 Sediment database.

SedimDeck41Db implements WossDb and WossSedimentDb for NetCDF DECK41 Sediment database. It provides logic to handle the three custom made databases: coordinates, marsden square and marsden coordinates.

Constructor & Destructor Documentation

◆ SedimDeck41Db()

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

SedimDeck41Db constructor

Parameters
namepathname of database

Member Function Documentation

◆ calculateAvgDepth()

double SedimDeck41Db::calculateAvgDepth ( const CoordZVector coordz_vector) const
protected

Computes the average depth of a valid CoordZVector for Sediment creation

Parameters
coordz_vectora vector of valid CoordZ
Returns
the average depth of the vector [m]

Referenced by getValue().

◆ calculateDeck41Types()

Deck41Types SedimDeck41Db::calculateDeck41Types ( const CoordZVector coordz_vector) const
protected

Gets the Deck41Types of a valid CoordZVector searching in order in: coord db, marsden db, marsden one db. On each search Deck41TypeTests curr_tests_state and prev_tests_state are updated, and based on result conditions, the process stops and returns or goes on to the next database.

Parameters
coordz_vectora vector of valid CoordZ
Returns
the corresponding Deck41Types (main sediment type, second sediment type) of the vector

References curr_tests_state, woss::WossDb::debug, doTestA(), doTestB(), doTestC(), getDeck41TypesFromCoords(), getDeck41TypesFromMarsdenCoords(), getDeck41TypesFromMarsdenSquare(), prev_tests_state, and woss::Deck41TypeTests::updateAllConditions().

Referenced by getValue().

Here is the call graph for this function:

◆ calculateSediment()

Sediment * SedimDeck41Db::calculateSediment ( const Deck41Types &  floor_types,
double  avg_depth 
) const
protected

Creates the corresponding Sediment from the searched Deck41Types returned by calculateDeck41Types

Parameters
floor_typesthe Deck41Types pair resulted from the search process
avg_depthdepth value [m] for Sediment calculations
Returns
Sediment value

Referenced by getValue().

◆ closeConnection()

bool SedimDeck41Db::closeConnection ( )
virtual

Closes the connection to the three databases provided

Returns
true if method was successful, false otherwise

Implements woss::WossDb.

References woss::WossNetcdfDb::closeConnection(), sediment_coord_db, sediment_marsden_db, and sediment_marsden_one_db.

Here is the call graph for this function:

◆ createSediment()

Sediment * SedimDeck41Db::createSediment ( int  deck41_type,
double  depth 
) const
protected

Creates a Sediment from the DECK41 integer type number

Parameters
deck41_typeDECK41 integer floor type number
depthdepth value [m] for Sediment calculations
Returns
Sediment value
See also
Deck41TypeTests

◆ doTestA()

bool woss::SedimDeck41Db::doTestA ( const Deck41TypeTests test) const
inlineprotected

Does Test A on given Deck41TypeTests reference. A positive result means that the search in the databases for a valid Deck41Types is over

Parameters
testconst Deck41TypeTests reference
Returns
true if test succeed, false otherwise

References woss::Deck41TypeTests::getConditionA(), woss::Deck41TypeTests::getConditionB(), woss::Deck41TypeTests::getConditionE(), and woss::Deck41TypeTests::getConditionF().

Referenced by calculateDeck41Types().

Here is the call graph for this function:

◆ doTestB()

bool woss::SedimDeck41Db::doTestB ( const Deck41TypeTests test) const
inlineprotected

Does Test B on given Deck41TypeTests reference. A positive result means that the search in the databases for a valid Deck41Types should continue. If next search step fails a Sediment not valid will be returned from the search process

Parameters
testconst Deck41TypeTests reference
Returns
true if test succeed, false otherwise

References woss::Deck41TypeTests::getConditionC(), woss::Deck41TypeTests::getConditionD(), and woss::Deck41TypeTests::getConditionG().

Referenced by calculateDeck41Types().

Here is the call graph for this function:

◆ doTestC()

bool woss::SedimDeck41Db::doTestC ( const Deck41TypeTests test) const
inlineprotected

Does Test C on given Deck41TypeTests reference. A positive result means that the search in the databases for a valid Deck41Types is over if the next search step Test A fails

Parameters
testconst Deck41TypeTests reference
Returns
true if test succeed, false otherwise

References woss::Deck41TypeTests::getConditionC(), and woss::Deck41TypeTests::getConditionD().

Referenced by calculateDeck41Types().

Here is the call graph for this function:

◆ finalizeConnection()

virtual bool woss::SedimDeck41Db::finalizeConnection ( )
inlinevirtual

Not allowed

Implements woss::WossDb.

◆ getDeck41TypesFromCoords()

Deck41Types SedimDeck41Db::getDeck41TypesFromCoords ( const CoordZVector coordz_vector) const
protected

Gets the Deck41Types of a valid CoordZVector from the SedimDeck41CoordDb database

Parameters
coordz_vectora vector of valid CoordZ
Returns
the corresponding Deck41Types (main sediment type, second sediment type) of the vector

References woss::WossDb::debug, getMaxAppereanceFrequencyValue(), woss::SedimDeck41CoordDb::getSeaFloorType(), and sediment_coord_db.

Referenced by calculateDeck41Types().

Here is the call graph for this function:

◆ getDeck41TypesFromMarsdenCoords()

Deck41Types SedimDeck41Db::getDeck41TypesFromMarsdenCoords ( const CoordZVector coordz_vector) const
protected

Gets the Deck41Types of a valid CoordZVector from the SedimDeck41MarsdenDb database

Parameters
coordz_vectora vector of valid CoordZ
Returns
the corresponding Deck41Types (main sediment type, second sediment type) of the vector

References woss::WossDb::debug, getMaxAppereanceFrequencyValue(), woss::SedimDeck41MarsdenOneDb::getSeaFloorType(), and sediment_marsden_one_db.

Referenced by calculateDeck41Types().

Here is the call graph for this function:

◆ getDeck41TypesFromMarsdenSquare()

Deck41Types SedimDeck41Db::getDeck41TypesFromMarsdenSquare ( const CoordZVector coordz_vector) const
protected

Gets the Deck41Types of a valid CoordZVector from the SedimDeck41MarsdenOneDb database

Parameters
coordz_vectora vector of valid CoordZ
Returns
the corresponding Deck41Types (main sediment type, second sediment type) of the vector

References woss::WossDb::debug, getMaxAppereanceFrequencyValue(), woss::SedimDeck41MarsdenDb::getSeaFloorType(), and sediment_marsden_db.

Referenced by calculateDeck41Types().

Here is the call graph for this function:

◆ getMaxAppereanceFrequencyValue()

int SedimDeck41Db::getMaxAppereanceFrequencyValue ( const FrequencyMap frequency_map) const
protected

Returns the type of the FrequencyMap that has the max number of times of appeareance in a database query result

Parameters
frequency_mapconst FrequencyMap reference
Returns
DECK41 integer type

Referenced by getDeck41TypesFromCoords(), getDeck41TypesFromMarsdenCoords(), and getDeck41TypesFromMarsdenSquare().

◆ getValue() [1/2]

Sediment * SedimDeck41Db::getValue ( const CoordZ coordz) const
virtual

Returns a pointer to a heap-based Sediment for given coordinates and depth, if present in any of the three databases. User is responsible of pointer's ownership

Parameters
coordsconst reference to a valid CoordZ object
Returns
valid Sediment if coordinates are found, not valid otherwise

Implements woss::WossSedimentDb.

References getValue().

Referenced by getValue().

Here is the call graph for this function:

◆ getValue() [2/2]

Sediment * SedimDeck41Db::getValue ( const CoordZVector coordz_vector) const
virtual

Returns a pointer to a heap-based Sediment for given coordinates and depth vector, if at least one set of coordinates is present in any of the three databases. User is responsible of pointer's ownership

Parameters
coordz_vectorconst reference to a valid CoordZ vector
Returns
valid Sediment if at least one set of coordinates is found, not valid otherwise

Implements woss::WossSedimentDb.

References calculateAvgDepth(), calculateDeck41Types(), and calculateSediment().

Here is the call graph for this function:

◆ initSedimWeightMap()

SedimWeightMap SedimDeck41Db::initSedimWeightMap ( )
staticprotected

Initializes the static sediment_weight_map

Returns
a SedimWeightMap

◆ insertValue()

bool SedimDeck41Db::insertValue ( const Coord coordinates,
const Sediment sediment_value 
)
virtual

Inserts the given woss::Sediment value in the database for given coordinates

Parameters
coordinatesconst reference to a valid Coord object
bathymetry_valueconst Reference to Sediment value to be inserted
Returns
true if method was successful, false otherwise

Implements woss::WossSedimentDb.

◆ openConnection()

virtual bool woss::SedimDeck41Db::openConnection ( )
inlinevirtual

Not allowed

Implements woss::WossDb.

Member Data Documentation

◆ curr_tests_state

Deck41TypeTests woss::SedimDeck41Db::curr_tests_state
mutableprotected

Current iteration Deck41TypeTests

Referenced by calculateDeck41Types().

◆ prev_tests_state

Deck41TypeTests woss::SedimDeck41Db::prev_tests_state
mutableprotected

Previous iteration Deck41TypeTests

Referenced by calculateDeck41Types().

◆ sediment_coord_db

SedimDeck41CoordDb woss::SedimDeck41Db::sediment_coord_db
protected

WossDb handling custom made NetCDF DECK41 database

Referenced by closeConnection(), getDeck41TypesFromCoords(), and woss::SedimDeck41DbCreator::initializeSedimDb().

◆ sediment_marsden_db

SedimDeck41MarsdenDb woss::SedimDeck41Db::sediment_marsden_db
protected

WossDb handling custom made NetCDF DECK41 marsden square database

Referenced by closeConnection(), getDeck41TypesFromMarsdenSquare(), and woss::SedimDeck41DbCreator::initializeSedimDb().

◆ sediment_marsden_one_db

SedimDeck41MarsdenOneDb woss::SedimDeck41Db::sediment_marsden_one_db
protected

WossDb handling custom made NetCDF DECK41 marsden coordinates database

Referenced by closeConnection(), getDeck41TypesFromMarsdenCoords(), and woss::SedimDeck41DbCreator::initializeSedimDb().

◆ sediment_weight_map

SedimWeightMap SedimDeck41Db::sediment_weight_map = SedimDeck41Db::initSedimWeightMap()
staticprotected

Weight map for DECK41 floor type to Sediment conversion


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