LEFT | RIGHT |
(no file at all) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2015 Federico Guerra |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Author: Federico Guerra <federico@guerra-tlc.com> |
| 19 */ |
| 20 |
| 21 #ifdef NS3_WOSS_SUPPORT |
| 22 |
| 23 #include "woss-helper.h" |
| 24 #include "ns3/log.h" |
| 25 #include "ns3/double.h" |
| 26 #include "ns3/boolean.h" |
| 27 #include "ns3/integer.h" |
| 28 #include "ns3/string.h" |
| 29 |
| 30 |
| 31 #define WH_SPACE_SAMPLING_DEFAULT (0.0) |
| 32 #define WH_DEBUG_DEFAULT false |
| 33 #define WH_TIME_EVOLUTION_DEFAULT (-1.0) |
| 34 #define WH_STRING_DEFAULT "" |
| 35 #define WH_TOTAL_RUNS_DEFAULT (5) |
| 36 #define WH_FREQUENCY_STEP_DEFAULT (0.0) |
| 37 #define WH_TOTAL_RANGE_STEPS_DEFAULT (3000.0) |
| 38 #define WH_TX_MIN_DEPTH_OFFSET_DEFAULT (0.0) |
| 39 #define WH_TX_MAX_DEPTH_OFFSET_DEFAULT (0.0) |
| 40 #define WH_TOTAL_TRANSMITTERS_DEFAULT (1) |
| 41 #define WH_TOTAL_RX_DEPTHS_DEFAULT (2) |
| 42 #define WH_RX_MIN_DEPTH_OFFSET_DEFAULT (-0.1) |
| 43 #define WH_RX_MAX_DEPTH_OFFSET_DEFAULT (0.1) |
| 44 #define WH_TOTAL_RX_RANGES_DEFAULT (2) |
| 45 #define WH_RX_MIN_RANGE_OFFSET_DEFAULT (-0.1) |
| 46 #define WH_RX_MAX_RANGE_OFFSET_DEFAULT (0.1) |
| 47 #define WH_TOTAL_RAYS_DEFAULT (0) |
| 48 #define WH_MIN_ANGLE_DEFAULT (-180.0) |
| 49 #define WH_MAX_ANGLE_DEFAULT (180.0) |
| 50 #define WH_SSP_DEPTH_PRECISION_DEFAULT (1.0E-8) |
| 51 #define WH_NORMALIZED_SSP_DEPTH_STEPS_DEFAULT (100000) |
| 52 #define WH_WORK_PATH_DEFAULT "./woss-output/work-dir" |
| 53 #define WH_BELLHOP_MODE_DEFAULT "A" |
| 54 #define WH_BEAM_OPTIONS_DEFAULT "B" |
| 55 #define WH_BATHYMETRY_TYPE_DEFAULT "L" |
| 56 #define WH_BATHYMETRY_METHOD_DEFAULT "S" |
| 57 #define WH_ALTIMETRY_TYPE_DEFAULT "L" |
| 58 #define WH_SIMULATION_TIMES_DEFAULT () |
| 59 #define WH_CONCURRENT_THREADS_DEFAULT (0.0) |
| 60 #define WH_BELLHOP_ARR_SYNTAX_DEFAULT (1) |
| 61 |
| 62 |
| 63 namespace ns3 { |
| 64 |
| 65 NS_LOG_COMPONENT_DEFINE ("WossHelper"); |
| 66 |
| 67 ATTRIBUTE_HELPER_CPP (WossSimTime); |
| 68 |
| 69 Vector |
| 70 CreateVectorFromCoords (double latitude, double longitude, double depth) |
| 71 { |
| 72 woss::CoordZ coordz (latitude, longitude, depth); |
| 73 |
| 74 return Vector (coordz.getCartX (), coordz.getCartY (), coordz.getCartZ ()); |
| 75 } |
| 76 |
| 77 Vector |
| 78 CreateVectorFromCoordZ (woss::CoordZ coordz) |
| 79 { |
| 80 return Vector (coordz.getCartX (), coordz.getCartY (), coordz.getCartZ ()); |
| 81 } |
| 82 |
| 83 woss::CoordZ |
| 84 CreateCoordZFromVector (Vector vect) |
| 85 { |
| 86 return (woss::CoordZ::getCoordZFromCartesianCoords (vect.x, vect.y, vect.z)); |
| 87 } |
| 88 |
| 89 |
| 90 woss::Coord |
| 91 CreateCoordFromVector (Vector vect) |
| 92 { |
| 93 woss::CoordZ coordZtemp = woss::CoordZ::getCoordZFromCartesianCoords (vect.x,
vect.y, vect.z); |
| 94 return (woss::Coord (coordZtemp.getLatitude (), coordZtemp.getLongitude ())); |
| 95 } |
| 96 |
| 97 |
| 98 ::std::ostream & |
| 99 operator << (::std::ostream &os, const WossSimTime &simTime) |
| 100 { |
| 101 os << simTime.start_time.getDay () << "|" << simTime.start_time.getMonth () <<
"|" << simTime.start_time.getYear () << "|" |
| 102 << simTime.end_time.getDay () << "|" << simTime.end_time.getMonth () << "|" <<
simTime.end_time.getYear (); |
| 103 |
| 104 return os; |
| 105 } |
| 106 |
| 107 ::std::istream & |
| 108 operator >> (::std::istream &is, WossSimTime &simTime) |
| 109 { |
| 110 char c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11; |
| 111 int d1, mn1, y1, h1, m1, s1, d2, mn2, y2, h2, m2, s2; |
| 112 |
| 113 is >> d1 >> c1 >> mn1 >> c2 >> y1 >> c3 >> h1 >> c4 >> m1 >> c5 >> s1 >> c6 |
| 114 >> d2 >> c7 >> mn2 >> c8 >> y2 >> c9 >> h2 >> c10 >> m2 >> c11 >> s2; |
| 115 |
| 116 if (c1 != '|' |
| 117 || c2 != '|' |
| 118 || c3 != '|' |
| 119 || c4 != '|' |
| 120 || c5 != '|' |
| 121 || c6 != '|' |
| 122 || c7 != '|' |
| 123 || c8 != '|' |
| 124 || c9 != '|' |
| 125 || c10 != '|' |
| 126 || c11 != '|' |
| 127 ) |
| 128 { |
| 129 is.setstate (std::ios_base::failbit); |
| 130 } |
| 131 |
| 132 simTime.start_time.setDay (d1); |
| 133 simTime.start_time.setMonth (mn1); |
| 134 simTime.start_time.setYear (y1); |
| 135 simTime.start_time.setHours (h1); |
| 136 simTime.start_time.setMinutes (m1); |
| 137 simTime.start_time.setSeconds (s1); |
| 138 |
| 139 simTime.end_time.setDay (d2); |
| 140 simTime.end_time.setMonth (mn2); |
| 141 simTime.end_time.setYear (y2); |
| 142 simTime.end_time.setHours (h2); |
| 143 simTime.end_time.setMinutes (m2); |
| 144 simTime.end_time.setSeconds (s2); |
| 145 |
| 146 if ( !(simTime.start_time.isValid ()) || !(simTime.end_time.isValid ()) ) |
| 147 { |
| 148 is.setstate (std::ios_base::failbit); |
| 149 } |
| 150 return is; |
| 151 } |
| 152 |
| 153 |
| 154 WossHelper::WossHelper () |
| 155 : m_locMap (), |
| 156 m_sspProto (), |
| 157 m_sedimentProto (), |
| 158 m_pressureProto (), |
| 159 m_timeArrProto (), |
| 160 m_transducerProto (), |
| 161 m_altimBretProto (), |
| 162 m_wossRandomGenStream (0), |
| 163 m_randomGenProto (), |
| 164 m_timeRefProto (), |
| 165 m_defHandler (NULL), |
| 166 m_resDbCreatorDebug (WH_DEBUG_DEFAULT), |
| 167 m_resDbDebug (WH_DEBUG_DEFAULT), |
| 168 m_resDbUseBinary (true), |
| 169 m_resDbUseTimeArr (true), |
| 170 m_resDbSpaceSampling (WH_SPACE_SAMPLING_DEFAULT), |
| 171 m_resDbFilePath (WH_STRING_DEFAULT), |
| 172 m_resDbFileName (WH_STRING_DEFAULT), |
| 173 m_resDbCreatorPressBin (NULL), |
| 174 m_resDbCreatorPressTxt (NULL), |
| 175 m_resDbCreatorTimeArrBin (NULL), |
| 176 m_resDbCreatorTimeArrTxt (NULL), |
| 177 m_sedimDbCreatorDebug (WH_DEBUG_DEFAULT), |
| 178 m_sedimDbDebug (WH_DEBUG_DEFAULT), |
| 179 m_sedimDbCoordFilePath (WH_STRING_DEFAULT), |
| 180 m_sedimDbMarsdenFilePath (WH_STRING_DEFAULT), |
| 181 m_sedimDbMarsdenOneFilePath (WH_STRING_DEFAULT), |
| 182 m_sedimDbCreator (NULL), |
| 183 m_sspDbCreatorDebug (WH_DEBUG_DEFAULT), |
| 184 m_sspDbDebug (WH_DEBUG_DEFAULT), |
| 185 m_sspDbFilePath (WH_STRING_DEFAULT), |
| 186 m_sspDbCreator (NULL), |
| 187 m_bathyDbCreatorDebug (WH_DEBUG_DEFAULT), |
| 188 m_bathyDbDebug (WH_DEBUG_DEFAULT), |
| 189 m_bathyDbUseThirtySecsPrec (true), |
| 190 m_bathyDbFilePath (WH_STRING_DEFAULT), |
| 191 m_bathyDbCreator (NULL), |
| 192 m_wossDbManagerDebug (WH_DEBUG_DEFAULT), |
| 193 m_wossDbManager (NULL), |
| 194 m_wossCreatorDebug (WH_DEBUG_DEFAULT), |
| 195 m_wossDebug (WH_DEBUG_DEFAULT), |
| 196 m_wossClearWorkDir (true), |
| 197 m_evolutionTimeQuantum (WH_TIME_EVOLUTION_DEFAULT), |
| 198 m_totalRuns (WH_TOTAL_RUNS_DEFAULT), |
| 199 m_frequencyStep (WH_FREQUENCY_STEP_DEFAULT), |
| 200 m_totalRangeSteps (WH_TOTAL_RANGE_STEPS_DEFAULT), |
| 201 m_txMinDepthOffset (WH_TX_MIN_DEPTH_OFFSET_DEFAULT), |
| 202 m_txMaxDepthOffset (WH_TX_MAX_DEPTH_OFFSET_DEFAULT), |
| 203 m_totalTransmitters (WH_TOTAL_TRANSMITTERS_DEFAULT), |
| 204 m_totalRxDepths (WH_TOTAL_RX_DEPTHS_DEFAULT), |
| 205 m_rxMinDepthOffset (WH_RX_MIN_DEPTH_OFFSET_DEFAULT), |
| 206 m_rxMaxDepthOffset (WH_RX_MAX_DEPTH_OFFSET_DEFAULT), |
| 207 m_totalRxRanges (WH_TOTAL_RX_RANGES_DEFAULT), |
| 208 m_rxMinRangeOffset (WH_RX_MIN_RANGE_OFFSET_DEFAULT), |
| 209 m_rxMaxRangeOffset (WH_RX_MAX_RANGE_OFFSET_DEFAULT), |
| 210 m_totalRays (WH_TOTAL_RAYS_DEFAULT), |
| 211 m_minAngle (WH_MIN_ANGLE_DEFAULT), |
| 212 m_maxAngle (WH_MAX_ANGLE_DEFAULT), |
| 213 m_sspDepthPrecision (WH_SSP_DEPTH_PRECISION_DEFAULT), |
| 214 m_normalizedSspDepthSteps (WH_NORMALIZED_SSP_DEPTH_STEPS_DEFAULT), |
| 215 m_workDirPath (WH_WORK_PATH_DEFAULT), |
| 216 m_bellhopPath (WH_STRING_DEFAULT), |
| 217 m_bellhopMode (WH_BELLHOP_MODE_DEFAULT), |
| 218 m_bellhopBeamOptions (WH_BEAM_OPTIONS_DEFAULT), |
| 219 m_bellhopBathyType (WH_BATHYMETRY_TYPE_DEFAULT), |
| 220 m_bathyMethod(WH_BATHYMETRY_METHOD_DEFAULT), |
| 221 m_bellhopAltimType (WH_ALTIMETRY_TYPE_DEFAULT), |
| 222 m_bellhopArrSyntax (WH_BELLHOP_ARR_SYNTAX_DEFAULT), |
| 223 m_simTime (), |
| 224 m_bellhopCreator (NULL), |
| 225 m_wossManagerDebug (WH_DEBUG_DEFAULT), |
| 226 m_isTimeEvolutionActive (false), |
| 227 m_concurrentThreads (WH_CONCURRENT_THREADS_DEFAULT), |
| 228 m_wossManagerSpaceSampling (WH_SPACE_SAMPLING_DEFAULT), |
| 229 m_wossManagerUseMultiThread (false), |
| 230 m_wossManagerSimple (NULL), |
| 231 m_wossManagerMulti (NULL), |
| 232 m_wossTransducerHndlDebug (WH_DEBUG_DEFAULT), |
| 233 m_wossTransducerHndl (NULL), |
| 234 m_wossControllerDebug (WH_DEBUG_DEFAULT), |
| 235 m_wossController (), |
| 236 m_initialized (false) |
| 237 { |
| 238 m_defHandler = woss::SDefHandler::instance (); |
| 239 } |
| 240 |
| 241 WossHelper::~WossHelper () |
| 242 { |
| 243 |
| 244 } |
| 245 |
| 246 |
| 247 void |
| 248 WossHelper::DoDispose (void) |
| 249 { |
| 250 NS_LOG_FUNCTION (this); |
| 251 |
| 252 DeleteWossLocationMap (); |
| 253 |
| 254 if (m_wossManagerSimple != NULL) |
| 255 { |
| 256 delete m_wossManagerSimple; |
| 257 } |
| 258 |
| 259 if (m_wossManagerMulti != NULL) |
| 260 { |
| 261 delete m_wossManagerMulti; |
| 262 } |
| 263 |
| 264 if (m_wossTransducerHndl != NULL) |
| 265 { |
| 266 delete m_wossTransducerHndl; |
| 267 } |
| 268 |
| 269 if (m_bellhopCreator != NULL) |
| 270 { |
| 271 delete m_bellhopCreator; |
| 272 } |
| 273 |
| 274 if (m_wossDbManager != NULL) |
| 275 { |
| 276 delete m_wossDbManager; |
| 277 } |
| 278 |
| 279 if (m_bathyDbCreator != NULL) |
| 280 { |
| 281 delete m_bathyDbCreator; |
| 282 } |
| 283 |
| 284 if (m_sspDbCreator != NULL) |
| 285 { |
| 286 delete m_sspDbCreator; |
| 287 } |
| 288 |
| 289 if (m_sedimDbCreator != NULL) |
| 290 { |
| 291 delete m_sedimDbCreator; |
| 292 } |
| 293 |
| 294 if (m_resDbCreatorPressBin != NULL) |
| 295 { |
| 296 delete m_resDbCreatorPressBin; |
| 297 } |
| 298 |
| 299 if (m_resDbCreatorPressTxt != NULL) |
| 300 { |
| 301 delete m_resDbCreatorPressTxt; |
| 302 } |
| 303 |
| 304 if (m_resDbCreatorTimeArrBin != NULL) |
| 305 { |
| 306 delete m_resDbCreatorTimeArrBin; |
| 307 } |
| 308 |
| 309 if (m_resDbCreatorTimeArrTxt != NULL) |
| 310 { |
| 311 delete m_resDbCreatorTimeArrTxt; |
| 312 } |
| 313 |
| 314 if (m_wossController != NULL) |
| 315 { |
| 316 delete m_wossController; |
| 317 } |
| 318 |
| 319 m_initialized = false; |
| 320 } |
| 321 |
| 322 void |
| 323 WossHelper::CheckInitialized (void) const |
| 324 { |
| 325 if (m_initialized == false) |
| 326 { |
| 327 NS_FATAL_ERROR ("Initialize (Ptr<WossPropModel> wossPropModel) has not bee
n called!"); |
| 328 } |
| 329 } |
| 330 |
| 331 void |
| 332 WossHelper::DoInitialize (void) |
| 333 { |
| 334 CheckInitialized (); |
| 335 } |
| 336 |
| 337 void |
| 338 WossHelper::Initialize (Ptr<WossPropModel> wossPropModel) |
| 339 { |
| 340 NS_LOG_FUNCTION (this << wossPropModel); |
| 341 |
| 342 if (m_initialized == true) |
| 343 { |
| 344 return; |
| 345 } |
| 346 |
| 347 NS_LOG_DEBUG ("Setting DefHandler"); |
| 348 |
| 349 m_defHandler->setSSP (m_sspProto.clone ()); |
| 350 m_defHandler->setSediment (m_sedimentProto.clone ()); |
| 351 m_defHandler->setTransducer (m_transducerProto.clone ()); |
| 352 m_defHandler->setAltimetry (m_altimBretProto.clone ()); |
| 353 m_defHandler->setPressure (m_pressureProto.clone ()); |
| 354 m_defHandler->setTimeArr (m_timeArrProto.clone ()); |
| 355 m_defHandler->setSSP (m_sspProto.clone ()); |
| 356 m_randomGenProto.AssignStreams (m_wossRandomGenStream); |
| 357 m_defHandler->setRandGenerator (m_randomGenProto.clone ()); |
| 358 |
| 359 m_wossController = new woss::WossController (); |
| 360 |
| 361 NS_LOG_DEBUG ("Setting BathymetryDbCreator"); |
| 362 |
| 363 if ( m_bathyDbFilePath != WH_STRING_DEFAULT ) |
| 364 { |
| 365 m_bathyDbCreator = new woss::BathyGebcoDbCreator (); |
| 366 |
| 367 m_bathyDbCreator->setDbPathName (m_bathyDbFilePath); |
| 368 m_bathyDbCreator->setDebug (m_bathyDbCreatorDebug); |
| 369 m_bathyDbCreator->setWossDebug (m_bathyDbDebug); |
| 370 |
| 371 m_wossController->setBathymetryDbCreator (m_bathyDbCreator); |
| 372 } |
| 373 |
| 374 NS_LOG_DEBUG ("Setting SedimDbCreator"); |
| 375 |
| 376 if ( m_sedimDbCoordFilePath != WH_STRING_DEFAULT && m_sedimDbMarsdenFilePath !
= WH_STRING_DEFAULT |
| 377 && m_sedimDbMarsdenOneFilePath != WH_STRING_DEFAULT ) |
| 378 { |
| 379 m_sedimDbCreator = new woss::SedimDeck41DbCreator (); |
| 380 |
| 381 m_sedimDbCreator->setDeck41CoordPathName (m_sedimDbCoordFilePath); |
| 382 m_sedimDbCreator->setDeck41MarsdenPathName (m_sedimDbMarsdenFilePath); |
| 383 m_sedimDbCreator->setDeck41MarsdenOnePathName (m_sedimDbMarsdenOneFilePath
); |
| 384 m_sedimDbCreator->setDebug (m_sedimDbCreatorDebug); |
| 385 m_sedimDbCreator->setWossDebug (m_sedimDbDebug); |
| 386 |
| 387 m_wossController->setSedimentDbCreator (m_sedimDbCreator); |
| 388 } |
| 389 |
| 390 NS_LOG_DEBUG ("Setting SspDbCreator"); |
| 391 |
| 392 if ( m_sspDbFilePath != WH_STRING_DEFAULT ) |
| 393 { |
| 394 m_sspDbCreator = new woss::SspWoa2005DbCreator (); |
| 395 |
| 396 m_sspDbCreator->setDbPathName (m_sspDbFilePath); |
| 397 m_sspDbCreator->setDebug (m_sspDbCreatorDebug); |
| 398 m_sspDbCreator->setWossDebug (m_sspDbDebug); |
| 399 |
| 400 m_wossController->setSSPDbCreator (m_sspDbCreator); |
| 401 } |
| 402 |
| 403 NS_LOG_DEBUG ("Setting ResDbCreator"); |
| 404 |
| 405 if ( (m_resDbFilePath != WH_STRING_DEFAULT) && (m_resDbFileName != WH_STRING_D
EFAULT) ) |
| 406 { |
| 407 NS_ASSERT ( CreateDirectory (m_resDbFilePath) == true ); |
| 408 |
| 409 if ( m_resDbUseBinary == true && m_resDbUseTimeArr == true ) |
| 410 { |
| 411 NS_LOG_DEBUG ("Setting TimeArr binary"); |
| 412 |
| 413 m_resDbCreatorTimeArrBin = new woss::ResTimeArrBinDbCreator (); |
| 414 |
| 415 m_resDbCreatorTimeArrBin->setDbPathName (m_resDbFilePath + "/" + m_res
DbFileName); |
| 416 m_resDbCreatorTimeArrBin->setDebug (m_resDbCreatorDebug); |
| 417 m_resDbCreatorTimeArrBin->setWossDebug (m_resDbDebug); |
| 418 |
| 419 m_wossController->setTimeArrDbCreator (m_resDbCreatorTimeArrBin); |
| 420 } |
| 421 else if ( m_resDbUseBinary == false && m_resDbUseTimeArr == true ) |
| 422 { |
| 423 NS_LOG_DEBUG ("Setting TimeArr ASCII"); |
| 424 |
| 425 m_resDbCreatorTimeArrTxt = new woss::ResTimeArrTxtDbCreator (); |
| 426 |
| 427 m_resDbCreatorTimeArrTxt->setDbPathName (m_resDbFilePath + "/" + m_re
sDbFileName); |
| 428 m_resDbCreatorTimeArrTxt->setDebug (m_resDbCreatorDebug); |
| 429 m_resDbCreatorTimeArrTxt->setWossDebug (m_resDbDebug); |
| 430 |
| 431 m_wossController->setTimeArrDbCreator (m_resDbCreatorTimeArrTxt); |
| 432 } |
| 433 else if ( m_resDbUseBinary == true && m_resDbUseTimeArr == false ) |
| 434 { |
| 435 NS_LOG_DEBUG ("Setting Pressure binary"); |
| 436 |
| 437 m_resDbCreatorPressBin = new woss::ResPressureBinDbCreator (); |
| 438 |
| 439 m_resDbCreatorPressBin->setDbPathName (m_resDbFilePath + "/" + m_resDb
FileName); |
| 440 m_resDbCreatorPressBin->setDebug (m_resDbCreatorDebug); |
| 441 m_resDbCreatorPressBin->setWossDebug (m_resDbDebug); |
| 442 |
| 443 m_wossController->setPressureDbCreator (m_resDbCreatorPressBin); |
| 444 } |
| 445 else if ( m_resDbUseBinary == false && m_resDbUseTimeArr == false ) |
| 446 { |
| 447 NS_LOG_DEBUG ("Setting Pressure ASCII"); |
| 448 |
| 449 m_resDbCreatorPressTxt = new woss::ResPressureTxtDbCreator (); |
| 450 |
| 451 m_resDbCreatorPressTxt->setDbPathName (m_resDbFilePath + "/" + m_resDb
FileName); |
| 452 m_resDbCreatorPressTxt->setDebug (m_resDbCreatorDebug); |
| 453 m_resDbCreatorPressTxt->setWossDebug (m_resDbDebug); |
| 454 |
| 455 m_wossController->setPressureDbCreator (m_resDbCreatorPressTxt); |
| 456 } |
| 457 } |
| 458 |
| 459 NS_LOG_DEBUG ("Setting Bellhop Creator"); |
| 460 |
| 461 m_bellhopCreator = new woss::BellhopCreator (); |
| 462 |
| 463 m_bellhopCreator->setDebug (m_wossCreatorDebug); |
| 464 m_bellhopCreator->setWossDebug (m_wossDebug); |
| 465 m_bellhopCreator->setWrkDirPath (m_workDirPath); |
| 466 m_bellhopCreator->setCleanWorkDir (m_wossClearWorkDir); |
| 467 m_bellhopCreator->setEvolutionTimeQuantum (m_evolutionTimeQuantum); |
| 468 m_bellhopCreator->setThorpeAttFlag (true); |
| 469 m_bellhopCreator->setTotalRuns (m_totalRuns); |
| 470 m_bellhopCreator->setFrequencyStep (m_frequencyStep); |
| 471 m_bellhopCreator->setTotalRangeSteps (m_totalRangeSteps); |
| 472 m_bellhopCreator->setTxMinDepthOffset (m_txMinDepthOffset); |
| 473 m_bellhopCreator->setTxMaxDepthOffset (m_txMaxDepthOffset); |
| 474 m_bellhopCreator->setTotalTransmitters (m_totalTransmitters); |
| 475 m_bellhopCreator->setRxTotalDepths (m_totalRxDepths); |
| 476 m_bellhopCreator->setRxMinDepthOffset (m_rxMinDepthOffset); |
| 477 m_bellhopCreator->setRxMaxDepthOffset (m_rxMaxDepthOffset); |
| 478 m_bellhopCreator->setRxTotalRanges (m_totalRxRanges); |
| 479 m_bellhopCreator->setRxMinRangeOffset (m_rxMinRangeOffset); |
| 480 m_bellhopCreator->setRxMaxRangeOffset (m_rxMaxRangeOffset); |
| 481 m_bellhopCreator->setRaysNumber (m_totalRays); |
| 482 m_bellhopCreator->setAngles (woss::CustomAngles (m_minAngle, m_maxAngle)); |
| 483 m_bellhopCreator->setSspDepthPrecision (m_sspDepthPrecision); |
| 484 m_bellhopCreator->setSspDepthSteps (m_normalizedSspDepthSteps); |
| 485 m_bellhopCreator->setBellhopPath (m_bellhopPath); |
| 486 m_bellhopCreator->setBhMode (m_bellhopMode); |
| 487 m_bellhopCreator->setBeamOptions (m_bellhopBeamOptions); |
| 488 m_bellhopCreator->setBathymetryType (m_bellhopBathyType); |
| 489 m_bellhopCreator->setBathymetryMethod (m_bathyMethod); |
| 490 m_bellhopCreator->setAltimetryType (m_bellhopAltimType); |
| 491 NS_ASSERT ((m_simTime.start_time.isValid () == true) && (m_simTime.end_time.is
Valid ()) ); |
| 492 m_bellhopCreator->setSimTime (m_simTime); |
| 493 m_bellhopCreator->setBellhopArrSyntax ((woss::BellhopArrSyntax)m_bellhopArrSyn
tax); |
| 494 m_wossController->setWossCreator (m_bellhopCreator); |
| 495 |
| 496 NS_LOG_DEBUG ("Setting WossDbManager"); |
| 497 |
| 498 m_wossDbManager = new woss::WossDbManager (); |
| 499 |
| 500 m_wossDbManager->setDebug (m_wossDbManagerDebug); |
| 501 |
| 502 m_wossController->setWossDbManager (m_wossDbManager); |
| 503 |
| 504 if (m_wossManagerUseMultiThread == false) |
| 505 { |
| 506 NS_LOG_DEBUG ("Setting WossManager Single Threaded"); |
| 507 |
| 508 m_wossManagerSimple = new woss::WossManagerSimple<woss::WossManagerResDb>
(); |
| 509 |
| 510 m_wossManagerSimple->setDebugFlag (m_wossManagerDebug); |
| 511 m_wossManagerSimple->setTimeEvolutionActiveFlag (m_isTimeEvolutionActive); |
| 512 m_wossManagerSimple->setSpaceSampling (m_wossManagerSpaceSampling); |
| 513 |
| 514 m_wossController->setWossManager (m_wossManagerSimple); |
| 515 wossPropModel->SetWossManager (m_wossManagerSimple); |
| 516 } |
| 517 else |
| 518 { |
| 519 NS_LOG_DEBUG ("Setting WossManager Multi Threaded"); |
| 520 |
| 521 m_wossManagerMulti = new woss::WossManagerSimple<woss::WossManagerResDbMT>
(); |
| 522 |
| 523 m_wossManagerMulti->setDebugFlag (m_wossManagerDebug); |
| 524 m_wossManagerMulti->setTimeEvolutionActiveFlag (m_isTimeEvolutionActive); |
| 525 m_wossManagerMulti->setSpaceSampling (m_wossManagerSpaceSampling); |
| 526 m_wossManagerMulti->setConcurrentThreads (m_concurrentThreads); |
| 527 |
| 528 m_wossController->setWossManager (m_wossManagerMulti); |
| 529 wossPropModel->SetWossManager (m_wossManagerMulti); |
| 530 } |
| 531 |
| 532 NS_LOG_DEBUG ("Setting TransducerHandler"); |
| 533 |
| 534 m_wossTransducerHndl = new woss::TransducerHandler (); |
| 535 |
| 536 m_wossTransducerHndl->setDebug (m_wossTransducerHndlDebug); |
| 537 m_wossController->setTransducerHandler (m_wossTransducerHndl); |
| 538 |
| 539 bool isOk = m_wossController->initialize (); |
| 540 |
| 541 NS_LOG_DEBUG ("WossController is initialized: " << (isOk ? "true" : "false") )
; |
| 542 |
| 543 if (isOk == false) |
| 544 { |
| 545 NS_FATAL_ERROR ("WossController is not initialized"); |
| 546 } |
| 547 |
| 548 m_initialized = true; |
| 549 } |
| 550 |
| 551 |
| 552 WossLocation* |
| 553 WossHelper::GetWossLocation ( Ptr< MobilityModel > ptr ) |
| 554 { |
| 555 NS_LOG_FUNCTION (this << ptr); |
| 556 |
| 557 WossLocation* retValue = NULL; |
| 558 |
| 559 MLMCIter it = m_locMap.find (PeekPointer (ptr)); |
| 560 |
| 561 if ( it == m_locMap.end () ) |
| 562 { |
| 563 NS_LOG_DEBUG ("WossController MobilityModel* not found, creating new WossL
ocation. map size " << m_locMap.size ()); |
| 564 |
| 565 retValue = new WossLocation ( ptr ); |
| 566 m_locMap.insert ( ::std::make_pair ( PeekPointer (ptr), retValue )); |
| 567 } |
| 568 else |
| 569 { |
| 570 retValue = it->second; |
| 571 } |
| 572 |
| 573 return retValue; |
| 574 } |
| 575 |
| 576 |
| 577 void |
| 578 WossHelper::DeleteWossLocationMap (void) |
| 579 { |
| 580 for ( MLMCIter it = m_locMap.begin (); it != m_locMap.end (); ++it ) |
| 581 { |
| 582 if (it->second != NULL) |
| 583 { |
| 584 delete it->second; |
| 585 } |
| 586 } |
| 587 } |
| 588 |
| 589 |
| 590 bool |
| 591 WossHelper::SetAngles (const ::std::string &angleString, Ptr<MobilityModel> tx,
Ptr<MobilityModel> rx) |
| 592 { |
| 593 CheckInitialized (); |
| 594 |
| 595 ::std::string angleTmp = angleString; |
| 596 ::std::string::size_type tmp; |
| 597 double param[2]; |
| 598 |
| 599 for (int cnt = 0; cnt < 2; ++cnt) |
| 600 { |
| 601 tmp = angleTmp.find ("|"); |
| 602 if ((tmp == std::string::npos) && (cnt != 2 - 1)) |
| 603 { |
| 604 NS_LOG_ERROR ("cnt:" << cnt << "; separator | not found, string parsed
: " << angleTmp); |
| 605 return false; |
| 606 } |
| 607 |
| 608 std::string paramStr = angleTmp.substr (0, tmp); |
| 609 angleTmp = angleTmp.substr (tmp + 1, angleTmp.npos); |
| 610 param[cnt] = ::std::atof (paramStr.c_str ()); |
| 611 |
| 612 NS_LOG_DEBUG ("cnt:" << cnt << "; param:" << param[cnt]); |
| 613 } |
| 614 |
| 615 woss::CustomAngles customAngles = woss::CustomAngles (param[0], param[1]); |
| 616 return SetAngles (customAngles, tx, rx); |
| 617 } |
| 618 |
| 619 |
| 620 bool |
| 621 WossHelper::SetAngles ( const woss::CustomAngles& angles, Ptr<MobilityModel> tx,
Ptr<MobilityModel> rx ) |
| 622 { |
| 623 CheckInitialized (); |
| 624 |
| 625 if ( tx == NULL ) |
| 626 { |
| 627 if ( rx == NULL ) |
| 628 { |
| 629 m_bellhopCreator->setAngles (angles); |
| 630 } |
| 631 else |
| 632 { |
| 633 WossLocation* rxLoc = GetWossLocation ( rx ); |
| 634 m_bellhopCreator->setAngles (angles, woss::BellhopCreator::CCAngles::A
LL_LOCATIONS, rxLoc ); |
| 635 } |
| 636 } |
| 637 else |
| 638 { |
| 639 WossLocation* txLoc = GetWossLocation ( tx ); |
| 640 |
| 641 if ( rx == NULL ) |
| 642 { |
| 643 m_bellhopCreator->eraseAngles ( txLoc ); |
| 644 } |
| 645 else |
| 646 { |
| 647 WossLocation* rxLoc = GetWossLocation ( rx ); |
| 648 m_bellhopCreator->eraseAngles ( txLoc, rxLoc ); |
| 649 } |
| 650 } |
| 651 |
| 652 return true; |
| 653 } |
| 654 |
| 655 |
| 656 woss::CustomAngles |
| 657 WossHelper::GetAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx ) const |
| 658 { |
| 659 CheckInitialized (); |
| 660 |
| 661 if ( tx == NULL ) |
| 662 { |
| 663 if ( rx == NULL ) |
| 664 { |
| 665 return m_bellhopCreator->getAngles (); |
| 666 } |
| 667 else |
| 668 { |
| 669 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 670 return m_bellhopCreator->getAngles (woss::BellhopCreator::CCAngles::AL
L_LOCATIONS, rxLoc ); |
| 671 } |
| 672 } |
| 673 else |
| 674 { |
| 675 WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx
); |
| 676 |
| 677 if ( rx == NULL ) |
| 678 { |
| 679 return m_bellhopCreator->getAngles ( txLoc ); |
| 680 } |
| 681 else |
| 682 { |
| 683 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 684 return m_bellhopCreator->getAngles ( txLoc, rxLoc ); |
| 685 } |
| 686 } |
| 687 } |
| 688 |
| 689 |
| 690 void |
| 691 WossHelper::EraseAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx ) |
| 692 { |
| 693 CheckInitialized (); |
| 694 |
| 695 if ( tx == NULL ) |
| 696 { |
| 697 if ( rx == NULL ) |
| 698 { |
| 699 m_bellhopCreator->eraseAngles (); |
| 700 } |
| 701 else |
| 702 { |
| 703 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 704 m_bellhopCreator->eraseAngles (woss::BellhopCreator::CCAngles::ALL_LOC
ATIONS, rxLoc ); |
| 705 } |
| 706 } |
| 707 else |
| 708 { |
| 709 WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx
); |
| 710 |
| 711 if ( rx == NULL ) |
| 712 { |
| 713 m_bellhopCreator->eraseAngles ( txLoc ); |
| 714 } |
| 715 else |
| 716 { |
| 717 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 718 m_bellhopCreator->eraseAngles ( txLoc, rxLoc ); |
| 719 } |
| 720 } |
| 721 } |
| 722 |
| 723 bool |
| 724 WossHelper::ImportTransducerAscii (const ::std::string &typeName, const std::str
ing &fileName) |
| 725 { |
| 726 CheckInitialized (); |
| 727 |
| 728 return m_wossTransducerHndl->importValueAscii (typeName, fileName); |
| 729 } |
| 730 |
| 731 bool WossHelper::ImportTransducerBinary (const ::std::string &typeName, const st
d::string &fileName) |
| 732 { |
| 733 CheckInitialized (); |
| 734 |
| 735 return m_wossTransducerHndl->importValueBinary (typeName, fileName); |
| 736 } |
| 737 |
| 738 bool |
| 739 WossHelper::SetCustomTransducer ( const ::std::string &transducerString, Ptr<Mob
ilityModel> tx, Ptr<MobilityModel> rx) |
| 740 { |
| 741 CheckInitialized (); |
| 742 |
| 743 ::std::string transducerType; |
| 744 ::std::string transTmp = transducerString; |
| 745 ::std::string::size_type tmp; |
| 746 double param[5]; |
| 747 |
| 748 tmp = transTmp.find ("|"); |
| 749 if (tmp == std::string::npos) |
| 750 { |
| 751 NS_LOG_ERROR ("separator | not found, string parsed:" << transTmp); |
| 752 return false; |
| 753 } |
| 754 |
| 755 transducerType = transTmp.substr (0, tmp); |
| 756 transTmp = transTmp.substr (tmp + 1, transTmp.npos); |
| 757 |
| 758 NS_LOG_ERROR ("transducerType: " << transducerType); |
| 759 |
| 760 for (int cnt = 0; cnt < 5; ++cnt) |
| 761 { |
| 762 // double range; |
| 763 // double depth; |
| 764 |
| 765 tmp = transTmp.find ("|"); |
| 766 if ((tmp == std::string::npos) && (cnt != 5 - 1)) |
| 767 { |
| 768 NS_LOG_ERROR ("cnt:" << cnt << "; separator | not found, string parsed
: " << transTmp); |
| 769 return false; |
| 770 } |
| 771 |
| 772 std::string paramStr = transTmp.substr (0, tmp); |
| 773 transTmp = transTmp.substr (tmp + 1, transTmp.npos); |
| 774 param[cnt] = ::std::atof (paramStr.c_str ()); |
| 775 |
| 776 NS_LOG_DEBUG ("cnt:" << cnt << "; param:" << param[cnt]); |
| 777 } |
| 778 |
| 779 woss::CustomTransducer customTrasducer = woss::CustomTransducer (transducerTyp
e, param[0], param[1], param[2], param[3], param[4]); |
| 780 |
| 781 return SetCustomTransducer (customTrasducer, tx, rx); |
| 782 } |
| 783 |
| 784 |
| 785 bool |
| 786 WossHelper::SetCustomTransducer ( const woss::CustomTransducer& type, Ptr<Mobili
tyModel> tx, Ptr<MobilityModel> rx ) |
| 787 { |
| 788 CheckInitialized (); |
| 789 |
| 790 if ( tx == NULL ) |
| 791 { |
| 792 if ( rx == NULL ) |
| 793 { |
| 794 m_bellhopCreator->setCustomTransducer (type); |
| 795 } |
| 796 else |
| 797 { |
| 798 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 799 m_bellhopCreator->setCustomTransducer (type, woss::BellhopCreator::CCT
ransducer::ALL_LOCATIONS, rxLoc ); |
| 800 } |
| 801 } |
| 802 else |
| 803 { |
| 804 WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx
); |
| 805 |
| 806 if ( rx == NULL ) |
| 807 { |
| 808 m_bellhopCreator->setCustomTransducer ( type, txLoc ); |
| 809 } |
| 810 else |
| 811 { |
| 812 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 813 m_bellhopCreator->setCustomTransducer ( type, txLoc, rxLoc ); |
| 814 } |
| 815 } |
| 816 |
| 817 return true; |
| 818 } |
| 819 |
| 820 |
| 821 woss::CustomTransducer |
| 822 WossHelper::GetCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
const |
| 823 { |
| 824 CheckInitialized (); |
| 825 |
| 826 if ( tx == NULL ) |
| 827 { |
| 828 if ( rx == NULL ) |
| 829 { |
| 830 return m_bellhopCreator->getCustomTransducer (); |
| 831 } |
| 832 else |
| 833 { |
| 834 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 835 return m_bellhopCreator->getCustomTransducer (woss::BellhopCreator::CC
Transducer::ALL_LOCATIONS, rxLoc ); |
| 836 } |
| 837 } |
| 838 else |
| 839 { |
| 840 WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx
); |
| 841 |
| 842 if ( rx == NULL ) |
| 843 { |
| 844 return m_bellhopCreator->getCustomTransducer ( txLoc ); |
| 845 } |
| 846 else |
| 847 { |
| 848 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 849 return m_bellhopCreator->getCustomTransducer ( txLoc, rxLoc ); |
| 850 } |
| 851 } |
| 852 } |
| 853 |
| 854 |
| 855 void |
| 856 WossHelper::EraseCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx
) |
| 857 { |
| 858 CheckInitialized (); |
| 859 |
| 860 if ( tx == NULL ) |
| 861 { |
| 862 if ( rx == NULL ) |
| 863 { |
| 864 m_bellhopCreator->eraseCustomTransducer (); |
| 865 } |
| 866 else |
| 867 { |
| 868 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 869 m_bellhopCreator->eraseCustomTransducer (woss::BellhopCreator::CCTrans
ducer::ALL_LOCATIONS, rxLoc ); |
| 870 } |
| 871 } |
| 872 else |
| 873 { |
| 874 WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx
); |
| 875 |
| 876 if ( rx == NULL ) |
| 877 { |
| 878 m_bellhopCreator->eraseCustomTransducer ( txLoc ); |
| 879 } |
| 880 else |
| 881 { |
| 882 WossLocation* rxLoc = const_cast<WossHelper*> (this)->GetWossLocation
( rx ); |
| 883 m_bellhopCreator->eraseCustomTransducer ( txLoc, rxLoc ); |
| 884 } |
| 885 } |
| 886 } |
| 887 |
| 888 |
| 889 bool |
| 890 WossHelper::SetCustomAltimetry (woss::Altimetry* const altimetry, const woss::Co
ord& txCoord, double bearing, |
| 891 double range) |
| 892 { |
| 893 CheckInitialized (); |
| 894 |
| 895 return m_wossDbManager->setCustomAltimetry (altimetry, txCoord, bearing, range
); |
| 896 } |
| 897 |
| 898 |
| 899 woss::Altimetry* |
| 900 WossHelper::GetCustomAltimetry (const woss::Coord& txCoord, double bearing, doub
le range) |
| 901 { |
| 902 CheckInitialized (); |
| 903 |
| 904 return m_wossDbManager->getCustomAltimetry (txCoord, bearing, range); |
| 905 } |
| 906 |
| 907 |
| 908 void |
| 909 WossHelper::EraseCustomAltimetry (const woss::Coord& txCoord, double bearing, do
uble range) |
| 910 { |
| 911 CheckInitialized (); |
| 912 |
| 913 m_wossDbManager->eraseCustomAltimetry (txCoord, bearing, range); |
| 914 } |
| 915 |
| 916 |
| 917 bool |
| 918 WossHelper::SetCustomSediment (woss::Sediment* const sediment, const woss::Coord
& txCoord, double bearing, |
| 919 double range) |
| 920 { |
| 921 CheckInitialized (); |
| 922 |
| 923 return m_wossDbManager->setCustomSediment (sediment, txCoord, bearing, range); |
| 924 } |
| 925 |
| 926 |
| 927 bool |
| 928 WossHelper::SetCustomSediment (const ::std::string &sedimentString, const woss::
Coord& txCoord, double bearing, double range) |
| 929 { |
| 930 NS_LOG_FUNCTION (this); |
| 931 |
| 932 CheckInitialized (); |
| 933 |
| 934 ::std::string sedimentType; |
| 935 ::std::string sedimTmp = sedimentString; |
| 936 ::std::string::size_type tmp; |
| 937 double param[5]; |
| 938 |
| 939 tmp = sedimTmp.find ("|"); |
| 940 if (tmp == std::string::npos) |
| 941 { |
| 942 NS_LOG_ERROR ("separator | not found, string parsed:" << sedimTmp); |
| 943 return false; |
| 944 } |
| 945 |
| 946 sedimentType = sedimTmp.substr (0, tmp); |
| 947 sedimTmp = sedimTmp.substr (tmp + 1, sedimTmp.npos); |
| 948 |
| 949 NS_LOG_DEBUG ("sedimentType: " << sedimentType); |
| 950 |
| 951 for (int cnt = 0; cnt < 5; ++cnt) |
| 952 { |
| 953 tmp = sedimTmp.find ("|"); |
| 954 if ((tmp == std::string::npos) && (cnt != 5 - 1)) |
| 955 { |
| 956 NS_LOG_ERROR ("cnt:" << cnt << "; separator | not found, string parsed
: " << sedimTmp); |
| 957 return false; |
| 958 } |
| 959 |
| 960 std::string paramStr = sedimTmp.substr (0, tmp); |
| 961 sedimTmp = sedimTmp.substr (tmp + 1, sedimTmp.npos); |
| 962 param[cnt] = ::std::atof (paramStr.c_str ()); |
| 963 |
| 964 NS_LOG_DEBUG ("cnt:" << cnt << "; param:" << param[cnt]); |
| 965 } |
| 966 |
| 967 woss::Sediment sediment = woss::Sediment ( sedimentType, param[0], param[1], p
aram[2], param[3], param[4]); |
| 968 |
| 969 return m_wossDbManager->setCustomSediment (sediment.clone (), txCoord, bearing
, range); |
| 970 } |
| 971 |
| 972 |
| 973 woss::Sediment* |
| 974 WossHelper::GetCustomSediment (const woss::Coord& txCoord, double bearing, doubl
e range) |
| 975 { |
| 976 CheckInitialized (); |
| 977 |
| 978 return m_wossDbManager->getCustomSediment (txCoord, bearing, range); |
| 979 } |
| 980 |
| 981 |
| 982 void |
| 983 WossHelper::EraseCustomSediment (const woss::Coord& txCoord, double bearing, dou
ble range) |
| 984 { |
| 985 CheckInitialized (); |
| 986 |
| 987 m_wossDbManager->eraseCustomSediment (txCoord, bearing, range); |
| 988 } |
| 989 |
| 990 |
| 991 bool |
| 992 WossHelper::SetCustomSsp (woss::SSP* const ssp, const woss::Coord& txCoord, doub
le bearing, |
| 993 double range, const woss::Time& timeValue) |
| 994 { |
| 995 CheckInitialized (); |
| 996 |
| 997 return m_wossDbManager->setCustomSSP ( ssp, txCoord, bearing, range, timeValue
); |
| 998 } |
| 999 |
| 1000 |
| 1001 bool |
| 1002 WossHelper::SetCustomSsp (const ::std::string &sspString, const woss::Coord& txC
oord, double bearing, |
| 1003 double range, const woss::Time& timeValue) |
| 1004 { |
| 1005 NS_LOG_FUNCTION (this); |
| 1006 |
| 1007 CheckInitialized (); |
| 1008 |
| 1009 woss::SSP ssp; |
| 1010 ::std::string sspTmp = sspString; |
| 1011 ::std::string::size_type tmp; |
| 1012 |
| 1013 int totalDepths = 0; |
| 1014 |
| 1015 tmp = sspTmp.find ("|"); |
| 1016 if (tmp == std::string::npos) |
| 1017 { |
| 1018 NS_LOG_ERROR ("WossHelper::SetCustomSsp() separator | not found, string pa
rsed:" << sspTmp); |
| 1019 return false; |
| 1020 } |
| 1021 |
| 1022 std::string totDepths = sspTmp.substr (0, tmp); |
| 1023 sspTmp = sspTmp.substr (tmp + 1, sspTmp.npos); |
| 1024 totalDepths = ::std::atoi (totDepths.c_str ()); |
| 1025 |
| 1026 NS_LOG_DEBUG ("totalDepths: " << totalDepths); |
| 1027 |
| 1028 if (totalDepths <= 0) |
| 1029 { |
| 1030 NS_LOG_ERROR ("totalDepths given < 0:" << totalDepths); |
| 1031 return false; |
| 1032 } |
| 1033 |
| 1034 for (int cnt = 0; cnt < totalDepths; ++cnt) |
| 1035 { |
| 1036 double depth; |
| 1037 double sspValue; |
| 1038 |
| 1039 tmp = sspTmp.find ("|"); |
| 1040 if (tmp == std::string::npos) |
| 1041 { |
| 1042 NS_LOG_ERROR ("WossHelper::SetCustomSsp() cnt:" << cnt << "; separator
| not found, string parsed:" << sspTmp); |
| 1043 return false; |
| 1044 } |
| 1045 |
| 1046 std::string depthStr = sspTmp.substr (0, tmp); |
| 1047 sspTmp = sspTmp.substr (tmp + 1, sspTmp.npos); |
| 1048 depth = ::std::atof (depthStr.c_str ()); |
| 1049 |
| 1050 tmp = sspTmp.find ("|"); |
| 1051 if ((tmp == std::string::npos) && (cnt != totalDepths - 1)) |
| 1052 { |
| 1053 NS_LOG_ERROR ("cnt:" << cnt << "; separator | not found, string parsed
: " << sspTmp); |
| 1054 return false; |
| 1055 } |
| 1056 |
| 1057 std::string sspValueStr = sspTmp.substr (0, tmp); |
| 1058 sspTmp = sspTmp.substr (tmp + 1, sspTmp.npos); |
| 1059 sspValue = ::std::atof (sspValueStr.c_str ()); |
| 1060 |
| 1061 NS_LOG_DEBUG ("cnt:" << cnt << "; depth:" << depth << "; sspValue:" << ssp
Value); |
| 1062 |
| 1063 if (sspValue < 0.0) |
| 1064 { |
| 1065 NS_LOG_ERROR ("cnt:" << cnt << " sspValue:" << depth << " < 0"); |
| 1066 return false; |
| 1067 } |
| 1068 else |
| 1069 { |
| 1070 ssp.insertValue (depth, sspValue); |
| 1071 } |
| 1072 } |
| 1073 |
| 1074 return m_wossDbManager->setCustomSSP (ssp.clone (), txCoord, bearing, range, t
imeValue); |
| 1075 } |
| 1076 |
| 1077 |
| 1078 bool |
| 1079 WossHelper::ImportCustomSsp ( const ::std::string &sspFileName, const woss::Coor
d& txCoord, double bearing, const woss::Time& timeValue) |
| 1080 { |
| 1081 CheckInitialized (); |
| 1082 |
| 1083 return m_wossDbManager->importCustomSSP (sspFileName, timeValue, txCoord, bear
ing); |
| 1084 } |
| 1085 |
| 1086 |
| 1087 woss::SSP* |
| 1088 WossHelper::GetCustomSsp (const woss::Coord& txCoord, double bearing, |
| 1089 double range, const woss::Time& timeValue) |
| 1090 { |
| 1091 CheckInitialized (); |
| 1092 |
| 1093 return m_wossDbManager->getCustomSSP (txCoord, bearing, range, timeValue); |
| 1094 } |
| 1095 |
| 1096 |
| 1097 void |
| 1098 WossHelper::EraseCustomSsp (const woss::Coord& txCoord, double bearing, |
| 1099 double range, const woss::Time& timeValue) |
| 1100 { |
| 1101 CheckInitialized (); |
| 1102 |
| 1103 m_wossDbManager->eraseCustomSSP (txCoord, bearing, range, timeValue); |
| 1104 } |
| 1105 |
| 1106 |
| 1107 bool |
| 1108 WossHelper::SetCustomBathymetry (woss::Bathymetry* const bathymetry, const woss:
:Coord& txCoord, |
| 1109 double bearing, double range) |
| 1110 { |
| 1111 CheckInitialized (); |
| 1112 |
| 1113 return m_wossDbManager->setCustomBathymetry (bathymetry, txCoord, bearing, ran
ge); |
| 1114 } |
| 1115 |
| 1116 |
| 1117 bool |
| 1118 WossHelper::SetCustomBathymetry (const ::std::string &bathyLine, const woss::Coo
rd& txCoord, double bearing) |
| 1119 { |
| 1120 NS_LOG_FUNCTION (this); |
| 1121 |
| 1122 CheckInitialized (); |
| 1123 |
| 1124 ::std::string bathyTmp = bathyLine; |
| 1125 ::std::string::size_type tmp; |
| 1126 |
| 1127 int totalRanges = 0; |
| 1128 |
| 1129 NS_LOG_DEBUG ("txCoord: " << txCoord << "; bearing: " << bearing); |
| 1130 |
| 1131 tmp = bathyTmp.find ("|"); |
| 1132 if (tmp == std::string::npos) |
| 1133 { |
| 1134 NS_LOG_ERROR ("separator | not found, string parsed:" << bathyTmp); |
| 1135 return false; |
| 1136 } |
| 1137 |
| 1138 std::string totRanges = bathyTmp.substr (0, tmp); |
| 1139 bathyTmp = bathyTmp.substr (tmp + 1, bathyTmp.npos); |
| 1140 totalRanges = ::std::atoi (totRanges.c_str ()); |
| 1141 |
| 1142 NS_LOG_DEBUG ("totalRanges: " << totalRanges); |
| 1143 |
| 1144 if (totalRanges <= 0) |
| 1145 { |
| 1146 NS_LOG_ERROR ("totalRanges given < 0:" << totalRanges); |
| 1147 return false; |
| 1148 } |
| 1149 |
| 1150 for (int cnt = 0; cnt < totalRanges; ++cnt) |
| 1151 { |
| 1152 double range; |
| 1153 double depth; |
| 1154 |
| 1155 tmp = bathyTmp.find ("|"); |
| 1156 if (tmp == std::string::npos) |
| 1157 { |
| 1158 NS_LOG_ERROR ("cnt:" << cnt << "; separator | not found, string parsed
:" << bathyTmp); |
| 1159 return false; |
| 1160 } |
| 1161 |
| 1162 std::string rangeStr = bathyTmp.substr (0, tmp); |
| 1163 bathyTmp = bathyTmp.substr (tmp + 1, bathyTmp.npos); |
| 1164 range = ::std::atof (rangeStr.c_str ()); |
| 1165 |
| 1166 tmp = bathyTmp.find ("|"); |
| 1167 if ((tmp == std::string::npos) && (cnt != totalRanges - 1)) |
| 1168 { |
| 1169 NS_LOG_ERROR ("cnt:" << cnt << "; separator | not found, string parsed
: " << bathyTmp); |
| 1170 return false; |
| 1171 } |
| 1172 |
| 1173 std::string depthStr = bathyTmp.substr (0, tmp); |
| 1174 bathyTmp = bathyTmp.substr (tmp + 1, bathyTmp.npos); |
| 1175 depth = ::std::atof (depthStr.c_str ()); |
| 1176 |
| 1177 NS_LOG_DEBUG ("cnt:" << cnt << "; range:" << range << "; depth:" << depth)
; |
| 1178 |
| 1179 if (depth < 0.0) |
| 1180 { |
| 1181 NS_LOG_ERROR ("cnt:" << cnt << " depth:" << depth << " < 0"); |
| 1182 return false; |
| 1183 } |
| 1184 else |
| 1185 { |
| 1186 m_wossDbManager->setCustomBathymetry (&depth, txCoord, bearing, range)
; |
| 1187 } |
| 1188 } |
| 1189 |
| 1190 return true; |
| 1191 } |
| 1192 |
| 1193 |
| 1194 bool |
| 1195 WossHelper::ImportCustomBathymetry (const ::std::string &bathyFile, const woss::
Coord& txCoord, double bearing) |
| 1196 { |
| 1197 CheckInitialized (); |
| 1198 |
| 1199 return m_wossDbManager->importCustomBathymetry (bathyFile, txCoord, bearing); |
| 1200 } |
| 1201 |
| 1202 |
| 1203 woss::Bathymetry* |
| 1204 WossHelper::GetCustomBathymetry (const woss::Coord& txCoord, double bearing, dou
ble range) |
| 1205 { |
| 1206 CheckInitialized (); |
| 1207 |
| 1208 return m_wossDbManager->getCustomBathymetry (txCoord, bearing, range); |
| 1209 } |
| 1210 |
| 1211 |
| 1212 void |
| 1213 WossHelper::EraseCustomBathymetry (const woss::Coord& txCoord, double bearing, d
ouble range) |
| 1214 { |
| 1215 CheckInitialized (); |
| 1216 |
| 1217 m_wossDbManager->eraseCustomBathymetry (txCoord, bearing, range); |
| 1218 } |
| 1219 |
| 1220 |
| 1221 bool |
| 1222 WossHelper::CreateDirectory (const ::std::string& path) |
| 1223 { |
| 1224 NS_LOG_FUNCTION (this); |
| 1225 |
| 1226 NS_ASSERT (path.size () > 0); |
| 1227 |
| 1228 int ret_value = -1; |
| 1229 static ::std::stringstream str_out; |
| 1230 |
| 1231 str_out << "mkdir -p " << path; |
| 1232 |
| 1233 ::std::string command = str_out.str (); |
| 1234 str_out.str (""); |
| 1235 |
| 1236 NS_LOG_DEBUG ("WossHelper::CreateDirectory () command = " << command); |
| 1237 |
| 1238 if (system (NULL)) |
| 1239 { |
| 1240 ret_value = system (command.c_str ()); |
| 1241 } |
| 1242 |
| 1243 return ( ret_value == 0 ); |
| 1244 } |
| 1245 |
| 1246 |
| 1247 NS_OBJECT_ENSURE_REGISTERED (WossHelper); |
| 1248 |
| 1249 TypeId |
| 1250 WossHelper::GetTypeId () |
| 1251 { |
| 1252 static TypeId tid = TypeId ("ns3::WossHelper") |
| 1253 .SetParent<Object> () |
| 1254 .SetGroupName ("Woss") |
| 1255 .AddConstructor<WossHelper> () |
| 1256 .AddAttribute ("WossRandomGenStream", |
| 1257 "int stream value for WOSS Uniform Random Generator", |
| 1258 IntegerValue (-1), |
| 1259 MakeIntegerAccessor (&WossHelper::m_wossRandomGenStream), |
| 1260 MakeIntegerChecker<int64_t> () ) |
| 1261 .AddAttribute ("ResDbCreatorDebug", |
| 1262 "A boolean that enables or disables the debug screen output o
f chosen ResDbCreator", |
| 1263 BooleanValue (WH_DEBUG_DEFAULT), |
| 1264 MakeBooleanAccessor (&WossHelper::m_resDbCreatorDebug), |
| 1265 MakeBooleanChecker () ) |
| 1266 .AddAttribute ("ResDbDebug", |
| 1267 "A boolean that enables or disables the debug screen output o
f chosen ResDb", |
| 1268 BooleanValue (WH_DEBUG_DEFAULT), |
| 1269 MakeBooleanAccessor (&WossHelper::m_resDbDebug), |
| 1270 MakeBooleanChecker () ) |
| 1271 .AddAttribute ("ResDbUseBinary", |
| 1272 "If true the ResDb will use its binary version, the ASCII one
otherwise", |
| 1273 BooleanValue (true), |
| 1274 MakeBooleanAccessor (&WossHelper::m_resDbUseBinary), |
| 1275 MakeBooleanChecker () ) |
| 1276 .AddAttribute ("ResDbUseTimeArr", |
| 1277 "if true the ResDb will store the computed channels in their
TimeArr form, in Pressure otherwise", |
| 1278 BooleanValue (true), |
| 1279 MakeBooleanAccessor (&WossHelper::m_resDbUseTimeArr), |
| 1280 MakeBooleanChecker () ) |
| 1281 .AddAttribute ("ResDbSpaceSampling", |
| 1282 "ResDb will use the given double as a space sampling radius", |
| 1283 DoubleValue (WH_SPACE_SAMPLING_DEFAULT), |
| 1284 MakeDoubleAccessor (&WossHelper::m_resDbSpaceSampling), |
| 1285 MakeDoubleChecker<double> () ) |
| 1286 .AddAttribute ("ResDbFilePath", |
| 1287 "ResDb will write/read from this path (full path required)", |
| 1288 StringValue (WH_STRING_DEFAULT), |
| 1289 MakeStringAccessor (&WossHelper::m_resDbFilePath), |
| 1290 MakeStringChecker () ) |
| 1291 .AddAttribute ("ResDbFileName", |
| 1292 "ResDb will write/read from this file. \ |
| 1293 In scenarios with HIGH mobility, the ResDb shouldn't be used
in order to avoid memory exhaustion.", |
| 1294 StringValue (WH_STRING_DEFAULT), |
| 1295 MakeStringAccessor (&WossHelper::m_resDbFileName), |
| 1296 MakeStringChecker () ) |
| 1297 .AddAttribute ("SedimentDbCreatorDebug", |
| 1298 "A boolean that enables or disables the debug screen output o
f Sediment Db Creator", |
| 1299 BooleanValue (WH_DEBUG_DEFAULT), |
| 1300 MakeBooleanAccessor (&WossHelper::m_sedimDbCreatorDebug), |
| 1301 MakeBooleanChecker () ) |
| 1302 .AddAttribute ("SedimentDbDebug", |
| 1303 "A boolean that enables or disables the debug screen output o
f Sediment Db", |
| 1304 BooleanValue (WH_DEBUG_DEFAULT), |
| 1305 MakeBooleanAccessor (&WossHelper::m_sedimDbDebug), |
| 1306 MakeBooleanChecker () ) |
| 1307 .AddAttribute ("SedimDbCoordFilePath", |
| 1308 "Sediment Db will read the coordinates database from this fil
e (full path required)", |
| 1309 StringValue (WH_STRING_DEFAULT), |
| 1310 MakeStringAccessor (&WossHelper::m_sedimDbCoordFilePath), |
| 1311 MakeStringChecker () ) |
| 1312 .AddAttribute ("SedimDbMarsdenFilePath", |
| 1313 "Sediment Db will read the marsden square database from this
file (full path required)", |
| 1314 StringValue (WH_STRING_DEFAULT), |
| 1315 MakeStringAccessor (&WossHelper::m_sedimDbMarsdenFilePath), |
| 1316 MakeStringChecker () ) |
| 1317 .AddAttribute ("SedimDbMarsdenOneFilePath", |
| 1318 "Sediment Db will read the marsden one square from this file
(full path required)", |
| 1319 StringValue (WH_STRING_DEFAULT), |
| 1320 MakeStringAccessor (&WossHelper::m_sedimDbMarsdenOneFilePath)
, |
| 1321 MakeStringChecker () ) |
| 1322 .AddAttribute ("SspDbCreatorDebug", |
| 1323 "A boolean that enables or disables the debug screen output o
f SSP Db Creator", |
| 1324 BooleanValue (WH_DEBUG_DEFAULT), |
| 1325 MakeBooleanAccessor (&WossHelper::m_sspDbCreatorDebug), |
| 1326 MakeBooleanChecker () ) |
| 1327 .AddAttribute ("SspDbDebug", |
| 1328 "A boolean that enables or disables the debug screen output o
f SSP Db", |
| 1329 BooleanValue (WH_DEBUG_DEFAULT), |
| 1330 MakeBooleanAccessor (&WossHelper::m_sspDbDebug), |
| 1331 MakeBooleanChecker () ) |
| 1332 .AddAttribute ("SspDbCoordFilePath", |
| 1333 "SSP Db will read the WOA database from this file (full path
required)", |
| 1334 StringValue (WH_STRING_DEFAULT), |
| 1335 MakeStringAccessor (&WossHelper::m_sspDbFilePath), |
| 1336 MakeStringChecker () ) |
| 1337 .AddAttribute ("BathyDbCreatorDebug", |
| 1338 "A boolean that enables or disables the debug screen output o
f Bathymetry Db Creator", |
| 1339 BooleanValue (WH_DEBUG_DEFAULT), |
| 1340 MakeBooleanAccessor (&WossHelper::m_bathyDbCreatorDebug), |
| 1341 MakeBooleanChecker () ) |
| 1342 .AddAttribute ("BathyDbDebug", |
| 1343 "A boolean that enables or disables the debug screen output o
f Bathymetry Db", |
| 1344 BooleanValue (WH_DEBUG_DEFAULT), |
| 1345 MakeBooleanAccessor (&WossHelper::m_bathyDbDebug), |
| 1346 MakeBooleanChecker () ) |
| 1347 .AddAttribute ("BathyDbUseThirtySecsPrecision", |
| 1348 "If true the Bathymetry Db will try to load the 30 seconds db
version, the one minute one otherwise", |
| 1349 BooleanValue (true), |
| 1350 MakeBooleanAccessor (&WossHelper::m_bathyDbUseThirtySecsPrec)
, |
| 1351 MakeBooleanChecker () ) |
| 1352 .AddAttribute ("BathyDbCoordFilePath", |
| 1353 "Bathymetry Db will read the GEBCO database from this file (f
ull path required)", |
| 1354 StringValue (WH_STRING_DEFAULT), |
| 1355 MakeStringAccessor (&WossHelper::m_bathyDbFilePath), |
| 1356 MakeStringChecker () ) |
| 1357 .AddAttribute ("WossDbManagerDebug", |
| 1358 "A boolean that enables or disables the debug screen output o
f WossDbManager", |
| 1359 BooleanValue (WH_DEBUG_DEFAULT), |
| 1360 MakeBooleanAccessor (&WossHelper::m_wossDbManagerDebug), |
| 1361 MakeBooleanChecker () ) |
| 1362 .AddAttribute ("WossCreatorDebug", |
| 1363 "A boolean that enables or disables the debug screen output o
f WossCreator", |
| 1364 BooleanValue (WH_DEBUG_DEFAULT), |
| 1365 MakeBooleanAccessor (&WossHelper::m_wossCreatorDebug), |
| 1366 MakeBooleanChecker () ) |
| 1367 .AddAttribute ("WossDebug", |
| 1368 "A boolean that enables or disables the debug screen output o
f created Woss objects", |
| 1369 BooleanValue (WH_DEBUG_DEFAULT), |
| 1370 MakeBooleanAccessor (&WossHelper::m_wossDebug), |
| 1371 MakeBooleanChecker () ) |
| 1372 .AddAttribute ("WossCleanWorkDir", |
| 1373 "A boolean that enables or disables the removal of the workin
g dir at the end of the simulation", |
| 1374 BooleanValue (WH_DEBUG_DEFAULT), |
| 1375 MakeBooleanAccessor (&WossHelper::m_wossClearWorkDir), |
| 1376 MakeBooleanChecker () ) |
| 1377 .AddAttribute ("WossEvolutionTimeQuantum", |
| 1378 "the created WOSS objects will use the given double as a time
evolution quantum [s]. Use -1.0 to disable the feature", |
| 1379 DoubleValue (WH_TIME_EVOLUTION_DEFAULT), |
| 1380 MakeDoubleAccessor (&WossHelper::m_evolutionTimeQuantum), |
| 1381 MakeDoubleChecker<double> () ) |
| 1382 .AddAttribute ("WossTotalRuns", |
| 1383 "the created WOSS objects will run the simulation for the giv
en uint value", |
| 1384 IntegerValue (WH_TOTAL_RUNS_DEFAULT), |
| 1385 MakeIntegerAccessor (&WossHelper::m_totalRuns), |
| 1386 MakeIntegerChecker<int> () ) |
| 1387 .AddAttribute ("WossFrequencyStep", |
| 1388 "the created WOSS objects will run the simulation at each fre
quency step [Hz]. Use 0.0 to disable the feature", |
| 1389 DoubleValue (WH_FREQUENCY_STEP_DEFAULT), |
| 1390 MakeDoubleAccessor (&WossHelper::m_frequencyStep), |
| 1391 MakeDoubleChecker<double> () ) |
| 1392 .AddAttribute ("WossTotalRangeSteps", |
| 1393 "the created WOSS objects will divide each range by the given
value", |
| 1394 IntegerValue (WH_TOTAL_RANGE_STEPS_DEFAULT), |
| 1395 MakeIntegerAccessor (&WossHelper::m_totalRangeSteps), |
| 1396 MakeIntegerChecker<int> () ) |
| 1397 .AddAttribute ("WossTxMinDepthOffset", |
| 1398 "the created WOSS objects will create a number of WossTotalTr
ansmitters equally spaced in range |WossTxMaxDepthOffset-WossTxMinDepthOffset|", |
| 1399 DoubleValue (WH_TX_MIN_DEPTH_OFFSET_DEFAULT), |
| 1400 MakeDoubleAccessor (&WossHelper::m_txMinDepthOffset), |
| 1401 MakeDoubleChecker<double> () ) |
| 1402 .AddAttribute ("WossTxMaxDepthOffset", |
| 1403 "the created WOSS objects will create a number of WossTotalTr
ansmitters equally spaced in range |WossTxMaxDepthOffset-WossTxMinDepthOffset|", |
| 1404 DoubleValue (WH_TX_MAX_DEPTH_OFFSET_DEFAULT), |
| 1405 MakeDoubleAccessor (&WossHelper::m_txMaxDepthOffset), |
| 1406 MakeDoubleChecker<double> () ) |
| 1407 .AddAttribute ("WossTotalTransmitters", |
| 1408 "the created WOSS objects will create the given number of tra
nsmitter", |
| 1409 IntegerValue (WH_TOTAL_TRANSMITTERS_DEFAULT), |
| 1410 MakeIntegerAccessor (&WossHelper::m_totalTransmitters), |
| 1411 MakeIntegerChecker<int> () ) |
| 1412 .AddAttribute ("WossTotalRxDepths", |
| 1413 "the created WOSS objects will place a receiver equally space
d in range |WossRxMaxDepthOffset - WossRxMinDepthOffset|", |
| 1414 IntegerValue (WH_TOTAL_RX_DEPTHS_DEFAULT), |
| 1415 MakeIntegerAccessor (&WossHelper::m_totalRxDepths), |
| 1416 MakeIntegerChecker<uint32_t> () ) |
| 1417 .AddAttribute ("WossRxMinDepthOffset", |
| 1418 "the created WOSS objects will create a number of WossTotalRx
Depths rx equally spaced in range |WossRxMaxDepthOffset-WossRxMinDepthOffset|", |
| 1419 DoubleValue (WH_RX_MIN_DEPTH_OFFSET_DEFAULT), |
| 1420 MakeDoubleAccessor (&WossHelper::m_rxMinDepthOffset), |
| 1421 MakeDoubleChecker<double> () ) |
| 1422 .AddAttribute ("WossRxMaxDepthOffset", |
| 1423 "the created WOSS objects will create a number of WossTotalRx
Depths rx equally spaced in range |WossRxMaxDepthOffset-WossRxMinDepthOffset|", |
| 1424 DoubleValue (WH_RX_MAX_DEPTH_OFFSET_DEFAULT), |
| 1425 MakeDoubleAccessor (&WossHelper::m_rxMaxDepthOffset), |
| 1426 MakeDoubleChecker<double> () ) |
| 1427 .AddAttribute ("WossTotalRxRanges", |
| 1428 "the created WOSS objects will place a receiver equally space
d in range |WossRxMaxRangeOffset - WossRxMinRangeOffset|", |
| 1429 IntegerValue (WH_TOTAL_RX_RANGES_DEFAULT), |
| 1430 MakeIntegerAccessor (&WossHelper::m_totalRxRanges), |
| 1431 MakeIntegerChecker<int> () ) |
| 1432 .AddAttribute ("WossRxMinRangeOffset", |
| 1433 "the created WOSS objects will create a number of WossTotalRx
Ranges rx equally spaced in range |WossRxMaxRangeOffset-WossRxMinRangeOffset|", |
| 1434 DoubleValue (WH_RX_MIN_RANGE_OFFSET_DEFAULT), |
| 1435 MakeDoubleAccessor (&WossHelper::m_rxMinRangeOffset), |
| 1436 MakeDoubleChecker<double> () ) |
| 1437 .AddAttribute ("WossRxMaxRangeOffset", |
| 1438 "the created WOSS objects will create a number of WossTotalRx
Ranges rx equally spaced in range |WossRxMaxRangeOffset-WossRxMinRangeOffset|", |
| 1439 DoubleValue (WH_RX_MAX_RANGE_OFFSET_DEFAULT), |
| 1440 MakeDoubleAccessor (&WossHelper::m_rxMaxRangeOffset), |
| 1441 MakeDoubleChecker<double> () ) |
| 1442 .AddAttribute ("WossTotalRays", |
| 1443 "the created WOSS objects will run bellhop with the given num
ber of rays. 0 for auto", |
| 1444 IntegerValue (WH_TOTAL_RAYS_DEFAULT), |
| 1445 MakeIntegerAccessor (&WossHelper::m_totalRays), |
| 1446 MakeIntegerChecker<int> () ) |
| 1447 .AddAttribute ("WossMinAngle", |
| 1448 "the created WOSS objects will run bellhop with given startin
g launch angle", |
| 1449 DoubleValue (WH_MIN_ANGLE_DEFAULT), |
| 1450 MakeDoubleAccessor (&WossHelper::m_minAngle), |
| 1451 MakeDoubleChecker<double> () ) |
| 1452 .AddAttribute ("WossMaxAngle", |
| 1453 "the created WOSS objects will run bellhop with given ending
launch angle", |
| 1454 DoubleValue (WH_MAX_ANGLE_DEFAULT), |
| 1455 MakeDoubleAccessor (&WossHelper::m_maxAngle), |
| 1456 MakeDoubleChecker<double> () ) |
| 1457 .AddAttribute ("WossSspDepthPrecision", |
| 1458 "the created WOSS objects will have the given SSP depth preci
sion [m]", |
| 1459 DoubleValue (WH_SSP_DEPTH_PRECISION_DEFAULT), |
| 1460 MakeDoubleAccessor (&WossHelper::m_sspDepthPrecision), |
| 1461 MakeDoubleChecker<double> () ) |
| 1462 .AddAttribute ("WossSspNormalizedDepthSteps", |
| 1463 "the created WOSS objects will have all normalized SSP with t
his number of depths", |
| 1464 DoubleValue (WH_NORMALIZED_SSP_DEPTH_STEPS_DEFAULT), |
| 1465 MakeDoubleAccessor (&WossHelper::m_normalizedSspDepthSteps), |
| 1466 MakeDoubleChecker<double> () ) |
| 1467 .AddAttribute ("WossWorkDirPath", |
| 1468 "the created WOSS objects will create its temporary files in
this directory (full path)", |
| 1469 StringValue (WH_WORK_PATH_DEFAULT), |
| 1470 MakeStringAccessor (&WossHelper::m_workDirPath), |
| 1471 MakeStringChecker () ) |
| 1472 .AddAttribute ("WossBellhopPath", |
| 1473 "the full path of bellhop executable. Leave blank if already
in environment search path", |
| 1474 StringValue (WH_STRING_DEFAULT), |
| 1475 MakeStringAccessor (&WossHelper::m_bellhopPath), |
| 1476 MakeStringChecker () ) |
| 1477 .AddAttribute ("WossBellhopMode", |
| 1478 "the bellhop running mode. see WOSS doxygen for supported mod
es", |
| 1479 StringValue (WH_BELLHOP_MODE_DEFAULT), |
| 1480 MakeStringAccessor (&WossHelper::m_bellhopMode), |
| 1481 MakeStringChecker () ) |
| 1482 .AddAttribute ("WossBellhopBeamOptions", |
| 1483 "the bellhop beam options. see WOSS doxygen for supported mod
es", |
| 1484 StringValue (WH_BEAM_OPTIONS_DEFAULT), |
| 1485 MakeStringAccessor (&WossHelper::m_bellhopBeamOptions), |
| 1486 MakeStringChecker () ) |
| 1487 .AddAttribute ("WossBellhopBathyType", |
| 1488 "the bellhop bathymetry type. see WOSS doxygen for supported
modes", |
| 1489 StringValue (WH_BATHYMETRY_TYPE_DEFAULT), |
| 1490 MakeStringAccessor (&WossHelper::m_bellhopBathyType), |
| 1491 MakeStringChecker () ) |
| 1492 .AddAttribute ("WossBathyWriteMethod", |
| 1493 "the woss bathymetry write method. see WOSS doxygen for suppo
rted modes", |
| 1494 StringValue (WH_BATHYMETRY_METHOD_DEFAULT), |
| 1495 MakeStringAccessor (&WossHelper::m_bathyMethod), |
| 1496 MakeStringChecker () ) |
| 1497 .AddAttribute ("WossBellhopAltimType", |
| 1498 "the bellhop altimetry type. see WOSS doxygen for supported m
odes", |
| 1499 StringValue (WH_ALTIMETRY_TYPE_DEFAULT), |
| 1500 MakeStringAccessor (&WossHelper::m_bellhopAltimType), |
| 1501 MakeStringChecker () ) |
| 1502 .AddAttribute ("WossSimTime", |
| 1503 "the created Woss objects will use the given SimTime for time
evolution purposes", |
| 1504 WossSimTimeValue (WossSimTime ()), |
| 1505 MakeWossSimTimeAccessor (&WossHelper::m_simTime), |
| 1506 MakeWossSimTimeChecker () ) |
| 1507 .AddAttribute ("WossBellhopArrSyntax",· |
| 1508 "Syntax to be used during bellhop arr file parsing", |
| 1509 IntegerValue (WH_BELLHOP_ARR_SYNTAX_DEFAULT), |
| 1510 MakeIntegerAccessor (&WossHelper::m_bellhopArrSyntax), |
| 1511 MakeIntegerChecker<int> () ) |
| 1512 .AddAttribute ("WossManagerDebug", |
| 1513 "A boolean that enables or disables the debug screen output o
f WossManager object", |
| 1514 BooleanValue (WH_DEBUG_DEFAULT), |
| 1515 MakeBooleanAccessor (&WossHelper::m_wossManagerDebug), |
| 1516 MakeBooleanChecker () ) |
| 1517 .AddAttribute ("WossManagerTimeEvoActive", |
| 1518 "A boolean that enables or disables the time evolution featur
e", |
| 1519 BooleanValue (false), |
| 1520 MakeBooleanAccessor (&WossHelper::m_isTimeEvolutionActive), |
| 1521 MakeBooleanChecker () ) |
| 1522 .AddAttribute ("WossManagerTotalThreads", |
| 1523 "WossManager will try to run the given maximum of parallel Wo
ss object. 0 for auto", |
| 1524 IntegerValue (WH_CONCURRENT_THREADS_DEFAULT), |
| 1525 MakeIntegerAccessor (&WossHelper::m_concurrentThreads), |
| 1526 MakeIntegerChecker<int> () ) |
| 1527 .AddAttribute ("WossManagerSpaceSampling", |
| 1528 "WossManager will use the given radius [m] to sample the surf
ace. 0 to disable the feature", |
| 1529 DoubleValue (WH_SPACE_SAMPLING_DEFAULT), |
| 1530 MakeDoubleAccessor (&WossHelper::m_wossManagerSpaceSampling), |
| 1531 MakeDoubleChecker<double> () ) |
| 1532 .AddAttribute ("WossManagerUseMultithread", |
| 1533 "A boolean that enables or disables the multithread feature", |
| 1534 BooleanValue (false), |
| 1535 MakeBooleanAccessor (&WossHelper::m_wossManagerUseMultiThread
), |
| 1536 MakeBooleanChecker () ) |
| 1537 .AddAttribute ("WossTransHandlerDebug", |
| 1538 "A boolean that enables or disables the TransducerHandler's d
ebug screen output", |
| 1539 BooleanValue (WH_DEBUG_DEFAULT), |
| 1540 MakeBooleanAccessor (&WossHelper::m_wossTransducerHndlDebug), |
| 1541 MakeBooleanChecker () ) |
| 1542 .AddAttribute ("WossControllerDebug", |
| 1543 "A boolean that enables or disables the WossController's debu
g screen output", |
| 1544 BooleanValue (WH_DEBUG_DEFAULT), |
| 1545 MakeBooleanAccessor (&WossHelper::m_wossControllerDebug), |
| 1546 MakeBooleanChecker () ) |
| 1547 ; |
| 1548 |
| 1549 return tid; |
| 1550 } |
| 1551 |
| 1552 |
| 1553 } // namespace ns3 |
| 1554 |
| 1555 #endif /* NS3_WOSS_SUPPORT */ |
LEFT | RIGHT |