CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
simulation.h
Go to the documentation of this file.
1
13
14#ifndef SIMULATION_H
15#define SIMULATION_H
16/* ===============================================================================================================================
17 This file is part of CoastalME, the Coastal Modelling Environment.
18
19 CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
20
21 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24===============================================================================================================================*/
25#include <vector>
26using std::vector;
27
28#include <ctime>
29using std::localtime;
30using std::time;
31using std::time_t;
32
33#include <fstream>
34using std::ofstream;
35
36#include <string>
37using std::string;
38
39#include <utility>
40using std::pair;
41
42#include <stack>
43using std::stack;
44
45#include <random>
46using std::default_random_engine;
47using std::normal_distribution;
48
49#include <gdal.h>
50using ::GDALDataType;
51
52#include "yaml_parser.h"
53#include "configuration.h"
54#include "2d_point.h"
55#include "2di_point.h"
56#include "line.h"
57#include "cme.h"
58#include "line.h"
59
60class CGeomRasterGrid; // Forward declarations
61class CRWCoast;
62class CGeomProfile;
64class CRWCliff;
66class CRWCellLandform;
67
69{
70 private:
73
76
79
82
85
88
91
94
97
100
103
106
109
112
115
118
121
124
127
130
133
136
139
142
145
148
151
154
157
160
163
166
169
172
175
178
181
184
187
190
193
196
199
202
205
208
211
214
217
220
223
226
229
232
235
238
241
244
247
250
253
256
259
262
265
268
271
274
277
280
283
286
289
292
295
298
301
304
307
310
313
316
319
322
325
328
331
334
337
340
343
346
349
352
355
358
361
364
367
370
373
376
379
382
385
388
391
394
397
400
403
406
409
412
415
418
421
424
427
430
433
436
439
442
445
448
451
454
457
460
463
466
469
472
475
478
481
484
487
490
493
496
499
502
505
508
511
514
517
520
523
526
529
532
535
538
541
544
547
550
553
556
559
562
565
568
571
574
577
580
583
586
589
592
595
598
601
604
607
609 unsigned long m_ulIter;
610
612 unsigned long m_ulTotTimestep;
613
616
618 unsigned long m_ulNumCells;
619
622
625
628
631
634
637
640
643
646
649
651 unsigned long m_ulMissingValue;
652
655
658
661
664
667
670
673
676
679
682
685
688
691
694
697
700
703
706
709
712
715
718
721
724
727
730
733
736
739
742
745
748
751
754
756 double m_dC_0;
757
759 double m_dL_0;
760
763
766
769
772
775
778
781
783 double m_dR;
784
787
790
793
796
799
802
805
808
811
814
817
819 double m_dKLS;
820
823
825 double m_dG;
826
829
832
835
838
841
844
847
850
853
856
859
862
865
868
871
874
877
880
883
886
889
892
895
898
901
904
907
910
913
916
919
922
925
928
931
934
937
940
943
946
949
952
955
958
961
964
967
970
973
976
979
982
985
988
991
994
997
1000
1003
1006
1009
1012
1015
1018
1021
1024
1027
1030
1033
1036
1039
1042
1045
1048
1051
1054
1055 // These grand totals are all long doubles. The aim is to minimize rounding errors when many very small numbers are added to a single much larger number, see e.g. http://www.ddj.com/cpp/184403224
1058
1061
1064
1067
1070
1073
1076
1079
1082
1085
1088
1091
1094
1097
1100
1103
1106
1109
1112
1115
1118
1121
1124
1127
1130
1133
1136
1139
1142
1145
1148
1151
1154
1157
1160
1163
1166
1169
1172
1175
1178
1181
1184
1187
1190
1193
1196
1199
1202
1205
1208
1211
1214
1217
1220
1223
1226
1229
1232
1235
1238
1241
1244
1247
1250
1253
1256
1259
1262
1265
1268
1271
1272 // GDAL description for the deep water wave stations vector file
1274
1277
1280
1283
1284 // GDAL description for the sediment input event locations vector file
1286
1289
1292
1295
1296 // GDAL description for the flood input locations point or vector file
1298
1301
1304
1307
1310
1313
1316
1319
1322
1325
1328
1331
1334
1337
1340
1342 ofstream OutStream;
1343
1346
1348 ofstream SWLTSStream;
1349
1352
1355
1358
1361
1364
1367
1370
1373
1376
1379
1382
1385
1388
1391
1394
1397
1400
1403
1405 vector<unsigned long> m_VulProfileTimestep;
1406
1409
1411 vector<double> m_VdSliceElev;
1412
1414 vector<double> m_VdErosionPotential;
1415
1417 vector<double> m_VdDepthOverDB;
1418
1420 vector<double> m_VdSavGolFCRWCoast;
1421
1424
1426 vector<double> m_VdTideData;
1427
1430
1433
1436
1439
1442
1445
1448
1451
1453 vector<TransectWaveData> m_VAllTransectsWithSynthetic;
1454
1457
1460
1462 vector<double> m_VdFloodLocationX;
1463
1465 vector<double> m_VdFloodLocationY;
1466
1469
1472
1475
1478
1481
1484
1487
1490
1493
1496
1499
1502
1505
1508
1511
1514
1517
1520
1523
1526
1529
1532
1535
1538
1541
1544
1547
1550
1553
1556
1559
1561 vector<CRWCoast> m_VCoast;
1562
1564 vector<CGeomLine> m_VHighestSWLCoastLine;
1565
1567 vector<CGeomLine> m_VLowestSWLCoastLine;
1568
1570 vector<CGeomLine> m_VCliffToe;
1571
1573 vector<CRWCoast> m_VFloodWaveSetupSurge;
1574
1577
1579 vector<CGeom2DIPoint> m_VEdgeCell;
1580
1582 vector<int> m_VEdgeCellEdge;
1583
1586
1588 vector<CRWSedInputEvent*> m_pVSedInputEvent;
1589
1591 default_random_engine m_Rand[NUMBER_OF_RNGS];
1592
1594 normal_distribution<double> m_dGetFromUnitNormalDist{0.0, 1.0};
1595
1596 private:
1597 // Input and output routines
1598 int nHandleCommandLineParams(int, char const*[]);
1599 bool bReadIniFile(void);
1600 bool bReadRunDataFile(void);
1601 bool bReadYamlFile(void);
1602 bool bDetectFileFormat(string const& strFileName, bool& bIsYaml);
1605 bool bApplyConfiguration(CConfiguration const& config);
1606 bool bOpenLogFile(void);
1607 bool bSetUpTSFiles(void);
1608 void WriteStartRunDetails(void);
1609 bool bWritePerTimestepResults(void);
1611 bool bWritePerTimestepResultsCSV(void);
1612 bool bWriteTSFiles(void);
1613 int nWriteEndRunDetails(void);
1614 int nReadShapeFunctionFile(void);
1615 int nReadWaveStationInputFile(int const);
1617 int nReadTideDataFile(void);
1618 int nSaveProfile(int const, CGeomProfile const*, int const, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<CGeom2DIPoint>*const, vector<double> const*) const;
1619 bool bWriteProfileData(int const, CGeomProfile const*, int const, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<CGeom2DIPoint>*const, vector<double> const*) const;
1620 int nSaveParProfile(int const, CGeomProfile const*, int const, int const, int const, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<CGeom2DIPoint>*const, vector<double> const*) const;
1621 bool bWriteParProfileData(int const, int const, int const, int const, int const, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<CGeom2DIPoint>*const, vector<double> const*) const;
1622 void WriteLookUpData(void);
1623
1624 // GIS input and output stuff
1625 void InitializeGDALPerformance(void);
1626 int nReadRasterBasementDEM(void);
1627 int nReadRasterGISFile(int const, int const);
1628 int nReadVectorGISFile(int const);
1629 bool bWriteRasterGISFile(int const, string const*, int const = 0, double const = 0);
1630 bool bWriteVectorGISFile(int const, string const*);
1631 void GetRasterOutputMinMax(int const, double&, double&, int const, double const);
1633 int nInterpolateWavesToPolygonCells(vector<TransectWaveData> const*, vector<double> const*, vector<double> const*, vector<double> const*, vector<double> const*);
1634
1635 // Initialization
1636 bool bCreateErosionPotentialLookUp(vector<double>*, vector<double>*, vector<double>*);
1637 void CalcMHWElevation(int const);
1638
1639 // Top-level simulation routines
1640 static int nUpdateIntervention(void);
1642 int nCalcExternalForcing(void);
1644 int nLocateSeaAndCoasts(void);
1645 int nLocateFloodAndCoasts(void);
1648 int nDoAllPropagateWaves(void);
1649 void GenerateSyntheticTransects(vector<TransectWaveData> const*, vector<TransectWaveData>*);
1652 int nDoCliffCollapse(int const, CRWCliff *, double&, double&, double&, int&, double&, double&);
1653 void DoCliffCollapseTalusDeposition(int const, CRWCliff const*, double const, double const, int const);
1655 int nUpdateGrid(void);
1656
1657 // For cliff toe location
1658 int nLocateCliffToe(void);
1659 void nCalcSlopeAtAllCells(void);
1660 void nLocateCliffCell(void);
1661 void nTraceSeawardCliffEdge(void);
1662 void nValidateCliffToeEdges(void);
1663 CGeomLine nValidateCliffToeDirection(CGeomLine& CliffEdge, bool bReverse);
1664 void nRemoveSmallCliffIslands(int const);
1665
1666 // Lower-level simulation routines
1667 void FindAllSeaCells(void);
1668 int FindAllInundatedCells(void);
1669 void CellByCellFillSea(int const, int const);
1670 void FloodFillLand(int const, int const);
1671 int nTraceCoastLine(unsigned int const, int const, int const, vector<bool>*, vector<CGeom2DIPoint> const*);
1672 int nTraceAllCoasts(void);
1673 int nTraceFloodCoastLine(unsigned int const, int const, int const, vector<bool>*, vector<CGeom2DIPoint> const*);
1674 int nTraceAllFloodCoasts(void);
1675 void DoCoastCurvature(int const, int const);
1676 int nCheckAndMarkAllProfiles(void);
1677 int nCreateAllProfiles(void);
1678 void LocateAndCreateProfiles(int const, int&, vector<bool>*, vector<pair<int, double>> const*);
1679 int nCreateProfile(int const, int const, int const, int const, bool const, CGeom2DIPoint const*);
1680 int nLocateAndCreateGridEdgeProfile(bool const, int const, int&);
1681 void MarkProfilesOnGrid(int const, int&);
1683 static bool bCheckForIntersection(CGeomProfile* const, CGeomProfile* const, int&, int&, double&, double&, double&, double&);
1684 void MergeProfilesAtFinalLineSegments(int const, CGeomProfile*, CGeomProfile*, int const, int const, double const, double const, double const, double const);
1685 void TruncateOneProfileRetainOtherProfile(int const, CGeomProfile*, CGeomProfile*, double, double, int, int, bool const);
1686 int nInsertPointIntoProfilesIfNeededThenUpdate(int const, CGeomProfile*, double const, double const, int const, CGeomProfile*, int const, bool const);
1687 void TruncateProfileAndAppendNew(int const, CGeomProfile*, int const, vector<CGeom2DPoint> const*, vector<vector<pair<int, int>>> const*);
1688 void CreateRasterizedProfile(int const, CGeomProfile*, vector<CGeom2DIPoint>*, vector<bool>*, bool&, bool&, bool&, bool&, bool&, bool&);
1689 static void CalcDeanProfile(vector<double>*, double const, double const, double const, bool const, int const, double const);
1690 static double dSubtractProfiles(vector<double> const*, vector<double> const*, vector<bool> const*);
1693 void ConstructParallelProfile(int const, int const, int const, int const, int const, vector<CGeom2DIPoint>* const, vector<CGeom2DIPoint>*, vector<CGeom2DPoint> *);
1694 double dCalcBeachProtectionFactor(int const, int const, double const);
1697 void DoActualPlatformErosionOnCell(int const, int const);
1698 double dLookUpErosionPotential(double const);
1699 static CGeom2DPoint PtChooseEndPoint(int const, CGeom2DPoint const*, CGeom2DPoint const*, double const, double const, double const, double const);
1700 int nGetCoastNormalEndPoint(int const, int const, int const, CGeom2DPoint const*, double const, CGeom2DPoint *, CGeom2DIPoint *, bool const);
1701 int nLandformToGrid(int const, int const);
1702 int nCalcWavePropertiesOnProfile(int const, int const, CGeomProfile*, vector<double>*, vector<double>*, vector<double>*, vector<double>*, vector<bool>*);
1703 int nGetThisProfileElevationsForCShore(int const, CGeomProfile*, int const, vector<double>*, vector<double>*, vector<double>*);
1704 int nCreateCShoreInfile(int const, int const, int const, int const, int const, int const, int const, int const, int const, int const, int const, int const, int const, double const, double const, double const, double const, double const, double const, double const, double const, vector<double> const*, vector<double> const*, vector<double> const*);
1705 int nReadCShoreOutput(int const, string const*, int const, int const, vector<double> const*, vector<double>*);
1706 /* static */ void InterpolateCShoreOutput(vector<double> const*, int const, int const, vector<double>*, vector<double>*, vector<double>*, vector<double>*, vector<double>*, vector<double>*, vector<double>*, vector<double>*, vector<double>*);
1707 static double dCalcWaveAngleToCoastNormal(double const, double const, int const);
1708 void CalcCoastTangents(int const);
1709 void InterpolateWavePropertiesBetweenProfiles(int const, int const);
1710 void InterpolateWaveHeightToCoastPoints(int const);
1711 // void InterpolateWavePropertiesToCells(int const, int const, int const);
1713 static double dCalcCurvature(int const, CGeom2DPoint const*, CGeom2DPoint const*, CGeom2DPoint const*);
1714 void CalcD50AndFillWaveCalcHoles(void);
1715 int nDoAllShadowZones(void);
1716 static bool bOnOrOffShoreAndUpOrDownCoast(double const, double const, int const, bool&);
1717 static CGeom2DIPoint PtiFollowWaveAngle(CGeom2DIPoint const*, double const, double&);
1718 // int nFindAllShadowZones(void);
1719 int nCellByCellFillShadowZone(int const, int const, CGeom2DIPoint const*, CGeom2DIPoint const*, CGeom2DIPoint const*);
1720 void DoShadowZoneAndDownDriftZone(int const, int const, int const, int const);
1721 void ProcessDownDriftCell(int const, int const, int const, double const, int const);
1722 void ProcessShadowZoneCell(int const, int const, int const, CGeom2DIPoint const*, int const, int const, int const);
1723 int nCreateAllPolygons(void);
1724 void RasterizePolygonJoiningLine(int const, CGeom2DIPoint const*, CGeom2DIPoint const*, int const);
1725 // static bool bIsWithinPolygon(CGeom2DPoint const*, vector<CGeom2DPoint> const*);
1726 // static CGeom2DPoint PtFindPointInPolygon(vector<CGeom2DPoint> const*, int const);
1727 void MarkPolygonCells(void);
1729 void DoAllPotentialBeachErosion(void);
1731 int nDoParallelProfileUnconsErosion(CGeomCoastPolygon *, int const, int const, int const, int const, int const, int const, vector<CGeom2DIPoint> const*, vector<double> const*, double&, double&, double&);
1732 void ErodeCellBeachSedimentSupplyLimited(int const, int const, int const, int const, double const, double&);
1733 int nDoUnconsErosionOnPolygon(int const, CGeomCoastPolygon *, int const, double const, double&);
1734 int nDoUnconsDepositionOnPolygon(int const, CGeomCoastPolygon *, int const, double, double&);
1735 void CalcDepthOfClosure(void);
1738 int nDoSedimentInputEvent(int const);
1739 void AllPolygonsUpdateStoredUncons(int const);
1740 bool bIsInterventionCell(int const, int const) const;
1741 bool bSurroundedByDriftCells(int const, int const);
1742 bool bElevAboveDeanElev(int const, int const, double const, CRWCellLandform const*);
1743 // void CreatePolygonIndexIDSeq(int const);
1744 int nDoMultipleCoastlines(void);
1745 int nTruncateProfilesDifferentCoasts(int const, int const, int const, int const, int const, int const);
1746 int nTruncateProfileHitDifferentCoast(int const, int const, int const, int const);
1747 int nTruncateProfileMultiLineDifferentCoasts(CGeomProfile*, double const, double const);
1748 bool bIncreaseCliffNotchIncision(int const, int const, int const, CRWCliff*, double const);
1749 bool bCreateNotchInland(int const, int const, int const, int const, double const, double const);
1750
1751 // GIS utility routines
1752 int nMarkBoundingBoxEdgeCells(void);
1753 bool bCheckRasterGISOutputFormat(void);
1754 bool bCheckVectorGISOutputFormat(void);
1755 bool bSaveAllRasterGISFiles(void);
1756 bool bSaveAllVectorGISFiles(void);
1757 bool bIsWithinValidGrid(int const, int const) const;
1758 bool bIsWithinValidGrid(CGeom2DIPoint const*) const;
1759 double dGridCentroidXToExtCRSX(int const) const;
1760 double dGridCentroidYToExtCRSY(int const) const;
1761 double dGridXToExtCRSX(double const) const;
1762 double dGridYToExtCRSY(double const) const;
1763 // double dExtCRSXToGridCentroidX(double const) const;
1764 // double dExtCRSYToGridCentroidY(double const) const;
1767 double dExtCRSXToGridX(double const) const;
1768 double dExtCRSYToGridY(double const) const;
1769 static double dGetDistanceBetween(CGeom2DPoint const*, CGeom2DPoint const*);
1770 static double dGetDistanceBetween(CGeom2DIPoint const*, CGeom2DIPoint const*);
1771 static double dGetDistanceBetween(double const, double const, double const, double const);
1772 static double dTriangleAreax2(CGeom2DPoint const*, CGeom2DPoint const*, CGeom2DPoint const*);
1773 void KeepWithinValidGrid(int&, int&) const;
1774 void KeepWithinValidGrid(int, int, int&, int&) const;
1775 void KeepWithinValidGrid(CGeom2DIPoint const*, CGeom2DIPoint *) const;
1776 static double dKeepWithin360(double const);
1777 // vector<CGeom2DPoint> VGetPerpendicular(CGeom2DPoint const*, CGeom2DPoint
1778 // const*, double const, int const);
1779 // static CGeom2DPoint PtGetPerpendicular(CGeom2DPoint const*, CGeom2DPoint const*, double const, int const);
1780 static CGeom2DIPoint PtiGetPerpendicular(CGeom2DIPoint const*, CGeom2DIPoint const*, double const, int const);
1781 static CGeom2DIPoint PtiGetPerpendicular(int const, int const, int const, int const, double const, int const);
1782 static CGeom2DPoint PtAverage(CGeom2DPoint const*, CGeom2DPoint const*);
1783 static CGeom2DPoint PtAverage(vector<CGeom2DPoint>*);
1784 // static CGeom2DIPoint PtiAverage(CGeom2DIPoint const*, CGeom2DIPoint const*);
1785 // static CGeom2DIPoint PtiAverage(vector<CGeom2DIPoint>*);
1786 static CGeom2DIPoint PtiWeightedAverage(CGeom2DIPoint const*, CGeom2DIPoint const*, double const);
1787 static CGeom2DIPoint PtiPolygonCentroid(vector<CGeom2DIPoint>*);
1788 static double dAngleSubtended(CGeom2DIPoint const*, CGeom2DIPoint const*, CGeom2DIPoint const*);
1789 static int nGetOppositeDirection(int const);
1790 // static void GetSlopeAndInterceptFromPoints(CGeom2DIPoint const*,
1791 // CGeom2DIPoint const*, double&, double&);
1792 CGeom2DIPoint PtiFindClosestCoastPoint(int const, int const, int&);
1793 int nFindClosestCoastPoint(int const, int const, int&);
1794 int nConvertMetresToNumCells(double const) const;
1795 bool bIsAdjacentEdgeCell(CGeom2DIPoint const*, CGeom2DIPoint const*);
1796 void FindClosestPointOnStraightLine(double const, double const, double const, double const, double const, double const, double&, double&);
1797
1798 // Interpolation routines
1799 double dGetInterpolatedValue(vector<double> const*, vector<double> const*, double, bool);
1800 double dGetInterpolatedValue(vector<int> const*, vector<double> const*, int, bool);
1801 int nFindIndex(vector<double> const*, double const);
1802 vector<double> VdInterpolateCShoreProfileOutput(vector<double> const*, vector<double> const*, vector<double> const*);
1803
1804 // Utility routines
1805 static void AnnounceStart(void);
1806 void AnnounceLicence(void);
1807 void AnnounceReadBasementDEM(void) const;
1808 static void AnnounceAddLayers(void);
1809 static void AnnounceReadRasterFiles(void);
1810 static void AnnounceReadVectorFiles(void);
1811 void AnnounceReadLGIS(void) const;
1812 void AnnounceReadICGIS(void) const;
1813 void AnnounceReadIHGIS(void) const;
1814 static void AnnounceFinalInitialization(void);
1815 void AnnounceReadInitialSuspSedGIS(void) const;
1816 void AnnounceReadInitialFineUnconsSedGIS(int const) const;
1817 void AnnounceReadInitialSandUnconsSedGIS(int const) const;
1818 void AnnounceReadInitialCoarseUnconsSedGIS(int const) const;
1819 void AnnounceReadInitialFineConsSedGIS(int const) const;
1820 void AnnounceReadInitialSandConsSedGIS(int const) const;
1821 void AnnounceReadInitialCoarseConsSedGIS(int const) const;
1822 void AnnounceReadDeepWaterWaveValuesGIS(void) const;
1824 void AnnounceReadFloodLocationGIS(void) const;
1825 void AnnounceReadTideData(void) const;
1826 static void AnnounceReadSCAPEShapeFunctionFile(void);
1827 static void AnnounceAllocateMemory(void);
1828 static void AnnounceIsRunning(void);
1829 static void AnnounceSimEnd(void);
1830 void StartClock(void);
1831 bool bFindExeDir(char const*);
1832 bool bTimeToQuit(void);
1833 static int nDoTimeUnits(string const*);
1834 int nDoSimulationTimeMultiplier(string const*);
1835 static double dGetTimeMultiplier(string const*);
1836 static bool bParseDate(string const*, int&, int&, int&);
1837 static bool bParseTime(string const*, int&, int&, int&);
1838 void DoEndOfTimestepTotals(void);
1839 static string strGetBuild(void);
1840 static string strGetComputerName(void);
1841 void DoCPUClockReset(void);
1842 // void CalcTime(double const);
1843 static string strDispTime(double const, bool const, bool const);
1844 static string strDispSimTime(double const);
1845 void AnnounceProgress(void);
1846 static string strGetErrorText(int const);
1847 string strListRasterFiles(void) const;
1848 string strListVectorFiles(void) const;
1849 string strListTSFiles(void) const;
1850 void CalcProcessStats(void);
1851 void CalcSavitzkyGolayCoeffs(void);
1852 CGeomLine LSmoothCoastSavitzkyGolay(CGeomLine *, int const, int const) const;
1854 vector<double> dVSmoothProfileSlope(vector<double>*) const;
1855 // vector<double> dVCalCGeomProfileSlope(vector<CGeom2DPoint>*, vector<double>*); // TODO 007 Why was this removed? vector<double>
1856 // dVSmoothProfileSavitzkyGolay(vector<double>*, vector<double>*); //
1857 // TODO 007 was this removed? vector<double>
1858 // dVSmoothProfileRunningMean(vector<double>*); //
1859 // TODO 007 was this removed?
1860 static void CalcSavitzkyGolay(double[], int const, int const, int const, int const, int const);
1861 static string pstrChangeToBackslash(string const*);
1862 static string pstrChangeToForwardSlash(string const*);
1863 static string strTrim(string const*);
1864 static string strTrimLeft(string const*);
1865 static string strTrimRight(string const*);
1866 static string strToLower(string const*);
1867 // static string strToUpper(string const*);
1868 static string strRemoveSubstr(string*, string const*);
1869 static vector<string>* VstrSplit(string const*, char const, vector<string>*);
1870 static vector<string> VstrSplit(string const*, char const);
1871 // static double dCrossProduct(double const, double const, double const,
1872 // double const, double const, double const); static double
1873 // dGetMean(vector<double> const*); static double dGetStdDev(vector<double>
1874 // const*);
1875 static void AppendEnsureNoGap(vector<CGeom2DIPoint>*, CGeom2DIPoint const*);
1876 // static bool bIsNumeric(string const*);
1877 unsigned long ulConvertToTimestep(string const*) const;
1878 void WritePolygonInfoTable(void);
1885 // void WritePolygonUnconsErosion(int const);
1886 void WritePolygonUnsortedSequence(vector<vector<vector<int>>>&);
1887 void WritePolygonSortedSequence(vector<vector<vector<int>>>&);
1888 void WritePolygonActualMovement(vector<vector<vector<int>>>&);
1889 void DoEndOfRunDeletes(void);
1890
1891 protected:
1892 public:
1893 ofstream LogStream;
1894
1895 CSimulation(void);
1896 ~CSimulation(void);
1897
1899 double dGetMissingValue(void) const;
1900
1902 double dGetThisIterSWL(void) const;
1903
1905 double dGetThisIterTotWaterLevel(void) const;
1906
1907 // //! Returns the vertical tolerance for beach cells to be included in smoothing
1908 // double dGetMaxBeachElevAboveSWL(void) const;
1909
1911 // double dGetCellSide(void) const;
1912
1914 int nGetGridXMax(void) const;
1915
1917 int nGetGridYMax(void) const;
1918
1920 double dGetD50Fine(void) const;
1921
1923 double dGetD50Sand(void) const;
1924
1926 double dGetD50Coarse(void) const;
1927
1929 int nDoSimulation(int, char const*[]);
1930
1932 void DoSimulationEnd(int const);
1933};
1934#endif // SIMULATION_H
Contains CGeom2DPoint definitions.
Contains CGeom2DIPoint definitions.
Unified configuration class for CoastalME simulation parameters.
Geometry class used to represent 2D point objects with integer coordinates.
Definition 2di_point.h:25
Geometry class used to represent 2D point objects with floating-point coordinates.
Definition 2d_point.h:25
Geometry class used for coast polygon objects.
Geometry class used to represent 2D vector line objects.
Definition line.h:28
Geometry class used to represent coast profile objects.
Definition profile.h:33
Geometry cass used to represent the raster grid of cell objects.
Definition raster_grid.h:29
Real-world class used to represent the landform of a cell.
Real-world class used to represent the 'cliff' category of coastal landform object.
Definition cliff.h:28
Real-world class used to represent coastline objects.
Definition coast.h:39
Class used to represent a sediment input event.
double m_dThisIterPotentialBeachErosion
Total potential beach erosion (all size classes of unconsolidated sediment) for this iteration (depth...
Definition simulation.h:861
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:939
void CalcDepthOfClosure(void)
Calculate the depth of closure.
Definition utils.cpp:2760
bool m_bCliffCollapseSave
Save cliff collapse raster GIS files?
Definition simulation.h:216
int m_nLogFileDetail
The level of detail in the log file output. Can be LOG_FILE_LOW_DETAIL, LOG_FILE_MIDDLE_DETAIL,...
Definition simulation.h:588
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:105
bool m_bCliffToeLocate
Cliff to location?
Definition simulation.h:462
string m_strGDALISSDriverCode
GDAL code for the initial suspended sediment raster file.
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.
Definition simulation.h:768
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:243
bool bReadYamlFile(void)
Reads YAML configuration file.
bool bWriteRasterGISFile(int const, string const *, int const =0, double const =0)
Writes GIS raster files using GDAL, using data from the RasterGrid array.
int m_nGISMaxSaveDigits
The maximum number of digits in GIS filenames. These can be sequential, or the iteration number.
Definition simulation.h:516
int m_nYMinBoundingBox
The minimum y value of the bounding box.
Definition simulation.h:558
static void AnnounceReadSCAPEShapeFunctionFile(void)
Now reading the SCAPE shape function file.
Definition utils.cpp:734
double m_dSyntheticTransectSpacing
Approximate minimum spacing (m) between wave transects (real and synthetic) for wave interpolation de...
Definition simulation.h:843
string m_strGDALISSProjection
GDAL projection string for the initial suspended sediment raster file.
void CalcSavitzkyGolayCoeffs(void)
Calculates the Savitzky-Golay smoothing coefficients for a given size of smoothing window....
string m_strInitialSuspSedimentFile
Name of initial suspended sediment file.
bool m_bSlopeConsSedSave
Save slope of consolidated sediment raster GIS files?
Definition simulation.h:174
void FindAllSeaCells(void)
Finds and flags all sea areas which have at least one cell at a grid edge (i.e. does not flag 'inland...
void WritePolygonShorePlatformErosion(void)
Writes to the log file a table showing per-polygon unconsolidated sand/coarse sediment derived from e...
vector< double > m_VdTSDeepWaterWaveStationPeriod
Time series of wave period at deep water wave station.
static void CalcSavitzkyGolay(double[], int const, int const, int const, int const, int const)
CalcSavitzkyGolay uses LULinearSolve and LUDecomp. It returns dFilterCoeffsArray[nWindowSize],...
string m_strOGRVectorOutputExtension
GDAL-OGR vector output drive file extension.
CGeomLine LSmoothCoastRunningMean(CGeomLine *) const
Does running-mean smoothing of a CGeomLine coastline vector (is in external CRS coordinates)
int m_nNumTotCliffCollapse
The total number of cells with cliff collapse since the start of the simulation.
Definition simulation.h:537
bool bCheckRasterGISOutputFormat(void)
Checks whether the selected raster GDAL driver supports file creation, 32-bit doubles,...
void InterpolateCShoreOutput(vector< double > const *, int const, int const, vector< double > *, vector< double > *, vector< double > *, vector< double > *, vector< double > *, vector< double > *, vector< double > *, vector< double > *, vector< double > *)
static void AnnounceIsRunning(void)
Tell the user that the simulation is now running.
Definition utils.cpp:751
void DoCPUClockReset(void)
Resets the CPU clock timer to prevent it 'rolling over', as can happen during long runs....
Definition utils.cpp:1499
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:189
string m_strSedimentInputEventFile
The name of the sediment input events time series file.
bool m_bHaveConsolidatedSediment
Does this simulation consider consolidated sediment, or is it an unconsolidated sediment only simulat...
Definition simulation.h:456
void GetRasterOutputMinMax(int const, double &, double &, int const, double const)
Finds the max and min values in order to scale raster output if we cannot write doubles.
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007 Finish surge and runup stuff.
Definition simulation.h:441
time_t m_tSysEndTime
System finish-simulation time.
string m_strCMEIni
Folder for the CME .ini file.
double m_dTotalCoarseUnconsInPolygons
Total coarse unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells ...
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:396
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:825
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.
Definition utils.cpp:586
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
Definition simulation.h:726
string m_strGDALICDataType
GDAL data type of the initial intervention class raster file.
int m_nBeachErosionDepositionEquation
Which beach erosion-deposition equation is used. Possible values are UNCONS_SEDIMENT_EQUATION_CERC an...
Definition simulation.h:543
ofstream CliffCollapseNetChangeTSStream
Cliff collapse net change (erosion - deposition) time series file output stream.
bool m_bCoastSave
Save coastline as vector GIS file?
Definition simulation.h:261
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
Definition simulation.h:315
bool bWritePerTimestepResults(void)
Write the results for this timestep to the .out file.
static string strRemoveSubstr(string *, string const *)
Returns a string with a substring removed, and with whitespace trimmed.
Definition utils.cpp:2559
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
vector< string > m_VstrGDALICCDataType
GDAL data type for the initial consolidated coarse sediment GIS data.
int nMoveCliffTalusToUnconsolidated(void)
Move talus from previous cliff collapse to unconsolidated sediment.
int nCalcWavePropertiesOnProfile(int const, int const, CGeomProfile *, vector< double > *, vector< double > *, vector< double > *, vector< double > *, vector< bool > *)
Calculates wave properties along a coastline-normal profile using either the COVE linear wave theory ...
static bool bParseTime(string const *, int &, int &, int &)
Parses a time string into hours, minutes, and seconds, and checks each of them.
Definition utils.cpp:2865
double dGetThisIterTotWaterLevel(void) const
Returns this timestep's total water level TODO 007 Finish surge and runup stuff.
Definition utils.cpp:104
void AnnounceReadInitialSandConsSedGIS(int const) const
Tells the user that we are now reading the initial sand consolidated sediment depth GIS file.
Definition utils.cpp:696
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:477
string strListRasterFiles(void) const
Return a space-separated string containing the names of the raster GIS output files.
Definition utils.cpp:759
vector< double > m_VdDeepWaterWaveStationY
Y coordinate (grid CRS) for deep water wave station.
int nAssignLandformsForAllCoasts(void)
Each timestep, classify coastal landforms and assign a coastal landform object to every point on ever...
void AnnounceReadInitialSandUnconsSedGIS(int const) const
Tells the user that we are now reading the initial sand unconsolidated sediment depth GIS file.
Definition utils.cpp:657
void LocateAndCreateProfiles(int const, int &, vector< bool > *, vector< pair< int, double > > const *)
For a single coastline, locate the start points for all coastline-normal profiles (except the grid-ed...
double m_dL_0
Deep water wave length (m)
Definition simulation.h:759
double m_dWaveDataWrapHours
Number of hours after which deep water wave data wraps.
Definition simulation.h:984
static int nGetOppositeDirection(int const)
Returns the opposite direction.
string strListVectorFiles(void) const
Return a space-separated string containing the names of the vector GIS output files.
Definition utils.cpp:1019
CGeom2DIPoint PtiExtCRSToGridRound(CGeom2DPoint const *) const
Transforms a pointer to a CGeom2DPoint in the external CRS to the equivalent CGeom2DIPoint in the ras...
vector< string > m_VstrGDALICFDataType
GDAL data type for the initial consolidated fine sediment GIS data.
vector< int > m_VCellFloodLocation
The location to compute the total water level for flooding.
double m_dMaxUserInputWavePeriod
Used to constrain depth of closure.
Definition simulation.h:780
void WritePolygonInfoTable(void)
Writes to the log file a table showing polygon info for all coasts.
bool m_bFloodSetupSurgeRunupTSSave
Save the flood setup surge runup time series file? TODO 007 Finish surge and runup stuff.
Definition simulation.h:327
bool m_bTopSurfIncSeaSave
Save top surface (sediment, talus, and sea) raster DEMs?
Definition simulation.h:87
bool bSetUpTSFiles(void)
This member function intialises the time series files.
Definition utils.cpp:1215
ofstream LogStream
int nWriteEndRunDetails(void)
Writes end-of-run information to Out, Log and time-series files.
void AnnounceReadInitialFineUnconsSedGIS(int const) const
Tells the user that we are now reading the initial fine unconsolidated sediment depth GIS file.
Definition utils.cpp:644
vector< string > m_VstrGDALICCDriverCode
GDAL driver code for the initial consolidated coarse sediment GIS data.
double m_dThisIterBeachErosionCoarse
Total actual beach erosion (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:870
int m_nGISMissingValue
The value for integer missing values, as read from GIS input files.
Definition simulation.h:546
char ** m_papszGDALVectorOptions
Options for GDAL when handling vector files.
Definition simulation.h:474
bool m_bSedIncTalusTopSurfSave
Save sediment (inc talus) top surface raster DEMs?
Definition simulation.h:84
vector< CRWCoast > m_VFloodWaveSetupSurgeRunup
TODO 007 Finish surge and runup stuff.
double m_dStartIterUnconsCoarseAllCells
Depth (m) of coarse unconsolidated sediment at the start of the simulation, all cells (both inside an...
int nReadRasterGISFile(int const, int const)
Reads raster GIS datafiles into the RasterGrid array.
vector< CRWCoast > m_VCoast
The coastline objects.
double m_dCoastNormalLength
Length of the coastline-normal profiles, in m.
Definition simulation.h:840
int nLocateFloodAndCoasts(void)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
static string pstrChangeToForwardSlash(string const *)
Swaps all backslashes in the input string to forward slashes, leaving the original unchanged.
Definition utils.cpp:2469
vector< string > m_VstrGDALIUFDataType
GDAL data type for the initial unconsolidated fine sediment GIS data.
bool m_bSaveGISThisIter
Save GIS files this iteration?
Definition simulation.h:333
long double m_ldGTotCliffCollapseCoarseErodedDuringDeposition
All-simulation total of coarse sediment eroded during talus deposition following cliff collapse (m)
int nTraceCoastLine(unsigned int const, int const, int const, vector< bool > *, vector< CGeom2DIPoint > const *)
Traces a coastline (which is defined to be just above still water level) on the grid using the 'wall ...
double m_dGISMissingValue
The value for floating-point missing values, as read from GIS input files.
Definition simulation.h:978
double m_dUnconsCoarseNotDepositedLastIter
Depth of unconsolidated coarse sediment that could not be deposited during the last iteration,...
string m_strOGRSedInputDataType
GDAL data type for the sediment input event locations vector file.
void DoSimulationEnd(int const)
Carries out end-of-simulation tidying (error messages etc.)
Definition utils.cpp:2344
double m_dCPUClock
Total elapsed CPU time.
Definition simulation.h:708
bool bSaveAllVectorGISFiles(void)
The bSaveAllvectorGISFiles member function saves the vector GIS files TODO 081 Choose more files to o...
bool m_bSingleDeepWaterWaveValues
Do we have just a point source for (i.e. only a single measurement of) deep water wave values.
Definition simulation.h:387
string m_strRunName
The name of this simulation.
int nDoMultipleCoastlines(void)
Checks all profiles on all coasts for intersections between profiles belonging to different coasts.
int m_nThisSave
Used in calculations of GIS save intervals.
Definition simulation.h:525
static string strGetComputerName(void)
Returns a string, hopefully giving the name of the computer on which the simulation is running.
Definition utils.cpp:1474
long m_lGDALMaxCanWrite
The maximum integer value which GDAL can write, can be UINT8_MAX, INT16_MAX, UINT16_MAX,...
Definition simulation.h:603
static string strDispSimTime(double const)
strDispSimTime returns a string formatted as year Julian_day hour, given a parameter in hours
Definition utils.cpp:1633
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:123
int nTraceAllFloodCoasts(void)
Locates all the potential coastline start points on the edges of the raster grid, then traces vector ...
void FloodFillLand(int const, int const)
Use the sealevel, wave set-up and run-up to evaluate flood hydraulically connected TODO 007 Finish su...
bool bConfigureFromYamlFile(CConfiguration &config)
Configures simulation from YAML file.
void MarkProfilesOnGrid(int const, int &)
For this coastline, marks all coastline-normal profiles (apart from the two 'special' ones at the sta...
double m_dSouthEastXExtCRS
The south-east x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:663
vector< TransectWaveData > m_VAllTransectsWithSynthetic
Storage for wave transect points (real and synthetic) for debug output.
string m_strSCAPEShapeFunctionFile
Name of SCAPE shape function file.
int m_nMissingValue
Used by CoastalME for integer missing values.
Definition simulation.h:549
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:117
long double m_ldGTotActualCoarseBeachErosion
All-simulation total of coarse sediment eroded during beach (unconsolidated sediment) movement (m)
int nCalcExternalForcing(void)
Calculate external forcings: change in still water level, tide level and deep water waves height,...
int nReadWaveStationInputFile(int const)
bool m_bCliffEdgeSave
Save cliff edge vector GIS files?
Definition simulation.h:264
double m_dFineErodibilityNormalized
Relative erodibility of fine unconsolidated beach sediment, normalized.
Definition simulation.h:810
bool bWriteVectorGISFile(int const, string const *)
Writes vector GIS files using GDAL/OGR.
double m_dThisIterCliffCollapseFineErodedDuringDeposition
Total fine sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:894
void nCalcSlopeAtAllCells(void)
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
Definition simulation.h:270
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:288
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Finish surge and runup stuff.
Definition simulation.h:747
static CGeom2DPoint PtChooseEndPoint(int const, CGeom2DPoint const *, CGeom2DPoint const *, double const, double const, double const, double const)
Choose which end point to use for the coastline-normal profile.
int nDoSimulationTimeMultiplier(string const *)
Given a string containing time units, this sets up the appropriate multiplier and display units for t...
Definition utils.cpp:411
int nReadSedimentInputEventFile(void)
Reads the sediment input event file.
vector< int > m_VnSedimentInputLocationID
ID for sediment input location, this corresponds with the ID in the sediment input time series file.
double m_dThisIterActualPlatformErosionCoarseCons
Total actual platform erosion (coarse consolidated sediment) for this iteration (depth in m)
Definition simulation.h:858
int m_nNumThisIterCliffCollapse
The number of cells with cliff collapse this iteration.
Definition simulation.h:534
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:156
void FindClosestPointOnStraightLine(double const, double const, double const, double const, double const, double const, double &, double &)
For the straight line between two points A and B, and given another point C, this finds the closest p...
int nDoAllShorePlatFormErosion(void)
Does platform erosion on all coastlines by first calculating platform erosion on coastline-normal pro...
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:480
vector< double > m_VdErosionPotential
For erosion potential lookup.
int nLocateCliffToe(void)
double m_dThisIterTopElevMin
This-iteration lowest elevation of DEM.
Definition simulation.h:990
void InitializeGDALPerformance(void)
Initialize GDAL with performance optimizations.
vector< double > m_VdTideData
Tide data: one record per timestep, is the change (m) from still water level for that timestep.
vector< string > m_VstrGDALIUFProjection
GDAL projection for the initial unconsolidated fine sediment GIS data.
bool m_bRunUpSave
Are we saving runup? TODO 007 Finish surge and runup stuff.
Definition simulation.h:420
bool m_bWaveTransectPointsSave
Save wave transect points vector GIS files?
Definition simulation.h:285
void ConstructParallelProfile(int const, int const, int const, int const, int const, vector< CGeom2DIPoint > *const, vector< CGeom2DIPoint > *, vector< CGeom2DPoint > *)
Constructs a parallel coastline-normal profile.
normal_distribution< double > m_dGetFromUnitNormalDist
c++11 unit normal distribution (mean = 0, stdev = 1)
GDALDataType m_GDALWriteIntDataType
The data type used by GDAL for integer operations, can be GDT_Byte, GDT_Int16, GDT_UInt16,...
Definition simulation.h:597
long double m_ldGTotCliffTalusFineToSuspension
All-simulation total of fine sediment moved to suspension, due to cliff collapse (m)
void ErodeCellBeachSedimentSupplyLimited(int const, int const, int const, int const, double const, double &)
Erodes the unconsolidated beach sediment on a single cell, for a single size class,...
bool m_bYamlInputFormat
Use YAML format for input datafile instead of .dat format?
Definition simulation.h:348
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:222
int nSaveParProfile(int const, CGeomProfile const *, int const, int const, int const, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< CGeom2DIPoint > *const, vector< double > const *) const
Save a coastline-normal parallel profile.
string m_strSedimentInputEventShapefile
The name of the sediment input events shape file.
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:150
static string strTrimLeft(string const *)
Trims whitespace from the left side of a string, does not change the original string.
Definition utils.cpp:2479
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:252
double m_dCoarseErodibility
The relative erodibility (0-1) of coarse unconsolidated beach sediment.
Definition simulation.h:807
double m_dGeoTransform[6]
GDAL geotransformation info (see http://www.gdal.org/classGDALDataset.html)
Definition simulation.h:711
double m_dMaxSWLSoFar
Maximum still water level (m)
Definition simulation.h:738
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:942
static CGeom2DIPoint PtiGetPerpendicular(CGeom2DIPoint const *, CGeom2DIPoint const *, double const, int const)
Returns a CGeom2DIPoint (grid CRS) which is the 'other' point of a two-point vector passing through P...
string m_strVectorGISOutFormat
Vector GIS output format.
void ProcessShadowZoneCell(int const, int const, int const, CGeom2DIPoint const *, int const, int const, int const)
Process a single cell which is in the shadow zone, changing its wave height and orientation.
vector< string > m_VstrGDALICFDriverCode
GDAL driver code for the initial consolidated fine sediment GIS data.
vector< string > m_VstrInitialFineConsSedimentFile
The name of the initial fine-sized consolidated sediment GIS file.
double m_dMissingValue
Used by CoastalME for floating-point missing values.
Definition simulation.h:981
double m_dNotchIncisionAtCollapse
Notch overhang (i.e. length of horizontal incision at the apex elevation) to initiate collapse (m)
Definition simulation.h:927
int m_nUnconsSedimentHandlingAtGridEdges
How sediment which moves off an edge of the grid is handled. Possible values are GRID_EDGE_CLOSED,...
Definition simulation.h:540
static double dGetDistanceBetween(CGeom2DPoint const *, CGeom2DPoint const *)
Returns the distance (in external CRS) between two points.
double m_dSandErodibility
The relative erodibility (0-1) of sand unconsolidated beach sediment.
Definition simulation.h:804
bool m_bBasementElevSave
Save basement raster DEMs?
Definition simulation.h:81
void CreateRasterizedProfile(int const, CGeomProfile *, vector< CGeom2DIPoint > *, vector< bool > *, bool &, bool &, bool &, bool &, bool &, bool &)
Given a pointer to a coastline-normal profile, returns an output vector of cells which are 'under' ev...
double m_dInvCellDiagonal
Inverse of m_dCellDiagonal.
Definition simulation.h:684
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:573
int nDoAllShadowZones(void)
Finds wave shadow zones and modifies waves in and near them. Note that where up-coast and down-coast ...
static CGeom2DPoint PtAverage(CGeom2DPoint const *, CGeom2DPoint const *)
Returns a point (external CRS) which is the average of (i.e. is midway between) two other external CR...
double m_dCoarseErodibilityNormalized
Relative erodibility of coarse unconsolidated beach sediment, normalized.
Definition simulation.h:816
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
Definition simulation.h:195
string m_strGDALLDriverCode
GDAL code for the for the initial landform class raster file.
bool m_bSuspSedTSSave
Save the suspended sediment time series file?
Definition simulation.h:321
static double dKeepWithin360(double const)
Constrains the supplied angle to be within 0 and 360 degrees.
string m_strDeepWaterWaveStationsShapefile
The name of the deep water wave stations shape file.
vector< double > m_VdDepthOverDB
For erosion potential lookup.
void CalcCoastTangents(int const)
Calculates tangents to a coastline: the tangent is assumed to be the orientation of energy/sediment f...
bool m_bCliffCollapseNetTSSave
Save the cliff collapse net change time series file?
Definition simulation.h:309
double m_dStartIterSuspFineInPolygons
Depth (m) of fine suspended sediment at the start of the simulation (only cells in polygons)
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
Definition simulation.h:231
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:624
static void AnnounceSimEnd(void)
Announce the end of the simulation.
Definition utils.cpp:1549
vector< string > m_VstrGDALICSDriverCode
GDAL driver code for the initial consolidated sand sediment GIS data.
unsigned long m_ulNumCells
The number of cells in the grid.
Definition simulation.h:618
void DoCliffCollapseTalusDeposition(int const, CRWCliff const *, double const, double const, int const)
Deposit the unconsolidated sediment from cliff collapse as talus on the cell on which collapse occurr...
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:915
int nGetGridYMax(void) const
Returns the size of the grid in the Y direction.
Definition utils.cpp:136
void AnnounceReadICGIS(void) const
Tells the user that we are now reading the Intervention class GIS file.
Definition utils.cpp:556
bool m_bFloodLocationSave
Are we saving the flood location? TODO 007 Finish surge and runup stuff.
Definition simulation.h:435
void KeepWithinValidGrid(int &, int &) const
Constrains the supplied point (in the grid CRS) to be a valid cell within the raster grid.
int nCheckForSedimentInputEvent(void)
Check to see if we have any sediment input events this timestep, if so then do the event(s)
vector< CGeomLine > m_VLowestSWLCoastLine
Coastline (external CRS) at the lowest SWL so far during this simulation.
double m_dWaveDepthRatioForWaveCalcs
Start depth for wave calculations.
Definition simulation.h:762
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:108
string m_strGDALISSDataType
GDAL data type for the initial suspended sediment raster file.
void WriteStartRunDetails(void)
Writes beginning-of-run information to Out and Log files.
int nTruncateProfileMultiLineDifferentCoasts(CGeomProfile *, double const, double const)
Truncates the CGeomMultiLine (external CRS) of a profile which has hit a different coast,...
double m_dThisIterCliffCollapseErosionCoarseUncons
This-iteration total of coarse unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:954
vector< string > m_VstrGDALIUCProjection
GDAL projection for the initial unconsolidated coarse sediment GIS data.
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:372
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:171
ofstream CliffCollapseDepositionTSStream
Cliff collapse deposition time series file output stream.
int nTruncateProfilesDifferentCoasts(int const, int const, int const, int const, int const, int const)
Truncates two intersecting coast-normal profile belonging to different coasts.
string m_strGDALLDataType
GDAL data type for the initial landform class raster file.
vector< CRWCoast > m_VFloodWaveSetupSurge
TODO 007 Finish surge and runup stuff.
static string strTrim(string const *)
Trims whitespace from both sides of a string, does not change the original string.
Definition utils.cpp:2514
string m_strRasterGISOutFormat
Raster GIS output format.
string m_strGDALIWDriverCode
GDAL code for the initial water depth raster file.
long double m_ldGTotCoarseBeachDeposition
All-simulation total of coarse sediment deposited during beach (unconsolidated sediment) movement (m)
double m_dDepositionCoarseDiff
Error term: if we are unable to deposit enough unconslidated coarse on polygon(s),...
Definition simulation.h:906
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:168
int m_nCoastMax
Maximum valid coast length when searching for coasts.
Definition simulation.h:528
int nCreateCShoreInfile(int const, int const, int const, int const, int const, int const, int const, int const, int const, int const, int const, int const, int const, double const, double const, double const, double const, double const, double const, double const, double const, vector< double > const *, vector< double > const *, vector< double > const *)
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0-1)
Definition simulation.h:798
double dGetMissingValue(void) const
Returns the NODATA value.
Definition utils.cpp:88
static void AnnounceFinalInitialization(void)
Tells the user that we are now initializing.
Definition utils.cpp:742
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:567
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:576
bool m_bGDALOptimisations
GDAL optimisations enabled?
Definition simulation.h:459
unsigned long m_ulThisIterNumActualPlatformErosionCells
The number of grid cells on which actual platform erosion occurs, for this iteration.
Definition simulation.h:630
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:192
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:300
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 ...
Definition utils.cpp:2926
int m_nCoastNormalSpacing
Average spacing between coastline normals, measured in cells.
Definition simulation.h:507
int m_nXMaxBoundingBox
The maximum x value of the bounding box.
Definition simulation.h:555
string m_strOGRFloodGeometry
GDAL geometry for the flood input locations point or vector file.
bool bCreateNotchInland(int const, int const, int const, int const, double const, double const)
If possible, creates an erosional notch further inland from a given coastline point.
long double m_ldGTotPotentialSedLostBeachErosion
All-simulation total of potential sediment lost via beach (unconsolidated) sediment movement (m),...
bool bIsAdjacentEdgeCell(CGeom2DIPoint const *, CGeom2DIPoint const *)
Given two different edge cells, returns true if they are adjacent.
double m_dThisIterCliffCollapseErosionFineUncons
This-iteration total of fine unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:948
double dGetD50Coarse(void) const
Returns the global d50 value for coarse sediment.
Definition utils.cpp:160
string m_strOGRSedInputDriverDesc
bool m_bTotCliffCollapseSave
Save total cliff collapse raster GIS files?
Definition simulation.h:219
int nReadShapeFunctionFile(void)
void MergeProfilesAtFinalLineSegments(int const, CGeomProfile *, CGeomProfile *, int const, int const, double const, double const, double const, double const)
Merges two profiles which intersect at their final (most seaward) line segments, seaward of their poi...
static void AnnounceAddLayers(void)
Tells the user that we are now adding layers.
Definition utils.cpp:516
unsigned long m_ulMissingValue
Used by CoastalME for unsigned long integer missing values.
Definition simulation.h:651
vector< unsigned long > m_VlDeepWaterWaveValuesAtTimestep
Calculate deep water wave values at these timesteps.
int nDoAllActualBeachErosionAndDeposition(void)
Does between-polygon and within-polygon actual (supply-limited) redistribution of transported beach s...
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:363
bool m_bLowestSWLSoFar
Do we have the lowest SWL so far?
Definition simulation.h:468
bool m_bSliceSave
Save slices?
Definition simulation.h:99
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
Definition simulation.h:228
double m_dInitialMeanSWL
The start-of-simulation still water level (m)
Definition simulation.h:717
string m_strOGRDWWVDriverCode
GDAL code for the deep water wave stations vector file.
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:165
double m_dThisIterNewNotchApexElev
Elevation (m) of the apex of any cliff notches created during this iteration.
Definition simulation.h:930
vector< double > m_VdFloodLocationX
X coordinate (grid CRS) for total water level flooding.
double m_dNorthWestYExtCRS
The north-west y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:660
vector< string > m_VstrGDALICSDriverDesc
GDAL driver description for the initial consolidated sand sediment GIS data.
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:258
int m_nLayers
The number of sediment layers.
Definition simulation.h:483
bool bFindExeDir(char const *)
Finds the folder (directory) in which the CoastalME executable is located.
Definition utils.cpp:316
double m_dStartIterConsCoarseAllCells
Depth (m) of coarse consolidated sediment at the start of the simulation, all cells (both inside and ...
double m_dStartIterConsSandAllCells
Depth (m) of sand consolidated sediment at the start of the simulation, all cells (both inside and ou...
int m_nCoastSmoothingWindowSize
The size of the window used for coast smoothing. Must be an odd number.
Definition simulation.h:489
void InterpolateWavePropertiesBetweenProfiles(int const, int const)
Interpolates wave properties from profiles to the coastline points between two profiles....
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...
Definition utils.cpp:2717
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:402
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:393
bool m_bFloodSWLSetupSurgeRunupLineSave
Are we saving the flood still water level setup surge runup line? TODO 007 Finish surge and runup stu...
Definition simulation.h:450
unsigned long m_ulThisIterNumBeachDepositionCells
The number of grid cells on which beach (unconsolidated sediment) deposition occurs,...
Definition simulation.h:639
double m_dInmersedToBulkVolumetric
For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) tra...
Definition simulation.h:828
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:267
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:111
static string strToLower(string const *)
Returns the lower case version of an string, leaving the original unchanged.
Definition utils.cpp:2539
vector< CGeomLine > m_VHighestSWLCoastLine
Coastline (external CRS) at the highest SWL so far during this simulation.
vector< double > m_VdThisIterDeepWaterWaveStationHeight
This-iteration wave height at deep water wave station.
int nCalcPotentialPlatformErosionBetweenProfiles(int const, CGeomProfile *, int const)
Calculates potential platform erosion on cells to one side of a given coastline-normal profile,...
CSimulation(void)
The CSimulation constructor.
double m_dDepositionSandDiff
Error term: if we are unable to deposit enough unconslidated sand on polygon(s), this is held over to...
Definition simulation.h:903
string m_strGDALBasementDEMDriverCode
GDAL code for the basement DEM raster file type.
vector< string > m_VstrGDALIUFDriverCode
GDAL driver code for the initial unconsolidated fine sediment GIS data.
void WritePolygonSortedSequence(vector< vector< vector< int > > > &)
Writes to the log file a table showing the sorted sequence of polygon processing for all coasts,...
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
Definition simulation.h:75
unsigned long m_ulMissingValueBasementCells
The number of basement cells marked with as missing value.
Definition simulation.h:648
int nSaveProfile(int const, CGeomProfile const *, int const, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< CGeom2DIPoint > *const, vector< double > const *) const
Save a coastline-normal profile.
void WritePolygonSedimentBeforeMovement(void)
Writes to the log file a table showing per-polygon totals of stored unconsolidated beach sediment pri...
double m_dThisiterUnconsCoarseInput
Depth (m) of coarse unconsolidated sediment added, at this iteration.
Definition simulation.h:999
int nReadVectorGISFile(int const)
Reads vector GIS datafiles using GDAL/OGR.
bool bReadRunDataFile(void)
Reads the run details input file and does some initialization.
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:522
double m_dThisIterPotentialPlatformErosion
Total potential platform erosion (all size classes of consolidated sediment) for this iteration (dept...
Definition simulation.h:849
bool bWriteTSFiles(void)
Write the results for this timestep to the time series CSV files.
double m_dDeanProfileStartAboveSWL
Berm height i.e. height above SWL of start of depositional Dean profile.
Definition simulation.h:975
int m_nSavGolCoastPoly
The order of the coastline profile smoothing polynomial if Savitzky-Golay smoothing is used (usually ...
Definition simulation.h:492
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:102
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:120
ofstream BeachDepositionTSStream
Beach sediment deposition time series file output stream.
vector< double > dVSmoothProfileSlope(vector< double > *) const
Does running-mean smoothing of the slope of a coastline-normal profile.
string m_strInitialBasementDEMFile
Name of initial basement DEM file.
int m_nRunUpEquation
The run-up equation used TODO 007 Finish surge and runup stuff.
Definition simulation.h:591
long double m_ldGTotCliffCollapseFine
All-simulation total of fine sediment from cliff collapse (m)
bool m_bWorldFile
Write a GIS World file?
Definition simulation.h:384
long double m_ldGTotCliffTalusCoarseDeposition
All-simulation total of coarse sediment deposited as talus following cliff collapse (m)
int nDoSedimentInputEvent(int const)
Do a sediment input event.
static string strTrimRight(string const *)
Trims whitespace from the right side of a string, does not change the original string.
Definition utils.cpp:2494
vector< double > m_VdDeepWaterWaveStationX
X coordinate (grid CRS) for deep water wave station.
void AnnounceReadSedimentEventInputValuesGIS(void) const
Tells the user that we are now reading the sediment input events GIS file.
Definition utils.cpp:601
double dGetD50Fine(void) const
Returns the global d50 value for fine sediment.
Definition utils.cpp:144
string m_strLogFile
Name of output log file.
double m_dDepthOverDBMax
Maximum value of deoth over DB, is used in erosion potential look-up function.
Definition simulation.h:909
long double m_ldGTotCliffCollapseCoarse
All-simulation total of coarse sediment from cliff collapse (m)
int m_nCoastNormalInterventionSpacing
Average spacing between coastline normals on interventions, measured in cells.
Definition simulation.h:510
double m_dFineErodibility
The relative erodibility (0-1) of fine unconsolidated beach sediment.
Definition simulation.h:801
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
Definition simulation.h:993
time_t m_tSysStartTime
System start-simulation time.
double m_dBreakingWaveHeightDepthRatio
Breaking wave height-to-depth ratio.
Definition simulation.h:765
void AnnounceReadFloodLocationGIS(void) const
Tells the user that we are now reading the flood location GIS file.
Definition utils.cpp:616
double m_dCoastNormalSpacing
Average spacing of the coastline-normal profiles, in m.
Definition simulation.h:834
int nDoUnconsDepositionOnPolygon(int const, CGeomCoastPolygon *, int const, double, double &)
Deposits unconsolidated beach sediment (sand or coarse) on the cells within a polygon....
bool bCheckVectorGISOutputFormat(void)
Checks whether the selected vector GDAL/OGR driver supports file creation etc.
bool m_bHaveWaveStationData
Do we have wave station data?
Definition simulation.h:390
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:714
int nDoSimulation(int, char const *[])
Runs the simulation.
int nReadCShoreOutput(int const, string const *, int const, int const, vector< double > const *, vector< double > *)
void StartClock(void)
Starts the clock ticking.
Definition utils.cpp:292
long double m_ldGTotSuspendedSediment
All-simulation total of suspended sediment (m)
vector< double > m_VdSedimentInputLocationX
X coordinate (grid CRS) for sediment input event.
bool m_bSlopeSaveForCliffToe
Save slope raster grids (used for cliff toe location)?
Definition simulation.h:93
int m_nSavGolCliffEdgePoly
The order of the cliff edge smoothing polynomial if Savitzky-Golay smoothing is used (usually 2 or 4,...
Definition simulation.h:501
int nCreateAllPolygons(void)
Create polygons, and mark the polygon boundaries on the raster grid.
double m_dSandErodibilityNormalized
Relative erodibility of sand unconsolidated beach sediment, normalized.
Definition simulation.h:813
double m_dR
Coast platform resistance to erosion R, see Walkden & Hall, 2011.
Definition simulation.h:783
void WritePolygonSedimentInputEventTable(void)
Writes to the log file a table showing per-polygon sediment input event totals for all coasts.
string m_strGDALLProjection
GDAL projection string for the initial landform class raster file.
bool m_bCliffCollapseTimestepSave
Are we saving the timestep at which each cliff occurred?
Definition simulation.h:447
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
Definition simulation.h:210
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:213
void AnnounceReadInitialSuspSedGIS(void) const
Tells the user that we are now reading the initial suspended sediment depth GIS file.
Definition utils.cpp:631
int nCellByCellFillShadowZone(int const, int const, CGeom2DIPoint const *, CGeom2DIPoint const *, CGeom2DIPoint const *)
Cell-by-cell fills a shadow zone from the centroid.
void DoEndOfRunDeletes(void)
Do end-of-run memory clearance.
Definition utils.cpp:3078
vector< string > m_VstrInitialSandUnconsSedimentFile
The name of the initial sand-sized unconsolidated sediment GIS file.
double m_dThisIterActualPlatformErosionSandCons
Total actual platform erosion (sand consolidated sediment) for this iteration (depth in m)
Definition simulation.h:855
void nTraceSeawardCliffEdge(void)
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:357
string m_strGDALIHProjection
GDAL projection string for the initial intervention height raster file.
void CheckForIntersectingProfiles(void)
Checks all coastline-normal profiles for intersection, and modifies those that intersect.
int nTraceFloodCoastLine(unsigned int const, int const, int const, vector< bool > *, vector< CGeom2DIPoint > const *)
Traces a coastline (which is defined to be just above still water level) on the grid using the 'wall ...
static int nDoTimeUnits(string const *)
This finds time units in a string.
Definition utils.cpp:450
void RasterizePolygonJoiningLine(int const, CGeom2DIPoint const *, CGeom2DIPoint const *, int const)
Puts a polygon 'joining line' (the line which is the seaward boundary of the polygon,...
string m_strGDALICDriverDesc
GDAL description of the initial intervention class raster file.
bool m_bSedimentInputAtCoast
Do we have sediment input at the coast?
Definition simulation.h:399
static void AnnounceReadRasterFiles(void)
Now reading raster GIS files.
Definition utils.cpp:525
vector< CGeomLine > m_VCliffToe
The traced cliff toe lines (in external CRS)
int m_nCliffEdgeSmooth
Which method to use for cliff edge smoothing.
Definition simulation.h:495
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:924
vector< string > m_VstrGDALIUSProjection
GDAL projection for the initial unconsolidated sand sediment GIS data.
double m_dThisIterBeachDepositionCoarse
Total beach deposition (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:876
vector< double > m_VdThisIterDeepWaterWaveStationPeriod
This-iteration wave period at deep water wave station.
double dGridCentroidYToExtCRSY(int const) const
Given the integer Y-axis ordinate of a cell in the raster grid CRS, returns the external CRS Y-axis o...
Definition gis_utils.cpp:74
double m_dD50Sand
The D50 for sand sediment.
Definition simulation.h:789
void CalcD50AndFillWaveCalcHoles(void)
Calculates an average d50 for each polygon. Also fills in 'holes' in active zone and wave calcs i....
void WritePolygonPreExistingSedimentTable(void)
Writes to the log file a table showing per-polygon pre-existing unconsolidated sediment for all coast...
long double m_ldGTotCliffTalusSandDeposition
All-simulation total of sand sediment deposited as talus following cliff collapse (m)
double m_dCellDiagonal
Length of a cell's diagonal (in external CRS units)
Definition simulation.h:678
string m_strCMEDir
The CME folder.
int nCreateProfile(int const, int const, int const, int const, bool const, CGeom2DIPoint const *)
Creates a single coastline-normal profile (which may be an intervention profile)
vector< int > m_VnProfileToSave
The numbers of the profiles which are to be saved.
void FillInBeachProtectionHolesAndRemoveLegacyCliffs(void)
Fills in 'holes' in the beach protection i.e. orphan cells which get omitted because of rounding prob...
int nDoCliffCollapse(int const, CRWCliff *, double &, double &, double &, int &, double &, double &)
Simulates cliff collapse on a single cell. Collapse happens when when a notch which is incised into t...
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:246
double m_dSlopeThresholdForCliffToe
Slope limit for cliff toe detection.
vector< double > VdInterpolateCShoreProfileOutput(vector< double > const *, vector< double > const *, vector< double > const *)
Returns a linearly interpolated vector of doubles, to make CShore profile output compatible with CME....
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:132
bool m_bCliffToeSave
Save cliff toe raster grids?
Definition simulation.h:96
double m_dKLS
Transport parameter KLS in the CERC equation.
Definition simulation.h:819
ofstream BeachSedimentNetChangeTSStream
Beach sediment net change (erosion - deposition) time series file output stream.
double m_dInvCellSide
Inverse of m_dCellSide.
Definition simulation.h:681
bool bIncreaseCliffNotchIncision(int const, int const, int const, CRWCliff *, double const)
Increase the incision (if any) of a cliff notch, assuming a linear decrease in incision with distance...
string m_strOGRDWWVDriverDesc
int m_nWavePropagationModel
The wave propagation model used. Possible values are WAVE_MODEL_CSHORE and WAVE_MODEL_COVE.
Definition simulation.h:564
long double m_ldGTotCliffCollapseSandErodedDuringDeposition
All-simulation total of sand sediment eroded during talus deposition following cliff collapse (m)
double m_dAllCellsDeepWaterWaveAngle
Deep water wave angle for all sea cells.
Definition simulation.h:771
static bool bOnOrOffShoreAndUpOrDownCoast(double const, double const, int const, bool &)
Determines whether the wave orientation at this point on a coast is onshore or offshore,...
vector< string > m_VstrGDALICFProjection
GDAL projection for the initial consolidated fine sediment GIS data.
string m_strOGRFloodDriverCode
GDAL code for the flood input locations point or vector file.
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:693
vector< string > m_VstrGDALICCProjection
GDAL projection for the initial consolidated coarse sediment GIS data.
static double dGetTimeMultiplier(string const *)
Given a string containing time units, this returns the appropriate multiplier.
Definition utils.cpp:376
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:273
void GenerateSyntheticTransects(vector< TransectWaveData > const *, vector< TransectWaveData > *)
double m_dMinSWLSoFar
Minimum still water level (m)
Definition simulation.h:735
int nGetGridXMax(void) const
Returns the cell size.
Definition utils.cpp:128
int m_nCliffEdgeSmoothWindow
The size of the window used for cliff edge smoothing. Must be an odd number.
Definition simulation.h:498
int m_nDeepWaterWaveDataNumTimeSteps
The duration of data for deep water waves, expressed as a number of timesteps.
Definition simulation.h:585
bool bWriteProfileData(int const, CGeomProfile const *, int const, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< CGeom2DIPoint > *const, vector< double > const *) const
Writes values for a single profile, for checking purposes.
void AnnounceReadBasementDEM(void) const
Tells the user that we are now reading the DEM file.
Definition utils.cpp:495
int nConvertMetresToNumCells(double const) const
Given a length in m, this returns the rounded equivalent number of cells.
void nLocateCliffCell(void)
int nInterpolateWavesToPolygonCells(vector< TransectWaveData > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *)
long double m_ldGTotCoarseSedimentInput
All-simulation total of coarse sediment input (m)
double m_dFinalMeanSWL
The end-of-simulation still water (m), is same as m_dInitialMeanSWL unless SWL changes.
Definition simulation.h:720
double dGridYToExtCRSY(double const) const
Given a real-valued Y-axis ordinate in the raster grid CRS (i.e. not the centroid of a cell),...
bool bWriteParProfileData(int const, int const, int const, int const, int const, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< CGeom2DIPoint > *const, vector< double > const *) const
Writes values for a single parallel profile, for checking purposes.
double m_dThisIterUnconsCoarseCliffDeposition
This-iteration total of coarse unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:969
bool bWritePerTimestepResultsCSV(void)
Write the results for this timestep to the .out file in CSV format.
bool m_bGDALCanWriteInt32
Is the selected GDAL output file format capable of writing 32-bit integers to files?
Definition simulation.h:378
bool m_bRasterWaveFloodLineSave
Are we saving the raster wave flood line? TODO 007 Finish surge and runup stuff.
Definition simulation.h:429
bool m_bSWLTSSave
Save the SWL (still water level) time series file?
Definition simulation.h:297
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:135
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:846
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:912
int m_nCoastMin
Minimum valid coast length when searching for coasts.
Definition simulation.h:531
string m_strMailAddress
An email addresx to which to send end-of-simulation messages.
double m_dRegularSaveTime
The time of the next save, in hours from the start of the simulation, if we are saving regularly.
Definition simulation.h:696
bool bConfigureFromDatFile(CConfiguration &config)
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:276
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:351
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
double m_dThisIterUnconsSandCliffDeposition
This-iteration total of sand unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:966
vector< int > m_VnDeepWaterWaveStationID
ID for deep water wave station, this corresponds with the ID in the wave time series file.
long double m_ldGTotSandSedimentInput
All-simulation total of sand sediment input (m)
string strListTSFiles(void) const
Return a space-separated string containing the names of the time series output files.
Definition utils.cpp:1123
bool m_bFloodSetupSurgeTSSave
Save the flood setup surge time series file? TODO 007 Finish surge and runup stuff.
Definition simulation.h:324
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:147
string m_strGDALLDriverDesc
GDAL description of the initial landform class raster file.
void SetRasterFileCreationDefaults(void)
Sets per-driver defaults for raster files created using GDAL.
bool m_bSetupSurgeFloodMaskSave
Are we saving the setup surge flood mask? TODO 007 Finish surge and runup stuff.
Definition simulation.h:423
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:129
double m_dNorthWestXExtCRS
The north-west x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:657
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:792
vector< CGeom2DIPoint > m_VEdgeCell
Edge cells.
static bool bCheckForIntersection(CGeomProfile *const, CGeomProfile *const, int &, int &, double &, double &, double &, double &)
Checks all line segments of a pair of coastline-normal profiles for intersection. If the lines inters...
int nInterpolateAllDeepWaterWaveValues(void)
static void AnnounceStart(void)
Tells the user that we have started the simulation.
Definition utils.cpp:272
static int nUpdateIntervention(void)
Check to see if we have a new intervention in place (not yet implemented)
vector< int > m_VnFloodLocationID
ID for flood location.
int m_nCoastCurvatureInterval
Coast curvature interval is a length, measured in coastline points.
Definition simulation.h:513
ofstream SWLTSStream
SWL time series file output stream.
vector< unsigned long > m_VulProfileTimestep
Timesteps at which to save profiles.
int nCalcPotentialPlatformErosionOnProfile(int const, CGeomProfile *)
Calculates potential (i.e. unconstrained by available sediment) erosional lowering of the shore platf...
ofstream CliffCollapseErosionTSStream
Cliff collapse erosion time series file output stream.
double m_dThisIterPotentialSedLostBeachErosion
Total unconsolidated sediment from beach erosion (all size classes) lost from the grid this iteration...
Definition simulation.h:882
bool m_bHighestSWLSoFar
Do we have the highest SWL so far?
Definition simulation.h:465
double m_dSouthEastYExtCRS
The south-east y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:666
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:153
static bool bParseDate(string const *, int &, int &, int &)
Parses a date string into days, months, and years, and checks each of them.
Definition utils.cpp:2804
string m_strFloodLocationShapefile
The name of the flood loction events shape file.
long double m_ldGTotCliffCollapseFineErodedDuringDeposition
All-simulation total of fine sediment eroded during talus deposition following cliff collapse (m)
~CSimulation(void)
The CSimulation destructor.
long double m_ldGTotCoarseDepositionDiff
All-simulation total of shortfall in unconsolidated coarse sediment deposition (m,...
int nSetAllCoastpointDeepWaterWaveValues(void)
Give every coast point a value for deep water wave height and direction TODO 005 This may not be real...
double m_dStartIterConsFineAllCells
Depth (m) of fine consolidated sediment at the start of the simulation, all cells (both inside and ou...
long double m_ldGTotActualCoarseLostBeachErosion
All-simulation total of coarse sediment lost via beach (unconsolidated) sediment movement (m)
bool m_bGISSaveDigitsSequential
Are the GIS save digits (which are part of each GIS file name) sequential, or are they the iteration ...
Definition simulation.h:453
static CGeom2DIPoint PtiFollowWaveAngle(CGeom2DIPoint const *, double const, double &)
Given a cell and a wave orientation, finds the 'upwave' cell.
vector< double > m_VdSavGolFCRWCoast
Savitzky-Golay filter coefficients for the coastline vector(s)
vector< double > m_VdSavGolFCGeomProfile
Savitzky-Golay filter coefficients for the profile vectors.
int nUpdateGrid(void)
Update all cells in the raster raster grid and do some per-timestep accounting.
int m_nSimStartMonth
Start date of the simulation (month)
Definition simulation.h:579
CGeomLine nValidateCliffToeDirection(CGeomLine &CliffEdge, bool bReverse)
int nGetCoastNormalEndPoint(int const, int const, int const, CGeom2DPoint const *, double const, CGeom2DPoint *, CGeom2DIPoint *, bool const)
Finds the end point of a coastline-normal line, given the start point on the vector coastline....
int nAssignLandformsForAllCells(void)
Each timestep, classify landforms for cells that are not on the coastline.
string m_strGDALIWProjection
GDAL projection string for the initial water depth raster file.
bool m_bSuspSedSave
Save suspended sediment raster GIS files?
Definition simulation.h:183
double m_dMinCliffTalusHeightFrac
Minimum height of the landward end of cliff collapse talus, as a fraction of cliff elevation.
Definition simulation.h:945
double m_dThisIterBeachErosionSand
Total actual beach erosion (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:867
static double dAngleSubtended(CGeom2DIPoint const *, CGeom2DIPoint const *, CGeom2DIPoint const *)
Returns the signed angle BAC (in radians) subtended between three CGeom2DIPoints B A C....
vector< string > m_VstrGDALIUSDriverDesc
GDAL driver description for the initial unconsolidated sand sediment GIS data.
string m_strDurationUnits
The duration units for this simulation.
void TruncateProfileAndAppendNew(int const, CGeomProfile *, int const, vector< CGeom2DPoint > const *, vector< vector< pair< int, int > > > const *)
Truncate a profile at the point of intersection, and do the same for all its co-incident profiles.
double m_dAccumulatedSeaLevelChange
If long-term SWL changes, the total change (m) so far since the start of simulation.
Definition simulation.h:732
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
Definition simulation.h:279
bool bElevAboveDeanElev(int const, int const, double const, CRWCellLandform const *)
Return true if the given elevation is higher than the Dean elevation (and other land use conditions a...
bool bDetectFileFormat(string const &strFileName, bool &bIsYaml)
Detects whether the input file is in YAML or .dat format.
bool m_bStormSurgeSave
Are we saving the storm surge? TODO 007 Finish surge and runup stuff.
Definition simulation.h:417
void DoActualPlatformErosionOnCell(int const, int const)
Calculates actual (constrained by available sediment) erosion of the consolidated shore platform on a...
vector< string > m_VstrInitialFineUnconsSedimentFile
The name of the initial fine-sized unconsolidated sediment GIS file.
double dExtCRSXToGridX(double const) const
Transforms an X-axis ordinate in the external CRS to the equivalent X-axis ordinate in the raster gri...
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:144
double m_dThisIterFineSedimentToSuspension
Total fine unconsolidated sediment in suspension for this iteration (depth in m)
Definition simulation.h:879
int nDoAllWaveEnergyToCoastLandforms(void)
bool bWritePerTimestepResultsFixedWidth(void)
Write the results for this timestep to the .out file in fixed-width format.
int nInsertPointIntoProfilesIfNeededThenUpdate(int const, CGeomProfile *, double const, double const, int const, CGeomProfile *, int const, bool const)
Inserts an intersection point into the profile that is to be retained, if that point is not already p...
double m_dThisIterBeachErosionFine
Total actual beach erosion (fine unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:864
double m_dNotchApexAboveMHW
Distance of notch base below SWL (m)
Definition simulation.h:933
void DoAllPotentialBeachErosion(void)
Uses either the CERC equation or the Kamphuis (1990) equation to calculate potential (unconstrained) ...
void FillPotentialPlatformErosionHoles(void)
Fills in 'holes' in the potential platform erosion i.e. orphan cells which get omitted because of rou...
bool bSurroundedByDriftCells(int const, int const)
Returns true if this cell has four drift cells surrounding it.
double m_dThisIterCliffCollapseSandErodedDuringDeposition
Total sand sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:897
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:570
bool bSaveAllRasterGISFiles(void)
The bSaveAllRasterGISFiles member function saves the raster GIS files using values from the RasterGri...
string m_strOGRDWWVGeometry
GDAL geometry for the deep water wave stations vector file.
unsigned long m_ulThisIterNumActualBeachErosionCells
The number of grid cells on which actual beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:636
bool bReadIniFile(void)
The bReadIniFile member function reads the initialisation file.
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
Definition simulation.h:72
double m_dCliffDepositionA
Scale parameter A for cliff deposition (m^(1/3)), may be zero for auto-calculation.
Definition simulation.h:936
string m_strDataPathName
Folder in which the CME data file is found.
string m_strOutPath
Path for all output files.
bool m_bBeachErosionTSSave
Save the beach (unconsolidated sediment) erosion time series file?
Definition simulation.h:312
int m_nYMaxBoundingBox
The maximum y value of the bounding box.
Definition simulation.h:561
double dLookUpErosionPotential(double const)
The erosion potential lookup: it returns a value for erosion potential given a value of Depth Over DB...
vector< string > m_VstrGDALICFDriverDesc
GDAL driver description for the initial consolidated fine sediment GIS data.
vector< double > m_VdSedimentInputLocationY
X coordinate (grid CRS) for sediment input event.
void WritePolygonUnsortedSequence(vector< vector< vector< int > > > &)
Writes to the log file a table showing the unsorted sequence of polygon processing for all coasts.
static string strGetBuild(void)
Returns the date and time on which the program was compiled.
Definition utils.cpp:1744
string m_strTideDataFile
Name of tide data file.
vector< string > m_VstrGDALIUFDriverDesc
GDAL driver description for the initial unconsolidated fine sediment GIS data.
vector< bool > m_bUnconsChangedThisIter
One element per layer: has the consolidated sediment of this layer been changed during this iteration...
bool m_bTotalPotentialBeachErosionSave
Save total potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:159
unsigned long m_ulThisIterNumPotentialPlatformErosionCells
The number of grid cells on which potential platform erosion occurs, for this iteration.
Definition simulation.h:627
string m_strGDALIWDataType
GDAL data type for the initial water depth raster file.
vector< string > m_VstrGDALIUSDataType
GDAL data type for the initial unconsolidated sand sediment GIS data.
bool bApplyConfiguration(CConfiguration const &config)
Applies configuration values to simulation member variables.
double m_dStartIterUnconsSandAllCells
Depth (m) of sand unconsolidated sediment at the start of the simulation, all cells (both inside and ...
void nRemoveSmallCliffIslands(int const)
long double m_ldGTotActualSandLostBeachErosion
All-simulation total of sand sediment lost via beach (unconsolidated) sediment movement (m)
double m_dDeltaSWLPerTimestep
If long-term SWL changes, the increment per timestep.
Definition simulation.h:723
void AllPolygonsUpdateStoredUncons(int const)
Before simulating beach erosion, update the per-polygon values of pre-existing unconsolidated sedimen...
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:519
string m_strInterventionClassFile
Name of intervention class file.
static CGeom2DIPoint PtiWeightedAverage(CGeom2DIPoint const *, CGeom2DIPoint const *, double const)
Returns an integer point (grid CRS) which is the weighted average of two other grid CRS integer point...
default_random_engine m_Rand[NUMBER_OF_RNGS]
The c++11 random number generators.
long double m_ldGTotActualFineLostBeachErosion
All-simulation total of fine sediment lost via beach (unconsolidated) sediment movement (m)
string m_strGDALBasementDEMDataType
GDAL data type for the basement DEM raster file.
bool m_bSeaMaskSave
Save sea mask raster GIS files?
Definition simulation.h:234
double m_dThisIterCliffCollapseErosionFineCons
This-iteration total of fine consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:957
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:177
long double m_ldGTotCoarseSedLostCliffCollapse
All-simulation total of coarse sediment lost via cliff collapse (m)
double m_dCoastNormalInterventionSpacing
Average spacing of the coastline-normal profiles on interventions, in m.
Definition simulation.h:837
long double m_ldGTotSandActualPlatformErosion
All-simulation total of sand sediment actual platform erosion (m)
int m_nSimStartYear
Start date of the simulation (year)
Definition simulation.h:582
bool m_bTotalActualBeachErosionSave
Save total actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:162
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:207
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.
Definition utils.cpp:2459
long double m_ldGTotSandSedLostCliffCollapse
All-simulation total of sand sediment lost via cliff collapse (m)
double m_dUnconsSandNotDepositedLastIter
Depth of unconsolidated sand sediment that could not be deposited during the last iteration,...
double m_dThisIterDiffWaveSetupWaterLevel
TODO 007 Finish surge and runup stuff.
Definition simulation.h:744
string m_strGDALICProjection
GDAL projection string for the initial intervention class raster file.
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
Definition simulation.h:180
double m_dTotalCoarseConsInPolygons
Total coarse consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
ofstream SeaAreaTSStream
Sea area time series file output stream.
unsigned long m_ulThisIterNumSeaCells
The number of grid cells which are marked as sea, for this iteration.
Definition simulation.h:621
int nDoUnconsErosionOnPolygon(int const, CGeomCoastPolygon *, int const, double const, double &)
Erodes unconsolidated beach sediment of one texture class on the cells within a polygon....
void AnnounceReadIHGIS(void) const
Tells the user that we are now reading the Intervention height GIS file.
Definition utils.cpp:571
double m_dTotalSandUnconsInPolygons
Total sand unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
void AnnounceReadInitialCoarseConsSedGIS(int const) const
Tells the user that we are now reading the initial coarse consolidated sediment depth GIS file.
Definition utils.cpp:709
bool m_bRiverineFlooding
Are we doing riverine flooding?
Definition simulation.h:411
long m_lGDALMinCanWrite
The minimum integer value which GDAL can write, can be zero, INT16_MIN, INT32_MIN.
Definition simulation.h:606
int nCreateAllProfiles(void)
Create coastline-normal profiles for all coastlines. The first profiles are created 'around' the most...
double m_dStartIterUnconsFineAllCells
Depth (m) of fine unconsolidated sediment at the start of the simulation, all cells (both inside and ...
static string strGetErrorText(int const)
Returns an error message given an error code.
Definition utils.cpp:2023
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:201
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:405
static double dTriangleAreax2(CGeom2DPoint const *, CGeom2DPoint const *, CGeom2DPoint const *)
Returns twice the signed area of a triangle, defined by three points.
double m_dThisIterMHWElev
This iteration's Mean High Water (MHW) elevation, calculated using a moving time window....
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
Definition simulation.h:78
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:699
long double m_ldGTotActualFineBeachErosion
All-simulation total of fine sediment eroded during beach (unconsolidated sediment) movement (m)
CGeomLine LSmoothCoastSavitzkyGolay(CGeomLine *, int const, int const) const
Does smoothing of a CGeomLine coastline vector (is in external CRS coordinates) using a Savitzky-Gola...
int nLocateSeaAndCoasts(void)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
bool m_bPolygonUnconsSedGainOrLossSave
Save polygon unconsolidated sediment gain or loss raster GIS files?
Definition simulation.h:255
void MarkPolygonCells(void)
Marks cells of the raster grid that are within each coastal polygon. The cell-by-cell fill (aka 'floo...
string m_strGDALISSDriverDesc
GDAL description for the initial suspended sediment raster file.
double m_dTimeStep
The length of an iteration (a timestep) in hours.
Definition simulation.h:690
static void AnnounceAllocateMemory(void)
Tells the user that we are now allocating memory.
Definition utils.cpp:508
unsigned long m_ulTotPotentialPlatformErosionOnProfiles
The number of cells on which on-profile average potential shore platform erosion occurs.
Definition simulation.h:642
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:306
int m_nXMinBoundingBox
The minimum x value of the bounding box.
Definition simulation.h:552
int nFindIndex(vector< double > const *, double const)
This is used by VdInterpolateCShoreProfileOutput, it returns the index of the value in pVdX which is ...
double dGetD50Sand(void) const
Returns the global d50 value for sand sediment.
Definition utils.cpp:152
string m_strGDALRasterOutputDriverLongname
GDAL raster output driver long name.
void CalcMHWElevation(int const)
Calculate Mean High Water (MHW) elevation for a given duration (in days). This is a tidal datum deter...
Definition utils.cpp:3091
vector< string > m_VstrGDALIUCDriverCode
GDAL driver code for the initial unconsolidated coarse sediment GIS data.
ofstream PlatformErosionTSStream
Shore platform erosion time series file output stream.
void DoEndOfTimestepTotals(void)
Update and print totals at the end of each timestep.
double m_dCellArea
Area of a cell (in external CRS units)
Definition simulation.h:675
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
Definition simulation.h:126
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
The number of cells on which between-profile average potential shore platform erosion occurs.
Definition simulation.h:645
double dExtCRSYToGridY(double const) const
Transforms a Y-axis ordinate in the external CRS to the equivalent Y-axis ordinate in the raster grid...
void WritePolygonPotentialErosion(void)
Writes to the log file a table showing per-polygon potential erosion of all size classes of unconsoli...
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
Definition simulation.h:972
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:777
vector< double > m_VdSliceElev
Elevations for raster slice output.
bool m_bOutputConsolidatedProfileData
Output profile data?
Definition simulation.h:336
void AnnounceReadInitialFineConsSedGIS(int const) const
Tells the user that we are now reading the initial fine consolidated sediment depth GIS file.
Definition utils.cpp:683
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
Definition simulation.h:138
ofstream CliffNotchElevTSStream
Cliff notch elevation time series file output stream.
static string strDispTime(double const, bool const, bool const)
strDispTime returns a string formatted as h:mm:ss, given a parameter in seconds, with rounding and fr...
Definition utils.cpp:1682
string m_strOGRSedInputGeometry
GDAL geometry for the sediment input event locations vector file.
string m_strOGRSedInputDriverCode
GDAL code for the sediment input event locations vector file.
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:369
int nGetThisProfileElevationsForCShore(int const, CGeomProfile *, int const, vector< double > *, vector< double > *, vector< double > *)
Get profile horizontal distance and bottom elevation vectors in CShore units.
unsigned long m_ulThisIterNumPotentialBeachErosionCells
The number of grid cells on which potential beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:633
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:198
string m_strGDALIWDriverDesc
GDAL description for the initial water depth raster file.
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:291
bool m_bCliffNotchElevTSSave
Save the cliff notch elevation time series file?
Definition simulation.h:330
bool bIsWithinValidGrid(int const, int const) const
Checks whether the supplied point (an x-y pair, in the grid CRS) is within the raster grid,...
int nDoParallelProfileUnconsErosion(CGeomCoastPolygon *, int const, int const, int const, int const, int const, int const, vector< CGeom2DIPoint > const *, vector< double > const *, double &, double &, double &)
This routine erodes unconsolidated beach sediment (either fine, sand, or coarse) on a parallel profil...
int m_nCoastSmooth
Which method to use for coast smoothing.
Definition simulation.h:486
bool m_bDeepWaterWavePeriodSave
Save deep water wave period raster GIS files?
Definition simulation.h:249
string m_strGDALBasementDEMDriverDesc
GDAL description of the basement DEM raster file type.
int nFindClosestCoastPoint(int const, int const, int &)
Finds the number of the closest point on any coastline to a given point, or INT_NODATA in case of err...
void ModifyBreakingWavePropertiesWithinShadowZoneToCoastline(int const, int const)
Modifies the wave breaking properties at coastline points of profiles within the shadow zone.
string m_strInitialLandformFile
Name of initial landform file.
double m_dC_0
Deep water wave speed (m/s)
Definition simulation.h:756
string m_strInterventionHeightFile
Name of intervention height file.
double m_dThisIterCliffCollapseErosionSandCons
This-iteration total of sand consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:960
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:318
vector< string > m_VstrGDALICSDataType
GDAL data type for the initial consolidated sand sediment GIS data.
double dGridXToExtCRSX(double const) const
Given a real-valued X-axis ordinate in the raster grid CRS (i.e. not the centroid of a cell),...
Definition gis_utils.cpp:95
double m_dThisIterBeachDepositionSand
Total beach deposition (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:873
int nReadTideDataFile(void)
Reads the tide time series data.
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:204
string m_strOGRFloodDriverDesc
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:294
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:381
double dGetThisIterSWL(void) const
Returns this timestep's SWL.
Definition utils.cpp:96
vector< string > m_VstrGDALICSProjection
GDAL dprojection for the initial consolidated sand sediment GIS data.
void CalcProcessStats(void)
This calculates and displays process statistics.
Definition utils.cpp:1796
void WriteLookUpData(void)
Output the erosion potential look-up values, for checking purposes.
void DoShadowZoneAndDownDriftZone(int const, int const, int const, int const)
Traverse the shadow zone, changing wave orientation and height, and the down-drift zone,...
static double dCalcCurvature(int const, CGeom2DPoint const *, CGeom2DPoint const *, CGeom2DPoint const *)
Calculates signed Menger curvature (https://en.wikipedia.org/wiki/Menger_curvature#Definition) from t...
CGeom2DPoint PtGridCentroidToExt(CGeom2DIPoint const *) const
Transforms a pointer to a CGeom2DIPoint in the raster grid CRS (assumed to be the centroid of a cell)...
Definition gis_utils.cpp:83
double m_dThisIterLeftGridUnconsCoarse
Total coarse unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:891
void DoCoastCurvature(int const, int const)
Calculates both detailed and smoothed curvature for every point on a coastline.
double m_dThisIterCliffCollapseErosionSandUncons
This-iteration total of sand unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:951
string m_strOGRFloodDataType
GDAL data type for the flood input locations point or vector file.
double m_dD50Fine
The D50 for fine sediment.
Definition simulation.h:786
unsigned long m_ulRandSeed[NUMBER_OF_RNGS]
A seed for each of the random number generators.
Definition simulation.h:615
int nTraceAllCoasts(void)
Locates all the potential coastline start/finish points on the edges of the raster grid,...
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:354
string m_strGDALRasterOutputDriverExtension
GDAL raster output driver file extension.
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:237
string m_strGDALBasementDEMProjection
GDAL projection string for the basement DEM raster file.
bool bOpenLogFile(void)
Opens the log file.
Definition utils.cpp:471
double m_dTotalSandConsInPolygons
Total sand consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in p...
static void AppendEnsureNoGap(vector< CGeom2DIPoint > *, CGeom2DIPoint const *)
Appends a CGeom2DIPoint to a vector<CGeom2DIPoint>, making sure that the new end point touches the pr...
Definition utils.cpp:2640
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:609
void AnnounceLicence(void)
Tells the user about the licence.
Definition utils.cpp:355
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:186
double m_dBeachSedimentDensity
The density of unconsolidated beach sediment (kg/m**3)
Definition simulation.h:795
double dGridCentroidXToExtCRSX(int const) const
Given the integer X-axis ordinate of a cell in the raster grid CRS, returns the external CRS X-axis o...
Definition gis_utils.cpp:65
vector< string > m_VstrInitialCoarseConsSedimentFile
The name of the initial coarse-sized consolidated sediment GIS file.
string m_strOGRDWWVDataType
GDAL data type for the deep water wave stations vector file.
double dGetInterpolatedValue(vector< double > const *, vector< double > const *, double, bool)
int nReadRasterBasementDEM(void)
Reads a raster DEM of basement elevation data to the Cell array.
int nLocateAndCreateGridEdgeProfile(bool const, int const, int &)
Creates a 'special' profile at each end of a coastline, at the edge of the raster grid....
double m_dSimDuration
Duration of simulation, in hours.
Definition simulation.h:687
double m_dTotalFineUnconsInPolygons
Total fine unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
string m_strGDALIHDriverCode
GDAL code for the initial intervention height raster file.
long double m_ldGTotSandDepositionDiff
All-simulation total of shortfall in unconsolidated sand sediment deposition (m, not currently used)
bool m_bTalusSave
Save talus depth?
Definition simulation.h:90
bool m_bCSVPerTimestepResults
Output per-timestep results in CSV format instead of fixed-width?
Definition simulation.h:345
bool m_bCliffNotchAllSave
Are we saving all cliff notches?
Definition simulation.h:444
void TruncateOneProfileRetainOtherProfile(int const, CGeomProfile *, CGeomProfile *, double, double, int, int, bool const)
Truncates one intersecting profile at the point of intersection, and retains the other profile.
string m_strGDALICDriverCode
GDAL code for the initial intervention class raster file.
ofstream FloodSetupSurgeTSStream
Flood setup surge time series file output stream.
double dCalcBeachProtectionFactor(int const, int const, double const)
Calculates the (inverse) beach protection factor as in SCAPE: 0 is fully protected,...
bool bTimeToQuit(void)
Checks to see if the simulation has gone on too long, amongst other things.
Definition utils.cpp:1446
double m_dTotalFineConsInPolygons
Total fine consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in p...
double m_dThisiterUnconsSandInput
Depth (m) of sand unconsolidated sediment added, at this iteration.
Definition simulation.h:996
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:669
void ProcessDownDriftCell(int const, int const, int const, double const, int const)
Process a single cell which is in the downdrift zone, changing its wave height.
int nDoAllPropagateWaves(void)
Simulates wave propagation along all coastline-normal profiles, on all coasts.
vector< double > m_VdThisIterDeepWaterWaveStationAngle
This-iteration wave orientation at deep water wave station.
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Finish surge and runup stuff.
Definition simulation.h:750
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:672
void nValidateCliffToeEdges(void)
void CellByCellFillSea(int const, int const)
Cell-by-cell fills all sea cells starting from a given cell. The cell-by-cell fill (aka 'floodfill') ...
vector< string > m_VstrGDALIUCDriverDesc
GDAL driver description for the initial unconsolidated coarse sediment GIS data.
bool bIsInterventionCell(int const, int const) const
Returns true if the cell is an intervention.
Definition utils.cpp:3066
double m_dMaxBeachElevAboveSWL
Maximum elevation of beach above SWL (m)
Definition simulation.h:921
long double m_ldGTotActualSandBeachErosion
All-simulation total of sand sediment eroded during beach (unconsolidated sediment) movement (m)
double m_dBreakingWaveHeight
The height of breaking waves (m)
Definition simulation.h:753
void AnnounceProgress(void)
Displays information regarding the progress of the simulation.
Definition utils.cpp:1761
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:225
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
Definition simulation.h:774
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Total coarse sediment eroded during Dean profile deposition of talus following cliff collapse (depth ...
Definition simulation.h:900
int nMarkBoundingBoxEdgeCells(void)
bool bCreateErosionPotentialLookUp(vector< double > *, vector< double > *, vector< double > *)
Creates a look-up table for erosion potential, given depth over DB.
long double m_ldGTotSandBeachDeposition
All-simulation total of sand sediment deposited during beach (unconsolidated sediment) movement (m)
double m_dUSaveTime[SAVEMAX]
Save time, in hours from the start of the simukation, if we are not saving regularly.
Definition simulation.h:702
vector< int > m_VnSavGolIndexCoast
Savitzky-Golay shift index for the coastline vector(s)
void WritePolygonCliffCollapseErosion(void)
Writes to the log file a table showing per-polygon per-polygon cliff collapse for all coasts.
void AnnounceReadLGIS(void) const
Tells the user that we are now reading the Landscape category GIS file.
Definition utils.cpp:541
double m_dThisIterTopElevMax
This-iteration highest elevation of DEM.
Definition simulation.h:987
double m_dThisIterActualPlatformErosionFineCons
Total actual platform erosion (fine consolidated sediment) for this iteration (depth in m)
Definition simulation.h:852
vector< double > m_VdFloodLocationY
X coordinate (grid CRS) for total water level flooding.
long double m_ldGTotPotentialBeachErosion
All-simulation total of potential beach erosion (m), all size classes.
double m_dProfileMaxSlope
Maximum slope on coastline-normal profiles.
Definition simulation.h:918
int m_nProfileSmoothWindow
The size of the window used for running-mean coast-normal profile smoothing (must be odd)
Definition simulation.h:504
string m_strGDALIHDriverDesc
GDAL description for the initial intervention height raster file.
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:366
static void AnnounceReadVectorFiles(void)
Now reading vector GIS files.
Definition utils.cpp:533
double m_dThisIterCliffCollapseErosionCoarseCons
This-iteration total of coarse consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:963
double m_dThisIterLeftGridUnconsSand
Total sand unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:888
double m_dDepthOfClosure
Depth of closure (in m) TODO 007 can be calculated using Hallermeier, R.J. (1978) or Birkemeier (1985...
Definition simulation.h:831
CGeom2DIPoint PtiFindClosestCoastPoint(int const, int const, int &)
Finds the closest point on any coastline to a given point.
int nInitGridAndCalcStillWaterLevel(void)
At the beginning of each timestep: clear vector coasts, profiles, and polygons, initialise the raster...
Definition init_grid.cpp:41
vector< string > m_VstrGDALICCDriverDesc
GDAL driver decription for the initial consolidated coarse sediment GIS data.
double m_dStartIterSuspFineAllCells
Depth (m) of fine suspended sediment at the start of the simulation, all cells (both inside and outsi...
string m_strOutFile
Name of main output file.
bool m_bSetupSurgeRunupFloodMaskSave
Are we saving the setup surge runup flood mask? TODO 007 Finish surge and runup stuff.
Definition simulation.h:426
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...
Definition utils.cpp:2678
double m_dThisIterDiffTotWaterLevel
TODO 007 Finish surge and runup stuff.
Definition simulation.h:741
vector< bool > m_bConsChangedThisIter
One element per layer: has the consolidated sediment of this layer been changed during this iteration...
string m_strGDALIHDataType
GDAL data type for the initial intervention height raster file.
ofstream FineSedSuspensionTSStream
Fine sediment in suspension time series file output stream.
ofstream FloodSetupSurgeRunupTSStream
Flood setup surge runup time series file output stream.
bool m_bWaveSetupSave
Are we saving the wave setup? TODO 007 Finish surge and runup stuff.
Definition simulation.h:414
int nDoPolygonSharedBoundaries(void)
For between-polygon potential sediment routing: find which are the adjacent polygons,...
void AnnounceReadTideData(void) const
Now reading tide data file.
Definition utils.cpp:722
vector< CRWSedInputEvent * > m_pVSedInputEvent
Sediment input events.
bool m_bFloodSWLSetupLineSave
Are we saving the flood still water level setup line? TODO 007 Finish surge and runup stuff.
Definition simulation.h:438
vector< double > m_VdTSDeepWaterWaveStationHeight
Time series of wave heights at deep water wave station.
void WritePolygonActualMovement(vector< vector< vector< int > > > &)
Writes to the log file a table showing per-polygon actual movement of unconsolidated beach sediment f...
double m_dClkLast
Last value returned by clock()
Definition simulation.h:705
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:240
long double m_ldGTotFineSedimentInput
All-simulation total of fine sediment input (m)
double m_dThisIterMeanSWL
The mean still water level for this timestep (does not include tidal changes, but includes any long-t...
Definition simulation.h:729
int nCheckAndMarkAllProfiles(void)
Check all coastline-normal profiles and modify the profiles if they intersect, then mark valid profil...
vector< string > m_VstrGDALIUCDataType
GDAL data type for the initial unconsolidated coarse sediment GIS data.
bool m_bCliffCollapseErosionTSSave
Save the cliff collapse erosion time series file?
Definition simulation.h:303
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:141
static CGeom2DIPoint PtiPolygonCentroid(vector< CGeom2DIPoint > *)
Returns an integer point (grid CRS) which is the centroid of a polygon, given by a vector of grid CRS...
long double m_ldGTotPotentialPlatformErosion
All-simulation total of potential platform erosion (m), all size classes.
GDALDataType m_GDALWriteFloatDataType
Thw data type used by GDAL for floating point operations, can be GDT_Byte, GDT_Int16,...
Definition simulation.h:600
void InterpolateWaveHeightToCoastPoints(int const)
Linearly interpolates wave properties from profiles to the coastline cells between two profiles.
ofstream BeachErosionTSStream
Beach sediment erosion time series file output stream.
bool m_bGDALCanWriteFloat
Is the selected GDAL output file format capable of writing floating-point values to files?
Definition simulation.h:375
void AnnounceReadInitialCoarseUnconsSedGIS(int const) const
Tells the user that we are now reading the initial coarse unconsolidated sediment depth GIS file.
Definition utils.cpp:670
int nHandleCommandLineParams(int, char const *[])
Handles command-line parameters.
Definition utils.cpp:168
long double m_ldGTotCliffCollapseSand
All-simulation total of sand sediment from cliff collapse (m)
int FindAllInundatedCells(void)
Finds and flags all sea areas which have at least one cell at a grid edge (i.e. does not flag 'inland...
char ** m_papszGDALRasterOptions
Options for GDAL when handling raster files.
Definition simulation.h:471
ofstream OutStream
The main output file stream.
double m_dDurationUnitsMult
Multiplier for duration units, to convert to hours.
Definition simulation.h:654
unsigned long m_ulTotTimestep
The target number of iterations.
Definition simulation.h:612
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:339
int nLandformToGrid(int const, int const)
At the end of each timestep, this routine stores the attributes from a single coastal landform object...
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:822
vector< double > m_VdTSDeepWaterWaveStationAngle
Time series of wave orientation at deep water wave station.
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...
Definition utils.cpp:2580
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:342
int m_nLevel
TODO 007 Used in WAVESETUP + SURGE + RUNUP Finish surge and runup stuff.
Definition simulation.h:594
bool m_bSedimentInputThisIter
Do we have a sediment input event this iteration?
Definition simulation.h:408
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:282
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007 Finish surge and runup stuff.
Definition simulation.h:432
vector< string > m_VstrGDALIUSDriverCode
GDAL driver code for the initial unconsolidated sand sediment GIS data.
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:114
static double dCalcWaveAngleToCoastNormal(double const, double const, int const)
Calculates the angle between the wave direction and a normal to the coastline tangent....
bool m_bOmitSearchEastEdge
Omit the east edge of the grid from coast-end searches?
Definition simulation.h:360
vector< int > m_VEdgeCellEdge
The grid edge that each edge cell belongs to.
int nTruncateProfileHitDifferentCoast(int const, int const, int const, int const)
Truncates a profile which has hit a different coast.
double m_dThisIterLeftGridUnconsFine
Total fine unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:885
This file contains global definitions for CoastalME.
int const SAVEMAX
Definition cme.h:368
int const NUMBER_OF_RNGS
Definition cme.h:367
Unified configuration class for CoastalME simulation parameters.
Contains CGeomLine definitions.
Simple YAML parser for CoastalME configuration files.