31#include <sys/resource.h>
69using std::resetiosflags;
70using std::setprecision;
77using std::stringstream;
94 if ((!isatty(fileno(stdout))) || (!isatty(fileno(stderr))))
99 for (
int i = 1; i < nArg; i++)
101 string strArg = pcArgv[i];
109 if (strArg.find(
"--gdal") != string::npos)
115 for (
int j = 0; j < GDALGetDriverCount(); j++)
117 GDALDriverH hDriver = GDALGetDriver(j);
119 string strTmp(GDALGetDriverShortName(hDriver));
121 strTmp.append(GDALGetDriverLongName(hDriver));
123 cout << strTmp << endl;
131 if (strArg.find(
"--about") != string::npos)
134 cout <<
ABOUT << endl;
142 if (strArg.find(
"--home") != string::npos)
148 size_t const pos = strArg.find(
'=');
151 if (pos != string::npos)
160 cout <<
"No '=' found in the input string" << endl;
170 cout <<
USAGE << endl;
201 if (
static_cast<clock_t
>(-1) == clock())
229 if (0 != GetModuleFileName(NULL, szBuf,
BUF_SIZE))
239 if (-1 != readlink(
"/proc/self/exe", szBuf,
BUF_SIZE))
253 int const nPos =
static_cast<int>(strTmp.find_last_of(
PATH_SEPARATOR));
265 cout <<
LINE << endl;
303 return 24 * 30.416667;
358 if (strIn->find(
"hour") != string::npos)
361 else if (strIn->find(
"day") != string::npos)
364 else if (strIn->find(
"month") != string::npos)
367 else if (strIn->find(
"year") != string::npos)
381 LogStream.open(
"/dev/null", ios::out | ios::trunc);
382 cout <<
"Warning: log file is not writting" << endl;
391 cerr <<
ERR <<
"cannot open " <<
m_strLogFile <<
" for output" << endl;
910 if (strTmp.size() > 2)
911 strTmp.resize(strTmp.size() - 2);
1004 strTmp.append(
", ");
1010 strTmp.append(
", ");
1014 if (strTmp.size() > 2)
1015 strTmp.resize(strTmp.size() - 2);
1030 strTmp.append(
", ");
1036 strTmp.append(
", ");
1042 strTmp.append(
", ");
1048 strTmp.append(
", ");
1054 strTmp.append(
", ");
1060 strTmp.append(
", ");
1066 strTmp.append(
", ");
1072 strTmp.append(
", ");
1078 strTmp.append(
", ");
1084 strTmp.append(
", ");
1090 strTmp.append(
", ");
1096 strTmp.append(
", ");
1100 if (strTmp.size() > 2)
1101 strTmp.resize(strTmp.size() - 2);
1118 strTSFile.append(
CSVEXT);
1126 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1136 strTSFile.append(
CSVEXT);
1144 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1154 strTSFile.append(
CSVEXT);
1162 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1172 strTSFile.append(
CSVEXT);
1180 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1190 strTSFile.append(
CSVEXT);
1198 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1208 strTSFile.append(
CSVEXT);
1216 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1226 strTSFile.append(
CSVEXT);
1234 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1244 strTSFile.append(
CSVEXT);
1252 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1262 strTSFile.append(
CSVEXT);
1270 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1280 strTSFile.append(
CSVEXT);
1288 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1298 strTSFile.append(
CSVEXT);
1306 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1316 strTSFile.append(
CSVEXT);
1324 cerr <<
ERR <<
"cannot open " << strTSFile <<
" for output" << endl;
1365 string strComputerName;
1369 strComputerName = getenv(
"COMPUTERNAME");
1375 strComputerName = szHostName;
1377 if (strComputerName.empty())
1378 strComputerName =
"Unknown Computer";
1382 return strComputerName;
1390 if (
static_cast<clock_t
>(-1) == clock())
1393 LogStream <<
"CPU time not available" << endl;
1399 double dClkThis =
static_cast<double>(clock());
1400 dClkThis -= CLOCK_T_MIN;
1412 <<
" before rollover=" << (CLOCK_T_RANGE + 1 -
m_dClkLast) << endl
1414 <<
" after rollover=" << dClkThis << endl
1416 <<
" ADDED=" << (CLOCK_T_RANGE + 1 -
m_dClkLast + dClkThis) << endl;
1455 double const dDuration =
m_dCPUClock / CLOCKS_PER_SEC;
1462 double const dPerTimestep = dDuration /
static_cast<double>(
m_ulTotTimestep);
1465 OutStream << fixed << setprecision(4) <<
" (" << dPerTimestep <<
" per timestep)" << endl;
1466 LogStream << fixed << setprecision(4) <<
" (" << dPerTimestep <<
" per timestep)" << endl;
1469 OutStream << resetiosflags(ios::floatfield);
1470 OutStream << fixed << setprecision(0) <<
"In terms of CPU time, this is ";
1471 LogStream << resetiosflags(ios::floatfield);
1472 LogStream << fixed << setprecision(0) <<
"In terms of CPU time, this is ";
1474 if (dDuration > dRunLength)
1476 OutStream << dDuration / dRunLength <<
" x slower than reality" << endl;
1477 LogStream << dDuration / dRunLength <<
" x slower than reality" << endl;
1482 OutStream << dRunLength / dDuration <<
" x faster than reality" << endl;
1483 LogStream << dRunLength / dDuration <<
" x faster than reality" << endl;
1495 double const dPerTimestep = dDuration /
static_cast<double>(
m_ulTotTimestep);
1498 OutStream << resetiosflags(ios::floatfield);
1499 OutStream <<
" (" << fixed << setprecision(4) << dPerTimestep <<
" per timestep)" << endl;
1500 LogStream << resetiosflags(ios::floatfield);
1501 LogStream <<
" (" << fixed << setprecision(4) << dPerTimestep <<
" per timestep)" << endl;
1504 OutStream << fixed << setprecision(0) <<
"In terms of run time, this is ";
1505 LogStream << fixed << setprecision(0) <<
"In terms of run time, this is ";
1507 if (dDuration > dRunLength)
1509 OutStream << dDuration / dRunLength <<
" x slower than reality" << endl;
1510 LogStream << dDuration / dRunLength <<
" x slower than reality" << endl;
1515 OutStream << dRunLength / dDuration <<
" x faster than reality" << endl;
1516 LogStream << dRunLength / dDuration <<
" x faster than reality" << endl;
1526 double dTmpTime =
tMax(dTimeIn, 0.0);
1531 double const dHoursInYear = 24 * 365;
1532 double const dHoursInDay = 24;
1535 if (dTmpTime >= dHoursInYear)
1537 double const dYears = floor(dTmpTime / dHoursInYear);
1538 dTmpTime -= (dYears * dHoursInYear);
1540 strTime = to_string(
static_cast<int>(dYears));
1541 strTime.append(
"y ");
1548 if (dTmpTime >= dHoursInDay)
1550 double const dJDays = floor(dTmpTime / dHoursInDay);
1551 dTmpTime -= (dJDays * dHoursInDay);
1553 stringstream ststrTmp;
1554 ststrTmp << FillToWidth('0', 3) << static_cast<int>(dJDays);
1555 strTime.append(ststrTmp.str());
1556 strTime.append(
"d ");
1560 strTime.append(
"000d ");
1563 stringstream ststrTmp;
1564 ststrTmp << FillToWidth('0', 2) << static_cast<int>(dTmpTime);
1565 strTime.append(ststrTmp.str());
1566 strTime.append(
"h");
1577 double dTime =
tMax(dTimeIn, 0.0);
1584 unsigned long ulTimeIn =
static_cast<unsigned long>(floor(dTime));
1585 dTime -=
static_cast<double>(ulTimeIn);
1588 if (ulTimeIn >= 3600)
1591 unsigned long const ulHours = ulTimeIn / 3600ul;
1592 ulTimeIn -= (ulHours * 3600ul);
1594 strTime = to_string(ulHours);
1595 strTime.append(
":");
1605 unsigned long const ulMins = ulTimeIn / 60ul;
1606 ulTimeIn -= (ulMins * 60ul);
1608 stringstream ststrTmp;
1609 ststrTmp << FillToWidth(
'0', 2) << ulMins;
1610 strTime.append(ststrTmp.str());
1611 strTime.append(
":");
1615 strTime.append(
"00:");
1618 stringstream ststrTmp;
1619 ststrTmp << FillToWidth(
'0', 2) << ulTimeIn;
1620 strTime.append(ststrTmp.str());
1625 strTime.append(
".");
1627 ststrTmp.str(
string());
1628 ststrTmp << FillToWidth('0', 2) << static_cast<unsigned long>(dTime * 100);
1629 strTime.append(ststrTmp.str());
1640 string strBuild(
"(");
1641 strBuild.append(__TIME__);
1642 strBuild.append(
" ");
1643 strBuild.append(__DATE__);
1645 strBuild.append(
" DEBUG");
1647 strBuild.append(
" build)");
1657 if (isatty(fileno(stdout)))
1660 static double sdElapsed = 0;
1661 static double sdToGo = 0;
1662 time_t
const tNow = time(
nullptr);
1671 cout <<
"% (elapsed " <<
strDispTime(sdElapsed,
false,
false) <<
" remaining ";
1673 cout <<
strDispTime(sdToGo,
false,
false) <<
") ";
1677 cout << setw(9) <<
"GIS" + to_string(
m_nGISSave);
1680 cout << setw(9) <<
"SED INPUT";
1683 cout << setw(9) <<
SPACE;
1694 string const NA =
"Not available";
1697 OutStream <<
"Process statistics" << endl;
1698 OutStream <<
"------------------" << endl;
1702 OSVERSIONINFOEX osvi;
1703 BOOL bOsVersionInfoEx;
1705 ZeroMemory(&osvi,
sizeof(OSVERSIONINFOEX));
1706 osvi.dwOSVersionInfoSize =
sizeof(OSVERSIONINFOEX);
1708 if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*)&osvi)))
1711 osvi.dwOSVersionInfoSize =
sizeof(OSVERSIONINFO);
1713 if (!GetVersionEx((OSVERSIONINFO*)&osvi))
1724 switch (osvi.dwPlatformId)
1726 case VER_PLATFORM_WIN32_NT:
1727 if (osvi.dwMajorVersion <= 4)
1730 else if (5 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1733 else if (5 == osvi.dwMajorVersion && 1 == osvi.dwMinorVersion)
1736 else if (6 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1739 else if (6 == osvi.dwMajorVersion && 1 == osvi.dwMinorVersion)
1742 else if (6 == osvi.dwMajorVersion && 2 == osvi.dwMinorVersion)
1745 else if (6 == osvi.dwMajorVersion && 3 == osvi.dwMinorVersion)
1748 else if (10 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1751 else if (11 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1755 OutStream <<
"unknown Windows version ";
1758 if (osvi.dwMajorVersion <= 4)
1759 OutStream <<
"version " << osvi.dwMajorVersion <<
"." << osvi.dwMinorVersion <<
" " << osvi.szCSDVersion <<
" (Build " << (osvi.dwBuildNumber & 0xFFFF) <<
")" << endl;
1762 OutStream << osvi.szCSDVersion <<
" (Build " << (osvi.dwBuildNumber & 0xFFFF) <<
")" << endl;
1766 case VER_PLATFORM_WIN32_WINDOWS:
1767 if (4 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
1771 if (
'C' == osvi.szCSDVersion[1] ||
'B' == osvi.szCSDVersion[1])
1777 else if (4 == osvi.dwMajorVersion && 10 == osvi.dwMinorVersion)
1781 if (
'A' == osvi.szCSDVersion[1])
1787 else if (4 == osvi.dwMajorVersion && 90 == osvi.dwMinorVersion)
1791 OutStream <<
"unknown 16-bit Windows version " << endl;
1795 case VER_PLATFORM_WIN32s:
1801 if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId)
1803 FILETIME ftCreate, ftExit, ftKernel, ftUser;
1805 if (GetProcessTimes(GetCurrentProcess(), &ftCreate, &ftExit, &ftKernel, &ftUser))
1808 ul.LowPart = ftUser.dwLowDateTime;
1809 ul.HighPart = ftUser.dwHighDateTime;
1810 OutStream <<
"Time spent executing user code \t: " <<
strDispTime(
static_cast<double>(ul.QuadPart) * 1e-7,
false) << endl;
1811 ul.LowPart = ftKernel.dwLowDateTime;
1812 ul.HighPart = ftKernel.dwHighDateTime;
1813 OutStream <<
"Time spent executing kernel code \t: " <<
strDispTime(
static_cast<double>(ul.QuadPart) * 1e-7,
false) << endl;
1818 OutStream <<
"Process timings \t: " << NA << endl;
1821 HINSTANCE hDLL = LoadLibrary(
"psapi.dll");
1826 typedef BOOL(__stdcall * DLLPROC)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD);
1830 ProcAdd = (DLLPROC)GetProcAddress(hDLL,
"GetProcessMemoryInfo");
1835 PROCESS_MEMORY_COUNTERS pmc;
1838 if ((ProcAdd)(GetCurrentProcess(), &pmc,
sizeof(pmc)))
1840 OutStream <<
"Peak working set size \t: " << pmc.PeakWorkingSetSize / (1024.0 * 1024.0) <<
" Mb" << endl;
1841 OutStream <<
"Current working set size \t: " << pmc.WorkingSetSize / (1024.0 * 1024.0) <<
" Mb" << endl;
1842 OutStream <<
"Peak paged pool usage \t: " << pmc.QuotaPeakPagedPoolUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1843 OutStream <<
"Current paged pool usage \t: " << pmc.QuotaPagedPoolUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1844 OutStream <<
"Peak non-paged pool usage \t: " << pmc.QuotaPeakNonPagedPoolUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1845 OutStream <<
"Current non-paged pool usage \t: " << pmc.QuotaNonPagedPoolUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1846 OutStream <<
"Peak pagefile usage \t: " << pmc.PeakPagefileUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1847 OutStream <<
"Current pagefile usage \t: " << pmc.PagefileUsage / (1024.0 * 1024.0) <<
" Mb" << endl;
1848 OutStream <<
"No. of page faults \t: " << pmc.PageFaultCount << endl;
1856#elif defined __GNUG__
1859 if (getrusage(RUSAGE_SELF, &ru) >= 0)
1861 OutStream <<
"Time spent executing user code \t: " <<
strDispTime(
static_cast<double>(ru.ru_utime.tv_sec),
false,
true) << endl;
1863 OutStream <<
"Time spent executing kernel code \t: " <<
strDispTime(
static_cast<double>(ru.ru_stime.tv_sec),
false,
true) << endl;
1869 OutStream <<
"No. of page faults not requiring physical I/O\t: " << ru.ru_minflt << endl;
1870 OutStream <<
"No. of page faults requiring physical I/O \t: " << ru.ru_majflt << endl;
1875 OutStream <<
"No. of voluntary context switches \t: " << ru.ru_nvcsw << endl;
1876 OutStream <<
"No. of involuntary context switches \t: " << ru.ru_nivcsw << endl;
1891 if (0 == omp_get_thread_num())
1893 OutStream <<
"Number of OpenMP threads \t: " << omp_get_num_threads() << endl;
1894 OutStream <<
"Number of OpenMP processors \t: " << omp_get_num_procs() << endl;
1896 LogStream <<
"Number of OpenMP threads \t: " << omp_get_num_threads() << endl;
1897 LogStream <<
"Number of OpenMP processors \t: " << omp_get_num_procs() << endl;
1903 struct tm* ptmRunTime = gmtime(&tRunTime);
1905 OutStream <<
"Time required for simulation \t: " << put_time(ptmRunTime,
"%T") << endl;
1906 LogStream <<
"Time required for simulation \t: " << put_time(ptmRunTime,
"%T") << endl;
1908 double const dSpeedUp =
m_dSimDuration * 3600 /
static_cast<double>(tRunTime);
1910 OutStream <<
"Time simulated / time required for simulation\t: " << dSpeedUp <<
" x faster than reality" << endl;
1913 LogStream <<
"Time simulated / time required for simulation\t: " << dSpeedUp <<
" x faster than reality" << endl;
1926 strErr =
"run ended by user";
1930 strErr =
"error in command-line parameter";
1934 strErr =
"error reading initialization file";
1938 strErr =
"error in directory name";
1942 strErr =
"error reading run details file";
1946 strErr =
"error reading SCAPE shape function file";
1950 strErr =
"error reading tide data file";
1954 strErr =
"error creating log file";
1958 strErr =
"error creating text output file";
1962 strErr =
"error creating time series file";
1966 strErr =
"error reading initial DEM file";
1970 strErr =
"error reading raster GIS file";
1974 strErr =
"error reading vector GIS file";
1978 strErr =
"error allocating memory";
1982 strErr =
"problem with raster GIS output format";
1986 strErr =
"problem with vector GIS output format";
1990 strErr =
"error writing text output file";
1994 strErr =
"error writing raster GIS output file";
1998 strErr =
"error writing vector GIS output file";
2002 strErr =
"error writing time series output file";
2006 strErr =
"error putting linear feature onto raster grid";
2010 strErr =
"no sea cells found";
2014 strErr =
"error when searching grid for linear feature";
2018 strErr =
"no coastlines found. Is the SWL correct?";
2022 strErr =
"error writing coastline-normal profiles";
2026 strErr =
"error in time units";
2030 strErr =
"no solution when finding end point for coastline-normal line";
2037 strErr =
"end point for coastline-normal line is not in the contiguous sea";
2041 strErr =
"cliff notch is above sediment top elevation";
2045 strErr =
"unable to deposit sediment from cliff collapse";
2049 strErr =
"coastline-normal profiles are too closely spaced";
2053 strErr =
"no coastline-normal profiles created, check the SWL";
2057 strErr =
"no coastline-normal profiles created during rasterization";
2061 strErr =
"hit grid edge when eroding beach";
2065 strErr =
"could not locate seaward end of profile when creating Dean profile for beach erosion";
2069 strErr =
"could not locate seaward end of profile when creating Dean profile for beach deposition (up-coast)";
2073 strErr =
"could not locate seaward end of profile when creating Dean profile for beach deposition (down-coast)";
2077 strErr =
"updating grid with landforms";
2081 strErr =
"no top layer of sediment";
2085 strErr =
"problem with polygon-to-polygon sediment routing sequence";
2089 strErr =
"inconsistent multiline";
2093 strErr =
"cannot insert point into multiline";
2097 strErr =
"cannot assign coastal landform";
2101 strErr =
"start point for cell-by-cell fill of wave shadow zone is outside grid";
2105 strErr =
"could not find start point for cell-by-cell fill of wave shadow zone";
2109 strErr =
"empty profile during during CShore wave propagation";
2113 strErr =
"creating file for CShore input";
2117 strErr =
"reading CShore output file";
2121 strErr =
"during wave interpolation lookup";
2125 strErr =
"while running GDALGridCreate()";
2129 strErr =
"cannot find edge cell while constructing grid-edge profile";
2133 strErr =
"CShore did not finish correctly";
2137 strErr =
"Could not find cell under coastline";
2141 strErr =
"opening deep sea wave time series file";
2145 strErr =
"reading deep sea wave time series file";
2149 strErr =
"finding edges of the bounding box";
2153 strErr =
"reading sediment input event time series file";
2157 strErr =
"simulating sediment input event";
2161 strErr =
"location of sediment input event is outside grod";
2165 strErr =
"location of wavestation is outside grid";
2169 strErr =
"cliff not in polygon";
2173 strErr =
"Cell marked as profile coast but not as profile";
2177 strErr =
"error tracing flood line on grid";
2181 strErr =
"error tracing coastline on grid, no coast start-finish points found";
2185 strErr =
"error tracing coastline on grid, no valid coast found";
2189 strErr =
"error tracing coastline on grid, coast search just repeats";
2193 strErr =
"error tracing coastline on grid, zero-length coast found";
2197 strErr =
"error tracing coastline on grid, coast below minimum permitted length";
2201 strErr =
"error tracing coastline on grid, coast ignored";
2205 strErr =
"error tracing coastline on grid, too many times round tracing loop";
2209 strErr =
"intersection cell not found in hit profile";
2213 strErr =
"unknown error";
2218 strErr =
"totally unknown error";
2273 if (isatty(fileno(stdout)))
2288 string strCmd(
"echo \"");
2290 stringstream ststrTmp;
2291 ststrTmp << put_time(localtime(&
m_tSysEndTime),
"%T on %A %d %B %Y") << endl;
2297 strCmd.append(
"Simulation ");
2299 strCmd.append(
", running on ");
2301 strCmd.append(
", completed normally at ");
2302 strCmd.append(ststrTmp.str());
2303 strCmd.append(
"\" | mail -s \"");
2305 strCmd.append(
": normal completion\" ");
2312 strCmd.append(
"Simulation ");
2314 strCmd.append(
", running on ");
2316 strCmd.append(
", aborted with error code ");
2317 strCmd.append(to_string(nRtn));
2318 strCmd.append(
": ");
2320 strCmd.append(
" at timestep ");
2321 strCmd.append(to_string(
m_ulIter));
2322 strCmd.append(
" (");
2324 strCmd.append(
").\n\nThis message sent at ");
2325 strCmd.append(ststrTmp.str());
2326 strCmd.append(
"\" | mail -s \"");
2328 strCmd.append(
": ERROR\" ");
2332 int const nRet = system(strCmd.c_str());
2334 if (WEXITSTATUS(nRet) != 0)
2347 string strOut(*strIn);
2348 strOut.replace(strOut.begin(), strOut.end(),
'/',
'\\');
2357 string strOut(*strIn);
2358 strOut.replace(strOut.begin(), strOut.end(),
'\\',
'/');
2368 size_t const nStartpos = strIn->find_first_not_of(
" \t");
2370 if (nStartpos == string::npos)
2374 return strIn->substr(nStartpos);
2382 string strTmp(*strIn);
2385 strTmp.erase(remove(strTmp.begin(), strTmp.end(),
'\r'), strTmp.end());
2388 size_t const nEndpos = strTmp.find_last_not_of(
" \t");
2390 if (nEndpos == string::npos)
2394 return strTmp.substr(0, nEndpos + 1);
2402 string strTmp = *strIn;
2405 strTmp.erase(remove(strTmp.begin(), strTmp.end(),
'\r'), strTmp.end());
2408 size_t nPos = strTmp.find_last_not_of(
" \t");
2410 if (nPos != string::npos)
2411 strTmp.resize(nPos + 1);
2414 nPos = strTmp.find_first_not_of(
" \t");
2416 if (nPos != string::npos)
2417 strTmp = strTmp.substr(nPos);
2427 string strOut = *strIn;
2428 transform(strIn->begin(), strIn->end(), strOut.begin(), tolower);
2447 size_t const nPos = pStrIn->find(*pStrSub);
2449 if (nPos != string::npos)
2452 pStrIn->replace(nPos, pStrSub->size(),
"");
2468 stringstream ss(*s);
2471 while (getline(ss, item, delim))
2474 elems->push_back(item);
2485 vector<string> elems;
2528 int const nX = pPti->
nGetX();
2529 int const nY = pPti->
nGetY();
2530 int const nXLast = pVPtiPoints->back().nGetX();
2531 int const nYLast = pVPtiPoints->back().nGetY();
2532 int const nXDiff = nX - nXLast;
2533 int const nYDiff = nY - nYLast;
2534 int const nXDiffA =
tAbs(nXDiff);
2535 int const nYDiffA =
tAbs(nYDiff);
2536 int const nDiff =
tMax(nXDiffA, nYDiffA);
2546 dXInc =
static_cast<double>(nXDiff) / nDiff;
2549 dYInc =
static_cast<double>(nYDiff) / nDiff;
2551 for (
int n = 1; n < nDiff; n++)
2554 pVPtiPoints->push_back(Pti);
2564void CSimulation::CalcDeanProfile(vector<double>* pdVDeanProfile,
double const dInc,
double const dDeanTopElev,
double const dA,
bool const bDeposition,
int const nSeawardOffset,
double const dStartCellElev)
2566 double dDistFromProfileStart = 0;
2571 pdVDeanProfile->at(0) = dStartCellElev;
2573 for (
int n = 1; n < static_cast<int>(pdVDeanProfile->size()); n++)
2575 if (n <= nSeawardOffset)
2577 pdVDeanProfile->at(n) = dStartCellElev;
2581 double const dDistBelowTop = dA * pow(dDistFromProfileStart,
DEAN_POWER);
2582 pdVDeanProfile->at(n) = dDeanTopElev - dDistBelowTop;
2584 dDistFromProfileStart += dInc;
2592 for (
int n = 0; n < static_cast<int>(pdVDeanProfile->size()); n++)
2594 double const dDistBelowTop = dA * pow(dDistFromProfileStart,
DEAN_POWER);
2595 pdVDeanProfile->at(n) = dDeanTopElev - dDistBelowTop;
2597 dDistFromProfileStart += dInc;
2607 double dTotElevDiff = 0;
2610 for (
int n = 0; n < static_cast<int>(pdVFirstProfile->size()); n++)
2612 if (pbVIsValid->at(n))
2614 double const dProfileDiff = pdVFirstProfile->at(n) - pdVSecondProfile->at(n);
2616 dTotElevDiff += dProfileDiff;
2642 return dTotElevDiff;
2651 dDeepWaterWaveHeight,
2678 m_dDepthOfClosure = (1.75 * dDeepWaterWaveHeight) - (57.9 * dDeepWaterWaveHeight * dDeepWaterWaveHeight / (
m_dG * dDeepWaterPeriod * dDeepWaterPeriod));
2696 if (VstrTmp.size() < 3)
2698 cerr <<
"date string must include day, month, and year '" << strDate <<
"'" << endl;
2705 cerr <<
"invalid integer for day in date '" << strDate <<
"'" << endl;
2709 nDay = stoi(VstrTmp[0]);
2711 if ((nDay < 1) || (nDay > 31))
2713 cerr <<
"day must be between 1 and 31 in date '" << strDate <<
"'" << endl;
2720 cerr <<
"invalid integer for month in date '" << strDate <<
"'" << endl;
2724 nMonth = stoi(VstrTmp[1]);
2726 if ((nMonth < 1) || (nMonth > 12))
2728 cerr <<
"month must be between 1 and 12 in date '" << strDate <<
"'" << endl;
2735 cerr <<
"invalid integer for year in date '" << strDate <<
"'" << endl;
2739 nYear = stoi(VstrTmp[2]);
2743 cerr <<
"year must be > 0 in date '" << strDate <<
"'" << endl;
2757 if (VstrTmp.size() < 3)
2759 cerr <<
"time string must include hours, minutes, and seconds '" << strTime <<
"'" << endl;
2766 cerr <<
"invalid integer for hours in time '" << strTime <<
"'" << endl;
2770 nHour = stoi(VstrTmp[0]);
2772 if ((nHour < 0) || (nHour > 23))
2774 cerr <<
"hour must be between 0 and 23 in time '" << strTime <<
"'" << endl;
2781 cerr <<
"invalid integer for minutes in time '" << strTime <<
"'" << endl;
2785 nMin = stoi(VstrTmp[1]);
2787 if ((nMin < 0) || (nMin > 59))
2789 cerr <<
"minutes must be betwen 0 and 59 in time '" << strTime <<
"'" << endl;
2796 cerr <<
"invalid integer for seconds in time '" << strTime <<
"'" << endl;
2800 nSec = stoi(VstrTmp[2]);
2802 if ((nSec < 0) || (nSec > 59))
2804 cerr <<
"seconds must be between 0 and 59 in time '" << strTime <<
"'" << endl;
2816 unsigned long ulTimeStep = 0;
2822 if (strDate.find(
"hour") != string::npos)
2829 cerr <<
"Error in number of hours '" + strDate +
"' for sediment input event" << endl;
2833 double const dHours = stod(
strTrim(&VstrTmp[0]));
2837 cerr <<
"Sediment input event '" + strDate +
"' occurs after end of simulation" << endl;
2844 else if (strDate.find(
"day") != string::npos)
2851 cerr <<
"Error in number of days '" + strDate +
"' for sediment input event" << endl;
2855 double const dHours = stod(
strTrim(&VstrTmp[0])) * 24;
2859 cerr <<
"Sediment input event '" + strDate +
"' occurs after end of simulation" << endl;
2871 if (VstrTmp.size() < 2)
2873 cerr <<
"Error in time/date '" + strDate +
"' of sediment input event" << endl;
2882 if (!
bParseTime(&VstrTmp[0], nHour, nMin, nSec))
2884 cerr <<
"Error in time '" + VstrTmp[0] +
"' of sediment input event" << endl;
2893 if (!
bParseDate(&VstrTmp[1], nDay, nMonth, nYear))
2895 cerr <<
"Error in date '" + VstrTmp[1] +
"' of sediment input event" << endl;
2900 struct tm tmSimStart = {};
2908 struct tm tmSimEvent = {};
2909 tmSimEvent.tm_sec = nSec;
2910 tmSimEvent.tm_min = nMin;
2911 tmSimEvent.tm_hour = nHour;
2912 tmSimEvent.tm_mday = nDay;
2913 tmSimEvent.tm_mon = nMonth - 1;
2914 tmSimEvent.tm_year = nYear - 1900;
2916 time_t
const tStart = mktime(&tmSimStart);
2917 time_t
const tEvent = mktime(&tmSimEvent);
2919 if (tStart == (time_t)(-1))
2921 cerr <<
"Error in simulation start time/date" << endl;
2925 if (tEvent == (time_t)(-1))
2927 cerr <<
"Error in time/date '" + strDate +
"' of sediment input event" << endl;
2931 double const dHours = difftime(tEvent, tStart) / (60 * 60);
2935 cerr <<
"Sediment input event '" + strDate +
"' occurs before start of simulation" << endl;
2941 cerr <<
"Sediment input event '" + strDate +
"' occurs after end of simulation" << endl;
2945 ulTimeStep =
static_cast<unsigned long>(dHours /
m_dTimeStep);
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.
Geometry class used for coast polygon objects.
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 AnnounceInitializing(void)
Tells the user that we are now initializing.
bool m_bTopSurfSave
Save fop surface (sediment and sea) raster DEMs?
static void AnnounceReadSCAPEShapeFunctionFile(void)
Now reading the SCAPE shape function file.
string m_strInitialSuspSedimentFile
Name of initial suspended sediment file.
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_bSedimentTopSurfSave
Save sediment top surface raster DEMs?
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.
ofstream CliffCollapseNetChangeTSStream
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.
void AnnounceReadInitialSandConsSedGIS(int const) const
Tells the user that we are now reading the initial sand consolidated sediment depth GIS file.
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 Does this work correctly?
bool bSetUpTSFiles(void)
The bSetUpTSFiles member function sets up 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.
vector< CRWCoast > m_VFloodWaveSetupSurgeRunup
TODO 007 Info needed.
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)
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?
bool m_bStillWaterLevelTSSave
Save the still water level time series file?
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.
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.
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 Info needed.
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?
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 ...
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?
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.
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.
ofstream StillWaterLevelTSStream
SWL time series file output stream.
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.
string m_strCMEDir
The CME folder.
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
ofstream BeachSedimentNetChangeTSStream
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?
void AnnounceReadBasementDEM(void) const
Tells the user that we are now reading the DEM 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 Does this work correctly?
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
static void AnnounceStart(void)
Tells the user that we have started the simulation.
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?
int m_nSimStartMin
Start time of the simulation (minutes)
bool bSaveAllRasterGISFiles(void)
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?
void CalcTime(double const)
Calculates and displays time elapsed in terms of CPU time and real time, also calculates time per tim...
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?
CGeomCoastPolygon * pGetPolygon(int const) const
Returns a pointer to a coast polygon, in down-coast sequence.
bool m_bSedimentInputEventSave
Save sediment inut data?
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
double m_dTimeStep
The length of an iteration (a time step) 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?
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>
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?
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?
void CalcProcessStats(void)
This calculates and displays process statistics.
int nGetCoastPolygonSize(void) const
Returns the size of the coast polygon vector.
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.
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...
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()
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?
void AppendPolygon(CGeomCoastPolygon *)
Appends a pointer to a coast polygon to the coast polygon vector.
vector< CGeomCoastPolygon * > m_pVCoastPolygon
Pointers to coast polygon objects, in down-coast sequence TODO 044 Will need to use global polygon ID...
bool m_bLocalSlopeSave
Save local slope 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
string const RASTER_SEA_DEPTH_NAME
int const RTN_ERR_READING_SEDIMENT_INPUT_EVENT
int const RTN_ERR_CLIFFNOTCH
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 RTN_ERR_GRIDTOLINE
int const RTN_ERR_TIMEUNITS
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_NOCOAST
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
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_STILL_WATER_LEVEL_NAME
string const RASTER_COAST_CODE
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_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
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 RASTER_BASEMENT_ELEVATION_CODE
int const RTN_ERR_PROFILEWRITE
string const RASTER_WAVE_HEIGHT_CODE
string const RASTER_INTERVENTION_CLASS_CODE
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
string const READING_TIDE_DATA_FILE
int const RTN_ERR_RASTER_FILE_READ
string const VECTOR_MEAN_WAVE_ENERGY_CODE
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
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
int const RTN_ERR_PROFILESPACING
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 INITIALIZING
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
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
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
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_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 VECTOR_CLIFF_NOTCH_SIZE_CODE
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_SUSP_SED_CODE
int const RTN_ERR_CANNOT_INSERT_POINT
int const RTN_ERR_NO_VALID_COAST
string const VECTOR_SHADOW_BOUNDARY_CODE
string const VECTOR_COAST_CURVATURE_CODE
string const TIME_SERIES_SEA_AREA_NAME
int const RTN_ERR_CLIFFDEPOSIT
int const RTN_ERR_UNKNOWN
int const RTN_ERR_ZERO_LENGTH_COAST
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
int const RTN_ERR_OUTFILE
string const ALLOCATE_MEMORY
string const RASTER_LOCAL_SLOPE_CODE
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 TIME_SERIES_STILL_WATER_LEVEL_CODE
string const RASTER_SEDIMENT_TOP_CODE
int const RTN_ERR_CELL_NOT_FOUND_IN_HIT_PROFILE_DIFFERENT_COASTS
string const VECTOR_WAVE_ANGLE_AND_HEIGHT_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 GDAL_DRIVERS
string const ERROR_NOTICE
int const RTN_ERR_NO_CELL_UNDER_COASTLINE
int const LF_CAT_INTERVENTION
string const RASTER_TOP_CODE
int const RTN_ERR_TIMESERIES_FILE_WRITE
string const VECTOR_DOWNDRIFT_BOUNDARY_CODE
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)
Version of the above that returns an int.