91 for (
int n = 0; n < nEvents; n++)
100 if (nPointGridX == -1)
112 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent + 1 <<
" at point [" << nPointGridX <<
"][" << nPointGridY <<
"] = {" <<
dGridXToExtCRSX(nPointGridX) <<
", " <<
dGridYToExtCRSY(nPointGridY) <<
"] with location ID " << nLocID;
114 int const nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetTopLayerAboveBasement();
117 double const dFineDepth = dFineSedVol /
m_dCellArea;
122 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
125 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
127 int const nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
144 double const dSandDepth = dSandSedVol /
m_dCellArea;
149 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
152 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
154 int const nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
171 double const dCoarseDepth = dCoarseSedVol /
m_dCellArea;
173 if (dCoarseDepth > 0)
176 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
179 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
181 int const nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
198 LogStream <<
", depth of fine sediment added = " << dFineDepth <<
" m, depth of sand sediment added = " << dSandDepth <<
" m, depth of coarse sediment added = " << dCoarseDepth <<
" m" << endl;
205 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;
210 int const nCoastX = PtiCoastPoint.
nGetX();
211 int const nCoastY = PtiCoastPoint.
nGetY();
214 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;
216 int const nCoast =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetCoast();
217 int const nCoastPoint =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetPointOnCoast();
220 int const nCoastLen =
m_VCoast[nCoast].nGetCoastlineSize();
221 int nCoastXBefore = nCoastX;
222 int nCoastYBefore = nCoastY;
223 int nCoastXAfter = nCoastX;
224 int nCoastYAfter = nCoastY;
228 nCoastXBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetX();
229 nCoastYBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetY();
232 if (nCoastPoint < nCoastLen - 1)
234 nCoastXAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetX();
235 nCoastYAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetY();
238 int const nCoastHand =
m_VCoast[nCoast].nGetSeaHandedness();
244 vector<CGeom2DIPoint> VPoints;
249 VPoints.push_back(PtiCoastPoint);
255 vector<int> VnCentrePointsXOffset, VnCentrePointsYOffset;
257 for (
int m = 0; m < nHalfWidth; m++)
263 for (
int n = 1; n < nLength; n++)
269 VPoints.push_back(PtiTmp);
271 VnCentrePointsXOffset.push_back(PtiTmp.
nGetX() - nCoastX);
272 VnCentrePointsYOffset.push_back(PtiTmp.
nGetY() - nCoastY);
279 int const nCoastPointInBlockBefore = nCoastPoint - m;
280 int const nCoastPointInBlockAfter = nCoastPoint + m;
282 if (nCoastPointInBlockBefore >= 0)
284 int const nCoastXInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetX();
285 int const nCoastYInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetY();
289 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockBefore, nCoastYInBlockBefore));
291 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
293 int const nXTmp = nCoastXInBlockBefore + VnCentrePointsXOffset[n];
294 int const nYTmp = nCoastYInBlockBefore + VnCentrePointsYOffset[n];
302 if (nCoastPointInBlockAfter < nCoastLen)
304 int const nCoastXInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetX();
305 int const nCoastYInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetY();
309 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockAfter, nCoastYInBlockAfter));
311 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
313 int const nXTmp = nCoastXInBlockAfter + VnCentrePointsXOffset[n];
314 int const nYTmp = nCoastYInBlockAfter + VnCentrePointsYOffset[n];
321 if (find(begin(VPoints), end(VPoints), PtiTmp) == end(VPoints))
323 VPoints.push_back(PtiTmp);
349 double const dFineDepth = dFineSedVol /
m_dCellArea;
350 double const dSandDepth = dSandSedVol /
m_dCellArea;
351 double const dCoarseDepth = dCoarseSedVol /
m_dCellArea;
354 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;
356 size_t const nArea = VPoints.size();
357 double const dArea =
static_cast<double>(nArea);
358 double const dFineDepthPerCell = dFineDepth / dArea;
359 double const dSandDepthPerCell = dSandDepth / dArea;
360 double const dCoarseDepthPerCell = dCoarseDepth / dArea;
363 int const nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetTopLayerAboveBasement();
365 for (
unsigned int n = 0; n < nArea; n++)
367 int const nX = VPoints[n].nGetX();
368 int const nY = VPoints[n].nGetY();
371 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepthPerCell);
374 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepthPerCell);
377 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepthPerCell);
391 vector<int> VnLineGridX;
392 vector<int> VnLineGridY;
394 for (
int n = 0; n < nPoints; n++)
445 if (VnLineGridX.size() == 0)
449 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent <<
" at line/coast intersection for line with ID " << nLocID << endl;
455 for (
unsigned int n = 0; n < VnLineGridX.size() - 1; n++)
457 int const nXStart = VnLineGridX[n];
458 int const nXEnd = VnLineGridX[n + 1];
459 int const nYStart = VnLineGridY[n];
460 int const nYEnd = VnLineGridY[n + 1];
463 double dXInc = nXEnd - nXStart;
464 double dYInc = nYEnd - nYStart;
474 for (
int m = 0; m <=
nRound(dLength); m++)
476 int const nX =
nRound(dX);
477 int const nY =
nRound(dY);
521 int const nTopLayer =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetTopLayerAboveBasement();
524 double const dFineDepth = dFineSedVol /
m_dCellArea;
529 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
532 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
534 int const nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
551 double const dSandDepth = dSandSedVol /
m_dCellArea;
556 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
559 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
561 int const nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
578 double const dCoarseDepth = dCoarseSedVol /
m_dCellArea;
580 if (dCoarseDepth > 0)
583 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
586 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
588 int const nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
605 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;