27#include <sys/resource.h>
66using std::setprecision;
73using std::stringstream;
170 if ((!isatty(fileno(stdout))) || (!isatty(fileno(stderr))))
175 for (
int i = 1; i < nArg; i++)
177 string strArg = pcArgv[i];
185 if (strArg.find(
"--gdal") != string::npos)
191 for (
int j = 0; j < GDALGetDriverCount(); j++)
193 GDALDriverH hDriver = GDALGetDriver(j);
195 string strTmp(GDALGetDriverShortName(hDriver));
197 strTmp.append(GDALGetDriverLongName(hDriver));
199 cout << strTmp << endl;
207 if (strArg.find(
"--about") != string::npos)
210 cout <<
ABOUT << endl;
218 if (strArg.find(
"--yaml") != string::npos)
224 else if (strArg.find(
"--home") != string::npos)
230 size_t const pos = strArg.find(
'=');
233 if (pos != string::npos)
242 cout <<
"No '=' found in the input string" << endl;
252 cout <<
USAGE << endl;
277 cout <<
"OpenMP is ENABLED" << endl;
278 cout <<
"Max threads available: " << omp_get_max_threads() << endl;
282 std::cout <<
"Actually running with " << omp_get_num_threads() <<
" threads" << std::endl;
285 std::cout <<
"OpenMP is NOT ENABLED - code will run serially!" << std::endl;
295 if (
static_cast<clock_t
>(-1) == clock())
323 if (0 != GetModuleFileName(NULL, szBuf,
BUF_SIZE))
333 if (-1 != readlink(
"/proc/self/exe", szBuf,
BUF_SIZE))
347 int const nPos =
static_cast<int>(strTmp.find_last_of(
PATH_SEPARATOR));
359 cout <<
LINE << endl;
397 return 24 * 30.416667;
452 if (strIn->find(
"hour") != string::npos)
455 else if (strIn->find(
"day") != string::npos)
458 else if (strIn->find(
"month") != string::npos)
461 else if (strIn->find(
"year") != string::npos)
475 LogStream.open(
"/dev/null", ios::out | ios::trunc);
476 cout <<
"Warning: log file is not writting" << endl;
485 cerr <<
ERR <<
"cannot open " <<
m_strLogFile <<
" for output" << endl;
1000 strTmp.append(
", ");
1006 strTmp.append(
", ");
1010 if (strTmp.size() > 2)
1011 strTmp.resize(strTmp.size() - 2);
1026 strTmp.append(
", ");
1032 strTmp.append(
", ");
1038 strTmp.append(
", ");
1044 strTmp.append(
", ");
1050 strTmp.append(
", ");
1056 strTmp.append(
", ");
1062 strTmp.append(
", ");
1068 strTmp.append(
", ");
1074 strTmp.append(
", ");
1080 strTmp.append(
", ");
1086 strTmp.append(
", ");
1092 strTmp.append(
", ");
1098 strTmp.append(
", ");
1104 strTmp.append(
", ");
1110 strTmp.append(
", ");
1114 if (strTmp.size() > 2)
1115 strTmp.resize(strTmp.size() - 2);
1130 strTmp.append(
", ");
1136 strTmp.append(
", ");
1142 strTmp.append(
", ");
1148 strTmp.append(
", ");
1154 strTmp.append(
", ");
1160 strTmp.append(
", ");
1166 strTmp.append(
", ");
1172 strTmp.append(
", ");
1178 strTmp.append(
", ");
1184 strTmp.append(
", ");
1190 strTmp.append(
", ");
1196 strTmp.append(
", ");
1202 strTmp.append(
", ");
1206 if (strTmp.size() > 2)
1207 strTmp.resize(strTmp.size() - 2);
1224 strTSFile.append(
CSVEXT);
1231 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1241 strTSFile.append(
CSVEXT);
1244 SWLTSStream.open(strTSFile.c_str(), ios::out | ios::trunc);
1248 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1258 strTSFile.append(
CSVEXT);
1265 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1275 strTSFile.append(
CSVEXT);
1282 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1292 strTSFile.append(
CSVEXT);
1299 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1309 strTSFile.append(
CSVEXT);
1316 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1326 strTSFile.append(
CSVEXT);
1333 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1343 strTSFile.append(
CSVEXT);
1350 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1360 strTSFile.append(
CSVEXT);
1367 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1377 strTSFile.append(
CSVEXT);
1384 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1394 strTSFile.append(
CSVEXT);
1401 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1411 strTSFile.append(
CSVEXT);
1418 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1428 strTSFile.append(
CSVEXT);
1435 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1476 string strComputerName;
1480 strComputerName = getenv(
"COMPUTERNAME");
1486 strComputerName = szHostName;
1488 if (strComputerName.empty())
1489 strComputerName =
"Unknown Computer";
1493 return strComputerName;
1501 if (
static_cast<clock_t
>(-1) == clock())
1504 LogStream <<
"CPU time not available" << endl;
1510 double dClkThis =
static_cast<double>(clock());
1511 dClkThis -= CLOCK_T_MIN;
1523 <<
" before rollover=" << (CLOCK_T_RANGE + 1 -
m_dClkLast) << endl
1525 <<
" after rollover=" << dClkThis << endl
1527 <<
" ADDED=" << (CLOCK_T_RANGE + 1 -
m_dClkLast + dClkThis) << endl;
1636 double dTmpTime =
tMax(dTimeIn, 0.0);
1641 double const dHoursInYear = 24 * 365;
1642 double const dHoursInDay = 24;
1645 if (dTmpTime >= dHoursInYear)
1647 double const dYears = floor(dTmpTime / dHoursInYear);
1648 dTmpTime -= (dYears * dHoursInYear);
1650 strTime = to_string(
static_cast<int>(dYears));
1651 strTime.append(
"y ");
1657 if (dTmpTime >= dHoursInDay)
1659 double const dJDays = floor(dTmpTime / dHoursInDay);
1660 dTmpTime -= (dJDays * dHoursInDay);
1662 stringstream ststrTmp;
1663 ststrTmp << FillToWidth('0', 3) << static_cast<int>(dJDays);
1664 strTime.append(ststrTmp.str());
1665 strTime.append(
"d ");
1668 strTime.append(
"000d ");
1671 stringstream ststrTmp;
1672 ststrTmp << FillToWidth('0', 2) << static_cast<int>(dTmpTime);
1673 strTime.append(ststrTmp.str());
1674 strTime.append(
"h");
1685 double dTime =
tMax(dTimeIn, 0.0);
1692 unsigned long ulTimeIn =
static_cast<unsigned long>(floor(dTime));
1693 dTime -=
static_cast<double>(ulTimeIn);
1696 if (ulTimeIn >= 3600)
1699 unsigned long const ulHours = ulTimeIn / 3600ul;
1700 ulTimeIn -= (ulHours * 3600ul);
1702 strTime = to_string(ulHours);
1703 strTime.append(
":");
1712 unsigned long const ulMins = ulTimeIn / 60ul;
1713 ulTimeIn -= (ulMins * 60ul);
1715 stringstream ststrTmp;
1716 ststrTmp << FillToWidth(
'0', 2) << ulMins;
1717 strTime.append(ststrTmp.str());
1718 strTime.append(
":");
1721 strTime.append(
"00:");
1724 stringstream ststrTmp;
1725 ststrTmp << FillToWidth(
'0', 2) << ulTimeIn;
1726 strTime.append(ststrTmp.str());
1731 strTime.append(
".");
1733 ststrTmp.str(
string());
1734 ststrTmp << FillToWidth('0', 2) << static_cast<unsigned long>(dTime * 100);
1735 strTime.append(ststrTmp.str());
1746 string strBuild(
"(");
1747 strBuild.append(__TIME__);
1748 strBuild.append(
" ");
1749 strBuild.append(__DATE__);
1751 strBuild.append(
" DEBUG");
1753 strBuild.append(
" build)");
1763 if (isatty(fileno(stdout)))
1766 static double sdElapsed = 0;
1767 static double sdToGo = 0;
1768 time_t
const tNow = time(
nullptr);
1777 cout <<
"% (elapsed " <<
strDispTime(sdElapsed,
false,
false) <<
" remaining ";
1779 cout <<
strDispTime(sdToGo,
false,
false) <<
") ";
1783 cout << setw(9) <<
"GIS" + to_string(
m_nGISSave);
1785 cout << setw(9) <<
"SED INPUT";
1787 cout << setw(9) <<
SPACE;
1798 string const NA =
"Not available";
1801 OutStream <<
"Process statistics" << endl;
1802 OutStream <<
"------------------" << endl;
1806 OSVERSIONINFOEX osvi;
1807 BOOL bOsVersionInfoEx;
1809 ZeroMemory(&osvi,
sizeof(OSVERSIONINFOEX));
1810 osvi.dwOSVersionInfoSize =
sizeof(OSVERSIONINFOEX);
1812 if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*)&osvi)))
1815 osvi.dwOSVersionInfoSize =
sizeof(OSVERSIONINFO);
1817 if (!GetVersionEx((OSVERSIONINFO*)&osvi))
1828 switch (osvi.dwPlatformId)
1830 case VER_PLATFORM_WIN32_NT:
1831 if (osvi.dwMajorVersion <= 4)
1834 else if (5 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1837 else if (5 == osvi.dwMajorVersion && 1 == osvi.dwMinorVersion)
1840 else if (6 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1843 else if (6 == osvi.dwMajorVersion && 1 == osvi.dwMinorVersion)
1846 else if (6 == osvi.dwMajorVersion && 2 == osvi.dwMinorVersion)
1849 else if (6 == osvi.dwMajorVersion && 3 == osvi.dwMinorVersion)
1852 else if (10 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1855 else if (11 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1859 OutStream <<
"unknown Windows version ";
1862 if (osvi.dwMajorVersion <= 4)
1863 OutStream <<
"version " << osvi.dwMajorVersion <<
"." << osvi.dwMinorVersion <<
" " << osvi.szCSDVersion <<
" (Build " << (osvi.dwBuildNumber & 0xFFFF) <<
")" << endl;
1866 OutStream << osvi.szCSDVersion <<
" (Build " << (osvi.dwBuildNumber & 0xFFFF) <<
")" << endl;
1870 case VER_PLATFORM_WIN32_WINDOWS:
1871 if (4 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1875 if (
'C' == osvi.szCSDVersion[1] ||
'B' == osvi.szCSDVersion[1])
1881 else if (4 == osvi.dwMajorVersion && 10 == osvi.dwMinorVersion)
1885 if (
'A' == osvi.szCSDVersion[1])
1891 else if (4 == osvi.dwMajorVersion && 90 == osvi.dwMinorVersion)
1895 OutStream <<
"unknown 16-bit Windows version " << endl;
1899 case VER_PLATFORM_WIN32s:
1905 if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId)
1907 FILETIME ftCreate, ftExit, ftKernel, ftUser;
1909 if (GetProcessTimes(GetCurrentProcess(), &ftCreate, &ftExit, &ftKernel, &ftUser))
1912 ul.LowPart = ftUser.dwLowDateTime;
1913 ul.HighPart = ftUser.dwHighDateTime;
1914 OutStream <<
"Time spent executing user code \t: " <<
strDispTime(
static_cast<double>(ul.QuadPart) * 1e-7,
false) << endl;
1915 ul.LowPart = ftKernel.dwLowDateTime;
1916 ul.HighPart = ftKernel.dwHighDateTime;
1917 OutStream <<
"Time spent executing kernel code \t: " <<
strDispTime(
static_cast<double>(ul.QuadPart) * 1e-7,
false) << endl;
1922 OutStream <<
"Process timings \t: " << NA << endl;
1925 HINSTANCE hDLL = LoadLibrary(
"psapi.dll");
1930 typedef BOOL(__stdcall * DLLPROC)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD);
1934 ProcAdd = (DLLPROC)GetProcAddress(hDLL,
"GetProcessMemoryInfo");
1939 PROCESS_MEMORY_COUNTERS pmc;
1942 if ((ProcAdd)(GetCurrentProcess(), &pmc,
sizeof(pmc)))
1944 OutStream <<
"Peak working set size \t: " << pmc.PeakWorkingSetSize / (1024.0 * 1024.0) <<
" Mb" << endl;
1945 OutStream <<
"Current working set size \t: " << pmc.WorkingSetSize / (1024.0 * 1024.0) <<
" Mb" << endl;
1946 OutStream <<
"Peak paged pool usage \t: " << pmc.QuotaPeakPagedPoolUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1947 OutStream <<
"Current paged pool usage \t: " << pmc.QuotaPagedPoolUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1948 OutStream <<
"Peak non-paged pool usage \t: " << pmc.QuotaPeakNonPagedPoolUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1949 OutStream <<
"Current non-paged pool usage \t: " << pmc.QuotaNonPagedPoolUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1950 OutStream <<
"Peak pagefile usage \t: " << pmc.PeakPagefileUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1951 OutStream <<
"Current pagefile usage \t: " << pmc.PagefileUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1952 OutStream <<
"No. of page faults \t: " << pmc.PageFaultCount << endl;
1960#elif defined __GNUG__
1963 if (getrusage(RUSAGE_SELF, &ru) >= 0)
1965 OutStream <<
"Time spent executing user code \t: " <<
strDispTime(
static_cast<double>(ru.ru_utime.tv_sec),
false,
true) << endl;
1967 OutStream <<
"Time spent executing kernel code \t: " <<
strDispTime(
static_cast<double>(ru.ru_stime.tv_sec),
false,
true) << endl;
1973 OutStream <<
"No. of page faults not requiring physical I/O\t: " << ru.ru_minflt << endl;
1974 OutStream <<
"No. of page faults requiring physical I/O \t: " << ru.ru_majflt << endl;
1979 OutStream <<
"No. of voluntary context switches \t: " << ru.ru_nvcsw << endl;
1980 OutStream <<
"No. of involuntary context switches \t: " << ru.ru_nivcsw << endl;
1995 if (0 == omp_get_thread_num())
1997 OutStream <<
"Number of OpenMP threads \t: " << omp_get_num_threads() << endl;
1998 OutStream <<
"Number of OpenMP processors \t: " << omp_get_num_procs() << endl;
2000 LogStream <<
"Number of OpenMP threads \t: " << omp_get_num_threads() << endl;
2001 LogStream <<
"Number of OpenMP processors \t: " << omp_get_num_procs() << endl;
2007 struct tm* ptmRunTime = gmtime(&tRunTime);
2009 OutStream <<
"Time required for simulation \t: " << put_time(ptmRunTime,
"%T") << endl;
2010 LogStream <<
"Time required for simulation \t: " << put_time(ptmRunTime,
"%T") << endl;
2012 double const dSpeedUp =
m_dSimDuration * 3600 /
static_cast<double>(tRunTime);
2014 OutStream <<
"Time simulated / time required for simulation\t: " << dSpeedUp <<
" x faster than reality" << endl;
2017 LogStream <<
"Time simulated / time required for simulation\t: " << dSpeedUp <<
" x faster than reality" << endl;
2030 strErr =
"run ended by user";
2034 strErr =
"error in command-line parameter";
2038 strErr =
"error reading initialisation file";
2042 strErr =
"error in directory name";
2046 strErr =
"error reading run details file";
2050 strErr =
"error reading SCAPE shape function file";
2054 strErr =
"error reading tide data file";
2058 strErr =
"error creating log file";
2062 strErr =
"error creating text output file";
2066 strErr =
"error creating time series file";
2070 strErr =
"error reading initial DEM file";
2074 strErr =
"error reading raster GIS file";
2078 strErr =
"error reading vector GIS file";
2082 strErr =
"error allocating memory";
2086 strErr =
"problem with raster GIS output format";
2090 strErr =
"problem with vector GIS output format";
2094 strErr =
"error writing text output file";
2098 strErr =
"error writing raster GIS output file";
2102 strErr =
"error writing vector GIS output file";
2106 strErr =
"error writing time series output file";
2110 strErr =
"error putting linear feature onto raster grid";
2114 strErr =
"no sea cells found";
2118 strErr =
"error when searching grid for linear feature";
2122 strErr =
"no coastlines found. Is the SWL correct?";
2126 strErr =
"error writing coastline-normal profiles";
2130 strErr =
"error in time units";
2134 strErr =
"no solution when finding end point for coastline-normal line";
2138 strErr =
"end point for coastline-normal line is not in the contiguous sea";
2142 strErr =
"cliff notch is above sediment top elevation";
2146 strErr =
"unable to deposit enough unconsolidated sediment (talus) from cliff collapse";
2150 strErr =
"coastline-normal profiles are too closely spaced";
2154 strErr =
"no coastline-normal profiles created, check the SWL";
2158 strErr =
"no coastline-normal profiles created during rasterization";
2162 strErr =
"hit grid edge when eroding beach";
2166 strErr =
"could not locate seaward end of profile when creating Dean profile for beach erosion";
2170 strErr =
"could not locate seaward end of profile when creating Dean profile for up-coast beach deposition";
2174 strErr =
"could not locate seaward end of profile when creating Dean profile for down-coast beach deposition";
2178 strErr =
"updating grid with landforms";
2182 strErr =
"no top layer of sediment";
2186 strErr =
"problem with polygon-to-polygon sediment routing sequence";
2190 strErr =
"inconsistent multiline";
2194 strErr =
"cannot insert point into multiline";
2198 strErr =
"cannot assign coastal landform";
2202 strErr =
"start point for cell-by-cell fill of wave shadow zone is outside grid";
2206 strErr =
"could not find start point for cell-by-cell fill of wave shadow zone";
2210 strErr =
"empty profile during during CShore wave propagation";
2214 strErr =
"creating file for CShore input";
2218 strErr =
"reading CShore output file";
2222 strErr =
"during wave interpolation lookup";
2226 strErr =
"while running GDALGridCreate()";
2230 strErr =
"cannot find edge cell while constructing grid-edge profile";
2234 strErr =
"CShore did not finish correctly";
2238 strErr =
"Could not find cell under coastline";
2242 strErr =
"opening deep sea wave time series file";
2246 strErr =
"reading deep sea wave time series file";
2250 strErr =
"finding edges of the bounding box";
2254 strErr =
"reading sediment input event time series file";
2258 strErr =
"simulating sediment input event";
2262 strErr =
"location of sediment input event is outside grod";
2266 strErr =
"location of wavestation is outside grid";
2270 strErr =
"cliff not in polygon";
2274 strErr =
"Cell marked as profile coast but not as profile";
2278 strErr =
"error tracing flood line on grid";
2282 strErr =
"error tracing coastline on grid, no coast start-finish points found";
2286 strErr =
"error tracing coastline on grid, no valid coast found";
2290 strErr =
"error tracing coastline on grid, coast search just repeats";
2294 strErr =
"error tracing coastline on grid, zero-length coast found";
2298 strErr =
"error tracing coastline on grid, coast below minimum permitted length";
2302 strErr =
"error tracing coastline on grid, coast ignored";
2306 strErr =
"error tracing coastline on grid, too many times round tracing loop";
2310 strErr =
"intersection cell not found in hit profile";
2314 strErr =
"point not found when truncating multiline for different coasts";
2318 strErr =
"cell not found in hit profile";
2322 strErr =
"cell marked as in polygon, but does not have polygon's coast";
2326 strErr =
"cannot find closest point to coast when moving talus to unconsolidated sediment";
2330 strErr =
"unknown error";
2389 if (isatty(fileno(stdout)))
2404 string strCmd(
"echo \"");
2406 stringstream ststrTmp;
2407 ststrTmp << put_time(localtime(&
m_tSysEndTime),
"%T on %A %d %B %Y") << endl;
2413 strCmd.append(
"Simulation ");
2415 strCmd.append(
", running on ");
2417 strCmd.append(
", completed normally at ");
2418 strCmd.append(ststrTmp.str());
2419 strCmd.append(
"\" | mail -s \"");
2421 strCmd.append(
": normal completion\" ");
2427 strCmd.append(
"Simulation ");
2429 strCmd.append(
", running on ");
2431 strCmd.append(
", aborted with error code ");
2432 strCmd.append(to_string(nRtn));
2433 strCmd.append(
": ");
2435 strCmd.append(
" at timestep ");
2436 strCmd.append(to_string(
m_ulIter));
2437 strCmd.append(
" (");
2439 strCmd.append(
").\n\nThis message sent at ");
2440 strCmd.append(ststrTmp.str());
2441 strCmd.append(
"\" | mail -s \"");
2443 strCmd.append(
": ERROR\" ");
2447 int const nRet = system(strCmd.c_str());
2449 if (WEXITSTATUS(nRet) != 0)
2461 string strOut(*strIn);
2462 strOut.replace(strOut.begin(), strOut.end(),
'/',
'\\');
2471 string strOut(*strIn);
2472 strOut.replace(strOut.begin(), strOut.end(),
'\\',
'/');
2482 size_t const nStartpos = strIn->find_first_not_of(
" \t");
2484 if (nStartpos == string::npos)
2488 return strIn->substr(nStartpos);
2496 string strTmp(*strIn);
2499 strTmp.erase(remove(strTmp.begin(), strTmp.end(),
'\r'), strTmp.end());
2502 size_t const nEndpos = strTmp.find_last_not_of(
" \t");
2504 if (nEndpos == string::npos)
2508 return strTmp.substr(0, nEndpos + 1);
2516 string strTmp = *strIn;
2519 strTmp.erase(remove(strTmp.begin(), strTmp.end(),
'\r'), strTmp.end());
2522 size_t nPos = strTmp.find_last_not_of(
" \t");
2524 if (nPos != string::npos)
2525 strTmp.resize(nPos + 1);
2528 nPos = strTmp.find_first_not_of(
" \t");
2530 if (nPos != string::npos)
2531 strTmp = strTmp.substr(nPos);
2541 string strOut = *strIn;
2542 transform(strIn->begin(), strIn->end(), strOut.begin(), tolower);
2561 size_t const nPos = pStrIn->find(*pStrSub);
2563 if (nPos != string::npos)
2566 pStrIn->replace(nPos, pStrSub->size(),
"");
2582 stringstream ss(*s);
2585 while (getline(ss, item, delim))
2588 elems->push_back(item);
2599 vector<string> elems;
2642 int const nX = pPti->
nGetX();
2643 int const nY = pPti->
nGetY();
2644 int const nXLast = pVPtiPoints->back().nGetX();
2645 int const nYLast = pVPtiPoints->back().nGetY();
2646 int const nXDiff = nX - nXLast;
2647 int const nYDiff = nY - nYLast;
2648 int const nXDiffA =
tAbs(nXDiff);
2649 int const nYDiffA =
tAbs(nYDiff);
2650 int const nDiff =
tMax(nXDiffA, nYDiffA);
2660 dXInc =
static_cast<double>(nXDiff) / nDiff;
2663 dYInc =
static_cast<double>(nYDiff) / nDiff;
2665 for (
int n = 1; n < nDiff; n++)
2668 pVPtiPoints->push_back(Pti);
2678void CSimulation::CalcDeanProfile(vector<double>* pdVDeanProfile,
double const dInc,
double const dDeanTopElev,
double const dA,
bool const bDeposition,
int const nSeawardOffset,
double const dStartCellElev)
2680 double dDistFromProfileStart = 0;
2685 pdVDeanProfile->at(0) = dStartCellElev;
2687 for (
int n = 1; n < static_cast<int>(pdVDeanProfile->size()); n++)
2689 if (n <= nSeawardOffset)
2691 pdVDeanProfile->at(n) = dStartCellElev;
2694 double const dDistBelowTop = dA * pow(dDistFromProfileStart,
DEAN_POWER);
2695 pdVDeanProfile->at(n) = dDeanTopElev - dDistBelowTop;
2697 dDistFromProfileStart += dInc;
2704 for (
int n = 0; n < static_cast<int>(pdVDeanProfile->size()); n++)
2706 double const dDistBelowTop = dA * pow(dDistFromProfileStart,
DEAN_POWER);
2707 pdVDeanProfile->at(n) = dDeanTopElev - dDistBelowTop;
2709 dDistFromProfileStart += dInc;
2719 double dTotElevDiff = 0;
2722 for (
int n = 0; n < static_cast<int>(pdVFirstProfile->size()); n++)
2724 if (pbVIsValid->at(n))
2726 double const dProfileDiff = pdVFirstProfile->at(n) - pdVSecondProfile->at(n);
2728 dTotElevDiff += dProfileDiff;
2754 return dTotElevDiff;
2763 dDeepWaterWaveHeight,
2790 m_dDepthOfClosure = (1.75 * dDeepWaterWaveHeight) - (57.9 * dDeepWaterWaveHeight * dDeepWaterWaveHeight / (
m_dG * dDeepWaterPeriod * dDeepWaterPeriod));
2808 if (VstrTmp.size() < 3)
2810 cerr <<
"date string must include day, month, and year '" << strDate <<
"'" << endl;
2817 cerr <<
"invalid integer for day in date '" << strDate <<
"'" << endl;
2821 nDay = stoi(VstrTmp[0]);
2823 if ((nDay < 1) || (nDay > 31))
2825 cerr <<
"day must be between 1 and 31 in date '" << strDate <<
"'" << endl;
2832 cerr <<
"invalid integer for month in date '" << strDate <<
"'" << endl;
2836 nMonth = stoi(VstrTmp[1]);
2838 if ((nMonth < 1) || (nMonth > 12))
2840 cerr <<
"month must be between 1 and 12 in date '" << strDate <<
"'" << endl;
2847 cerr <<
"invalid integer for year in date '" << strDate <<
"'" << endl;
2851 nYear = stoi(VstrTmp[2]);
2855 cerr <<
"year must be > 0 in date '" << strDate <<
"'" << endl;
2869 if (VstrTmp.size() < 3)
2871 cerr <<
"time string must include hours, minutes, and seconds '" << strTime <<
"'" << endl;
2878 cerr <<
"invalid integer for hours in time '" << strTime <<
"'" << endl;
2882 nHour = stoi(VstrTmp[0]);
2884 if ((nHour < 0) || (nHour > 23))
2886 cerr <<
"hour must be between 0 and 23 in time '" << strTime <<
"'" << endl;
2893 cerr <<
"invalid integer for minutes in time '" << strTime <<
"'" << endl;
2897 nMin = stoi(VstrTmp[1]);
2899 if ((nMin < 0) || (nMin > 59))
2901 cerr <<
"minutes must be betwen 0 and 59 in time '" << strTime <<
"'" << endl;
2908 cerr <<
"invalid integer for seconds in time '" << strTime <<
"'" << endl;
2912 nSec = stoi(VstrTmp[2]);
2914 if ((nSec < 0) || (nSec > 59))
2916 cerr <<
"seconds must be between 0 and 59 in time '" << strTime <<
"'" << endl;
2928 unsigned long ulTimeStep = 0;
2934 if (strDate.find(
"hour") != string::npos)
2941 cerr <<
"Error in number of hours '" + strDate +
"' for sediment input event" << endl;
2945 double const dHours = stod(
strTrim(&VstrTmp[0]));
2949 cerr <<
"Sediment input event '" + strDate +
"' occurs after end of simulation" << endl;
2956 else if (strDate.find(
"day") != string::npos)
2963 cerr <<
"Error in number of days '" + strDate +
"' for sediment input event" << endl;
2967 double const dHours = stod(
strTrim(&VstrTmp[0])) * 24;
2971 cerr <<
"Sediment input event '" + strDate +
"' occurs after end of simulation" << endl;
2983 if (VstrTmp.size() < 2)
2985 cerr <<
"Error in time/date '" + strDate +
"' of sediment input event" << endl;
2994 if (!
bParseTime(&VstrTmp[0], nHour, nMin, nSec))
2996 cerr <<
"Error in time '" + VstrTmp[0] +
"' of sediment input event" << endl;
3005 if (!
bParseDate(&VstrTmp[1], nDay, nMonth, nYear))
3007 cerr <<
"Error in date '" + VstrTmp[1] +
"' of sediment input event" << endl;
3012 struct tm tmSimStart = {};
3020 struct tm tmSimEvent = {};
3021 tmSimEvent.tm_sec = nSec;
3022 tmSimEvent.tm_min = nMin;
3023 tmSimEvent.tm_hour = nHour;
3024 tmSimEvent.tm_mday = nDay;
3025 tmSimEvent.tm_mon = nMonth - 1;
3026 tmSimEvent.tm_year = nYear - 1900;
3028 time_t
const tStart = mktime(&tmSimStart);
3029 time_t
const tEvent = mktime(&tmSimEvent);
3031 if (tStart == (time_t)(-1))
3033 cerr <<
"Error in simulation start time/date" << endl;
3037 if (tEvent == (time_t)(-1))
3039 cerr <<
"Error in time/date '" + strDate +
"' of sediment input event" << endl;
3043 double const dHours = difftime(tEvent, tStart) / (60 * 60);
3047 cerr <<
"Sediment input event '" + strDate +
"' occurs before start of simulation" << endl;
3053 cerr <<
"Sediment input event '" + strDate +
"' occurs after end of simulation" << endl;
3057 ulTimeStep =
static_cast<unsigned long>(dHours /
m_dTimeStep);
3068 int const nCat =
m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFCategory();
3097 int const nNumTideValues =
static_cast<int>(
m_VdTideData.size());
3100 int nThisCount = nTideDataCount;
3101 double dTotMaxTide = 0;
3102 for (
int n = 0; n < nTideValuesToRead; n++)
3105 double dDayMaxTide = -DBL_MAX;
3106 for (
int m = 0; m < nTidevaluesPerDay; m++)
3109 if (nThisCount > nNumTideValues - 1)
3114 if (dThisTideData > dDayMaxTide)
3115 dDayMaxTide = dThisTideData;
3121 dTotMaxTide += dDayMaxTide;
3125 double const dMaxTideAvg = dTotMaxTide / nTideValuesToRead;
Contains CGeom2DIPoint definitions.
Geometry class used to represent 2D point objects with integer coordinates.
int nGetY(void) const
Returns the CGeom2DIPoint object's integer Y coordinate.
int nGetX(void) const
Returns the CGeom2DIPoint object's integer X coordinate.
void CalcDepthOfClosure(void)
Calculate the depth of closure.
int m_nLogFileDetail
The level of detail in the log file output. Can be LOG_FILE_LOW_DETAIL, LOG_FILE_MIDDLE_DETAIL,...
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
vector< string > m_VstrInitialSandConsSedimentFile
The name of the initial sand-sized consolidated sediment GIS file.
double m_dAllCellsDeepWaterWaveHeight
Deep water wave height (m) for all sea cells.
static void AnnounceReadSCAPEShapeFunctionFile(void)
Now reading the SCAPE shape function file.
string m_strInitialSuspSedimentFile
Name of initial suspended sediment file.
bool m_bSlopeConsSedSave
Save slope of consolidated sediment raster GIS files?
static void AnnounceIsRunning(void)
Tell the user that the simulation is now running.
void DoCPUClockReset(void)
Resets the CPU clock timer to prevent it 'rolling over', as can happen during long runs....
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
string m_strSedimentInputEventFile
The name of the sediment input events time series file.
time_t m_tSysEndTime
System finish-simulation time.
string m_strCMEIni
Folder for the CME .ini file.
double m_dG
Gravitational acceleration (m**2/sec)
vector< string > m_VstrInitialCoarseUnconsSedimentFile
The name of the initial coarse-sized unconsolidated sediment GIS file.
void AnnounceReadDeepWaterWaveValuesGIS(void) const
Tells the user that we are now reading the deep water wave values GIS file.
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
ofstream CliffCollapseNetChangeTSStream
Cliff collapse net change (erosion - deposition) time series file output stream.
bool m_bCoastSave
Save coastline as vector GIS file?
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
static string strRemoveSubstr(string *, string const *)
Returns a string with a substring removed, and with whitespace trimmed.
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
static bool bParseTime(string const *, int &, int &, int &)
Parses a time string into hours, minutes, and seconds, and checks each of them.
double dGetThisIterTotWaterLevel(void) const
Returns this timestep's total water level TODO 007 Finish surge and runup stuff.
void AnnounceReadInitialSandConsSedGIS(int const) const
Tells the user that we are now reading the initial sand consolidated sediment depth GIS file.
int m_nXGridSize
The size of the grid in the x direction.
string strListRasterFiles(void) const
Return a space-separated string containing the names of the raster GIS output files.
void AnnounceReadInitialSandUnconsSedGIS(int const) const
Tells the user that we are now reading the initial sand unconsolidated sediment depth GIS file.
string strListVectorFiles(void) const
Return a space-separated string containing the names of the vector GIS output files.
double m_dMaxUserInputWavePeriod
Used to constrain depth of closure.
bool m_bFloodSetupSurgeRunupTSSave
Save the flood setup surge runup time series file? TODO 007 Finish surge and runup stuff.
bool m_bTopSurfIncSeaSave
Save top surface (sediment, talus, and sea) raster DEMs?
bool bSetUpTSFiles(void)
This member function intialises the time series files.
void AnnounceReadInitialFineUnconsSedGIS(int const) const
Tells the user that we are now reading the initial fine unconsolidated sediment depth GIS file.
bool m_bSedIncTalusTopSurfSave
Save sediment (inc talus) top surface raster DEMs?
vector< CRWCoast > m_VFloodWaveSetupSurgeRunup
TODO 007 Finish surge and runup stuff.
vector< CRWCoast > m_VCoast
The coastline objects.
static string pstrChangeToForwardSlash(string const *)
Swaps all backslashes in the input string to forward slashes, leaving the original unchanged.
bool m_bSaveGISThisIter
Save GIS files this iteration?
void DoSimulationEnd(int const)
Carries out end-of-simulation tidying (error messages etc.)
double m_dCPUClock
Total elapsed CPU time.
bool bSaveAllVectorGISFiles(void)
The bSaveAllvectorGISFiles member function saves the vector GIS files TODO 081 Choose more files to o...
bool m_bSingleDeepWaterWaveValues
Do we have just a point source for (i.e. only a single measurement of) deep water wave values.
string m_strRunName
The name of this simulation.
static string strGetComputerName(void)
Returns a string, hopefully giving the name of the computer on which the simulation is running.
static string strDispSimTime(double const)
strDispSimTime returns a string formatted as year Julian_day hour, given a parameter in hours
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
int nDoSimulationTimeMultiplier(string const *)
Given a string containing time units, this sets up the appropriate multiplier and display units for t...
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
int m_nYGridSize
The size of the grid in the y direction.
vector< double > m_VdTideData
Tide data: one record per timestep, is the change (m) from still water level for that timestep.
bool m_bYamlInputFormat
Use YAML format for input datafile instead of .dat format?
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
static string strTrimLeft(string const *)
Trims whitespace from the left side of a string, does not change the original string.
vector< string > m_VstrInitialFineConsSedimentFile
The name of the initial fine-sized consolidated sediment GIS file.
double m_dMissingValue
Used by CoastalME for floating-point missing values.
bool m_bBasementElevSave
Save basement raster DEMs?
int m_nSimStartHour
Start time of the simulation (hours)
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
bool m_bSuspSedTSSave
Save the suspended sediment time series file?
bool m_bCliffCollapseNetTSSave
Save the cliff collapse net change time series file?
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
static void AnnounceSimEnd(void)
Announce the end of the simulation.
int nGetGridYMax(void) const
Returns the size of the grid in the Y direction.
void AnnounceReadICGIS(void) const
Tells the user that we are now reading the Intervention class GIS file.
bool m_bWaveHeightSave
Save wave height raster GIS files?
bool m_bLandformSave
Save coast landform raster GIS files?
ofstream CliffCollapseDepositionTSStream
Cliff collapse deposition time series file output stream.
vector< CRWCoast > m_VFloodWaveSetupSurge
TODO 007 Finish surge and runup stuff.
static string strTrim(string const *)
Trims whitespace from both sides of a string, does not change the original string.
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
double dGetMissingValue(void) const
Returns the NODATA value.
static void AnnounceFinalInitialization(void)
Tells the user that we are now initializing.
int m_nSimStartSec
Start time of the simulation (seconds)
int m_nSimStartDay
Start date of the simulation (day)
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
unsigned long ulConvertToTimestep(string const *) const
For sediment input events, parses a string that may be relative (a number of hours or days after the ...
double dGetD50Coarse(void) const
Returns the global d50 value for coarse sediment.
static void AnnounceAddLayers(void)
Tells the user that we are now adding layers.
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
double m_dThisIterNewNotchApexElev
Elevation (m) of the apex of any cliff notches created during this iteration.
bool bFindExeDir(char const *)
Finds the folder (directory) in which the CoastalME executable is located.
static double dSubtractProfiles(vector< double > const *, vector< double > const *, vector< bool > const *)
Calculate the total elevation difference between every point in two elevation profiles (first profile...
bool m_bNormalsSave
Save coastline-normal vector GIS files?
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
static string strToLower(string const *)
Returns the lower case version of an string, leaving the original unchanged.
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
bool m_bSeaDepthSave
Save sea depth raster GIS files?
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
ofstream BeachDepositionTSStream
Beach sediment deposition time series file output stream.
string m_strInitialBasementDEMFile
Name of initial basement DEM file.
static string strTrimRight(string const *)
Trims whitespace from the right side of a string, does not change the original string.
void AnnounceReadSedimentEventInputValuesGIS(void) const
Tells the user that we are now reading the sediment input events GIS file.
double dGetD50Fine(void) const
Returns the global d50 value for fine sediment.
string m_strLogFile
Name of output log file.
time_t m_tSysStartTime
System start-simulation time.
void AnnounceReadFloodLocationGIS(void) const
Tells the user that we are now reading the flood location GIS file.
void StartClock(void)
Starts the clock ticking.
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
bool m_bActiveZoneSave
Save active zone raster GIS files?
void AnnounceReadInitialSuspSedGIS(void) const
Tells the user that we are now reading the initial suspended sediment depth GIS file.
void DoEndOfRunDeletes(void)
Do end-of-run memory clearance.
vector< string > m_VstrInitialSandUnconsSedimentFile
The name of the initial sand-sized unconsolidated sediment GIS file.
static int nDoTimeUnits(string const *)
This finds time units in a string.
static void AnnounceReadRasterFiles(void)
Now reading raster GIS files.
double m_dD50Sand
The D50 for sand sediment.
string m_strCMEDir
The CME folder.
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
ofstream BeachSedimentNetChangeTSStream
Beach sediment net change (erosion - deposition) time series file output stream.
double m_dSimElapsed
Time simulated so far, in hours.
static double dGetTimeMultiplier(string const *)
Given a string containing time units, this returns the appropriate multiplier.
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
int nGetGridXMax(void) const
Returns the cell size.
void AnnounceReadBasementDEM(void) const
Tells the user that we are now reading the DEM file.
bool m_bSWLTSSave
Save the SWL (still water level) time series file?
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
string m_strMailAddress
An email addresx to which to send end-of-simulation messages.
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
string strListTSFiles(void) const
Return a space-separated string containing the names of the time series output files.
bool m_bFloodSetupSurgeTSSave
Save the flood setup surge time series file? TODO 007 Finish surge and runup stuff.
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
double m_dD50Coarse
The D50 for coarse sediment.
static void AnnounceStart(void)
Tells the user that we have started the simulation.
ofstream SWLTSStream
SWL time series file output stream.
ofstream CliffCollapseErosionTSStream
Cliff collapse erosion time series file output stream.
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
static bool bParseDate(string const *, int &, int &, int &)
Parses a date string into days, months, and years, and checks each of them.
string m_strFloodLocationShapefile
The name of the flood loction events shape file.
int m_nSimStartMonth
Start date of the simulation (month)
bool m_bSuspSedSave
Save suspended sediment raster GIS files?
string m_strDurationUnits
The duration units for this simulation.
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
vector< string > m_VstrInitialFineUnconsSedimentFile
The name of the initial fine-sized unconsolidated sediment GIS file.
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
double m_dNotchApexAboveMHW
Distance of notch base below SWL (m)
int m_nSimStartMin
Start time of the simulation (minutes)
bool bSaveAllRasterGISFiles(void)
The bSaveAllRasterGISFiles member function saves the raster GIS files using values from the RasterGri...
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
string m_strOutPath
Path for all output files.
bool m_bBeachErosionTSSave
Save the beach (unconsolidated sediment) erosion time series file?
static string strGetBuild(void)
Returns the date and time on which the program was compiled.
string m_strTideDataFile
Name of tide data file.
bool m_bTotalPotentialBeachErosionSave
Save total potential beach (unconsolidated sediment) erosion raster GIS files?
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
string m_strInterventionClassFile
Name of intervention class file.
bool m_bSeaMaskSave
Save sea mask raster GIS files?
bool m_bInterventionClassSave
Save intervention class raster GIS files?
int m_nSimStartYear
Start date of the simulation (year)
bool m_bTotalActualBeachErosionSave
Save total actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
string m_strDeepWaterWavesInputFile
The name of the deep water wave stations time series file.
static string pstrChangeToBackslash(string const *)
Changes all forward slashes in the input string to backslashes, leaving the original unchanged.
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
ofstream SeaAreaTSStream
Sea area time series file output stream.
void AnnounceReadIHGIS(void) const
Tells the user that we are now reading the Intervention height GIS file.
void AnnounceReadInitialCoarseConsSedGIS(int const) const
Tells the user that we are now reading the initial coarse consolidated sediment depth GIS file.
static string strGetErrorText(int const)
Returns an error message given an error code.
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
bool m_bSedimentInputEventSave
Save sediment inut data?
double m_dThisIterMHWElev
This iteration's Mean High Water (MHW) elevation, calculated using a moving time window....
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
double m_dTimeStep
The length of an iteration (a timestep) in hours.
static void AnnounceAllocateMemory(void)
Tells the user that we are now allocating memory.
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
double dGetD50Sand(void) const
Returns the global d50 value for sand sediment.
void CalcMHWElevation(int const)
Calculate Mean High Water (MHW) elevation for a given duration (in days). This is a tidal datum deter...
ofstream PlatformErosionTSStream
Shore platform erosion time series file output stream.
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
void AnnounceReadInitialFineConsSedGIS(int const) const
Tells the user that we are now reading the initial fine consolidated sediment depth GIS file.
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
ofstream CliffNotchElevTSStream
Cliff notch elevation time series file output stream.
static string strDispTime(double const, bool const, bool const)
strDispTime returns a string formatted as h:mm:ss, given a parameter in seconds, with rounding and fr...
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
bool m_bCliffNotchElevTSSave
Save the cliff notch elevation time series file?
string m_strInitialLandformFile
Name of initial landform file.
string m_strInterventionHeightFile
Name of intervention height file.
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
bool m_bSeaAreaTSSave
Save the sea area time series file?
double dGetThisIterSWL(void) const
Returns this timestep's SWL.
void CalcProcessStats(void)
This calculates and displays process statistics.
double m_dD50Fine
The D50 for fine sediment.
bool m_bBeachMaskSave
Save beach mask raster GIS files?
bool bOpenLogFile(void)
Opens the log file.
static void AppendEnsureNoGap(vector< CGeom2DIPoint > *, CGeom2DIPoint const *)
Appends a CGeom2DIPoint to a vector<CGeom2DIPoint>, making sure that the new end point touches the pr...
unsigned long m_ulIter
The number of the current iteration (time step)
void AnnounceLicence(void)
Tells the user about the licence.
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
vector< string > m_VstrInitialCoarseConsSedimentFile
The name of the initial coarse-sized consolidated sediment GIS file.
double m_dSimDuration
Duration of simulation, in hours.
bool m_bTalusSave
Save talus depth?
ofstream FloodSetupSurgeTSStream
Flood setup surge time series file output stream.
bool bTimeToQuit(void)
Checks to see if the simulation has gone on too long, amongst other things.
bool bIsInterventionCell(int const, int const) const
Returns true if the cell is an intervention.
void AnnounceProgress(void)
Displays information regarding the progress of the simulation.
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
void AnnounceReadLGIS(void) const
Tells the user that we are now reading the Landscape category GIS file.
static void AnnounceReadVectorFiles(void)
Now reading vector GIS files.
double m_dDepthOfClosure
Depth of closure (in m) TODO 007 can be calculated using Hallermeier, R.J. (1978) or Birkemeier (1985...
static void CalcDeanProfile(vector< double > *, double const, double const, double const, bool const, int const, double const)
Calculates a Dean equilibrium profile h(y) = A * y^(2/3) where h(y) is the distance below the highest...
double m_dThisIterDiffTotWaterLevel
TODO 007 Finish surge and runup stuff.
ofstream FineSedSuspensionTSStream
Fine sediment in suspension time series file output stream.
ofstream FloodSetupSurgeRunupTSStream
Flood setup surge runup time series file output stream.
void AnnounceReadTideData(void) const
Now reading tide data file.
double m_dClkLast
Last value returned by clock()
double m_dThisIterMeanSWL
The mean still water level for this timestep (does not include tidal changes, but includes any long-t...
bool m_bCliffCollapseErosionTSSave
Save the cliff collapse erosion time series file?
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
ofstream BeachErosionTSStream
Beach sediment erosion time series file output stream.
void AnnounceReadInitialCoarseUnconsSedGIS(int const) const
Tells the user that we are now reading the initial coarse unconsolidated sediment depth GIS file.
int nHandleCommandLineParams(int, char const *[])
Handles command-line parameters.
ofstream OutStream
The main output file stream.
double m_dDurationUnitsMult
Multiplier for duration units, to convert to hours.
unsigned long m_ulTotTimestep
The target number of iterations.
static vector< string > * VstrSplit(string const *, char const, vector< string > *)
From http://stackoverflow.com/questions/236129/split-a-string-in-c They implement (approximately) Pyt...
bool m_bSedimentInputThisIter
Do we have a sediment input event this iteration?
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
bool m_bWaveAngleSave
Save wave angle raster GIS files?
This file contains global definitions for CoastalME.
string const TIME_SERIES_CLIFF_COLLAPSE_DEPOSITION_CODE
string const READING_UNCONS_SAND_SEDIMENT_FILE
string const TIME_SERIES_SUSPENDED_SEDIMENT_CODE
string const RASTER_POTENTIAL_PLATFORM_EROSION_MASK_CODE
int const RTN_ERR_READING_SEDIMENT_INPUT_EVENT
int const RTN_ERR_POINT_NOT_FOUND_IN_MULTILINE_DIFFERENT_COASTS
string const TIME_SERIES_PLATFORM_EROSION_CODE
int const RTN_ERR_NO_TOP_LAYER
string const RASTER_COARSE_CONS_CODE
string const VECTOR_POLYGON_NODE_CODE
int const LF_INTERVENTION_STRUCT
string const TIME_SERIES_FLOOD_SETUP_SURGE_RUNUP_CODE
string const READING_VECTOR_FILES
string const READING_CONS_FINE_SEDIMENT_FILE
int const RTN_ERR_DEMFILE
string const READING_BASEMENT
string const RASTER_ACTIVE_ZONE_CODE
int const RTN_ERR_COAST_CANT_FIND_EDGE_CELL
int const RTN_ERR_CSHORE_FILE_INPUT
string const RASTER_SAND_CONS_CODE
string const TIME_SERIES_FLOOD_SETUP_SURGE_CODE
int const RTN_ERR_MEMALLOC
string const TIME_SERIES_CLIFF_NOTCH_ELEV_CODE
int const RTN_ERR_SCAPE_SHAPE_FUNCTION_FILE
int const RTN_ERR_WAVESTATION_LOCATION
int const RTN_ERR_LOGFILE
string const RASTER_COAST_NORMAL_CODE
string const RASTER_AVG_SUSP_SED_CODE
string const TIME_SERIES_CLIFF_NOTCH_ELEV_NAME
string const RASTER_COAST_CODE
int const RTN_ERR_NO_COAST
int const RTN_ERR_SHADOW_ZONE_FLOOD_START_POINT
string const RASTER_SEDIMENT_INPUT_EVENT_CODE
string const VECTOR_WAVE_ENERGY_SINCE_COLLAPSE_CODE
string const RASTER_WAVE_ORIENTATION_CODE
int const RTN_ERR_EDGE_OF_GRID
string const READING_CONS_SAND_SEDIMENT_FILE
int const RTN_ERR_GRIDCREATE
int const RTN_ERR_PROFILE_WRITE
int const RTN_ERR_RASTER_GIS_OUT_FORMAT
string const TIME_SERIES_BEACH_EROSION_NAME
int const RTN_ERR_LANDFORM_TO_GRID
int const RTN_ERR_RASTER_FILE_WRITE
int const LF_INTERVENTION_NON_STRUCT
string const INITIALIZING_NOTICE
string const RASTER_COARSE_UNCONS_CODE
int const RTN_ERR_BADPARAM
string const READING_RASTER_FILES
char const PATH_SEPARATOR
int const RTN_ERR_SHADOW_ZONE_FLOOD_FILL_NOGRID
string const VECTOR_INVALID_NORMALS_CODE
int const RTN_ERR_TOO_LONG_TRACING_COAST
string const VECTOR_CLIFF_NOTCH_ACTIVE_CODE
string const RASTER_BASEMENT_ELEVATION_CODE
string const RASTER_WAVE_HEIGHT_CODE
string const RASTER_INTERVENTION_CLASS_CODE
string const TIME_SERIES_SWL_NAME
int const RTN_ERR_IGNORING_COAST
string const RASTER_POTENTIAL_PLATFORM_EROSION_CODE
int const RTN_ERR_WAVE_INTERPOLATION_LOOKUP
string const RASTER_POTENTIAL_BEACH_EROSION_CODE
string const READING_CONS_COARSE_SEDIMENT_FILE
int const RTN_ERR_CELL_NOT_FOUND_IN_HIT_PROFILE
string const READING_TIDE_DATA_FILE
int const RTN_ERR_RASTER_FILE_READ
string const VECTOR_MEAN_WAVE_ENERGY_CODE
int const RTN_ERR_CELL_IN_POLY_BUT_NO_POLY_COAST
string const READING_SCAPE_SHAPE_FUNCTION_FILE
int const RTN_ERR_CSHORE_ERROR
string const TIME_SERIES_BEACH_DEPOSITION_NAME
string const READING_INTERVENTION_CLASS_FILE
string const READING_UNCONS_COARSE_SEDIMENT_FILE
string const READING_DEEP_WATER_WAVE_FILE
int const RTN_ERR_BOUNDING_BOX
int const RTN_ERR_NO_SEAWARD_END_OF_PROFILE_DOWNCOAST_BEACH_DEPOSITION
string const TIME_SERIES_CLIFF_COLLAPSE_NET_CODE
int const RTN_ERR_OPEN_DEEP_WATER_WAVE_DATA
int const RTN_ERR_RUNDATA
int const RTN_ERR_SEDIMENT_INPUT_EVENT_LOCATION
string const RASTER_TOTAL_ACTUAL_BEACH_EROSION_CODE
string const VECTOR_NORMALS_CODE
int const CLOCK_CHECK_ITERATION
string const RASTER_BEACH_DEPOSITION_CODE
string const FINAL_OUTPUT
string const RASTER_TOTAL_BEACH_DEPOSITION_CODE
int const RTN_ERR_GRID_TO_LINE
int const NUM_DAYS_FOR_MEAN_HIGH_WATER_CALC
string const TIME_SERIES_BEACH_CHANGE_NET_NAME
int const RTN_ERR_NO_ADJACENT_POLYGON
string const VECTOR_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT_CODE
int const RTN_ERR_PROFILE_SPACING
string const READING_LANDFORM_FILE
int const RTN_ERR_READING_CSHORE_FILE_OUTPUT
string const RASTER_BEACH_PROTECTION_CODE
string const RASTER_TOTAL_POTENTIAL_PLATFORM_EROSION_CODE
string const VECTOR_SHADOW_ZONE_BOUNDARY_CODE
int const RTN_ERR_CLIFF_NOT_IN_POLYGON
string const TIME_SERIES_CLIFF_COLLAPSE_EROSION_CODE
string const PROGRAM_NAME
int const RTN_ERR_VECTOR_FILE_READ
string const RASTER_BEACH_MASK_CODE
int const RTN_ERR_NOSEACELLS
int const RTN_ERR_VECTOR_GIS_OUT_FORMAT
string const RASTER_AVG_WAVE_HEIGHT_CODE
string const READING_INTERVENTION_HEIGHT_FILE
string const TIME_SERIES_BEACH_EROSION_CODE
int const RTN_ERR_NO_START_FINISH_POINTS_TRACING_COAST
int const RTN_ERR_TRACING_FLOOD
string const RASTER_TOTAL_POTENTIAL_BEACH_EROSION_CODE
string const RASTER_AVG_SEA_DEPTH_CODE
int const RTN_ERR_NO_PROFILES_2
int const RTN_ERR_PROFILE_ENDPOINT_IS_INLAND
string const RASTER_SAND_UNCONS_CODE
string const RUN_END_NOTICE
string const TIME_SERIES_SWL_CODE
string const TIME_SERIES_PLATFORM_EROSION_NAME
int const RTN_ERR_BAD_MULTILINE
string const READING_SED_INPUT_EVENT_FILE
int const RTN_ERR_COAST_TOO_SMALL
int const RTN_ERR_TEXT_FILE_WRITE
string const RASTER_LANDFORM_CODE
int const RTN_ERR_VECTOR_FILE_WRITE
string const TIME_SERIES_CLIFF_COLLAPSE_NET_NAME
string const RASTER_TOTAL_ACTUAL_PLATFORM_EROSION_CODE
int const RTN_ERR_READING_DEEP_WATER_WAVE_DATA
string const RASTER_ACTUAL_PLATFORM_EROSION_CODE
string const VECTOR_BREAKING_WAVE_HEIGHT_CODE
int const RTN_ERR_CELL_MARKED_PROFILE_COAST_BUT_NOT_PROFILE
string const TIME_SERIES_CLIFF_COLLAPSE_EROSION_NAME
int const RTN_ERR_NO_PROFILES_1
unsigned long const SEDIMENT_INPUT_EVENT_ERROR
int const RTN_ERR_TIDEDATAFILE
string const RASTER_SLOPE_OF_CONSOLIDATED_SEDIMENT_CODE
string const RASTER_SUSP_SED_CODE
int const RTN_ERR_CANNOT_INSERT_POINT
int const RTN_ERR_NO_VALID_COAST
string const VECTOR_COAST_CURVATURE_CODE
int const RTN_ERR_CLIFF_NOTCH
string const TIME_SERIES_SEA_AREA_NAME
int const RTN_ERR_UNKNOWN
int const RTN_ERR_ZERO_LENGTH_COAST
string const INITIALIZING_FINAL
string const READING_SUSPENDED_SEDIMENT_FILE
int const RTN_ERR_CANNOT_ASSIGN_COASTAL_LANDFORM
string const READING_FLOOD_LOCATION
int const RTN_ERR_REPEATING_WHEN_TRACING_COAST
string const RASTER_SEA_DEPTH_CODE
int const RTN_ERR_OUTFILE
string const ALLOCATE_MEMORY
string const TIME_SERIES_SUSPENDED_SEDIMENT_NAME
int const RTN_ERR_NO_SOLUTION_FOR_ENDPOINT
string const TIME_SERIES_CLIFF_COLLAPSE_DEPOSITION_NAME
string const RASTER_FINE_CONS_CODE
string const VECTOR_POLYGON_BOUNDARY_CODE
string const RASTER_FINE_UNCONS_CODE
string const VECTOR_DOWNDRIFT_ZONE_BOUNDARY_CODE
string const RASTER_SEDIMENT_TOP_CODE
int const RTN_ERR_TIME_UNITS
int const RTN_ERR_CELL_NOT_FOUND_IN_HIT_PROFILE_DIFFERENT_COASTS
string const VECTOR_WAVE_ANGLE_AND_HEIGHT_CODE
int const RTN_ERR_CLIFF_TALUS_TO_UNCONS
string const RASTER_TOP_ELEVATION_INC_SEA_CODE
int const RTN_ERR_SEDIMENT_INPUT_EVENT
int const RTN_ERR_CSHORE_EMPTY_PROFILE
string const VECTOR_AVG_WAVE_ANGLE_AND_HEIGHT_CODE
string const TIME_SERIES_BEACH_CHANGE_NET_CODE
string const RASTER_INTERVENTION_HEIGHT_CODE
string const TIME_SERIES_BEACH_DEPOSITION_CODE
int const RTN_ERR_NO_SEAWARD_END_OF_PROFILE_BEACH_EROSION
string const READING_UNCONS_FINE_SEDIMENT_FILE
string const START_NOTICE
string const RASTER_POLYGON_CODE
string const RASTER_ACTUAL_BEACH_EROSION_CODE
string const RASTER_INUNDATION_MASK_CODE
string const VECTOR_COAST_CODE
string const TIME_SERIES_SEA_AREA_CODE
int const RTN_ERR_NO_SEAWARD_END_OF_PROFILE_UPCOAST_BEACH_DEPOSITION
int const RTN_ERR_LINETOGRID
string const RASTER_TALUS_CODE
string const GDAL_DRIVERS
string const ERROR_NOTICE
int const RTN_ERR_CLIFF_CANNOT_DEPOSIT_ALL
int const RTN_ERR_NO_CELL_UNDER_COASTLINE
int const RTN_ERR_TIMESERIES_FILE_WRITE
Contains CRWCoast definitions.
Contains CSimulation definitions.
double dRound(double const d)
Correctly rounds doubles.
bool bIsStringValidInt(string &str)
Checks to see if a string can be read as a valid integer, from https://stackoverflow....
int nRound(double const d)
Correctly rounds doubles, returns an int.