86 for (
int n = 0; n < nEvents; n++)
95 if (nPointGridX == -1)
106 int const nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetNumOfTopLayerAboveBasement();
109 int const nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
114 nThisPolyCoast =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonCoastID();
123 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent + 1 <<
" at point [" << nPointGridX <<
"][" << nPointGridY <<
"] = {" <<
dGridXToExtCRSX(nPointGridX) <<
", " <<
dGridYToExtCRSY(nPointGridY) <<
"] with location ID " << nLocID;
126 LogStream <<
" which is within coast " << nThisPolyCoast <<
" polygon " << nThisPoly << endl;
128 LogStream <<
" this is not within a polygon" << endl;
132 double const dFineDepth = dFineSedVol /
m_dCellArea;
136 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
139 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
143 m_VCoast[nThisPolyCoast].pGetPolygon(nThisPoly)->SetSedimentInputUnconsFine(dFineDepth);
153 double const dSandDepth = dSandSedVol /
m_dCellArea;
158 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
161 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
165 m_VCoast[nThisPolyCoast].pGetPolygon(nThisPoly)->SetSedimentInputUnconsSand(dSandDepth);
175 double const dCoarseDepth = dCoarseSedVol /
m_dCellArea;
177 if (dCoarseDepth > 0)
180 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
183 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
187 m_VCoast[nThisPolyCoast].pGetPolygon(nThisPoly)->SetSedimentInputUnconsCoarse(dCoarseDepth);
197 LogStream <<
", depth of fine sediment added = " << dFineDepth <<
" m, depth of sand sediment added = " << dSandDepth <<
" m, depth of coarse sediment added = " << dCoarseDepth <<
" m" << endl;
203 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent + 1 <<
" with location ID " << nLocID <<
" at closest point on coast to [" << nPointGridX <<
"][" << nPointGridY <<
"] = {" <<
dGridXToExtCRSX(nPointGridX) <<
", " <<
dGridYToExtCRSY(nPointGridY) <<
"]" << endl;
209 int const nCoastX = PtiCoastPoint.
nGetX();
210 int const nCoastY = PtiCoastPoint.
nGetY();
213 LogStream <<
m_ulIter <<
": Closest coast point is on coast " << nCoastClosest <<
" at [" << nCoastX <<
"][" << nCoastY <<
"] = {" <<
dGridXToExtCRSX(nCoastX) <<
", " <<
dGridYToExtCRSY(nCoastY) <<
"}, along-coast width of sediment block = " << dWidth <<
" m, coast-normal length of sediment block = " << dLen <<
" m" << endl;
215 int const nCoast =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetCoast();
216 int const nCoastPoint =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetPointOnCoast();
219 int const nCoastLen =
m_VCoast[nCoast].nGetCoastlineSize();
220 int nCoastXBefore = nCoastX;
221 int nCoastYBefore = nCoastY;
222 int nCoastXAfter = nCoastX;
223 int nCoastYAfter = nCoastY;
227 nCoastXBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetX();
228 nCoastYBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetY();
231 if (nCoastPoint < nCoastLen - 1)
233 nCoastXAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetX();
234 nCoastYAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetY();
237 int const nCoastHand =
m_VCoast[nCoast].nGetSeaHandedness();
243 vector<CGeom2DIPoint> VPoints;
248 VPoints.push_back(PtiCoastPoint);
254 vector<int> VnCentrePointsXOffset, VnCentrePointsYOffset;
256 for (
int m = 0; m < nHalfWidth; m++)
262 for (
int n = 1; n < nLength; n++)
268 VPoints.push_back(PtiTmp);
270 VnCentrePointsXOffset.push_back(PtiTmp.
nGetX() - nCoastX);
271 VnCentrePointsYOffset.push_back(PtiTmp.
nGetY() - nCoastY);
277 int const nCoastPointInBlockBefore = nCoastPoint - m;
278 int const nCoastPointInBlockAfter = nCoastPoint + m;
280 if (nCoastPointInBlockBefore >= 0)
282 int const nCoastXInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetX();
283 int const nCoastYInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetY();
287 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockBefore, nCoastYInBlockBefore));
289 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
291 int const nXTmp = nCoastXInBlockBefore + VnCentrePointsXOffset[n];
292 int const nYTmp = nCoastYInBlockBefore + VnCentrePointsYOffset[n];
300 if (nCoastPointInBlockAfter < nCoastLen)
302 int const nCoastXInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetX();
303 int const nCoastYInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetY();
307 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockAfter, nCoastYInBlockAfter));
309 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
311 int const nXTmp = nCoastXInBlockAfter + VnCentrePointsXOffset[n];
312 int const nYTmp = nCoastYInBlockAfter + VnCentrePointsYOffset[n];
319 if (find(begin(VPoints), end(VPoints), PtiTmp) == end(VPoints))
321 VPoints.push_back(PtiTmp);
347 double const dFineDepth = dFineSedVol /
m_dCellArea;
348 double const dSandDepth = dSandSedVol /
m_dCellArea;
349 double const dCoarseDepth = dCoarseSedVol /
m_dCellArea;
352 LogStream <<
m_ulIter <<
": Total depth of fine sediment added = " << dFineDepth <<
" m, total depth of sand sediment added = " << dSandDepth <<
" m, total depth of coarse sediment added = " << dCoarseDepth <<
" m" << endl;
354 size_t const nArea = VPoints.size();
355 double const dArea =
static_cast<double>(nArea);
356 double const dFineDepthPerCell = dFineDepth / dArea;
357 double const dSandDepthPerCell = dSandDepth / dArea;
358 double const dCoarseDepthPerCell = dCoarseDepth / dArea;
361 int const nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetNumOfTopLayerAboveBasement();
363 for (
unsigned int n = 0; n < nArea; n++)
365 int const nX = VPoints[n].nGetX();
366 int const nY = VPoints[n].nGetY();
369 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepthPerCell);
372 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepthPerCell);
375 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepthPerCell);
388 vector<int> VnLineGridX;
389 vector<int> VnLineGridY;
391 for (
int n = 0; n < nPoints; n++)
442 if (VnLineGridX.size() == 0)
446 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent <<
" at line/coast intersection for line with ID " << nLocID << endl;
452 for (
unsigned int n = 0; n < VnLineGridX.size() - 1; n++)
454 int const nXStart = VnLineGridX[n];
455 int const nXEnd = VnLineGridX[n + 1];
456 int const nYStart = VnLineGridY[n];
457 int const nYEnd = VnLineGridY[n + 1];
460 double dXInc = nXEnd - nXStart;
461 double dYInc = nYEnd - nYStart;
471 for (
int m = 0; m <=
nRound(dLength); m++)
473 int const nX =
nRound(dX);
474 int const nY =
nRound(dY);
514 int const nTopLayer =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetNumOfTopLayerAboveBasement();
517 int const nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
522 nThisPolyCoast =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonCoastID();
534 LogStream <<
" which is within coast " << nThisPolyCoast <<
" polygon " << nThisPoly << endl;
536 LogStream <<
" which is not within a polygon" << endl;
540 double const dFineDepth = dFineSedVol /
m_dCellArea;
544 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
547 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
551 m_VCoast[nThisPolyCoast].pGetPolygon(nThisPoly)->SetSedimentInputUnconsFine(dFineDepth);
561 double const dSandDepth = dSandSedVol /
m_dCellArea;
565 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
568 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
572 m_VCoast[nThisPolyCoast].pGetPolygon(nThisPoly)->SetSedimentInputUnconsSand(dSandDepth);
582 double const dCoarseDepth = dCoarseSedVol /
m_dCellArea;
583 if (dCoarseDepth > 0)
586 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
589 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
593 m_VCoast[nThisPolyCoast].pGetPolygon(nThisPoly)->SetSedimentInputUnconsCoarse(dCoarseDepth);
603 LogStream <<
m_ulIter <<
"; depth of fine sediment added = " << dFineDepth <<
" m, depth of sand sediment added = " << dSandDepth <<
" m, depth of coarse sediment added = " << dCoarseDepth <<
" m" << endl;