88 for (
int n = 0; n < nEvents; n++)
97 if (nPointGridX == -1)
109 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent + 1 <<
" at point [" << nPointGridX <<
"][" << nPointGridY <<
"] = {" <<
dGridXToExtCRSX(nPointGridX) <<
", " <<
dGridYToExtCRSY(nPointGridY) <<
"] with location ID " << nLocID;
111 int nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetTopLayerAboveBasement();
119 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
122 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
124 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
146 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
149 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
151 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
170 if (dCoarseDepth > 0)
173 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
176 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
178 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
195 LogStream <<
", depth of fine sediment added = " << dFineDepth <<
" m, depth of sand sediment added = " << dSandDepth <<
" m, depth of coarse sediment added = " << dCoarseDepth <<
" m" << endl;
202 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;
207 int nCoastX = PtiCoastPoint.
nGetX();
208 int nCoastY = PtiCoastPoint.
nGetY();
211 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;
213 int nCoast =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetCoast();
214 int nCoastPoint =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetPointOnCoast();
217 int nCoastLen =
m_VCoast[nCoast].nGetCoastlineSize();
218 int nCoastXBefore = nCoastX;
219 int nCoastYBefore = nCoastY;
220 int nCoastXAfter = nCoastX;
221 int nCoastYAfter = nCoastY;
225 nCoastXBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetX();
226 nCoastYBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetY();
229 if (nCoastPoint < nCoastLen - 1)
231 nCoastXAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetX();
232 nCoastYAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetY();
235 int nCoastHand =
m_VCoast[nCoast].nGetSeaHandedness();
241 vector<CGeom2DIPoint> VPoints;
246 VPoints.push_back(PtiCoastPoint);
252 vector<int> VnCentrePointsXOffset, VnCentrePointsYOffset;
254 for (
int m = 0; m < nHalfWidth; m++)
260 for (
int n = 1; n < nLength; n++)
266 VPoints.push_back(PtiTmp);
268 VnCentrePointsXOffset.push_back(PtiTmp.
nGetX() - nCoastX);
269 VnCentrePointsYOffset.push_back(PtiTmp.
nGetY() - nCoastY);
276 int nCoastPointInBlockBefore = nCoastPoint - m;
277 int nCoastPointInBlockAfter = nCoastPoint + m;
279 if (nCoastPointInBlockBefore >= 0)
281 int nCoastXInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetX();
282 int nCoastYInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetY();
286 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockBefore, nCoastYInBlockBefore));
288 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
290 int nXTmp = nCoastXInBlockBefore + VnCentrePointsXOffset[n];
291 int nYTmp = nCoastYInBlockBefore + VnCentrePointsYOffset[n];
299 if (nCoastPointInBlockAfter < nCoastLen)
301 int nCoastXInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetX();
302 int nCoastYInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetY();
306 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockAfter, nCoastYInBlockAfter));
308 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
310 int nXTmp = nCoastXInBlockAfter + VnCentrePointsXOffset[n];
311 int nYTmp = nCoastYInBlockAfter + VnCentrePointsYOffset[n];
318 if (find(begin(VPoints), end(VPoints), PtiTmp) == end(VPoints))
320 VPoints.push_back(PtiTmp);
351 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;
353 size_t nArea = VPoints.size();
354 double dArea =
static_cast<double>(nArea);
355 double dFineDepthPerCell = dFineDepth / dArea;
356 double dSandDepthPerCell = dSandDepth / dArea;
357 double dCoarseDepthPerCell = dCoarseDepth / dArea;
360 int nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetTopLayerAboveBasement();
362 for (
unsigned int n = 0; n < nArea; n++)
364 int nX = VPoints[n].nGetX();
365 int nY = VPoints[n].nGetY();
368 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepthPerCell);
371 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepthPerCell);
374 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 nXStart = VnLineGridX[n];
455 int nXEnd = VnLineGridX[n + 1];
456 int nYStart = VnLineGridY[n];
457 int nYEnd = VnLineGridY[n + 1];
460 double dXInc = nXEnd - nXStart;
461 double dYInc = nYEnd - nYStart;
471 for (
int m = 0; m <=
nRound(dLength); m++)
518 int nTopLayer =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetTopLayerAboveBasement();
526 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
529 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
531 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
553 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
556 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
558 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
577 if (dCoarseDepth > 0)
580 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
583 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
585 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
602 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;