Skip to content

Commit

Permalink
WIP: added support for WOA2013 (#24)
Browse files Browse the repository at this point in the history
* added support for WOA2013

* fixed example
  • Loading branch information
MetalKnight authored Jan 30, 2020
1 parent 29bb08e commit 6d26af3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
4 changes: 3 additions & 1 deletion examples/woss-aloha-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ Experiment::InitWossHelper (Ptr<WossHelper> wossHelper, Ptr<WossPropModel> wossP
wossHelper->SetAttribute ("SedimDbCoordFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_coordinates.nc"));
wossHelper->SetAttribute ("SedimDbMarsdenFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_mardsen_square.nc"));
wossHelper->SetAttribute ("SedimDbMarsdenOneFilePath", StringValue (m_databasePath + "/seafloor_sediment/DECK41_mardsen_one_degree.nc"));
wossHelper->SetAttribute ("SspDbCoordFilePath", StringValue (m_databasePath + "/ssp/2WOA2009_SSP_April.nc"));
wossHelper->SetAttribute ("BathyDbDebug", BooleanValue (false));
#if defined (WOSS_NETCDF4_SUPPORT)
wossHelper->SetAttribute ("BathyDbGebcoFormat", IntegerValue (4)); // 15 seconds, 2D netcdf format
wossHelper->SetAttribute ("BathyDbCoordFilePath", StringValue (m_databasePath + "/bathymetry/GEBCO_2019.nc"));
wossHelper->SetAttribute ("SspDbWoaDbType", IntegerValue (1)); // 2013 WOA DB Format
wossHelper->SetAttribute ("SspDbCoordFilePath", StringValue (m_databasePath + "/ssp/WOA2013/WOA2013_SSP_April.nc"));
#else
wossHelper->SetAttribute ("BathyDbGebcoFormat", IntegerValue (3)); // 30 seconds, 2D netcdf format
wossHelper->SetAttribute ("BathyDbCoordFilePath", StringValue (m_databasePath + "/bathymetry/GEBCO_2014_2D.nc"));
wossHelper->SetAttribute ("SspDbCoordFilePath", StringValue (m_databasePath + "/ssp/WOA2009/2WOA2009_SSP_April.nc"));
#endif // defined (WOSS_NETCDF4_SUPPORT)
#endif // defined (WOSS_NETCDF_SUPPORT)
}
Expand Down
29 changes: 26 additions & 3 deletions helper/woss-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,18 @@
#define WH_SIMULATION_TIMES_DEFAULT ()
#define WH_CONCURRENT_THREADS_DEFAULT (0.0)
#define WH_BELLHOP_ARR_SYNTAX_DEFAULT (2)
#define WH_BELLHOP_ARR_SYNTAX_MIN (0)
#define WH_BELLHOP_ARR_SYNTAX_MAX (2)
#define WH_BOX_DEPTH (-3000.0)
#define WH_BOX_RANGE (-3000.0)
#define WH_GEBCO_FORMAT_DEFAULT (3)
#define WH_GEBCO_FORMAT_MIN (0)
#define WH_GEBCO_FORMAT_MAX (4)
#if defined (WOSS_NETCDF4_SUPPORT)
#define WH_WOA_DB_TYPE_DEFAULT (1)
#define WH_WOA_DB_TYPE_MIN (0)
#define WH_WOA_DB_TYPE_MAX (1)
#endif // defined (WOSS_NETCDF_SUPPORT)

namespace ns3 {

Expand Down Expand Up @@ -186,6 +195,9 @@ WossHelper::WossHelper ()
m_sspDbCreatorDebug (WH_DEBUG_DEFAULT),
m_sspDbDebug (WH_DEBUG_DEFAULT),
m_sspDbFilePath (WH_STRING_DEFAULT),
#if defined (WOSS_NETCDF4_SUPPORT)
m_sspWoaDbType (WH_WOA_DB_TYPE_DEFAULT),
#endif // defined (WOSS_NETCDF_SUPPORT)
m_sspDbCreator (NULL),
m_bathyDbCreatorDebug (WH_DEBUG_DEFAULT),
m_bathyDbDebug (WH_DEBUG_DEFAULT),
Expand Down Expand Up @@ -401,7 +413,11 @@ WossHelper::Initialize (Ptr<WossPropModel> wossPropModel)

if ( m_sspDbFilePath != WH_STRING_DEFAULT )
{
#if defined (WOSS_NETCDF4_SUPPORT)
m_sspDbCreator = new woss::SspWoa2005DbCreator ((woss::WOADbType)m_sspWoaDbType);
#else
m_sspDbCreator = new woss::SspWoa2005DbCreator ();
#endif // defined (WOSS_NETCDF_SUPPORT)

m_sspDbCreator->setDbPathName (m_sspDbFilePath);
m_sspDbCreator->setDebug (m_sspDbCreatorDebug);
Expand Down Expand Up @@ -1348,6 +1364,13 @@ WossHelper::GetTypeId ()
StringValue (WH_STRING_DEFAULT),
MakeStringAccessor (&WossHelper::m_sspDbFilePath),
MakeStringChecker () )
#if defined (WOSS_NETCDF4_SUPPORT)
.AddAttribute ("SspDbWoaDbType",
"SSP WOA Db Type: 0 = 2005 Format Db, 1 = 2013 Format Db",
IntegerValue (WH_WOA_DB_TYPE_DEFAULT),
MakeIntegerAccessor (&WossHelper::m_sspWoaDbType),
MakeIntegerChecker<int> (WH_WOA_DB_TYPE_MIN, WH_WOA_DB_TYPE_MAX) )
#endif // defined (WOSS_NETCDF4_SUPPORT)
.AddAttribute ("BathyDbCreatorDebug",
"A boolean that enables or disables the debug screen output of Bathymetry Db Creator",
BooleanValue (WH_DEBUG_DEFAULT),
Expand All @@ -1362,7 +1385,7 @@ WossHelper::GetTypeId ()
"Sets up the the GEBCO database format: 0 = 1D one minute, 1 = 1D 30 seconds, 2 = 2D one minute, 3 = 2D 30 seconds, 4 = 2D 15 seconds",
IntegerValue (WH_GEBCO_FORMAT_DEFAULT),
MakeIntegerAccessor (&WossHelper::m_bathyDbGebcoFormat),
MakeIntegerChecker<int> () )
MakeIntegerChecker<int> (WH_GEBCO_FORMAT_MIN, WH_GEBCO_FORMAT_MAX) )
.AddAttribute ("BathyDbCoordFilePath",
"Bathymetry Db will read the GEBCO database from this file (full path required)",
StringValue (WH_STRING_DEFAULT),
Expand Down Expand Up @@ -1520,10 +1543,10 @@ WossHelper::GetTypeId ()
MakeWossSimTimeAccessor (&WossHelper::m_simTime),
MakeWossSimTimeChecker () )
.AddAttribute ("WossBellhopArrSyntax",
"Syntax to be used during bellhop arr file parsing",
"Syntax to be used during bellhop arr file parsing, range [0-2]",
IntegerValue (WH_BELLHOP_ARR_SYNTAX_DEFAULT),
MakeIntegerAccessor (&WossHelper::m_bellhopArrSyntax),
MakeIntegerChecker<int> () )
MakeIntegerChecker<int> (WH_BELLHOP_ARR_SYNTAX_MIN, WH_BELLHOP_ARR_SYNTAX_MAX) )
.AddAttribute ("WossManagerDebug",
"A boolean that enables or disables the debug screen output of WossManager object",
BooleanValue (WH_DEBUG_DEFAULT),
Expand Down
6 changes: 5 additions & 1 deletion helper/woss-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class WossHelper : public Object
{

public:

WossHelper (); //!< Default constructor.

virtual ~WossHelper (); //!< Default destructor.
Expand Down Expand Up @@ -493,6 +494,9 @@ class WossHelper : public Object
bool m_sspDbCreatorDebug; //!< enable/disable the debug prints of the woss SSP database creator.
bool m_sspDbDebug; //!< enable/disable the debug prints of the woss SSP database.
::std::string m_sspDbFilePath; //!< setup the path of the woss monthly SSP database indexed by geographical coordinates
#if defined (WOSS_NETCDF4_SUPPORT)
int m_sspWoaDbType; //!< WOA SSP Db Type: 0 = 2005 format Db, 1 2013 Format Db
#endif // defined (WOSS_NETCDF_SUPPORT)
woss::SspWoa2005DbCreator *m_sspDbCreator; //!< the helper will automatically allocate the woss sediment database creator

bool m_bathyDbCreatorDebug; //!< enable/disable the debug prints of the woss Bathymetry database creator.
Expand Down Expand Up @@ -534,7 +538,7 @@ class WossHelper : public Object
::std::string m_bellhopBathyType; //!< woss object configuration: Bellhop bathymetry type string
::std::string m_bathyMethod; //!< woss object configuration: Bathymetry write method string
::std::string m_bellhopAltimType; //!< woss object configuration: Bellhop Altimetry type string
int m_bellhopArrSyntax; //!< woss object configration: Bellhop Arr file syntax to be used during .arr file parsing
int m_bellhopArrSyntax; //!< woss object configration: Bellhop Arr file syntax to be used during .arr file parsing, range [0,2]
WossSimTime m_simTime; //!< woss object configuration: woss simulation times (start and end sim times)
woss::BellhopCreator *m_bellhopCreator; //!< the helper will automatically allocate the woss creator
double m_boxDepth; //!< woss object configuration: maximum depth to trace rays to; deeper rays will be ignored
Expand Down

0 comments on commit 6d26af3

Please sign in to comment.