34using std::resetiosflags;
35using std::setiosflags;
36using std::setprecision;
81 for (
unsigned int n = 0; n <
m_VEdgeCell.size(); n++)
115 stack<CGeom2DIPoint> PtiStack;
122 while (! PtiStack.empty())
125 if (nRoundLoop++ > nRoundLoopMax)
131 int nX = Pti.
nGetX();
132 int nY = Pti.
nGetY();
134 while ((nX >= 0) && (!
m_pRasterGrid->m_Cell[nX][nY].bBasementElevIsMissingValue()) && (
m_pRasterGrid->m_Cell[nX][nY].bIsInundated()))
139 bool bSpanAbove =
false;
140 bool bSpanBelow =
false;
159 m_pRasterGrid->m_Cell[nX][nY].SetWaveValuesToDeepWaterWaveValues();
173 m_pRasterGrid->m_Cell[nX][nY].SetWaveValuesToDeepWaterWaveValues();
192 if ((! bSpanAbove) && (nY > 0) && (!
m_pRasterGrid->m_Cell[nX][nY-1].bBasementElevIsMissingValue()) && (
m_pRasterGrid->m_Cell[nX][nY-1].bIsInundated()))
197 else if (bSpanAbove && (nY > 0) && (!
m_pRasterGrid->m_Cell[nX][nY-1].bBasementElevIsMissingValue()) && (!
m_pRasterGrid->m_Cell[nX][nY-1].bIsInundated()))
292 vector<bool> VbPossibleStartCellLHEdge;
293 vector<bool> VbTraced;
294 vector<int> VnSearchDirection;
295 vector<CGeom2DIPoint> V2DIPossibleStartCell;
298 for (
unsigned int n = 0; n <
m_VEdgeCell.size() - 1; n++)
318 bool bThisCellIsSea =
m_pRasterGrid->m_Cell[nXThis][nYThis].bIsInContiguousSea();
319 bool bNextCellIsSea =
m_pRasterGrid->m_Cell[nXNext][nYNext].bIsInContiguousSea();
322 if ((! bThisCellIsSea) && bNextCellIsSea)
325 if (!
m_pRasterGrid->m_Cell[nXThis][nYThis].bIsPossibleCoastStartCell())
328 m_pRasterGrid->m_Cell[nXThis][nYThis].SetPossibleCoastStartCell();
333 V2DIPossibleStartCell.push_back(
CGeom2DIPoint(nXThis, nYThis));
334 VbPossibleStartCellLHEdge.push_back(
true);
336 VbTraced.push_back(
false);
339 else if (bThisCellIsSea && (! bNextCellIsSea))
342 if (!
m_pRasterGrid->m_Cell[nXNext][nYNext].bIsPossibleCoastStartCell())
345 m_pRasterGrid->m_Cell[nXNext][nYNext].SetPossibleCoastStartCell();
350 V2DIPossibleStartCell.push_back(
CGeom2DIPoint(nXNext, nYNext));
351 VbPossibleStartCellLHEdge.push_back(
false);
353 VbTraced.push_back(
false);
358 for (
unsigned int n = 0; n < V2DIPossibleStartCell.size(); n++)
363 if (VbPossibleStartCellLHEdge[n])
385 cerr <<
m_ulIter <<
": no valid coasts found" << endl;
393int CSimulation::nTraceCoastLine(
unsigned int const nTraceFromStartCellIndex,
int const nStartSearchDirection,
int const nHandedness, vector<bool>* pVbTraced, vector<CGeom2DIPoint>
const* pV2DIPossibleStartCell)
395 bool bHitStartCell =
false;
396 bool bAtCoast =
false;
397 bool bHasLeftStartEdge =
false;
398 bool bTooLong =
false;
399 bool bOffEdge =
false;
400 bool bRepeating =
false;
402 int nStartX = pV2DIPossibleStartCell->at(nTraceFromStartCellIndex).nGetX();
403 int nStartY = pV2DIPossibleStartCell->at(nTraceFromStartCellIndex).nGetY();
406 int nSearchDirection = nStartSearchDirection;
416 m_pRasterGrid->m_Cell[nStartX][nStartY].SetAsCoastline(
true);
418 ILTempGridCRS.
Append(&PtiStart);
446 if ((nRoundLoop > 10) && (ILTempGridCRS.
nGetSize() < 2))
455 if (! bHasLeftStartEdge)
458 if (((nStartSearchDirection ==
SOUTH) && (nY > nStartY)) || ((nStartSearchDirection ==
NORTH) && (nY < nStartY)) ||
459 ((nStartSearchDirection ==
EAST) && (nX > nStartX)) || ((nStartSearchDirection ==
WEST) && (nX < nStartX)))
460 bHasLeftStartEdge =
true;
470 for (
unsigned int nn = 0; nn < pVbTraced->size(); nn++)
472 if ((nn != nTraceFromStartCellIndex) && (!pVbTraced->at(nn)))
476 if (bAtCoast && (nX == pV2DIPossibleStartCell->at(nn).nGetX()) && (nY == pV2DIPossibleStartCell->at(nn).nGetY()))
479 LogStream <<
m_ulIter <<
": Valid coastline found, traced from [" << nStartX <<
"][" << nStartY <<
"] and hit another start cell at [" << nX <<
"][" << nY <<
"]" << endl;
481 pVbTraced->at(nn) =
true;
482 bHitStartCell =
true;
496 int nSeawardNewDirection = 0;
497 int nXStraightOn = 0;
498 int nYStraightOn = 0;
499 int nXAntiSeaward = 0;
500 int nYAntiSeaward = 0;
501 int nAntiSeawardNewDirection = 0;
504 int nGoBackNewDirection = 0;
513 switch (nSearchDirection)
519 nSeawardNewDirection =
EAST;
523 nYStraightOn = nY - 1;
526 nXAntiSeaward = nX - 1;
528 nAntiSeawardNewDirection =
WEST;
533 nGoBackNewDirection =
SOUTH;
541 nSeawardNewDirection =
SOUTH;
544 nXStraightOn = nX + 1;
549 nYAntiSeaward = nY - 1;
550 nAntiSeawardNewDirection =
NORTH;
555 nGoBackNewDirection =
WEST;
563 nSeawardNewDirection =
WEST;
567 nYStraightOn = nY + 1;
570 nXAntiSeaward = nX + 1;
572 nAntiSeawardNewDirection =
EAST;
577 nGoBackNewDirection =
NORTH;
585 nSeawardNewDirection =
NORTH;
588 nXStraightOn = nX - 1;
593 nYAntiSeaward = nY + 1;
594 nAntiSeawardNewDirection =
SOUTH;
599 nGoBackNewDirection =
EAST;
607 switch (nSearchDirection)
613 nSeawardNewDirection =
WEST;
617 nYStraightOn = nY - 1;
620 nXAntiSeaward = nX + 1;
622 nAntiSeawardNewDirection =
EAST;
627 nGoBackNewDirection =
SOUTH;
635 nSeawardNewDirection =
NORTH;
638 nXStraightOn = nX + 1;
643 nYAntiSeaward = nY + 1;
644 nAntiSeawardNewDirection =
SOUTH;
649 nGoBackNewDirection =
WEST;
657 nSeawardNewDirection =
EAST;
661 nYStraightOn = nY + 1;
664 nXAntiSeaward = nX - 1;
666 nAntiSeawardNewDirection =
WEST;
671 nGoBackNewDirection =
NORTH;
679 nSeawardNewDirection =
SOUTH;
682 nXStraightOn = nX - 1;
687 nYAntiSeaward = nY - 1;
688 nAntiSeawardNewDirection =
NORTH;
693 nGoBackNewDirection =
EAST;
704 if (
m_pRasterGrid->m_Cell[nXSeaward][nYSeaward].bIsInContiguousSea())
717 ILTempGridCRS.
Append(&Pti);
723 ILTempGridCRS.
Append(&Pti);
734 nSearchDirection = nSeawardNewDirection;
743 if (
m_pRasterGrid->m_Cell[nXStraightOn][nYStraightOn].bIsInContiguousSea())
756 ILTempGridCRS.
Append(&Pti);
762 ILTempGridCRS.
Append(&Pti);
781 if (
m_pRasterGrid->m_Cell[nXAntiSeaward][nYAntiSeaward].bIsInContiguousSea())
794 ILTempGridCRS.
Append(&Pti);
800 ILTempGridCRS.
Append(&Pti);
811 nSearchDirection = nAntiSeawardNewDirection;
823 nSearchDirection = nGoBackNewDirection;
834 int nCoastSize = ILTempGridCRS.
nGetSize();
842 for (
int n = 0; n < nCoastSize; n++)
843 m_pRasterGrid->m_Cell[ILTempGridCRS[n].nGetX()][ILTempGridCRS[n].nGetY()].SetAsCoastline(
false);
856 LogStream <<
", it ended at [" << ILTempGridCRS[nCoastSize - 1].nGetX() <<
"][" << ILTempGridCRS[nCoastSize - 1].nGetY() <<
"] = {" <<
dGridCentroidXToExtCRSX(ILTempGridCRS[nCoastSize - 1].nGetX()) <<
", " <<
dGridCentroidYToExtCRSY(ILTempGridCRS[nCoastSize - 1].nGetY()) <<
"}";
862 for (
int n = 0; n < nCoastSize; n++)
863 m_pRasterGrid->m_Cell[ILTempGridCRS[n].nGetX()][ILTempGridCRS[n].nGetY()].SetAsCoastline(
false);
875 LogStream <<
", it ended at [" << ILTempGridCRS[nCoastSize - 1].nGetX() <<
"][" << ILTempGridCRS[nCoastSize - 1].nGetY() <<
"] = {" <<
dGridCentroidXToExtCRSX(ILTempGridCRS[nCoastSize - 1].nGetX()) <<
", " <<
dGridCentroidYToExtCRSY(ILTempGridCRS[nCoastSize - 1].nGetY()) <<
"}";
881 for (
int n = 0; n < nCoastSize; n++)
882 m_pRasterGrid->m_Cell[ILTempGridCRS[n].nGetX()][ILTempGridCRS[n].nGetY()].SetAsCoastline(
false);
903 for (
int n = 0; n < nCoastSize; n++)
904 m_pRasterGrid->m_Cell[ILTempGridCRS[n].nGetX()][ILTempGridCRS[n].nGetY()].SetAsCoastline(
false);
912 int nCoastEndX = ILTempGridCRS[nCoastSize - 1].nGetX();
913 int nCoastEndY = ILTempGridCRS[nCoastSize - 1].nGetY();
915 if ((nCoastEndX != nEndX) || (nCoastEndY != nEndY))
918 if (!
m_pRasterGrid->m_Cell[nCoastEndX][nCoastEndY].bIsBoundingBoxEdge())
921 ILTempGridCRS.
Append(nEndX, nEndY);
929 int nStartEdge =
m_pRasterGrid->m_Cell[nStartX][nStartY].nGetBoundingBoxEdge();
930 int nEndEdge =
m_pRasterGrid->m_Cell[nEndX][nEndY].nGetBoundingBoxEdge();
934 for (
int j = 0; j < nCoastSize; j++)
957 int nCoast =
static_cast<int>(
m_VCoast.size()) - 1;
960 m_VCoast[nCoast].SetCoastlineExtCRS(<empExtCRS);
963 m_VCoast[nCoast].SetCoastlineGridCRS(&ILTempGridCRS);
981 m_VCoast[nCoast].SetSeaHandedness(nHandedness);
982 m_VCoast[nCoast].SetStartEdge(nStartEdge);
983 m_VCoast[nCoast].SetEndEdge(nEndEdge);
989 LogStream <<
m_ulIter <<
": Smoothed coastline " << nCoast <<
" runs from {" << LTempExtCRS[0].dGetX() <<
", " << LTempExtCRS[0].dGetY() <<
"} to {" << LTempExtCRS[nCoastSize - 1].dGetX() <<
", " << LTempExtCRS[nCoastSize - 1].dGetY() <<
"} i.e. from the ";
990 if (nStartEdge ==
NORTH)
992 else if (nStartEdge ==
SOUTH)
994 else if (nStartEdge ==
WEST)
996 else if (nStartEdge ==
EAST)
999 if (nEndEdge ==
NORTH)
1001 else if (nEndEdge ==
SOUTH)
1003 else if (nEndEdge ==
WEST)
1005 else if (nEndEdge ==
EAST)
1021 m_VCoast[nCoast].CreateProfilesAtCoastPoints();
1081 for (
unsigned int n = 0; n <
m_VEdgeCell.size(); n++)
1115 double dDiffTotWaterLevel = 0;
1117 double dAuxWaterLevelDiff = 0;
1120 int pointCounter = 0;
1121 for (
int nCoast = 0; nCoast < static_cast<int>(
m_VCoast.size()); nCoast++)
1123 int nCoastSize =
m_VCoast[nCoast].pLGetCoastlineExtCRS()->nGetSize();
1124 for (
int nCoastPoint = 0; nCoastPoint < nCoastSize; nCoastPoint++)
1127 if (! isnan(dAuxWaterLevelDiff))
1129 if (
tAbs(dAuxWaterLevelDiff) < 1)
1132 dDiffTotWaterLevel += dAuxWaterLevelDiff;
1137 if (pointCounter > 0)
1138 dDiffTotWaterLevel /= pointCounter;
1140 dDiffTotWaterLevel = 0;
1144 for (
long unsigned int n = 0; n < nLocIDs; n++)
1148 double dMinDiffTotWaterLevelAtCoast = 1e10;
1149 for (
int nCoast = 0; nCoast < static_cast<int>(
m_VCoast.size()); nCoast++)
1151 int nCoastSize =
m_VCoast[nCoast].pLGetCoastlineExtCRS()->nGetSize();
1152 double dMinDistSquare = 1e10;
1153 for (
int nCoastPoint = 0; nCoastPoint < nCoastSize; nCoastPoint++)
1155 double dCoastPointXExtCRS =
m_VCoast[nCoast].pPtGetCoastlinePointExtCRS(nCoastPoint)->dGetX();
1156 double dCoastPointYExtCRS =
m_VCoast[nCoast].pPtGetCoastlinePointExtCRS(nCoastPoint)->dGetY();
1158 double dDistSquare = (dCoastPointXExtCRS - dPointGridXExtCRS) * (dCoastPointXExtCRS - dPointGridXExtCRS) + (dCoastPointYExtCRS - dPointGridYExtCRS) * (dCoastPointYExtCRS - dPointGridYExtCRS);
1160 if (dDistSquare < dMinDistSquare)
1163 if (! isnan(dAuxWaterLevelDiff))
1165 dMinDistSquare = dDistSquare;
1166 dMinDiffTotWaterLevelAtCoast = dAuxWaterLevelDiff;
1171 dDiffTotWaterLevel += dMinDiffTotWaterLevelAtCoast;
1173 dDiffTotWaterLevel /=
static_cast<double>(nLocIDs);
1188 stack<CGeom2DIPoint> PtiStackFlood;
1194 while (! PtiStackFlood.empty())
1197 PtiStackFlood.pop();
1199 int nX = Pti.
nGetX();
1200 int nY = Pti.
nGetY();
1206 if (!
m_pRasterGrid->m_Cell[nX][nY].bIsElevLessThanWaterLevel())
1213 bool bSpanAbove =
false;
1214 bool bSpanBelow =
false;
1220 if (!
m_pRasterGrid->m_Cell[nX][nY].bIsElevLessThanWaterLevel())
1237 if ((! bSpanAbove) && (nY > 0) && (
m_pRasterGrid->m_Cell[nX][nY - 1].bIsElevLessThanWaterLevel()) && (!
m_pRasterGrid->m_Cell[nX][nY - 1].bIsCellFloodCheck()))
1242 else if (bSpanAbove && (nY > 0) && (!
m_pRasterGrid->m_Cell[nX][nY - 1].bIsElevLessThanWaterLevel()))
1267 vector<bool> VbPossibleStartCellLHEdge;
1268 vector<bool> VbTraced;
1269 vector<int> VnSearchDirection;
1270 vector<CGeom2DIPoint> V2DIPossibleStartCell;
1273 for (
unsigned int n = 0; n <
m_VEdgeCell.size() - 1; n++)
1293 bool bThisCellIsSea =
m_pRasterGrid->m_Cell[nXThis][nYThis].bIsInContiguousFlood();
1294 bool bNextCellIsSea =
m_pRasterGrid->m_Cell[nXNext][nYNext].bIsInContiguousFlood();
1297 if ((! bThisCellIsSea) && bNextCellIsSea)
1303 m_pRasterGrid->m_Cell[nXThis][nYThis].SetPossibleFloodStartCell();
1306 V2DIPossibleStartCell.push_back(
CGeom2DIPoint(nXThis, nYThis));
1307 VbPossibleStartCellLHEdge.push_back(
true);
1309 VbTraced.push_back(
false);
1312 else if (bThisCellIsSea && (! bNextCellIsSea))
1318 m_pRasterGrid->m_Cell[nXNext][nYNext].SetPossibleFloodStartCell();
1321 V2DIPossibleStartCell.push_back(
CGeom2DIPoint(nXNext, nYNext));
1322 VbPossibleStartCellLHEdge.push_back(
false);
1324 VbTraced.push_back(
false);
1329 bool bAtLeastOneCoastTraced =
false;
1330 for (
unsigned int n = 0; n < V2DIPossibleStartCell.size(); n++)
1335 if (VbPossibleStartCellLHEdge[n])
1348 bAtLeastOneCoastTraced =
true;
1353 if (bAtLeastOneCoastTraced)
1362int CSimulation::nTraceFloodCoastLine(
unsigned int const nTraceFromStartCellIndex,
int const nStartSearchDirection,
int const nHandedness, vector<bool>* pVbTraced, vector<CGeom2DIPoint>
const* pV2DIPossibleStartCell)
1364 bool bHitStartCell =
false;
1365 bool bAtCoast =
false;
1366 bool bHasLeftStartEdge =
false;
1367 bool bTooLong =
false;
1368 bool bOffEdge =
false;
1369 bool bRepeating =
false;
1371 int nStartX = pV2DIPossibleStartCell->at(nTraceFromStartCellIndex).nGetX();
1372 int nStartY = pV2DIPossibleStartCell->at(nTraceFromStartCellIndex).nGetY();
1375 int nSearchDirection = nStartSearchDirection;
1376 int nRoundLoop = -1;
1385 m_pRasterGrid->m_Cell[nStartX][nStartY].SetAsFloodLine(
true);
1387 ILTempGridCRS.
Append(&PtiStart);
1415 if ((nRoundLoop > 10) && (ILTempGridCRS.
nGetSize() < 2))
1424 if (! bHasLeftStartEdge)
1427 if (((nStartSearchDirection ==
SOUTH) && (nY > nStartY)) || ((nStartSearchDirection ==
NORTH) && (nY < nStartY)) ||
1428 ((nStartSearchDirection ==
EAST) && (nX > nStartX)) || ((nStartSearchDirection ==
WEST) && (nX < nStartX)))
1429 bHasLeftStartEdge =
true;
1439 for (
unsigned int nn = 0; nn < pVbTraced->size(); nn++)
1441 if ((nn != nTraceFromStartCellIndex) && (!pVbTraced->at(nn)))
1445 if (bAtCoast && (nX == pV2DIPossibleStartCell->at(nn).nGetX()) && (nY == pV2DIPossibleStartCell->at(nn).nGetY()))
1448 LogStream <<
m_ulIter <<
": valid flood coastline found, traced from [" << nStartX <<
"][" << nStartY <<
"] and hit another start cell at [" << nX <<
"][" << nY <<
"]" << endl;
1450 pVbTraced->at(nn) =
true;
1451 bHitStartCell =
true;
1465 int nSeawardNewDirection = 0;
1466 int nXStraightOn = 0;
1467 int nYStraightOn = 0;
1468 int nXAntiSeaward = 0;
1469 int nYAntiSeaward = 0;
1470 int nAntiSeawardNewDirection = 0;
1473 int nGoBackNewDirection = 0;
1478 switch (nHandedness)
1482 switch (nSearchDirection)
1488 nSeawardNewDirection =
EAST;
1492 nYStraightOn = nY - 1;
1495 nXAntiSeaward = nX - 1;
1497 nAntiSeawardNewDirection =
WEST;
1502 nGoBackNewDirection =
SOUTH;
1510 nSeawardNewDirection =
SOUTH;
1513 nXStraightOn = nX + 1;
1518 nYAntiSeaward = nY - 1;
1519 nAntiSeawardNewDirection =
NORTH;
1524 nGoBackNewDirection =
WEST;
1532 nSeawardNewDirection =
WEST;
1536 nYStraightOn = nY + 1;
1539 nXAntiSeaward = nX + 1;
1541 nAntiSeawardNewDirection =
EAST;
1546 nGoBackNewDirection =
NORTH;
1554 nSeawardNewDirection =
NORTH;
1557 nXStraightOn = nX - 1;
1562 nYAntiSeaward = nY + 1;
1563 nAntiSeawardNewDirection =
SOUTH;
1568 nGoBackNewDirection =
EAST;
1576 switch (nSearchDirection)
1582 nSeawardNewDirection =
WEST;
1586 nYStraightOn = nY - 1;
1589 nXAntiSeaward = nX + 1;
1591 nAntiSeawardNewDirection =
EAST;
1596 nGoBackNewDirection =
SOUTH;
1604 nSeawardNewDirection =
NORTH;
1607 nXStraightOn = nX + 1;
1612 nYAntiSeaward = nY + 1;
1613 nAntiSeawardNewDirection =
SOUTH;
1618 nGoBackNewDirection =
WEST;
1626 nSeawardNewDirection =
EAST;
1630 nYStraightOn = nY + 1;
1633 nXAntiSeaward = nX - 1;
1635 nAntiSeawardNewDirection =
WEST;
1640 nGoBackNewDirection =
NORTH;
1648 nSeawardNewDirection =
SOUTH;
1651 nXStraightOn = nX - 1;
1656 nYAntiSeaward = nY - 1;
1657 nAntiSeawardNewDirection =
NORTH;
1662 nGoBackNewDirection =
EAST;
1673 if (
m_pRasterGrid->m_Cell[nXSeaward][nYSeaward].bIsInContiguousFlood())
1686 ILTempGridCRS.
Append(&Pti);
1688 else if (!
m_pRasterGrid->m_Cell[nX][nY].bIsElevLessThanWaterLevel())
1692 ILTempGridCRS.
Append(&Pti);
1703 nSearchDirection = nSeawardNewDirection;
1712 if (
m_pRasterGrid->m_Cell[nXStraightOn][nYStraightOn].bIsInContiguousFlood())
1725 ILTempGridCRS.
Append(&Pti);
1727 else if (!
m_pRasterGrid->m_Cell[nX][nY].bIsElevLessThanWaterLevel())
1731 ILTempGridCRS.
Append(&Pti);
1750 if (
m_pRasterGrid->m_Cell[nXAntiSeaward][nYAntiSeaward].bIsInContiguousFlood())
1763 ILTempGridCRS.
Append(&Pti);
1765 else if (!
m_pRasterGrid->m_Cell[nX][nY].bIsElevLessThanWaterLevel())
1769 ILTempGridCRS.
Append(&Pti);
1780 nSearchDirection = nAntiSeawardNewDirection;
1792 nSearchDirection = nGoBackNewDirection;
1803 int nCoastSize = ILTempGridCRS.
nGetSize();
1811 for (
int n = 0; n < nCoastSize; n++)
1812 m_pRasterGrid->m_Cell[ILTempGridCRS[n].nGetX()][ILTempGridCRS[n].nGetY()].SetAsFloodLine(
false);
1825 LogStream <<
", it ended at [" << ILTempGridCRS[nCoastSize - 1].nGetX() <<
"][" << ILTempGridCRS[nCoastSize - 1].nGetY() <<
"] = {" <<
dGridCentroidXToExtCRSX(ILTempGridCRS[nCoastSize - 1].nGetX()) <<
", " <<
dGridCentroidYToExtCRSY(ILTempGridCRS[nCoastSize - 1].nGetY()) <<
"}";
1831 for (
int n = 0; n < nCoastSize; n++)
1832 m_pRasterGrid->m_Cell[ILTempGridCRS[n].nGetX()][ILTempGridCRS[n].nGetY()].SetAsFloodLine(
false);
1844 LogStream <<
", it ended at [" << ILTempGridCRS[nCoastSize - 1].nGetX() <<
"][" << ILTempGridCRS[nCoastSize - 1].nGetY() <<
"] = {" <<
dGridCentroidXToExtCRSX(ILTempGridCRS[nCoastSize - 1].nGetX()) <<
", " <<
dGridCentroidYToExtCRSY(ILTempGridCRS[nCoastSize - 1].nGetY()) <<
"}";
1850 for (
int n = 0; n < nCoastSize; n++)
1851 m_pRasterGrid->m_Cell[ILTempGridCRS[n].nGetX()][ILTempGridCRS[n].nGetY()].SetAsFloodLine(
false);
1856 if (nCoastSize == 0)
1872 for (
int n = 0; n < nCoastSize; n++)
1873 m_pRasterGrid->m_Cell[ILTempGridCRS[n].nGetX()][ILTempGridCRS[n].nGetY()].SetAsFloodLine(
false);
1881 int nCoastEndX = ILTempGridCRS[nCoastSize - 1].nGetX();
1882 int nCoastEndY = ILTempGridCRS[nCoastSize - 1].nGetY();
1884 if ((nCoastEndX != nEndX) || (nCoastEndY != nEndY))
1887 if (!
m_pRasterGrid->m_Cell[nCoastEndX][nCoastEndY].bIsBoundingBoxEdge())
1890 ILTempGridCRS.
Append(nEndX, nEndY);
1904 for (
int j = 0; j < nCoastSize; j++)
int nGetSize(void) const
Returns the number of integer point in the vector which represents this 2D shape.
void Append(CGeom2DIPoint const *)
Appends a new integer point to the vector which represents this 2D shape.
void Append(CGeom2DPoint const *)
Appends a point to this 2D shape.
Geometry class used to represent 2D point objects with integer coordinates.
int nGetY(void) const
Returns the CGeom2DIPoint object's integer Y coordinate.
int nGetX(void) const
Returns the CGeom2DIPoint object's integer X coordinate.
Geometry class used to represent 2D vector integer line objects.
Geometry class used to represent 2D vector line objects.
Real-world class used to represent coastline objects.
int m_nLogFileDetail
The level of detail in the log file output. Can be LOG_FILE_LOW_DETAIL, LOG_FILE_MIDDLE_DETAIL,...
int m_nYMinBoundingBox
The minimum y value of the bounding box.
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...
CGeomLine LSmoothCoastRunningMean(CGeomLine *) const
Does running-mean smoothing of a CGeomLine coastline vector (is in external CRS coordinates)
int nLocateSeaAndCoasts(int &)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int m_nXGridSize
The size of the grid in the x direction.
static int nGetOppositeDirection(int const)
Returns the opposite direction.
vector< CRWCoast > m_VFloodWaveSetupSurgeRunup
TODO 007 Info needed.
vector< CRWCoast > m_VCoast
The coastline objects.
int nLocateFloodAndCoasts(void)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
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 ...
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 Not clear...
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Info needed.
int m_nYGridSize
The size of the grid in the y direction.
double m_dThisIterTopElevMin
This-iteration lowest elevation of DEM.
void CalcCoastTangents(int const)
Calculates tangents to a coastline: the tangent is assumed to be the orientation of energy/sediment f...
vector< CRWCoast > m_VFloodWaveSetupSurge
TODO 007 Info needed.
int m_nCoastMax
Maximum valid coast length when searching for coasts, actually is COAST_LENGTH_MAX * tMax(m_nXGridSiz...
int m_nXMaxBoundingBox
The maximum x value of the bounding box.
vector< double > m_VdFloodLocationX
X coordinate (grid CRS) for total water level flooding.
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
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 ...
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...
int m_nCoastMin
Minimum valid coast legth when searching for coass, actualli is tMin(m_nXGridSize,...
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
vector< CGeom2DIPoint > m_VEdgeCell
Edge cells.
int m_nYMaxBoundingBox
The maximum y value of the bounding box.
unsigned long m_ulThisIterNumSeaCells
The number of grid cells which are marked as sea, for this iteration.
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 m_nXMinBoundingBox
The minimum x value of the bounding box.
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 m_nCoastSmooth
Which method to use for coast smoothing.
void DoCoastCurvature(int const, int const)
Calculates both detailed and smoothed curvature for every point on a coastline.
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
unsigned long m_ulIter
The number of the current iteration (time step)
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...
int nTraceAllCoasts(int &)
Locates all the potential coastline start points on the edges of the raster grid, then traces vector ...
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
bool bIsInterventionCell(int const, int const) const
Returns true if the cell is an intervention.
double m_dThisIterTopElevMax
This-iteration highest elevation of DEM.
vector< double > m_VdFloodLocationY
X coordinate (grid CRS) for total water level flooding.
void FloodFillSea(int const, int const)
Flood-fills all sea cells starting from a given cell. The flood fill code used here is adapted from a...
double m_dThisIterDiffTotWaterLevel
TODO 007 Info needed.
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...
int m_nLevel
TODO 007 Used in WAVESETUP + SURGE + RUNUP.
bool m_bOmitSearchEastEdge
Omit the east edge of the grid from coast-end searches?
vector< int > m_VEdgeCellEdge
The grid edge that each edge cell belongs to.
This file contains global definitions for CoastalME.
int const RTN_ERR_NOCOAST
int const LF_CAT_SEDIMENT_INPUT
int const LF_CAT_SEDIMENT_INPUT_SUBMERGED
int const LOG_FILE_MIDDLE_DETAIL
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
int const LOG_FILE_HIGH_DETAIL
int const SMOOTH_SAVITZKY_GOLAY
int const SMOOTH_RUNNING_MEAN
int const LF_CAT_SEDIMENT_INPUT_NOT_SUBMERGED
int const RTN_ERR_TRACING_COAST
Contains CRWCoast definitions.
Contains CGeomILine definitions.
Contains CGeomLine definitions.
Contains CGeomRasterGrid definitions.
Contains CSimulation definitions.