45bool bPolygonLengthPairCompare(
const pair<int, double>& prLeft,
const pair<int, double>& prRight)
58 for (
int nCoast = 0; nCoast < static_cast<int>(
m_VCoast.size()); nCoast++)
60 int const nNumPolygons =
m_VCoast[nCoast].nGetNumPolygons();
63 vector<pair<int, double>> prVPolygonLength;
65 for (
int nPoly = 0; nPoly < nNumPolygons; nPoly++)
68 double const dSeawardLength = pPolygon->
dGetLength();
69 prVPolygonLength.push_back(make_pair(nPoly, dSeawardLength));
73 sort(prVPolygonLength.begin(), prVPolygonLength.end(), bPolygonLengthPairCompare);
76 for (
int n = 0; n < nNumPolygons; n++)
78 int const nThisPoly = prVPolygonLength[n].first;
85 int const nCoastStartPoint =
m_VCoast[nCoast].pGetProfile(nStartNormal)->nGetCoastPoint();
86 int const nCoastEndPoint =
m_VCoast[nCoast].pGetProfile(nEndNormal)->nGetCoastPoint();
88 int nActiveZonePoints = 0;
90 double dAvgBreakingWaveHeight = 0;
91 double dAvgBreakingWaveAngle = 0;
92 double dAvgDeepWaterWavePeriod = 0;
93 double dAvgFluxOrientation = 0;
94 double dAvgBreakingDepth = 0;
95 double dAvgBreakingDist = 0;
98 for (
int nCoastPoint = nCoastStartPoint; nCoastPoint < nCoastEndPoint - 1; nCoastPoint++)
101 dAvgFluxOrientation +=
m_VCoast[nCoast].dGetFluxOrientation(nCoastPoint);
103 double const dThisBreakingWaveHeight =
m_VCoast[nCoast].dGetBreakingWaveHeight(nCoastPoint);
109 dAvgBreakingWaveHeight += dThisBreakingWaveHeight;
111 double const dThisBreakingWaveAngle =
m_VCoast[nCoast].dGetBreakingWaveAngle(nCoastPoint);
112 double const dThisDeepWaterWavePeriod =
m_VCoast[nCoast].dGetCoastDeepWaterWavePeriod(nCoastPoint);
114 dAvgBreakingWaveAngle += dThisBreakingWaveAngle;
115 dAvgDeepWaterWavePeriod += dThisDeepWaterWavePeriod;
117 dAvgBreakingDepth +=
m_VCoast[nCoast].dGetDepthOfBreaking(nCoastPoint);
124 if (nCoastPoints == 0)
128 dAvgFluxOrientation /= nCoastPoints;
130 if (nActiveZonePoints > 0)
133 dAvgBreakingWaveHeight /= nActiveZonePoints;
134 dAvgBreakingWaveAngle /= nActiveZonePoints;
135 dAvgDeepWaterWavePeriod /= nActiveZonePoints;
136 dAvgBreakingDepth /= nActiveZonePoints;
137 dAvgBreakingDist /= nActiveZonePoints;
140 int const nSeaHand =
m_VCoast[nCoast].nGetSeaHandedness();
141 double dNormalOrientation;
150 double dThetaBr = dNormalOrientation - dAvgBreakingWaveAngle;
153 dThetaBr = dAvgBreakingWaveAngle + 360.0 - dNormalOrientation;
155 else if (dThetaBr < -270)
156 dThetaBr = dNormalOrientation + 360.0 - dAvgBreakingWaveAngle;
158 bool bDownCoast =
true;
167 dThetaBr =
tAbs(dThetaBr);
170 dThetaBr =
tMin(dThetaBr, 90.0);
173 double dImmersedWeightTransport = 0;
201 if (dAvgBreakingDist > 0)
207 double const dBeachSlope = dAvgBreakingDepth / dAvgBreakingDist;
210 dImmersedWeightTransport =
m_dKamphuis * 2.33 * pow(dAvgDeepWaterWavePeriod, 1.5) * pow(dBeachSlope, 0.75) * pow(dD50, -0.25) * pow(dAvgBreakingWaveHeight, 2) * pow(sin((
PI / 180) * 2 * dThetaBr), 0.6);
222 double dSedimentDepth = dSedimentVol /
m_dCellArea;