87 for (
int n = 0; n < nEvents; n++)
96 if (nPointGridX == -1)
108 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent+1 <<
" at point [" << nPointGridX <<
"][" << nPointGridY <<
"] = {" <<
dGridXToExtCRSX(nPointGridX) <<
", " <<
dGridYToExtCRSY(nPointGridY) <<
"] with location ID " << nLocID;
110 int nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetTopLayerAboveBasement();
117 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
120 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
122 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
142 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
145 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
147 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
164 if (dCoarseDepth > 0)
167 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
170 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
172 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
188 LogStream <<
", depth of fine sediment added = " << dFineDepth <<
" m, depth of sand sediment added = " << dSandDepth <<
" m, depth of coarse sediment added = " << dCoarseDepth <<
" m" << endl;
194 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;
199 int nCoastX = PtiCoastPoint.
nGetX();
200 int nCoastY = PtiCoastPoint.
nGetY();
203 LogStream <<
m_ulIter <<
": Closest coast point is at [" << nCoastX <<
"][" << nCoastY <<
"] = {" <<
dGridXToExtCRSX(nCoastX) <<
", " <<
dGridYToExtCRSY(nCoastY) <<
"}, along-coast width of sediment block = " << dWidth <<
" m, coast-normal length of sediment block = " << dLen <<
" m" << endl;
205 int nCoast =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetCoast();
206 int nCoastPoint =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetPointOnCoast();
209 int nCoastLen =
m_VCoast[nCoast].nGetCoastlineSize();
210 int nCoastXBefore = nCoastX;
211 int nCoastYBefore = nCoastY;
212 int nCoastXAfter = nCoastX;
213 int nCoastYAfter = nCoastY;
217 nCoastXBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetX();
218 nCoastYBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetY();
221 if (nCoastPoint < nCoastLen - 1)
223 nCoastXAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetX();
224 nCoastYAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetY();
227 int nCoastHand =
m_VCoast[nCoast].nGetSeaHandedness();
233 vector<CGeom2DIPoint> VPoints;
238 VPoints.push_back(PtiCoastPoint);
243 vector<int> VnCentrePointsXOffset, VnCentrePointsYOffset;
245 for (
int m = 0; m < nHalfWidth; m++)
250 for (
int n = 1; n < nLength; n++)
256 VPoints.push_back(PtiTmp);
258 VnCentrePointsXOffset.push_back(PtiTmp.
nGetX() - nCoastX);
259 VnCentrePointsYOffset.push_back(PtiTmp.
nGetY() - nCoastY);
265 int nCoastPointInBlockBefore = nCoastPoint - m;
266 int nCoastPointInBlockAfter = nCoastPoint + m;
268 if (nCoastPointInBlockBefore >= 0)
270 int nCoastXInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetX();
271 int nCoastYInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetY();
275 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockBefore, nCoastYInBlockBefore));
277 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
279 int nXTmp = nCoastXInBlockBefore + VnCentrePointsXOffset[n];
280 int nYTmp = nCoastYInBlockBefore + VnCentrePointsYOffset[n];
288 if (nCoastPointInBlockAfter < nCoastLen)
290 int nCoastXInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetX();
291 int nCoastYInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetY();
295 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockAfter, nCoastYInBlockAfter));
297 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
299 int nXTmp = nCoastXInBlockAfter + VnCentrePointsXOffset[n];
300 int nYTmp = nCoastYInBlockAfter + VnCentrePointsYOffset[n];
307 if (find(begin(VPoints), end(VPoints), PtiTmp) == end(VPoints))
309 VPoints.push_back(PtiTmp);
340 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;
342 size_t nArea = VPoints.size();
343 double dArea =
static_cast<double>(nArea);
344 double dFineDepthPerCell = dFineDepth / dArea;
345 double dSandDepthPerCell = dSandDepth / dArea;
346 double dCoarseDepthPerCell = dCoarseDepth / dArea;
349 int nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetTopLayerAboveBasement();
350 for (
unsigned int n = 0; n < nArea; n++)
352 int nX = VPoints[n].nGetX();
353 int nY = VPoints[n].nGetY();
356 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepthPerCell);
359 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepthPerCell);
362 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepthPerCell);
375 vector<int> VnLineGridX;
376 vector<int> VnLineGridY;
378 for (
int n = 0; n < nPoints; n++)
429 if (VnLineGridX.size() == 0)
433 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent <<
" at line/coast intersection for line with ID " << nLocID << endl;
439 for (
unsigned int n = 0; n < VnLineGridX.size() - 1; n++)
441 int nXStart = VnLineGridX[n];
442 int nXEnd = VnLineGridX[n + 1];
443 int nYStart = VnLineGridY[n];
444 int nYEnd = VnLineGridY[n + 1];
447 double dXInc = nXEnd - nXStart;
448 double dYInc = nYEnd - nYStart;
458 for (
int m = 0; m <=
nRound(dLength); m++)
505 int nTopLayer =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetTopLayerAboveBasement();
512 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
515 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
517 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
537 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
540 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
542 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
559 if (dCoarseDepth > 0)
562 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
565 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
567 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
583 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;