86 for (
int n = 0; n < nEvents; n++)
95 if (nPointGridX == -1)
107 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent+1 <<
" at point [" << nPointGridX <<
"][" << nPointGridY <<
"] = {" <<
dGridXToExtCRSX(nPointGridX) <<
", " <<
dGridYToExtCRSY(nPointGridY) <<
"] with location ID " << nLocID;
109 int nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetTopLayerAboveBasement();
116 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
119 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
121 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
141 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
144 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
146 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
163 if (dCoarseDepth > 0)
166 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
169 m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].CalcAllLayerElevsAndD50();
171 int nThisPoly =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetPolygonID();
187 LogStream <<
", depth of fine sediment added = " << dFineDepth <<
" m, depth of sand sediment added = " << dSandDepth <<
" m, depth of coarse sediment added = " << dCoarseDepth <<
" m" << endl;
193 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;
198 int nCoastX = PtiCoastPoint.
nGetX();
199 int nCoastY = PtiCoastPoint.
nGetY();
202 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;
204 int nCoast =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetCoast();
205 int nCoastPoint =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLandform()->nGetPointOnCoast();
208 int nCoastLen =
m_VCoast[nCoast].nGetCoastlineSize();
209 int nCoastXBefore = nCoastX;
210 int nCoastYBefore = nCoastY;
211 int nCoastXAfter = nCoastX;
212 int nCoastYAfter = nCoastY;
216 nCoastXBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetX();
217 nCoastYBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint - 1)->nGetY();
220 if (nCoastPoint < nCoastLen - 1)
222 nCoastXAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetX();
223 nCoastYAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint + 1)->nGetY();
226 int nCoastHand =
m_VCoast[nCoast].nGetSeaHandedness();
232 vector<CGeom2DIPoint> VPoints;
237 VPoints.push_back(PtiCoastPoint);
242 vector<int> VnCentrePointsXOffset, VnCentrePointsYOffset;
244 for (
int m = 0; m < nHalfWidth; m++)
249 for (
int n = 1; n < nLength; n++)
255 VPoints.push_back(PtiTmp);
257 VnCentrePointsXOffset.push_back(PtiTmp.
nGetX() - nCoastX);
258 VnCentrePointsYOffset.push_back(PtiTmp.
nGetY() - nCoastY);
264 int nCoastPointInBlockBefore = nCoastPoint - m;
265 int nCoastPointInBlockAfter = nCoastPoint + m;
267 if (nCoastPointInBlockBefore >= 0)
269 int nCoastXInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetX();
270 int nCoastYInBlockBefore =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockBefore)->nGetY();
274 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockBefore, nCoastYInBlockBefore));
276 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
278 int nXTmp = nCoastXInBlockBefore + VnCentrePointsXOffset[n];
279 int nYTmp = nCoastYInBlockBefore + VnCentrePointsYOffset[n];
287 if (nCoastPointInBlockAfter < nCoastLen)
289 int nCoastXInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetX();
290 int nCoastYInBlockAfter =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPointInBlockAfter)->nGetY();
294 VPoints.push_back(
CGeom2DIPoint(nCoastXInBlockAfter, nCoastYInBlockAfter));
296 for (
unsigned int n = 0; n < VnCentrePointsXOffset.size(); n++)
298 int nXTmp = nCoastXInBlockAfter + VnCentrePointsXOffset[n];
299 int nYTmp = nCoastYInBlockAfter + VnCentrePointsYOffset[n];
306 if (find(begin(VPoints), end(VPoints), PtiTmp) == end(VPoints))
308 VPoints.push_back(PtiTmp);
339 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;
341 size_t nArea = VPoints.size();
342 double dArea =
static_cast<double>(nArea);
343 double dFineDepthPerCell = dFineDepth / dArea;
344 double dSandDepthPerCell = dSandDepth / dArea;
345 double dCoarseDepthPerCell = dCoarseDepth / dArea;
348 int nTopLayer =
m_pRasterGrid->m_Cell[nPointGridX][nPointGridY].nGetTopLayerAboveBasement();
349 for (
unsigned int n = 0; n < nArea; n++)
351 int nX = VPoints[n].nGetX();
352 int nY = VPoints[n].nGetY();
355 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepthPerCell);
358 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepthPerCell);
361 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepthPerCell);
374 vector<int> VnLineGridX;
375 vector<int> VnLineGridY;
377 for (
int n = 0; n < nPoints; n++)
428 if (VnLineGridX.size() == 0)
432 LogStream <<
m_ulIter <<
": Sediment input event " << nEvent <<
" at line/coast intersection for line with ID " << nLocID << endl;
438 for (
unsigned int n = 0; n < VnLineGridX.size() - 1; n++)
440 int nXStart = VnLineGridX[n];
441 int nXEnd = VnLineGridX[n + 1];
442 int nYStart = VnLineGridY[n];
443 int nYEnd = VnLineGridY[n + 1];
446 double dXInc = nXEnd - nXStart;
447 double dYInc = nYEnd - nYStart;
457 for (
int m = 0; m <=
nRound(dLength); m++)
504 int nTopLayer =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetTopLayerAboveBasement();
511 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddFineSedimentInputDepth(dFineDepth);
514 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
516 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
536 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddSandSedimentInputDepth(dSandDepth);
539 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
541 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
558 if (dCoarseDepth > 0)
561 m_pRasterGrid->m_Cell[nCoastX][nCoastY].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->AddCoarseSedimentInputDepth(dCoarseDepth);
564 m_pRasterGrid->m_Cell[nCoastX][nCoastY].CalcAllLayerElevsAndD50();
566 int nThisPoly =
m_pRasterGrid->m_Cell[nCoastX][nCoastY].nGetPolygonID();
582 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;