40bool bPolygonLengthPairCompare(
const pair<int, double>& prLeft,
const pair<int, double>& prRight)
53 for (
int nCoast = 0; nCoast < static_cast<int>(
m_VCoast.size()); nCoast++)
55 int const nNumPolygons =
m_VCoast[nCoast].nGetNumPolygons();
58 vector<pair<int, double>> prVPolygonLength;
60 for (
int nPoly = 0; nPoly < nNumPolygons; nPoly++)
63 double const dSeawardLength = pPolygon->
dGetLength();
64 prVPolygonLength.push_back(make_pair(nPoly, dSeawardLength));
68 sort(prVPolygonLength.begin(), prVPolygonLength.end(), bPolygonLengthPairCompare);
71 for (
int n = 0; n < nNumPolygons; n++)
73 int const nThisPoly = prVPolygonLength[n].first;
80 int const nCoastStartPoint =
m_VCoast[nCoast].pGetProfile(nStartNormal)->nGetCoastPoint();
81 int const nCoastEndPoint =
m_VCoast[nCoast].pGetProfile(nEndNormal)->nGetCoastPoint();
83 int nActiveZonePoints = 0;
85 double dAvgBreakingWaveHeight = 0;
86 double dAvgBreakingWaveAngle = 0;
87 double dAvgDeepWaterWavePeriod = 0;
88 double dAvgFluxOrientation = 0;
89 double dAvgBreakingDepth = 0;
90 double dAvgBreakingDist = 0;
93 for (
int nCoastPoint = nCoastStartPoint; nCoastPoint < nCoastEndPoint - 1; nCoastPoint++)
96 dAvgFluxOrientation +=
m_VCoast[nCoast].dGetFluxOrientation(nCoastPoint);
98 double const dThisBreakingWaveHeight =
m_VCoast[nCoast].dGetBreakingWaveHeight(nCoastPoint);
104 dAvgBreakingWaveHeight += dThisBreakingWaveHeight;
106 double const dThisBreakingWaveAngle =
m_VCoast[nCoast].dGetBreakingWaveAngle(nCoastPoint);
107 double const dThisDeepWaterWavePeriod =
m_VCoast[nCoast].dGetCoastDeepWaterWavePeriod(nCoastPoint);
109 dAvgBreakingWaveAngle += dThisBreakingWaveAngle;
110 dAvgDeepWaterWavePeriod += dThisDeepWaterWavePeriod;
112 dAvgBreakingDepth +=
m_VCoast[nCoast].dGetDepthOfBreaking(nCoastPoint);
119 if (nCoastPoints == 0)
123 dAvgFluxOrientation /= nCoastPoints;
125 if (nActiveZonePoints > 0)
128 dAvgBreakingWaveHeight /= nActiveZonePoints;
129 dAvgBreakingWaveAngle /= nActiveZonePoints;
130 dAvgDeepWaterWavePeriod /= nActiveZonePoints;
131 dAvgBreakingDepth /= nActiveZonePoints;
132 dAvgBreakingDist /= nActiveZonePoints;
135 int const nSeaHand =
m_VCoast[nCoast].nGetSeaHandedness();
136 double dNormalOrientation;
144 double dThetaBr = dNormalOrientation - dAvgBreakingWaveAngle;
147 dThetaBr = dAvgBreakingWaveAngle + 360.0 - dNormalOrientation;
148 else if (dThetaBr < -270)
149 dThetaBr = dNormalOrientation + 360.0 - dAvgBreakingWaveAngle;
151 bool bDownCoast =
true;
160 dThetaBr =
tAbs(dThetaBr);
163 dThetaBr =
tMin(dThetaBr, 90.0);
166 double dImmersedWeightTransport = 0;
189 if (dAvgBreakingDist > 0)
195 double const dBeachSlope = dAvgBreakingDepth / dAvgBreakingDist;
198 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);
210 double dSedimentDepth = dSedimentVol /
m_dCellArea;