World Ocean Simulation System (WOSS) library
woss-creator.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 2025 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - WOSS@guerra-tlc.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation;
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
33#ifndef WOSS_CREATOR_DEFINITIONS_H
34#define WOSS_CREATOR_DEFINITIONS_H
35
36#include <string>
37#include <memory>
38#include "woss.h"
40
41static constexpr inline double WOSS_CREATOR_MAX_FREQ_STEP = (1.0e20);
42
43namespace woss {
44
45 class WossDbManager;
46 class TransducerHandler;
47
54
55 protected:
56
69
70 public:
71
76
77 virtual ~WossCreator() = default;
78
87 virtual std::unique_ptr<Woss> const createWoss( const CoordZ& tx, const CoordZ& rx, double start_freq, double end_freq ) const = 0;
88
94 WossCreator& setWossDebug( bool flag ) { woss_debug = flag; return *this; }
95
101 WossCreator& setDebug( bool flag ) { debug = flag; updateDebugFlag(); return *this; }
102
107 bool usingDebug() const { return debug; }
108
113 bool usingWossDebug() const { return woss_debug; }
114
120 WossCreator& setWrkDirPath( const std::string& path ) { work_dir_path = path; return *this; }
121
127 WossCreator& setCleanWorkDir( bool flag ) { woss_clean_workdir = flag; return *this; }
128
133 std::string getWrkDirPath() const { return work_dir_path; }
134
142 WossCreator& setFrequencyStep( double f_step, const CoordZ& tx, const CoordZ& rx ) {
143 if ( f_step <= 0.0 )
144 f_step = WOSS_CREATOR_MAX_FREQ_STEP;
145 ccfrequency_step.replace(f_step, tx, rx);
146 return *this; }
147
155 WossCreator& setFrequencyStep( double f_step, const std::shared_ptr<Location>& tx = CCDouble::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCDouble::ALL_LOCATIONS ) {
156 if ( f_step <= 0.0 )
157 f_step = WOSS_CREATOR_MAX_FREQ_STEP;
158 ccfrequency_step.replace(f_step, tx, rx);
159 return *this; }
160
167 double getFrequencyStep( const CoordZ& tx, const CoordZ& rx ) const {
168 return ccfrequency_step.get(tx, rx); }
169
176 double getFrequencyStep( const std::shared_ptr<Location>& tx = CCDouble::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCDouble::ALL_LOCATIONS ) const {
177 return ccfrequency_step.get(tx, rx); }
178
185 WossCreator& eraseFrequencyStep( const CoordZ& tx, const CoordZ& rx ) {
186 ccfrequency_step.erase(tx, rx); return *this; }
187
194 WossCreator& eraseFrequencyStep( const std::shared_ptr<Location>& tx = CCDouble::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCDouble::ALL_LOCATIONS ) {
195 ccfrequency_step.erase(tx, rx); return *this; }
196
204 WossCreator& setEvolutionTimeQuantum( double value, const CoordZ& tx, const CoordZ& rx ) {
205 ccevolution_time_quantum.replace( value, tx, rx ); return *this; }
206
214 WossCreator& setEvolutionTimeQuantum( double value, const std::shared_ptr<Location>& tx = CCInt::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCInt::ALL_LOCATIONS ) {
215 ccevolution_time_quantum.replace( value, tx, rx ); return *this; }
216
223 double getEvolutionTimeQuantum( const CoordZ& tx, const CoordZ& rx ) const {
224 return ccevolution_time_quantum.get(tx, rx); }
225
232 double getEvolutionTimeQuantum( const std::shared_ptr<Location>& tx = CCInt::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCInt::ALL_LOCATIONS ) const {
233 return ccevolution_time_quantum.get(tx, rx); }
234
242 ccevolution_time_quantum.erase(tx, rx); return *this; }
243
250 WossCreator& eraseEvolutionTimeQuantum( const std::shared_ptr<Location>& tx = CCInt::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCInt::ALL_LOCATIONS ) {
251 ccevolution_time_quantum.erase(tx, rx); return *this; }
252
260 WossCreator& setTotalRuns( int runs, const CoordZ& tx, const CoordZ& rx ) {
261 cctotal_runs.replace( runs, tx, rx ); return *this; }
262
270 WossCreator& setTotalRuns( int runs, const std::shared_ptr<Location>& tx = CCInt::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCInt::ALL_LOCATIONS ) {
271 cctotal_runs.replace( runs, tx, rx ); return *this; }
272
279 int getTotalRuns( const CoordZ& tx, const CoordZ& rx ) const {
280 return cctotal_runs.get(tx, rx); }
281
288 int getTotalRuns( const std::shared_ptr<Location>& tx = CCInt::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCInt::ALL_LOCATIONS ) const {
289 return cctotal_runs.get(tx, rx); }
290
297 WossCreator& eraseTotalRuns( const CoordZ& tx, const CoordZ& rx ) {
298 cctotal_runs.erase( tx, rx ); return *this; }
299
306 WossCreator& eraseTotalRuns( const std::shared_ptr<Location>& tx = CCInt::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCInt::ALL_LOCATIONS ) {
307 cctotal_runs.erase( tx, rx ); return *this; }
308
316 WossCreator& setSimTime( const SimTime& simtime, const CoordZ& tx, const CoordZ& rx ) {
317 ccsimtime_map.replace(simtime, tx, rx); return *this; }
318
326 WossCreator& setSimTime( const SimTime& simtime, const std::shared_ptr<Location>& tx = CCSimTime::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCSimTime::ALL_LOCATIONS ) {
327 ccsimtime_map.replace(simtime, tx, rx); return *this; }
328
335 SimTime getSimTime( const CoordZ& tx, const CoordZ& rx ) const {
336 return ccsimtime_map.get(tx, rx); }
337
344 SimTime getSimTime( const std::shared_ptr<Location>& tx = CCSimTime::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCSimTime::ALL_LOCATIONS ) const {
345 return ccsimtime_map.get(tx, rx); }
346
353 WossCreator& eraseSimTime( const CoordZ& tx, const CoordZ& rx ) { ccsimtime_map.erase(tx, rx); return *this; }
354
361 WossCreator& eraseSimTime( const std::shared_ptr<Location>& tx = CCSimTime::ALL_LOCATIONS, const std::shared_ptr<Location>& rx = CCSimTime::ALL_LOCATIONS ) {
362 ccsimtime_map.erase(tx, rx); return *this; }
363
369 WossCreator& setWossDbManager( const std::shared_ptr<WossDbManager>& ptr ) { woss_db_manager = ptr; return *this; }
370
376 WossCreator& setTransducerHandler( const std::shared_ptr<TransducerHandler>& ptr ) { transducer_handler = ptr; return *this; }
377
378 protected:
379
380 std::shared_ptr<WossDbManager> woss_db_manager;
381
382 std::shared_ptr<TransducerHandler> transducer_handler;
383
387 std::string work_dir_path;
388
393
398
403
408
412 bool debug;
413
418
423
429 virtual bool initializeWoss( Woss& woss_ref ) const = 0;
430
434 virtual void updateDebugFlag();
435
436 };
437
438}
439
440#endif /* WOSS_CREATOR_DEFINITIONS_H */
441
442
3D-Coordinates (lat, long, depth) class definitions and functions library
Definition coordinates-definitions.h:384
Data get(const std::shared_ptr< Location > &tx, const std::shared_ptr< Location > &rx) const
Definition woss-creator-container.cpp:153
void replace(const Data &data, const std::shared_ptr< Location > &tx, const std::shared_ptr< Location > &rx)
Definition woss-creator-container.h:533
static std::shared_ptr< Location > ALL_LOCATIONS
Definition woss-creator-container.h:119
void erase(const std::shared_ptr< Location > &tx, const std::shared_ptr< Location > &rx)
Definition woss-creator-container.h:501
Abstract class that provides correctly initialized Woss objects.
Definition woss-creator.h:53
WossCreator & setEvolutionTimeQuantum(double value, const std::shared_ptr< Location > &tx=CCInt::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCInt::ALL_LOCATIONS)
Definition woss-creator.h:214
WossCreator & eraseFrequencyStep(const std::shared_ptr< Location > &tx=CCDouble::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCDouble::ALL_LOCATIONS)
Definition woss-creator.h:194
WossCreator & eraseSimTime(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:353
WossCreator & setWrkDirPath(const std::string &path)
Definition woss-creator.h:120
WossCreator & setWossDebug(bool flag)
Definition woss-creator.h:94
bool usingWossDebug() const
Definition woss-creator.h:113
WossCreator & eraseEvolutionTimeQuantum(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:241
WossCreator & setFrequencyStep(double f_step, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:142
CCDouble ccevolution_time_quantum
Definition woss-creator.h:392
WossCreator & setWossDbManager(const std::shared_ptr< WossDbManager > &ptr)
Definition woss-creator.h:369
WossCreator & setDebug(bool flag)
Definition woss-creator.h:101
SimTime getSimTime(const std::shared_ptr< Location > &tx=CCSimTime::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCSimTime::ALL_LOCATIONS) const
Definition woss-creator.h:344
bool usingDebug() const
Definition woss-creator.h:107
WossCreator()
Definition woss-creator.cpp:39
WossCreator & setTotalRuns(int runs, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:260
WossCreator & setTotalRuns(int runs, const std::shared_ptr< Location > &tx=CCInt::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCInt::ALL_LOCATIONS)
Definition woss-creator.h:270
virtual ~WossCreator()=default
std::shared_ptr< WossDbManager > woss_db_manager
Definition woss-creator.h:380
WossCreator & eraseTotalRuns(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:297
SimTime getSimTime(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator.h:335
double getEvolutionTimeQuantum(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator.h:223
virtual void updateDebugFlag()
Definition woss-creator.cpp:57
WossCreator & setCleanWorkDir(bool flag)
Definition woss-creator.h:127
std::string work_dir_path
Definition woss-creator.h:387
WossCreator & setSimTime(const SimTime &simtime, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:316
CCSimTime ccsimtime_map
Definition woss-creator.h:407
CCInt cctotal_runs
Definition woss-creator.h:397
WossCreator & setTransducerHandler(const std::shared_ptr< TransducerHandler > &ptr)
Definition woss-creator.h:376
WossCreator & setEvolutionTimeQuantum(double value, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:204
double getFrequencyStep(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator.h:167
double getFrequencyStep(const std::shared_ptr< Location > &tx=CCDouble::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCDouble::ALL_LOCATIONS) const
Definition woss-creator.h:176
CCDouble ccfrequency_step
Definition woss-creator.h:402
bool debug
Definition woss-creator.h:412
std::shared_ptr< TransducerHandler > transducer_handler
Definition woss-creator.h:382
int getTotalRuns(const std::shared_ptr< Location > &tx=CCInt::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCInt::ALL_LOCATIONS) const
Definition woss-creator.h:288
virtual bool initializeWoss(Woss &woss_ref) const =0
Definition woss-creator.cpp:64
WossCreator & setSimTime(const SimTime &simtime, const std::shared_ptr< Location > &tx=CCSimTime::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCSimTime::ALL_LOCATIONS)
Definition woss-creator.h:326
std::string getWrkDirPath() const
Definition woss-creator.h:133
virtual std::unique_ptr< Woss > const createWoss(const CoordZ &tx, const CoordZ &rx, double start_freq, double end_freq) const =0
WossCreator & eraseSimTime(const std::shared_ptr< Location > &tx=CCSimTime::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCSimTime::ALL_LOCATIONS)
Definition woss-creator.h:361
bool woss_clean_workdir
Definition woss-creator.h:422
WossCreator & eraseEvolutionTimeQuantum(const std::shared_ptr< Location > &tx=CCInt::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCInt::ALL_LOCATIONS)
Definition woss-creator.h:250
WossCreator & setFrequencyStep(double f_step, const std::shared_ptr< Location > &tx=CCDouble::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCDouble::ALL_LOCATIONS)
Definition woss-creator.h:155
WossCreator & eraseFrequencyStep(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:185
double getEvolutionTimeQuantum(const std::shared_ptr< Location > &tx=CCInt::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCInt::ALL_LOCATIONS) const
Definition woss-creator.h:232
bool woss_debug
Definition woss-creator.h:417
int getTotalRuns(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator.h:279
WossCreator & eraseTotalRuns(const std::shared_ptr< Location > &tx=CCInt::ALL_LOCATIONS, const std::shared_ptr< Location > &rx=CCInt::ALL_LOCATIONS)
Definition woss-creator.h:306
Abstract class that provides the interface for initializing and running a channel simulator.
Definition woss.h:76
Definition ac-toolbox-arr-asc-reader.h:44
Struct that stores start and end Time.
Definition time-definitions.h:336
Provides the interface for woss::WossCreatorContainer class.
Provides the interface for woss::Woss and woss::WossResReader classes.