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(
"--yaml") != string::npos)
 
  148            else if (strArg.find(
"--home") != string::npos)
 
  154               size_t const pos = strArg.find(
'=');
 
  157               if (pos != string::npos)
 
  166                  cout << 
"No '=' found in the input string" << endl;
 
  176               cout << 
USAGE << endl;
 
 
  208   if (
static_cast<clock_t
>(-1) == clock())
 
 
  236   if (0 != GetModuleFileName(NULL, szBuf, 
BUF_SIZE))
 
  246   if (-1 != readlink(
"/proc/self/exe", szBuf, 
BUF_SIZE))
 
  260   int const nPos = 
static_cast<int>(strTmp.find_last_of(
PATH_SEPARATOR));
 
 
  272   cout << 
LINE << endl;
 
 
  310      return 24 * 30.416667; 
 
 
  365   if (strIn->find(
"hour") != string::npos)
 
  368   else if (strIn->find(
"day") != string::npos)
 
  371   else if (strIn->find(
"month") != string::npos)
 
  374   else if (strIn->find(
"year") != string::npos)
 
 
  388      LogStream.open(
"/dev/null", ios::out | ios::trunc);
 
  389      cout << 
"Warning: log file is not writting" << endl;
 
  398      cerr << 
ERR << 
"cannot open " << 
m_strLogFile << 
" for output" << endl;
 
 
  917   if (strTmp.size() > 2)
 
  918      strTmp.resize(strTmp.size() - 2);
 
 
 1005      strTmp.append(
", ");
 
 1011      strTmp.append(
", ");
 
 1017      strTmp.append(
", ");
 
 1021   if (strTmp.size() > 2)
 
 1022      strTmp.resize(strTmp.size() - 2);
 
 
 1037      strTmp.append(
", ");
 
 1043      strTmp.append(
", ");
 
 1049      strTmp.append(
", ");
 
 1055      strTmp.append(
", ");
 
 1061      strTmp.append(
", ");
 
 1067      strTmp.append(
", ");
 
 1073      strTmp.append(
", ");
 
 1079      strTmp.append(
", ");
 
 1085      strTmp.append(
", ");
 
 1091      strTmp.append(
", ");
 
 1097      strTmp.append(
", ");
 
 1103      strTmp.append(
", ");
 
 1107   if (strTmp.size() > 2)
 
 1108      strTmp.resize(strTmp.size() - 2);
 
 
 1125      strTSFile.append(
CSVEXT);
 
 1133         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1143      strTSFile.append(
CSVEXT);
 
 1151         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1161      strTSFile.append(
CSVEXT);
 
 1169         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1179      strTSFile.append(
CSVEXT);
 
 1187         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1197      strTSFile.append(
CSVEXT);
 
 1205         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1215      strTSFile.append(
CSVEXT);
 
 1223         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1233      strTSFile.append(
CSVEXT);
 
 1241         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1251      strTSFile.append(
CSVEXT);
 
 1259         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1269      strTSFile.append(
CSVEXT);
 
 1277         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1287      strTSFile.append(
CSVEXT);
 
 1295         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1305      strTSFile.append(
CSVEXT);
 
 1313         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 1323      strTSFile.append(
CSVEXT);
 
 1331         cerr << 
ERR << 
"cannot open " << strTSFile << 
" for output" << endl;
 
 
 1372   string strComputerName;
 
 1376   strComputerName = getenv(
"COMPUTERNAME");
 
 1382   strComputerName = szHostName;
 
 1384   if (strComputerName.empty())
 
 1385      strComputerName = 
"Unknown Computer";
 
 1389   return strComputerName;
 
 
 1397   if (
static_cast<clock_t
>(-1) == clock())
 
 1400      LogStream << 
"CPU time not available" << endl;
 
 1406   double dClkThis = 
static_cast<double>(clock());
 
 1407   dClkThis -= CLOCK_T_MIN; 
 
 1419                << 
" before rollover=" << (CLOCK_T_RANGE + 1 - 
m_dClkLast) << endl
 
 1421                << 
" after rollover=" << dClkThis << endl
 
 1423                << 
" ADDED=" << (CLOCK_T_RANGE + 1 - 
m_dClkLast + dClkThis) << endl;
 
 
 1462      double const dDuration = 
m_dCPUClock / CLOCKS_PER_SEC;
 
 1469      double const dPerTimestep = dDuration / 
static_cast<double>(
m_ulTotTimestep);
 
 1472      OutStream << fixed << setprecision(4) << 
" (" << dPerTimestep << 
" per timestep)" << endl;
 
 1473      LogStream << fixed << setprecision(4) << 
" (" << dPerTimestep << 
" per timestep)" << endl;
 
 1476      OutStream << resetiosflags(ios::floatfield);
 
 1477      OutStream << fixed << setprecision(0) << 
"In terms of CPU time, this is ";
 
 1478      LogStream << resetiosflags(ios::floatfield);
 
 1479      LogStream << fixed << setprecision(0) << 
"In terms of CPU time, this is ";
 
 1481      if (dDuration > dRunLength)
 
 1483         OutStream << dDuration / dRunLength << 
" x slower than reality" << endl;
 
 1484         LogStream << dDuration / dRunLength << 
" x slower than reality" << endl;
 
 1489         OutStream << dRunLength / dDuration << 
" x faster than reality" << endl;
 
 1490         LogStream << dRunLength / dDuration << 
" x faster than reality" << endl;
 
 1502   double const dPerTimestep = dDuration / 
static_cast<double>(
m_ulTotTimestep);
 
 1505   OutStream << resetiosflags(ios::floatfield);
 
 1506   OutStream << 
" (" << fixed << setprecision(4) << dPerTimestep << 
" per timestep)" << endl;
 
 1507   LogStream << resetiosflags(ios::floatfield);
 
 1508   LogStream << 
" (" << fixed << setprecision(4) << dPerTimestep << 
" per timestep)" << endl;
 
 1511   OutStream << fixed << setprecision(0) << 
"In terms of run time, this is ";
 
 1512   LogStream << fixed << setprecision(0) << 
"In terms of run time, this is ";
 
 1514   if (dDuration > dRunLength)
 
 1516      OutStream << dDuration / dRunLength << 
" x slower than reality" << endl;
 
 1517      LogStream << dDuration / dRunLength << 
" x slower than reality" << endl;
 
 1522      OutStream << dRunLength / dDuration << 
" x faster than reality" << endl;
 
 1523      LogStream << dRunLength / dDuration << 
" x faster than reality" << endl;
 
 
 1533   double dTmpTime = 
tMax(dTimeIn, 0.0);
 
 1538   double const dHoursInYear = 24 * 365; 
 
 1539   double const dHoursInDay = 24;
 
 1542   if (dTmpTime >= dHoursInYear)
 
 1544      double const dYears = floor(dTmpTime / dHoursInYear);
 
 1545      dTmpTime -= (dYears * dHoursInYear);
 
 1547      strTime = to_string(
static_cast<int>(dYears));
 
 1548      strTime.append(
"y ");
 
 1555   if (dTmpTime >= dHoursInDay)
 
 1557      double const dJDays = floor(dTmpTime / dHoursInDay);
 
 1558      dTmpTime -= (dJDays * dHoursInDay);
 
 1560      stringstream ststrTmp;
 
 1561      ststrTmp << FillToWidth('0', 3) << static_cast<int>(dJDays);
 
 1562      strTime.append(ststrTmp.str());
 
 1563      strTime.append(
"d ");
 
 1567      strTime.append(
"000d ");
 
 1570   stringstream ststrTmp;
 
 1571   ststrTmp << FillToWidth('0', 2) << static_cast<int>(dTmpTime);
 
 1572   strTime.append(ststrTmp.str());
 
 1573   strTime.append(
"h");
 
 
 1584   double dTime = 
tMax(dTimeIn, 0.0);
 
 1591   unsigned long ulTimeIn = 
static_cast<unsigned long>(floor(dTime));
 
 1592   dTime -= 
static_cast<double>(ulTimeIn);
 
 1595   if (ulTimeIn >= 3600)
 
 1598      unsigned long const ulHours = ulTimeIn / 3600ul;
 
 1599      ulTimeIn -= (ulHours * 3600ul);
 
 1601      strTime = to_string(ulHours);
 
 1602      strTime.append(
":");
 
 1612      unsigned long const ulMins = ulTimeIn / 60ul;
 
 1613      ulTimeIn -= (ulMins * 60ul);
 
 1615      stringstream ststrTmp;
 
 1616      ststrTmp << FillToWidth(
'0', 2) << ulMins;
 
 1617      strTime.append(ststrTmp.str());
 
 1618      strTime.append(
":");
 
 1622      strTime.append(
"00:");
 
 1625   stringstream ststrTmp;
 
 1626   ststrTmp << FillToWidth(
'0', 2) << ulTimeIn;
 
 1627   strTime.append(ststrTmp.str());
 
 1632      strTime.append(
".");
 
 1634      ststrTmp.str(
string());
 
 1635      ststrTmp << FillToWidth('0', 2) << static_cast<unsigned long>(dTime * 100);
 
 1636      strTime.append(ststrTmp.str());
 
 
 1647   string strBuild(
"(");
 
 1648   strBuild.append(__TIME__);
 
 1649   strBuild.append(
" ");
 
 1650   strBuild.append(__DATE__);
 
 1652   strBuild.append(
" DEBUG");
 
 1654   strBuild.append(
" build)");
 
 
 1664   if (isatty(fileno(stdout)))
 
 1667      static double sdElapsed = 0;
 
 1668      static double sdToGo = 0;
 
 1669      time_t 
const tNow = time(
nullptr);
 
 1678      cout << 
"%   (elapsed " << 
strDispTime(sdElapsed, 
false, 
false) << 
" remaining ";
 
 1680      cout << 
strDispTime(sdToGo, 
false, 
false) << 
")  ";
 
 1684         cout << setw(9) << 
"GIS" + to_string(
m_nGISSave);
 
 1687         cout << setw(9) << 
"SED INPUT";
 
 1690         cout << setw(9) << 
SPACE;
 
 
 1701   string const NA = 
"Not available";
 
 1704   OutStream << 
"Process statistics" << endl;
 
 1705   OutStream << 
"------------------" << endl;
 
 1709   OSVERSIONINFOEX osvi;
 
 1710   BOOL bOsVersionInfoEx;
 
 1712   ZeroMemory(&osvi, 
sizeof(OSVERSIONINFOEX)); 
 
 1713   osvi.dwOSVersionInfoSize = 
sizeof(OSVERSIONINFOEX);
 
 1715   if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*)&osvi)))
 
 1718      osvi.dwOSVersionInfoSize = 
sizeof(OSVERSIONINFO);
 
 1720      if (!GetVersionEx((OSVERSIONINFO*)&osvi))
 
 1731   switch (osvi.dwPlatformId)
 
 1733   case VER_PLATFORM_WIN32_NT:
 
 1734      if (osvi.dwMajorVersion <= 4)
 
 1737      else if (5 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
 
 1740      else if (5 == osvi.dwMajorVersion && 1 == osvi.dwMinorVersion)
 
 1743      else if (6 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
 
 1746      else if (6 == osvi.dwMajorVersion && 1 == osvi.dwMinorVersion)
 
 1749      else if (6 == osvi.dwMajorVersion && 2 == osvi.dwMinorVersion)
 
 1752      else if (6 == osvi.dwMajorVersion && 3 == osvi.dwMinorVersion)
 
 1755      else if (10 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
 
 1758      else if (11 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
 
 1762         OutStream << 
"unknown Windows version ";
 
 1765      if (osvi.dwMajorVersion <= 4)
 
 1766         OutStream << 
"version " << osvi.dwMajorVersion << 
"." << osvi.dwMinorVersion << 
" " << osvi.szCSDVersion << 
" (Build " << (osvi.dwBuildNumber & 0xFFFF) << 
")" << endl;
 
 1769         OutStream << osvi.szCSDVersion << 
" (Build " << (osvi.dwBuildNumber & 0xFFFF) << 
")" << endl;
 
 1773   case VER_PLATFORM_WIN32_WINDOWS:
 
 1774      if (4 == osvi.dwMajorVersion && 0 == osvi.dwMinorVersion)
 
 1778         if (
'C' == osvi.szCSDVersion[1] || 
'B' == osvi.szCSDVersion[1])
 
 1784      else if (4 == osvi.dwMajorVersion && 10 == osvi.dwMinorVersion)
 
 1788         if (
'A' == osvi.szCSDVersion[1])
 
 1794      else if (4 == osvi.dwMajorVersion && 90 == osvi.dwMinorVersion)
 
 1798         OutStream << 
"unknown 16-bit Windows version " << endl;
 
 1802   case VER_PLATFORM_WIN32s:
 
 1808   if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId)
 
 1810      FILETIME ftCreate, ftExit, ftKernel, ftUser;
 
 1812      if (GetProcessTimes(GetCurrentProcess(), &ftCreate, &ftExit, &ftKernel, &ftUser))
 
 1815         ul.LowPart = ftUser.dwLowDateTime;
 
 1816         ul.HighPart = ftUser.dwHighDateTime;
 
 1817         OutStream << 
"Time spent executing user code               \t: " << 
strDispTime(
static_cast<double>(ul.QuadPart) * 1e-7, 
false) << endl;
 
 1818         ul.LowPart = ftKernel.dwLowDateTime;
 
 1819         ul.HighPart = ftKernel.dwHighDateTime;
 
 1820         OutStream << 
"Time spent executing kernel code             \t: " << 
strDispTime(
static_cast<double>(ul.QuadPart) * 1e-7, 
false) << endl;
 
 1825      OutStream << 
"Process timings                              \t: " << NA << endl;
 
 1828   HINSTANCE hDLL = LoadLibrary(
"psapi.dll");
 
 1833      typedef BOOL(__stdcall * DLLPROC)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD);
 
 1837      ProcAdd = (DLLPROC)GetProcAddress(hDLL, 
"GetProcessMemoryInfo");
 
 1842         PROCESS_MEMORY_COUNTERS pmc;
 
 1845         if ((ProcAdd)(GetCurrentProcess(), &pmc, 
sizeof(pmc)))
 
 1847            OutStream << 
"Peak working set size                        \t: " << pmc.PeakWorkingSetSize / (1024.0 * 1024.0) << 
" Mb" << endl;
 
 1848            OutStream << 
"Current working set size                     \t: " << pmc.WorkingSetSize / (1024.0 * 1024.0) << 
" Mb" << endl;
 
 1849            OutStream << 
"Peak paged pool usage                        \t: " << pmc.QuotaPeakPagedPoolUsage / (1024.0 * 1024.0) << 
" Mb" << endl;
 
 1850            OutStream << 
"Current paged pool usage                     \t: " << pmc.QuotaPagedPoolUsage / (1024.0 * 1024.0) << 
" Mb" << endl;
 
 1851            OutStream << 
"Peak non-paged pool usage                    \t: " << pmc.QuotaPeakNonPagedPoolUsage / (1024.0 * 1024.0) << 
" Mb" << endl;
 
 1852            OutStream << 
"Current non-paged pool usage                 \t: " << pmc.QuotaNonPagedPoolUsage / (1024.0 * 1024.0) << 
" Mb" << endl;
 
 1853            OutStream << 
"Peak pagefile usage                          \t: " << pmc.PeakPagefileUsage / (1024.0 * 1024.0) << 
" Mb" << endl;
 
 1854            OutStream << 
"Current pagefile usage                       \t: " << pmc.PagefileUsage / (1024.0 * 1024.0) << 
" Mb" << endl;
 
 1855            OutStream << 
"No. of page faults                           \t: " << pmc.PageFaultCount << endl;
 
 1863#elif defined __GNUG__ 
 1866   if (getrusage(RUSAGE_SELF, &ru) >= 0)
 
 1868      OutStream << 
"Time spent executing user code               \t: " << 
strDispTime(
static_cast<double>(ru.ru_utime.tv_sec), 
false, 
true) << endl;
 
 1870      OutStream << 
"Time spent executing kernel code             \t: " << 
strDispTime(
static_cast<double>(ru.ru_stime.tv_sec), 
false, 
true) << endl;
 
 1876      OutStream << 
"No. of page faults not requiring physical I/O\t: " << ru.ru_minflt << endl;
 
 1877      OutStream << 
"No. of page faults requiring physical I/O    \t: " << ru.ru_majflt << endl;
 
 1882      OutStream << 
"No. of voluntary context switches            \t: " << ru.ru_nvcsw << endl;
 
 1883      OutStream << 
"No. of involuntary context switches          \t: " << ru.ru_nivcsw << endl;
 
 1898      if (0 == omp_get_thread_num())
 
 1900         OutStream << 
"Number of OpenMP threads                     \t: " << omp_get_num_threads() << endl;
 
 1901         OutStream << 
"Number of OpenMP processors                  \t: " << omp_get_num_procs() << endl;
 
 1903         LogStream << 
"Number of OpenMP threads                     \t: " << omp_get_num_threads() << endl;
 
 1904         LogStream << 
"Number of OpenMP processors                  \t: " << omp_get_num_procs() << endl;
 
 1910   struct tm* ptmRunTime = gmtime(&tRunTime);
 
 1912   OutStream << 
"Time required for simulation                 \t: " << put_time(ptmRunTime, 
"%T") << endl;
 
 1913   LogStream << 
"Time required for simulation                 \t: " << put_time(ptmRunTime, 
"%T") << endl;
 
 1915   double const dSpeedUp = 
m_dSimDuration * 3600 / 
static_cast<double>(tRunTime);
 
 1917   OutStream << 
"Time simulated / time required for simulation\t: " << dSpeedUp << 
" x faster than reality" << endl;
 
 1920   LogStream << 
"Time simulated / time required for simulation\t: " << dSpeedUp << 
" x faster than reality" << endl;
 
 
 1933      strErr = 
"run ended by user";
 
 1937      strErr = 
"error in command-line parameter";
 
 1941      strErr = 
"error reading initialization file";
 
 1945      strErr = 
"error in directory name";
 
 1949      strErr = 
"error reading run details file";
 
 1953      strErr = 
"error reading SCAPE shape function file";
 
 1957      strErr = 
"error reading tide data file";
 
 1961      strErr = 
"error creating log file";
 
 1965      strErr = 
"error creating text output file";
 
 1969      strErr = 
"error creating time series file";
 
 1973      strErr = 
"error reading initial DEM file";
 
 1977      strErr = 
"error reading raster GIS file";
 
 1981      strErr = 
"error reading vector GIS file";
 
 1985      strErr = 
"error allocating memory";
 
 1989      strErr = 
"problem with raster GIS output format";
 
 1993      strErr = 
"problem with vector GIS output format";
 
 1997      strErr = 
"error writing text output file";
 
 2001      strErr = 
"error writing raster GIS output file";
 
 2005      strErr = 
"error writing vector GIS output file";
 
 2009      strErr = 
"error writing time series output file";
 
 2013      strErr = 
"error putting linear feature onto raster grid";
 
 2017      strErr = 
"no sea cells found";
 
 2021      strErr = 
"error when searching grid for linear feature";
 
 2025      strErr = 
"no coastlines found. Is the SWL correct?";
 
 2029      strErr = 
"error writing coastline-normal profiles";
 
 2033      strErr = 
"error in time units";
 
 2037      strErr = 
"no solution when finding end point for coastline-normal line";
 
 2044      strErr = 
"end point for coastline-normal line is not in the contiguous sea";
 
 2048      strErr = 
"cliff notch is above sediment top elevation";
 
 2052      strErr = 
"unable to deposit sediment from cliff collapse";
 
 2056      strErr = 
"coastline-normal profiles are too closely spaced";
 
 2060      strErr = 
"no coastline-normal profiles created, check the SWL";
 
 2064      strErr = 
"no coastline-normal profiles created during rasterization";
 
 2068      strErr = 
"hit grid edge when eroding beach";
 
 2072      strErr = 
"could not locate seaward end of profile when creating Dean profile for beach erosion";
 
 2076      strErr = 
"could not locate seaward end of profile when creating Dean profile for beach deposition (up-coast)";
 
 2080      strErr = 
"could not locate seaward end of profile when creating Dean profile for beach deposition (down-coast)";
 
 2084      strErr = 
"updating grid with landforms";
 
 2088      strErr = 
"no top layer of sediment";
 
 2092      strErr = 
"problem with polygon-to-polygon sediment routing sequence";
 
 2096      strErr = 
"inconsistent multiline";
 
 2100      strErr = 
"cannot insert point into multiline";
 
 2104      strErr = 
"cannot assign coastal landform";
 
 2108      strErr = 
"start point for cell-by-cell fill of wave shadow zone is outside grid";
 
 2112      strErr = 
"could not find start point for cell-by-cell fill of wave shadow zone";
 
 2116      strErr = 
"empty profile during during CShore wave propagation";
 
 2120      strErr = 
"creating file for CShore input";
 
 2124      strErr = 
"reading CShore output file";
 
 2128      strErr = 
"during wave interpolation lookup";
 
 2132      strErr = 
"while running GDALGridCreate()";
 
 2136      strErr = 
"cannot find edge cell while constructing grid-edge profile";
 
 2140      strErr = 
"CShore did not finish correctly";
 
 2144      strErr = 
"Could not find cell under coastline";
 
 2148      strErr = 
"opening deep sea wave time series file";
 
 2152      strErr = 
"reading deep sea wave time series file";
 
 2156      strErr = 
"finding edges of the bounding box";
 
 2160      strErr = 
"reading sediment input event time series file";
 
 2164      strErr = 
"simulating sediment input event";
 
 2168      strErr = 
"location of sediment input event is outside grod";
 
 2172      strErr = 
"location of wavestation is outside grid";
 
 2176      strErr = 
"cliff not in polygon";
 
 2180      strErr = 
"Cell marked as profile coast but not as profile";
 
 2184      strErr = 
"error tracing flood line on grid";
 
 2188      strErr = 
"error tracing coastline on grid, no coast start-finish points found";
 
 2192      strErr = 
"error tracing coastline on grid, no valid coast found";
 
 2196      strErr = 
"error tracing coastline on grid, coast search just repeats";
 
 2200      strErr = 
"error tracing coastline on grid, zero-length coast found";
 
 2204      strErr = 
"error tracing coastline on grid, coast below minimum permitted length";
 
 2208      strErr = 
"error tracing coastline on grid, coast ignored";
 
 2212      strErr = 
"error tracing coastline on grid, too many times round tracing loop";
 
 2216      strErr = 
"intersection cell not found in hit profile";
 
 2220      strErr = 
"unknown error";
 
 2225      strErr = 
"totally unknown error";
 
 
 2280   if (isatty(fileno(stdout)))
 
 2295         string strCmd(
"echo \"");
 
 2297         stringstream ststrTmp;
 
 2298         ststrTmp << put_time(localtime(&
m_tSysEndTime), 
"%T on %A %d %B %Y") << endl;
 
 2304            strCmd.append(
"Simulation ");
 
 2306            strCmd.append(
", running on ");
 
 2308            strCmd.append(
", completed normally at ");
 
 2309            strCmd.append(ststrTmp.str());
 
 2310            strCmd.append(
"\" | mail -s \"");
 
 2312            strCmd.append(
": normal completion\" ");
 
 2319            strCmd.append(
"Simulation ");
 
 2321            strCmd.append(
", running on ");
 
 2323            strCmd.append(
", aborted with error code ");
 
 2324            strCmd.append(to_string(nRtn));
 
 2325            strCmd.append(
": ");
 
 2327            strCmd.append(
" at timestep ");
 
 2328            strCmd.append(to_string(
m_ulIter));
 
 2329            strCmd.append(
" (");
 
 2331            strCmd.append(
").\n\nThis message sent at ");
 
 2332            strCmd.append(ststrTmp.str());
 
 2333            strCmd.append(
"\" | mail -s \"");
 
 2335            strCmd.append(
": ERROR\" ");
 
 2339         int const nRet = system(strCmd.c_str());
 
 2341         if (WEXITSTATUS(nRet) != 0)
 
 
 2354   string strOut(*strIn);
 
 2355   strOut.replace(strOut.begin(), strOut.end(), 
'/', 
'\\');
 
 
 2364   string strOut(*strIn);
 
 2365   strOut.replace(strOut.begin(), strOut.end(), 
'\\', 
'/');
 
 
 2375   size_t const nStartpos = strIn->find_first_not_of(
" \t");
 
 2377   if (nStartpos == string::npos)
 
 2381      return strIn->substr(nStartpos);
 
 
 2389   string strTmp(*strIn);
 
 2392   strTmp.erase(remove(strTmp.begin(), strTmp.end(), 
'\r'), strTmp.end());
 
 2395   size_t const nEndpos = strTmp.find_last_not_of(
" \t");
 
 2397   if (nEndpos == string::npos)
 
 2401      return strTmp.substr(0, nEndpos + 1);
 
 
 2409   string strTmp = *strIn;
 
 2412   strTmp.erase(remove(strTmp.begin(), strTmp.end(), 
'\r'), strTmp.end());
 
 2415   size_t nPos = strTmp.find_last_not_of(
" \t");
 
 2417   if (nPos != string::npos)
 
 2418      strTmp.resize(nPos + 1);
 
 2421   nPos = strTmp.find_first_not_of(
" \t");
 
 2423   if (nPos != string::npos)
 
 2424      strTmp = strTmp.substr(nPos);
 
 
 2434   string strOut = *strIn;
 
 2435   transform(strIn->begin(), strIn->end(), strOut.begin(), tolower);
 
 
 2454   size_t const nPos = pStrIn->find(*pStrSub);
 
 2456   if (nPos != string::npos)
 
 2459      pStrIn->replace(nPos, pStrSub->size(), 
"");
 
 
 2475   stringstream ss(*s);
 
 2478   while (getline(ss, item, delim))
 
 2481         elems->push_back(item);
 
 
 2492   vector<string> elems;
 
 
 2535   int const nX = pPti->
nGetX();
 
 2536   int const nY = pPti->
nGetY();
 
 2537   int const nXLast = pVPtiPoints->back().nGetX();
 
 2538   int const nYLast = pVPtiPoints->back().nGetY();
 
 2539   int const nXDiff = nX - nXLast;
 
 2540   int const nYDiff = nY - nYLast;
 
 2541   int const nXDiffA = 
tAbs(nXDiff);
 
 2542   int const nYDiffA = 
tAbs(nYDiff);
 
 2543   int const nDiff = 
tMax(nXDiffA, nYDiffA);
 
 2553         dXInc = 
static_cast<double>(nXDiff) / nDiff;
 
 2556         dYInc = 
static_cast<double>(nYDiff) / nDiff;
 
 2558      for (
int n = 1; n < nDiff; n++)
 
 2561         pVPtiPoints->push_back(Pti);
 
 
 2571void CSimulation::CalcDeanProfile(vector<double>* pdVDeanProfile, 
double const dInc, 
double const dDeanTopElev, 
double const dA, 
bool const bDeposition, 
int const nSeawardOffset, 
double const dStartCellElev)
 
 2573   double dDistFromProfileStart = 0;
 
 2578      pdVDeanProfile->at(0) = dStartCellElev; 
 
 2580      for (
int n = 1; n < static_cast<int>(pdVDeanProfile->size()); n++)
 
 2582         if (n <= nSeawardOffset)
 
 2584            pdVDeanProfile->at(n) = dStartCellElev;
 
 2588            double const dDistBelowTop = dA * pow(dDistFromProfileStart, 
DEAN_POWER);
 
 2589            pdVDeanProfile->at(n) = dDeanTopElev - dDistBelowTop;
 
 2591            dDistFromProfileStart += dInc;
 
 2599      for (
int n = 0; n < static_cast<int>(pdVDeanProfile->size()); n++)
 
 2601         double const dDistBelowTop = dA * pow(dDistFromProfileStart, 
DEAN_POWER);
 
 2602         pdVDeanProfile->at(n) = dDeanTopElev - dDistBelowTop;
 
 2604         dDistFromProfileStart += dInc;
 
 
 2614   double dTotElevDiff = 0;
 
 2617   for (
int n = 0; n < static_cast<int>(pdVFirstProfile->size()); n++)
 
 2619      if (pbVIsValid->at(n))
 
 2621         double const dProfileDiff = pdVFirstProfile->at(n) - pdVSecondProfile->at(n);
 
 2623         dTotElevDiff += dProfileDiff;
 
 2649   return dTotElevDiff;
 
 
 2658       dDeepWaterWaveHeight,
 
 2685   m_dDepthOfClosure = (1.75 * dDeepWaterWaveHeight) - (57.9 * dDeepWaterWaveHeight * dDeepWaterWaveHeight / (
m_dG * dDeepWaterPeriod * dDeepWaterPeriod));
 
 
 2703   if (VstrTmp.size() < 3)
 
 2705      cerr << 
"date string must include day, month, and year '" << strDate << 
"'" << endl;
 
 2712      cerr << 
"invalid integer for day in date '" << strDate << 
"'" << endl;
 
 2716   nDay = stoi(VstrTmp[0]);
 
 2718   if ((nDay < 1) || (nDay > 31))
 
 2720      cerr << 
"day must be between 1 and 31 in date '" << strDate << 
"'" << endl;
 
 2727      cerr << 
"invalid integer for month in date '" << strDate << 
"'" << endl;
 
 2731   nMonth = stoi(VstrTmp[1]);
 
 2733   if ((nMonth < 1) || (nMonth > 12))
 
 2735      cerr << 
"month must be between 1 and 12 in date '" << strDate << 
"'" << endl;
 
 2742      cerr << 
"invalid integer for year in date '" << strDate << 
"'" << endl;
 
 2746   nYear = stoi(VstrTmp[2]);
 
 2750      cerr << 
"year must be > 0 in date '" << strDate << 
"'" << endl;
 
 
 2764   if (VstrTmp.size() < 3)
 
 2766      cerr << 
"time string must include hours, minutes, and seconds '" << strTime << 
"'" << endl;
 
 2773      cerr << 
"invalid integer for hours in time '" << strTime << 
"'" << endl;
 
 2777   nHour = stoi(VstrTmp[0]);
 
 2779   if ((nHour < 0) || (nHour > 23))
 
 2781      cerr << 
"hour must be between 0 and 23 in time '" << strTime << 
"'" << endl;
 
 2788      cerr << 
"invalid integer for minutes in time '" << strTime << 
"'" << endl;
 
 2792   nMin = stoi(VstrTmp[1]);
 
 2794   if ((nMin < 0) || (nMin > 59))
 
 2796      cerr << 
"minutes must be betwen 0 and 59 in time '" << strTime << 
"'" << endl;
 
 2803      cerr << 
"invalid integer for seconds in time '" << strTime << 
"'" << endl;
 
 2807   nSec = stoi(VstrTmp[2]);
 
 2809   if ((nSec < 0) || (nSec > 59))
 
 2811      cerr << 
"seconds must be between 0 and 59 in time '" << strTime << 
"'" << endl;
 
 
 2823   unsigned long ulTimeStep = 0;
 
 2829   if (strDate.find(
"hour") != string::npos)
 
 2836         cerr << 
"Error in number of hours '" + strDate + 
"' for sediment input event" << endl;
 
 2840      double const dHours = stod(
strTrim(&VstrTmp[0]));
 
 2844         cerr << 
"Sediment input event '" + strDate + 
"' occurs after end of simulation" << endl;
 
 2851   else if (strDate.find(
"day") != string::npos)
 
 2858         cerr << 
"Error in number of days '" + strDate + 
"' for sediment input event" << endl;
 
 2862      double const dHours = stod(
strTrim(&VstrTmp[0])) * 24;
 
 2866         cerr << 
"Sediment input event '" + strDate + 
"' occurs after end of simulation" << endl;
 
 2878      if (VstrTmp.size() < 2)
 
 2880         cerr << 
"Error in time/date '" + strDate + 
"' of sediment input event" << endl;
 
 2889      if (! 
bParseTime(&VstrTmp[0], nHour, nMin, nSec))
 
 2891         cerr << 
"Error in time '" + VstrTmp[0] + 
"' of sediment input event" << endl;
 
 2900      if (! 
bParseDate(&VstrTmp[1], nDay, nMonth, nYear))
 
 2902         cerr << 
"Error in date '" + VstrTmp[1] + 
"' of sediment input event" << endl;
 
 2907      struct tm tmSimStart = {};
 
 2915      struct tm tmSimEvent = {};
 
 2916      tmSimEvent.tm_sec = nSec;
 
 2917      tmSimEvent.tm_min = nMin;
 
 2918      tmSimEvent.tm_hour = nHour;
 
 2919      tmSimEvent.tm_mday = nDay;
 
 2920      tmSimEvent.tm_mon = nMonth - 1;
 
 2921      tmSimEvent.tm_year = nYear - 1900;
 
 2923      time_t 
const tStart = mktime(&tmSimStart);
 
 2924      time_t 
const tEvent = mktime(&tmSimEvent);
 
 2926      if (tStart == (time_t)(-1))
 
 2928         cerr << 
"Error in simulation start time/date" << endl;
 
 2932      if (tEvent == (time_t)(-1))
 
 2934         cerr << 
"Error in time/date '" + strDate + 
"' of sediment input event" << endl;
 
 2938      double const dHours = difftime(tEvent, tStart) / (60 * 60);
 
 2942         cerr << 
"Sediment input event '" + strDate + 
"' occurs before start of simulation" << endl;
 
 2948         cerr << 
"Sediment input event '" + strDate + 
"' occurs after end of simulation" << endl;
 
 2952      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_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.
 
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.