World Ocean Simulation System (WOSS) library
sediment-definitions.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_SEDIMENT_DEFINITIONS_H
34#define WOSS_SEDIMENT_DEFINITIONS_H
35
36
37#include <utility>
38#include <string>
39#include <memory>
40#include <ostream>
41
42namespace woss {
43
44 static constexpr inline double SEDIMENT_NOT_SET_VALUE = (-10000.0);
45
46 using Deck41Types = std::pair < int , int >;
47
54 class Sediment {
55
56 public:
57
61 Sediment();
62
73 Sediment( const std::string& name, double velc, double vels, double dens, double attc, double atts, double bottom_depth = 1.0 );
74
75 Sediment( const Sediment& copy ) = default;
76
77 Sediment( Sediment&& tmp ) = default;
78
79 virtual ~Sediment() = default;
80
85 virtual std::unique_ptr<Sediment> create() const {
86 return std::make_unique<Sediment>(); }
87
99 virtual std::unique_ptr<Sediment> create( const std::string& name, double velc, double vels, double dens, double attc, double atts, double bottom_depth = 1.0 ) const {
100 return std::make_unique<Sediment>( name, velc, vels, dens, attc, atts, bottom_depth); }
101
106 virtual std::unique_ptr<Sediment> clone() const { return std::make_unique<Sediment>(*this); }
107
113 Sediment& setType( const std::string& name ) { type = name; return *this; }
114
120 Sediment& setVelocityC( double vel ) { vel_c = vel; return *this; }
121
127 Sediment& setVelocityS( double vel ) { vel_s = vel; return *this; }
128
134 Sediment& setDensity( double dens ) { density = dens; return *this; }
135
141 Sediment& setAttenuationC( double att ) { att_c = att; return *this; }
142
148 Sediment& setAttenuationS( double att ) { att_s = att; return *this; }
149
155 Sediment& setDepth( double bottom_depth ) { depth = bottom_depth; return *this; }
156
168 Sediment& set( const std::string& name, double velc, double vels, double dens, double attc , double atts, double bottom_depth ) {
170 att_c = attc; att_s = atts; depth = bottom_depth; return *this; }
171
176 static void setDebug( bool flag ) { debug = flag; }
177
182 double getVelocityC() const { return vel_c; }
183
188 double getVelocityS() const { return vel_s; }
189
194 double getDensity() const { return density; }
195
200 double getAttenuationC() const { return att_c; }
201
206 double getAttenuationS() const { return att_s; }
207
212 double getDepth() const { return depth; }
213
218 std::string getType() const { return type; }
219
224 virtual bool isValid() const { return ( vel_c != SEDIMENT_NOT_SET_VALUE && vel_s != SEDIMENT_NOT_SET_VALUE && density != SEDIMENT_NOT_SET_VALUE
225 && att_c != SEDIMENT_NOT_SET_VALUE && att_s != SEDIMENT_NOT_SET_VALUE ); }
226
231 virtual const std::string getStringValues() const;
232
233 Sediment& operator=( const Sediment& sed ) = default;
234
236
243 friend const Sediment operator+( const Sediment& left, const Sediment& right );
244
251 friend const Sediment operator-( const Sediment& left, const Sediment& right );
252
259 friend const Sediment operator/( const Sediment& left, const Sediment& right );
260
267 friend const Sediment operator*( const Sediment& left, const Sediment& right );
268
276
284
292
300
301
308 friend Sediment& operator+=( Sediment& left, double right );
309
316 friend Sediment& operator-=( Sediment& left, double right );
317
324 friend Sediment& operator/=( Sediment& left, double right );
325
332 friend Sediment& operator*=( Sediment& left, double right );
333
340 friend bool operator==( const Sediment& left, const Sediment& right );
341
348 friend bool operator!=( const Sediment& left, const Sediment& right );
349
356 friend const Sediment operator+( const double left, const Sediment& right );
357
364 friend const Sediment operator-( const double left, const Sediment& right );
365
372 friend const Sediment operator/( const double left, const Sediment& right );
373
380 friend const Sediment operator*( const double left, const Sediment& right );
381
388 friend const Sediment operator+( const Sediment& left, double right );
389
396 friend const Sediment operator-( const Sediment& left, double right );
397
404 friend const Sediment operator/( const Sediment& left, double right );
405
412 friend const Sediment operator*( const Sediment& left, double right );
413
420 friend std::ostream& operator<<( std::ostream& os, const Sediment& instance );
421
422 protected:
423
427 std::string type;
428
432 double depth;
433
437 double vel_c;
438
442 double vel_s;
443
447 double density;
448
452 double att_c;
453
457 double att_s;
458
462 static bool debug;
463
464 };
465
466 // non-inline friend operator declarations
468 const Sediment operator/( const double left, const Sediment& right );
469
470 const Sediment operator*( const double left, const Sediment& right );
471
472 const Sediment operator/( const Sediment& left, const double right );
473
474 const Sediment operator*( const Sediment& left, const double right );
475
476
477 Sediment& operator+=( Sediment& left, const Sediment& right );
478
479 Sediment& operator-=( Sediment& left, const Sediment& right );
480
481 Sediment& operator/=( Sediment& left, const Sediment& right );
482
483 Sediment& operator*=( Sediment& left, const Sediment& right );
484
485
486 Sediment& operator+=( Sediment& left, double right );
487
488 Sediment& operator-=( Sediment& left, double right );
489
490 Sediment& operator/=( Sediment& left, double right );
491
492 Sediment& operator*=( Sediment& left, double right );
493
494 //inline functions
496 inline bool operator==( const Sediment& left, const Sediment& right ) {
497 if ( &left == &right )
498 return true;
499 return( left.vel_c == right.vel_c && left.vel_s == right.vel_s && left.att_c == right.att_c && left.att_s == right.att_s
500 && left.density == right.density );
501 }
502
503 inline bool operator!=( const Sediment& left, const Sediment& right ) {
504 if ( &left == &right )
505 return false;
506 return( left.vel_c != right.vel_c || left.vel_s != right.vel_s || left.att_c != right.att_c || left.att_s != right.att_s
507 || left.density != right.density );
508 }
509
510 inline std::ostream& operator<<(std::ostream& os, const Sediment& instance ) {
511 os << "Sediment type = " << instance.type << "; velocity_c = " << instance.vel_c << "; velocity_s = " << instance.vel_s << "; density = " << instance.density
512 << "; attenuation_c = " << instance.att_c << "; attenuation_s = " << instance.att_s;
513 return os;
514 }
515
516 inline const Sediment operator+( const Sediment& left, const Sediment& right ) {
517 return( Sediment( left.type + " + " + right.type, left.vel_c + right.vel_c, left.vel_s + right.vel_s, left.density + right.density, left.att_c + right.att_c, left.att_s + right.att_s ) );
518 }
519
520 inline const Sediment operator-( const Sediment& left, const Sediment& right ) {
521 return( Sediment( left.type + " - " + right.type, left.vel_c - right.vel_c, left.vel_s - right.vel_s, left.density - right.density, left.att_c - right.att_c, left.att_s - right.att_s ) );
522 }
523
524 inline const Sediment operator/( const Sediment& left, const Sediment& right ) {
525 return( Sediment( left.type + " / " + right.type, left.vel_c / right.vel_c, left.vel_s / right.vel_s, left.density / right.density, left.att_c / right.att_c, left.att_s / right.att_s ) );
526 }
527
528 inline const Sediment operator*( const Sediment& left, const Sediment& right ) {
529 return( Sediment( left.type + " * " + right.type, left.vel_c * right.vel_c, left.vel_s * right.vel_s, left.density * right.density, left.att_c * right.att_c, left.att_s * right.att_s ) );
530 }
532
538 class SedimentGravel : public Sediment {
539
540 public:
541
542 SedimentGravel(double depth = 1.0);
543
544 protected:
545
549 double calculateVelocityS(double vels, double bottom_depth) const;
550
551 };
552
553
559 class SedimentSand : public Sediment {
560
561 public:
562
563 SedimentSand();
564
565 };
566
567
573 class SedimentSilt : public Sediment {
574
575 public:
576
577 SedimentSilt(double depth = 1.0);
578
579 protected:
580
584 double calculateVelocityS(double vels, double bottom_depth) const;
585
586 };
587
588
594 class SedimentClay : public Sediment {
595
596 public:
597
598 SedimentClay();
599
600 };
601
602
608 class SedimentOoze : public Sediment {
609
610 public:
611
612 SedimentOoze();
613
614 };
615
616
622 class SedimentMud : public Sediment {
623
624 public:
625
626 SedimentMud(double depth = 1.0);
627
628 protected:
629
633 double calculateVelocityS(double vels, double bottom_depth) const;
634
635 };
636
637
645 class SedimentRocks : public Sediment {
646
647 public:
648
650
651 };
652
653
661 class SedimentOrganic : public Sediment {
662
663 public:
664
666
667 };
668
669
677 class SedimentNodules : public Sediment {
678
679 public:
680
682
683 };
684
685
692
693 public:
694
696
697 };
698
699}
700
701#endif /* WOSS_SEDIMENT_DEFINITIONS_H */
702
Clay type implementation.
Definition sediment-definitions.h:594
SedimentClay()
Definition sediment-definitions.cpp:276
Gravel type implementation.
Definition sediment-definitions.h:538
double calculateVelocityS(double vels, double bottom_depth) const
Definition sediment-definitions.cpp:234
Hard bottom type implementation.
Definition sediment-definitions.h:691
SedimentHardBottom()
Definition sediment-definitions.cpp:311
Mud type implementation.
Definition sediment-definitions.h:622
double calculateVelocityS(double vels, double bottom_depth) const
Definition sediment-definitions.cpp:262
Deck41 nodules type implementation.
Definition sediment-definitions.h:677
SedimentNodules()
Definition sediment-definitions.cpp:304
Ooze type implementation.
Definition sediment-definitions.h:608
SedimentOoze()
Definition sediment-definitions.cpp:283
Organic type implementation.
Definition sediment-definitions.h:661
SedimentOrganic()
Definition sediment-definitions.cpp:297
Rocks type implementation.
Definition sediment-definitions.h:645
SedimentRocks()
Definition sediment-definitions.cpp:290
Sand type implementation.
Definition sediment-definitions.h:559
SedimentSand()
Definition sediment-definitions.cpp:269
Silt type implementation.
Definition sediment-definitions.h:573
double calculateVelocityS(double vels, double bottom_depth) const
Definition sediment-definitions.cpp:248
Surficial sediment geoacoustic parameters definitions.
Definition sediment-definitions.h:54
Sediment & setVelocityC(double vel)
Definition sediment-definitions.h:120
Sediment & setAttenuationC(double att)
Definition sediment-definitions.h:141
friend bool operator!=(const Sediment &left, const Sediment &right)
Definition sediment-definitions.h:503
friend const Sediment operator-(const double left, const Sediment &right)
Sediment & operator=(Sediment &&tmp)=default
friend Sediment & operator+=(Sediment &left, const Sediment &right)
friend Sediment & operator*=(Sediment &left, const Sediment &right)
Sediment & setDensity(double dens)
Definition sediment-definitions.h:134
Sediment & set(const std::string &name, double velc, double vels, double dens, double attc, double atts, double bottom_depth)
Definition sediment-definitions.h:168
friend const Sediment operator*(const double left, const Sediment &right)
virtual std::unique_ptr< Sediment > create() const
Definition sediment-definitions.h:85
double att_c
Definition sediment-definitions.h:452
Sediment()
Definition sediment-definitions.cpp:44
friend bool operator==(const Sediment &left, const Sediment &right)
Definition sediment-definitions.h:496
friend const Sediment operator/(const double left, const Sediment &right)
friend const Sediment operator-(const Sediment &left, const Sediment &right)
Definition sediment-definitions.h:520
virtual ~Sediment()=default
friend Sediment & operator-=(Sediment &left, const Sediment &right)
std::string getType() const
Definition sediment-definitions.h:218
friend const Sediment operator+(const Sediment &left, const Sediment &right)
Definition sediment-definitions.h:516
friend const Sediment operator/(const Sediment &left, double right)
double getDepth() const
Definition sediment-definitions.h:212
static void setDebug(bool flag)
Definition sediment-definitions.h:176
virtual bool isValid() const
Definition sediment-definitions.h:224
friend Sediment & operator-=(Sediment &left, double right)
double getVelocityC() const
Definition sediment-definitions.h:182
friend const Sediment operator/(const Sediment &left, const Sediment &right)
Definition sediment-definitions.h:524
friend Sediment & operator/=(Sediment &left, const Sediment &right)
friend const Sediment operator*(const Sediment &left, double right)
Sediment & setAttenuationS(double att)
Definition sediment-definitions.h:148
Sediment & setDepth(double bottom_depth)
Definition sediment-definitions.h:155
virtual std::unique_ptr< Sediment > clone() const
Definition sediment-definitions.h:106
friend std::ostream & operator<<(std::ostream &os, const Sediment &instance)
Definition sediment-definitions.h:510
friend Sediment & operator/=(Sediment &left, double right)
double density
Definition sediment-definitions.h:447
friend const Sediment operator-(const Sediment &left, double right)
double getDensity() const
Definition sediment-definitions.h:194
double depth
Definition sediment-definitions.h:432
std::string type
Definition sediment-definitions.h:427
double vel_s
Definition sediment-definitions.h:442
virtual std::unique_ptr< Sediment > create(const std::string &name, double velc, double vels, double dens, double attc, double atts, double bottom_depth=1.0) const
Definition sediment-definitions.h:99
friend Sediment & operator*=(Sediment &left, double right)
double getAttenuationS() const
Definition sediment-definitions.h:206
double getVelocityS() const
Definition sediment-definitions.h:188
Sediment(const Sediment &copy)=default
double getAttenuationC() const
Definition sediment-definitions.h:200
Sediment(Sediment &&tmp)=default
double vel_c
Definition sediment-definitions.h:437
friend const Sediment operator+(const Sediment &left, double right)
virtual const std::string getStringValues() const
Definition sediment-definitions.cpp:69
static bool debug
Definition sediment-definitions.h:462
double att_s
Definition sediment-definitions.h:457
friend Sediment & operator+=(Sediment &left, double right)
Sediment & operator=(const Sediment &sed)=default
Sediment & setType(const std::string &name)
Definition sediment-definitions.h:113
friend const Sediment operator*(const Sediment &left, const Sediment &right)
Definition sediment-definitions.h:528
friend const Sediment operator+(const double left, const Sediment &right)
Sediment & setVelocityS(double vel)
Definition sediment-definitions.h:127
Definition ac-toolbox-arr-asc-reader.h:44
bool operator!=(const Altimetry &left, const Altimetry &right)
Definition altimetry-definitions.h:833
std::ostream & operator<<(std::ostream &os, const Altimetry &instance)
Definition altimetry-definitions.h:812
Altimetry & operator*=(Altimetry &left, double right)
Definition altimetry-definitions.cpp:346
std::pair< int, int > Deck41Types
Definition sediment-definitions.h:46
const Altimetry operator/(const Altimetry &left, const double right)
Definition altimetry-definitions.cpp:264
bool operator==(const Altimetry &left, const Altimetry &right)
Definition altimetry-definitions.h:826
Altimetry & operator+=(Altimetry &left, const Altimetry &right)
Definition altimetry-definitions.cpp:306
const Altimetry operator+(const Altimetry &left, const Altimetry &right)
Definition altimetry-definitions.cpp:236
const Altimetry operator*(const Altimetry &left, const double right)
Definition altimetry-definitions.cpp:271
Altimetry & operator-=(Altimetry &left, const Altimetry &right)
Definition altimetry-definitions.cpp:314
const Altimetry operator-(const Altimetry &left, const Altimetry &right)
Definition altimetry-definitions.cpp:243
Altimetry & operator/=(Altimetry &left, double right)
Definition altimetry-definitions.cpp:338