CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
gis_utils.cpp
Go to the documentation of this file.
1
26
27/*===============================================================================================================================
28
29This file is part of CoastalME, the Coastal Modelling Environment.
30
31CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
32
33This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
34
35You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
36
37===============================================================================================================================*/
38#include <assert.h>
39
40#include <iostream>
41using std::cerr;
42using std::cout;
43using std::endl;
44using std::ios;
45
46#include <cmath>
47
48#include <cfloat>
49
50#include <gdal_priv.h>
51
52#include <ogrsf_frmts.h>
53
54#include "cme.h"
55#include "simulation.h"
56#include "coast.h"
57#include "raster_grid.h"
58
59//===============================================================================================================================
61//===============================================================================================================================
62double CSimulation::dGridCentroidXToExtCRSX(int const nGridX) const
63{
64 // TODO 064
65 return (m_dGeoTransform[0] + (nGridX * m_dGeoTransform[1]) + (m_dGeoTransform[1] / 2));
66}
67
68//===============================================================================================================================
70//===============================================================================================================================
71double CSimulation::dGridCentroidYToExtCRSY(int const nGridY) const
72{
73 // TODO 064
74 return (m_dGeoTransform[3] + (nGridY * m_dGeoTransform[5]) + (m_dGeoTransform[5] / 2));
75}
76
77//===============================================================================================================================
79//===============================================================================================================================
81{
82 // TODO 064
83 double dX = m_dGeoTransform[0] + (pPtiIn->nGetX() * m_dGeoTransform[1]) + (m_dGeoTransform[1] / 2);
84 double dY = m_dGeoTransform[3] + (pPtiIn->nGetY() * m_dGeoTransform[5]) + (m_dGeoTransform[5] / 2);
85
86 return CGeom2DPoint(dX, dY);
87}
88
89//===============================================================================================================================
91//===============================================================================================================================
92double CSimulation::dGridXToExtCRSX(double const dGridX) const
93{
94 // TODO 064 Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2)
95 return m_dGeoTransform[0] + (dGridX * m_dGeoTransform[1]) - 1;
96}
97
98//===============================================================================================================================
100//===============================================================================================================================
101double CSimulation::dGridYToExtCRSY(double const dGridY) const
102{
103 // TODO 064 Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5)
104 return m_dGeoTransform[3] + (dGridY * m_dGeoTransform[5]) - 1;
105}
106
107//===============================================================================================================================
109//===============================================================================================================================
110double CSimulation::dExtCRSXToGridX(double const dExtCRSX) const
111{
112 // TODO 064
113 return ((dExtCRSX - m_dGeoTransform[0]) / m_dGeoTransform[1]) - 1;
114}
115
116//===============================================================================================================================
118//===============================================================================================================================
119double CSimulation::dExtCRSYToGridY(double const dExtCRSY) const
120{
121 // TODO 064
122 return ((dExtCRSY - m_dGeoTransform[3]) / m_dGeoTransform[5]) - 1;
123}
124
125//===============================================================================================================================
127//===============================================================================================================================
129{
130 // TODO 064
131 int nX = nRound(((pPtIn->dGetX() - m_dGeoTransform[0]) / m_dGeoTransform[1]) - 1);
132 int nY = nRound(((pPtIn->dGetY() - m_dGeoTransform[3]) / m_dGeoTransform[5]) - 1);
133
134 return CGeom2DIPoint(nX, nY);
135}
136
137//===============================================================================================================================
139//===============================================================================================================================
141{
142 double dXDist = Pt1->dGetX() - Pt2->dGetX();
143 double dYDist = Pt1->dGetY() - Pt2->dGetY();
144
145 return hypot(dXDist, dYDist);
146}
147
148//===============================================================================================================================
150//===============================================================================================================================
152{
153 double dXDist = Pti1->nGetX() - Pti2->nGetX();
154 double dYDist = Pti1->nGetY() - Pti2->nGetY();
155
156 return hypot(dXDist, dYDist);
157}
158
159//===============================================================================================================================
161//===============================================================================================================================
162double CSimulation::dTriangleAreax2(CGeom2DPoint const* pPtA, CGeom2DPoint const* pPtB, CGeom2DPoint const* pPtC)
163{
164 return (pPtB->dGetX() - pPtA->dGetX()) * (pPtC->dGetY() - pPtA->dGetY()) - (pPtB->dGetY() - pPtA->dGetY()) * (pPtC->dGetX() - pPtA->dGetX());
165}
166
167//===============================================================================================================================
169//===============================================================================================================================
170bool CSimulation::bIsWithinValidGrid(int const nX, int const nY) const
171{
172 if ((nX < 0) || (nX >= m_nXGridSize))
173 return false;
174
175 if ((nY < 0) || (nY >= m_nYGridSize))
176 return false;
177
178 if (m_pRasterGrid->m_Cell[nX][nY].bBasementElevIsMissingValue())
179 return false;
180
181 return true;
182}
183
184//===============================================================================================================================
186//===============================================================================================================================
188{
189 int nX = Pti->nGetX();
190 int nY = Pti->nGetY();
191
192 return this->bIsWithinValidGrid(nX, nY);
193}
194
195//===============================================================================================================================
197//===============================================================================================================================
199{
200 KeepWithinValidGrid(Pti0->nGetX(), Pti0->nGetY(), *Pti1->pnGetX(), *Pti1->pnGetY());
201}
202
203//===============================================================================================================================
205//===============================================================================================================================
206void CSimulation::KeepWithinValidGrid(int nX0, int nY0, int &nX1, int &nY1) const
207{
208 // Safety check: make sure that the first point is within the valid grid
209 if (nX0 >= m_nXGridSize)
210 nX0 = m_nXGridSize - 1;
211 else if (nX0 < 0)
212 nX0 = 0;
213
214 if (nY0 >= m_nYGridSize)
215 nY0 = m_nYGridSize - 1;
216 else if (nY0 < 0)
217 nY0 = 0;
218
219 // OK let's go
220 int nDiffX = nX0 - nX1;
221 int nDiffY = nY0 - nY1;
222
223 if (nDiffX == 0)
224 {
225 // The two points have the same x coordinates, so we just need to constrain the y co-ord
226 if (nY1 < nY0)
227 {
228 nY1 = -1;
229
230 do
231 {
232 nY1++;
233 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
234
235 return;
236 }
237 else
238 {
239 nY1 = m_nYGridSize;
240
241 do
242 {
243 nY1--;
244 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
245
246 return;
247 }
248 }
249 else if (nDiffY == 0)
250 {
251 // The two points have the same y coordinates, so we just need to constrain the x co-ord
252 if (nX1 < nX0)
253 {
254 nX1 = -1;
255
256 do
257 {
258 nX1++;
259 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
260
261 return;
262 }
263 else
264 {
265 nX1 = m_nXGridSize;
266
267 do
268 {
269 nX1--;
270 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
271
272 return;
273 }
274 }
275 else
276 {
277 // The two points have different x coordinates and different y coordinates, so we have to work harder. First find which of the coordinates is the greatest distance outside the grid, and constrain that co-ord for efficiency (since this will reduce the number of times round the loop). Note that both may be inside the grid, if the incorrect co-ord is in the invalid margin, in which case arbitrarily contrain the x co-ord
278 int nXDistanceOutside = 0;
279 int nYDistanceOutside = 0;
280
281 if (nX1 < 0)
282 nXDistanceOutside = -nX1;
283 else if (nX1 >= m_nXGridSize)
284 nXDistanceOutside = nX1 - m_nXGridSize + 1;
285
286 if (nY1 < 0)
287 nYDistanceOutside = -nY1;
288 else if (nY1 >= m_nYGridSize)
289 nXDistanceOutside = nY1 - m_nYGridSize + 1;
290
291 if (nXDistanceOutside >= nYDistanceOutside)
292 {
293 // Constrain the x co-ord
294 if (nX1 < nX0)
295 {
296 // The incorrect x co-ord is less than the correct x co-ord: constrain it and find the y co-ord
297 nX1 = -1;
298
299 do
300 {
301 nX1++;
302
303 nY1 = nY0 + nRound(((nX1 - nX0) * nDiffY) / static_cast<double>(nDiffX));
304 } while ((nY1 < 0) || (nY1 >= m_nYGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
305
306 return;
307 }
308
309 else
310 {
311 // The incorrect x co-ord is greater than the correct x-co-ord: constrain it and find the y co-ord
312 nX1 = m_nXGridSize;
313
314 do
315 {
316 nX1--;
317
318 nY1 = nY0 + nRound(((nX1 - nX0) * nDiffY) / static_cast<double>(nDiffX));
319 } while ((nY1 < 0) || (nY1 >= m_nYGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
320
321 return;
322 }
323 }
324 else
325 {
326 // Constrain the y co-ord
327 if (nY1 < nY0)
328 {
329 // The incorrect y co-ord is less than the correct y-co-ord: constrain it and find the x co-ord
330 nY1 = -1;
331
332 do
333 {
334 nY1++;
335
336 nX1 = nX0 + nRound(((nY1 - nY0) * nDiffX) / static_cast<double>(nDiffY));
337 } while ((nX1 < 0) || (nX1 >= m_nXGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
338
339 return;
340 }
341
342 else
343 {
344 // The incorrect y co-ord is greater than the correct y co-ord: constrain it and find the x co-ord
345 nY1 = m_nYGridSize;
346
347 do
348 {
349 nY1--;
350
351 nX1 = nX0 + nRound(((nY1 - nY0) * nDiffX) / static_cast<double>(nDiffY));
352 } while ((nX1 < 0) || (nX1 >= m_nXGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
353
354 return;
355 }
356 }
357 }
358}
359
360//===============================================================================================================================
362//===============================================================================================================================
363double CSimulation::dKeepWithin360(double const dAngle)
364{
365 double dNewAngle = dAngle;
366
367 // Sort out -ve angles
368 while (dNewAngle < 0)
369 dNewAngle += 360;
370
371 // Sort out angles > 360
372 while (dNewAngle > 360)
373 dNewAngle -= 360;
374
375 return dNewAngle;
376}
377
378//===============================================================================================================================
380//===============================================================================================================================
382{
383 double dPt1X = pPt1->dGetX();
384 double dPt1Y = pPt1->dGetY();
385 double dPt2X = pPt2->dGetX();
386 double dPt2Y = pPt2->dGetY();
387 double dPtAvgX = (dPt1X + dPt2X) / 2;
388 double dPtAvgY = (dPt1Y + dPt2Y) / 2;
389
390 return CGeom2DPoint(dPtAvgX, dPtAvgY);
391}
392
393// //===============================================================================================================================
394// //! Returns an integer point (grid CRS) which is the approximate average of (i.e. is midway between) two other grid CRS integer points
395// //===============================================================================================================================
396// CGeom2DIPoint CSimulation::PtiAverage(CGeom2DIPoint const* pPti1, CGeom2DIPoint const* pPti2)
397// {
398// int nPti1X = pPti1->nGetX();
399// int nPti1Y = pPti1->nGetY();
400// int nPti2X = pPti2->nGetX();
401// int nPti2Y = pPti2->nGetY();
402// int nPtiAvgX = (nPti1X + nPti2X) / 2;
403// int nPtiAvgY = (nPti1Y + nPti2Y) / 2;
404//
405// return CGeom2DIPoint(nPtiAvgX, nPtiAvgY);
406// }
407
408//===============================================================================================================================
410//===============================================================================================================================
411CGeom2DIPoint CSimulation::PtiWeightedAverage(CGeom2DIPoint const* pPti1, CGeom2DIPoint const* pPti2, double const dWeight)
412{
413 int nPti1X = pPti1->nGetX();
414 int nPti1Y = pPti1->nGetY();
415 int nPti2X = pPti2->nGetX();
416 int nPti2Y = pPti2->nGetY();
417 double dOtherWeight = 1.0 - dWeight;
418
419 int nPtiWeightAvgX = nRound((dWeight * nPti2X) + (dOtherWeight * nPti1X));
420 int nPtiWeightAvgY = nRound((dWeight * nPti2Y) + (dOtherWeight * nPti1Y));
421
422 return CGeom2DIPoint(nPtiWeightAvgX, nPtiWeightAvgY);
423}
424
425//===============================================================================================================================
427//===============================================================================================================================
428CGeom2DPoint CSimulation::PtAverage(vector<CGeom2DPoint>* pVIn)
429{
430 int nSize = static_cast<int>(pVIn->size());
431 if (nSize == 0)
433
434 double dAvgX = 0;
435 double dAvgY = 0;
436
437 for (int n = 0; n < nSize; n++)
438 {
439 dAvgX += pVIn->at(n).dGetX();
440 dAvgY += pVIn->at(n).dGetY();
441 }
442
443 dAvgX /= nSize;
444 dAvgY /= nSize;
445
446 return CGeom2DPoint(dAvgX, dAvgY);
447}
448
449// //===============================================================================================================================
450// //! Returns a point (grid CRS) which is the average of a vector of grid CRS points
451// //===============================================================================================================================
452// CGeom2DIPoint CSimulation::PtiAverage(vector<CGeom2DIPoint>* pVIn)
453// {
454// int nSize = static_cast<int>(pVIn->size());
455// if (nSize == 0)
456// return CGeom2DIPoint(INT_NODATA, INT_NODATA);
457//
458// double dAvgX = 0;
459// double dAvgY = 0;
460//
461// for (int n = 0; n < nSize; n++)
462// {
463// dAvgX += pVIn->at(n).nGetX();
464// dAvgY += pVIn->at(n).nGetY();
465// }
466//
467// dAvgX /= nSize;
468// dAvgY /= nSize;
469//
470// return CGeom2DIPoint(nRound(dAvgX), nRound(dAvgY));
471// }
472
473//===============================================================================================================================
475//===============================================================================================================================
477{
478 CGeom2DIPoint PtiCentroid(0, 0);
479 int nSize = static_cast<int>(pVIn->size());
480 int nX0 = 0; // Current vertex X
481 int nY0 = 0; // Current vertex Y
482 int nX1 = 0; // Next vertex X
483 int nY1 = 0; // Next vertex Y
484
485 double dA = 0; // Partial signed area
486 double dSignedArea = 0.0;
487
488 // For all vertices except last
489 for (int i = 0; i < nSize - 1; ++i)
490 {
491 nX0 = pVIn->at(i).nGetX();
492 nY0 = pVIn->at(i).nGetY();
493 nX1 = pVIn->at(i + 1).nGetX();
494 nY1 = pVIn->at(i + 1).nGetY();
495
496 dA = (nX0 * nY1) - (nX1 * nY0);
497 dSignedArea += dA;
498 PtiCentroid.AddXAddY((nX0 + nX1) * dA, (nY0 + nY1) * dA);
499 }
500
501 // Do last vertex separately to avoid performing an expensive modulus operation in each iteration
502 nX0 = pVIn->at(nSize - 1).nGetX();
503 nY0 = pVIn->at(nSize - 1).nGetY();
504 nX1 = pVIn->at(0).nGetX();
505 nY1 = pVIn->at(0).nGetY();
506
507 dA = (nX0 * nY1) - (nX1 * nY0);
508 dSignedArea += dA;
509 PtiCentroid.AddXAddY((nX0 + nX1) * dA, (nY0 + nY1) * dA);
510
511 dSignedArea *= 0.5;
512 PtiCentroid.DivXDivY(6.0 * dSignedArea, 6.0 * dSignedArea);
513
514 return PtiCentroid;
515}
516
517/*==============================================================================================================================
518
519Returns a vector which is perpendicular to an existing vector
520
521===============================================================================================================================*/
522// vector<CGeom2DPoint> CSimulation::VGetPerpendicular(CGeom2DPoint const* PtStart, CGeom2DPoint const* PtNext, double const dDesiredLength, int const nHandedness)
523// {
524// // Returns a two-point vector which passes through PtStart with a scaled length
525// double dXLen = PtNext->dGetX() - PtStart->dGetX();
526// double dYLen = PtNext->dGetY() - PtStart->dGetY();
527//
528// double dLength = hypot(dXLen, dYLen);
529// double dScaleFactor = dDesiredLength / dLength;
530//
531// // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
532// CGeom2DPoint EndPt;
533// if (nHandedness == RIGHT_HANDED)
534// {
535// EndPt.SetX(PtStart->dGetX() + (dScaleFactor * dYLen));
536// EndPt.SetY(PtStart->dGetY() - (dScaleFactor * dXLen));
537// }
538// else
539// {
540// EndPt.SetX(PtStart->dGetX() - (dScaleFactor * dYLen));
541// EndPt.SetY(PtStart->dGetY() + (dScaleFactor * dXLen));
542// }
543//
544// vector<CGeom2DPoint> VNew;
545// VNew.push_back(*PtStart);
546// VNew.push_back(EndPt);
547// return VNew;
548// }
549
550//===============================================================================================================================
552//===============================================================================================================================
553CGeom2DPoint CSimulation::PtGetPerpendicular(CGeom2DPoint const *PtStart, CGeom2DPoint const *PtNext, double const dDesiredLength, int const nHandedness)
554{
555 double dXLen = PtNext->dGetX() - PtStart->dGetX();
556 double dYLen = PtNext->dGetY() - PtStart->dGetY();
557 double dLength;
558
559 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
560 dLength = dYLen;
561 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
562 dLength = dXLen;
563 else
564 dLength = hypot(dXLen, dYLen);
565
566 double dScaleFactor = dDesiredLength / dLength;
567
568 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
569 CGeom2DPoint EndPt;
570 if (nHandedness == RIGHT_HANDED)
571 {
572 EndPt.SetX(PtStart->dGetX() + (dScaleFactor * dYLen));
573 EndPt.SetY(PtStart->dGetY() - (dScaleFactor * dXLen));
574 }
575 else
576 {
577 EndPt.SetX(PtStart->dGetX() - (dScaleFactor * dYLen));
578 EndPt.SetY(PtStart->dGetY() + (dScaleFactor * dXLen));
579 }
580
581 return EndPt;
582}
583
584//===============================================================================================================================
586//===============================================================================================================================
587CGeom2DIPoint CSimulation::PtiGetPerpendicular(CGeom2DIPoint const *PtiStart, CGeom2DIPoint const *PtiNext, double const dDesiredLength, int const nHandedness)
588{
589 double dXLen = PtiNext->nGetX() - PtiStart->nGetX();
590 double dYLen = PtiNext->nGetY() - PtiStart->nGetY();
591 double dLength;
592
593 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
594 dLength = dYLen;
595 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
596 dLength = dXLen;
597 else
598 dLength = hypot(dXLen, dYLen);
599
600 double dScaleFactor = dDesiredLength / dLength;
601
602 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
603 CGeom2DIPoint EndPti;
604 if (nHandedness == RIGHT_HANDED)
605 {
606 EndPti.SetX(PtiStart->nGetX() + nRound(dScaleFactor * dYLen));
607 EndPti.SetY(PtiStart->nGetY() - nRound(dScaleFactor * dXLen));
608 }
609 else
610 {
611 EndPti.SetX(PtiStart->nGetX() - nRound(dScaleFactor * dYLen));
612 EndPti.SetY(PtiStart->nGetY() + nRound(dScaleFactor * dXLen));
613 }
614
615 return EndPti;
616}
617
618//===============================================================================================================================
620//===============================================================================================================================
621CGeom2DIPoint CSimulation::PtiGetPerpendicular(int const nStartX, int const nStartY, int const nNextX, int const nNextY, double const dDesiredLength, int const nHandedness)
622{
623 double dXLen = nNextX - nStartX;
624 double dYLen = nNextY - nStartY;
625 double dLength;
626
627 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
628 dLength = dYLen;
629 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
630 dLength = dXLen;
631 else
632 dLength = hypot(dXLen, dYLen);
633
634 double dScaleFactor = dDesiredLength / dLength;
635
636 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
637 CGeom2DIPoint EndPti;
638 if (nHandedness == RIGHT_HANDED)
639 {
640 EndPti.SetX(nStartX + nRound(dScaleFactor * dYLen));
641 EndPti.SetY(nStartY - nRound(dScaleFactor * dXLen));
642 }
643 else
644 {
645 EndPti.SetX(nStartX - nRound(dScaleFactor * dYLen));
646 EndPti.SetY(nStartY + nRound(dScaleFactor * dXLen));
647 }
648
649 return EndPti;
650}
651
652//===============================================================================================================================
654//===============================================================================================================================
655double CSimulation::dAngleSubtended(CGeom2DIPoint const* pPtiA, CGeom2DIPoint const* pPtiB, CGeom2DIPoint const* pPtiC)
656{
657 double
658 dXDistBtoA = pPtiB->nGetX() - pPtiA->nGetX(),
659 dYDistBtoA = pPtiB->nGetY() - pPtiA->nGetY(),
660 dXDistCtoA = pPtiC->nGetX() - pPtiA->nGetX(),
661 dYDistCtoA = pPtiC->nGetY() - pPtiA->nGetY(),
662 dDotProduct = dXDistBtoA * dXDistCtoA + dYDistBtoA * dYDistCtoA,
663 dPseudoCrossProduct = dXDistBtoA * dYDistCtoA - dYDistBtoA * dXDistCtoA,
664 dAngle = atan2(dPseudoCrossProduct, dDotProduct);
665
666 return dAngle;
667}
668
669//===============================================================================================================================
671//===============================================================================================================================
673{
674 // Register all available GDAL raster and vector drivers (GDAL 2)
675 GDALAllRegister();
676
677 // If the user hasn't specified a GIS output format, assume that we will use the same GIS format as the input basement DEM
678 if (m_strRasterGISOutFormat.empty())
680
681 // Load the raster GDAL driver
682 GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName(m_strRasterGISOutFormat.c_str());
683 if (NULL == pDriver)
684 {
685 // Can't load raster GDAL driver. Incorrectly specified?
686 cerr << ERR << "Unknown raster GIS output format '" << m_strRasterGISOutFormat << "'." << endl;
687 return false;
688 }
689
690 // Get the metadata for this raster driver
691 char** papszMetadata = pDriver->GetMetadata();
692
693 // for (int i = 0; papszMetadata[i] != NULL; i++)
694 // cout << papszMetadata[i] << endl;
695 // cout << endl;
696
697 // Need to test if this is a raster driver
698 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_RASTER, FALSE))
699 {
700 // This is not a raster driver
701 cerr << ERR << "GDAL driver '" << m_strRasterGISOutFormat << "' is not a raster driver. Choose another format." << endl;
702 return false;
703 }
704
705 // This driver is OK, so store its longname and the default file extension
706 string strTmp = CSLFetchNameValue(papszMetadata, "DMD_LONGNAME");
708 strTmp = CSLFetchNameValue(papszMetadata, "DMD_EXTENSIONS"); // Note DMD_EXTENSION (no S, is a single value) appears not to be implemented for newer drivers
709 strTmp = strTrim(&strTmp);
710
711 // We have a space-separated list of one or more file extensions: use the first extension in the list
712 long unsigned int nPos = strTmp.find(SPACE);
713 if (nPos == string::npos)
714 {
715 // No space i.e. just one extension
717 }
718 else
719 {
720 // There's a space, so we must have more than one extension
721 m_strGDALRasterOutputDriverExtension = strTmp.substr(0, nPos);
722 }
723
724 // Set up any defaults for raster files that are created using this driver
726
727 // Now do various tests of the driver's capabilities
728 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATE, FALSE))
729 {
730 // This raster driver does not support the Create() method, does it support CreateCopy()?
731 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATECOPY, FALSE))
732 {
733 cerr << ERR << "Cannot write using raster GDAL driver '" << m_strRasterGISOutFormat << " since neither Create() or CreateCopy() are supported'. Choose another GDAL raster format." << endl;
734 return false;
735 }
736
737 // Can't use Create() but can use CreateCopy()
738 m_bGDALCanCreate = false;
739 }
740
741 // Next, test to see what data types the driver can write and from this, work out the largest int and float we can write
742 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Float"))
743 {
745 m_GDALWriteFloatDataType = GDT_Float32;
746 }
747
748 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "UInt32"))
749 {
751
752 m_GDALWriteIntDataType = GDT_UInt32;
753 m_lGDALMaxCanWrite = UINT32_MAX;
755
757 m_GDALWriteFloatDataType = GDT_UInt32;
758
759 return true;
760 }
761
762 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Int32"))
763 {
765
766 m_GDALWriteIntDataType = GDT_Int32;
767 m_lGDALMaxCanWrite = INT32_MAX;
768 m_lGDALMinCanWrite = INT32_MIN;
769
771 m_GDALWriteFloatDataType = GDT_Int32;
772
773 return true;
774 }
775
776 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "UInt16"))
777 {
778 m_bGDALCanWriteInt32 = false;
779
780 m_GDALWriteIntDataType = GDT_UInt16;
781 m_lGDALMaxCanWrite = UINT16_MAX;
783
785 m_GDALWriteFloatDataType = GDT_UInt16;
786
787 return true;
788 }
789
790 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Int16"))
791 {
792 m_bGDALCanWriteInt32 = false;
793
794 m_GDALWriteIntDataType = GDT_Int16;
795 m_lGDALMaxCanWrite = INT16_MAX;
796 m_lGDALMinCanWrite = INT16_MIN;
797
799 m_GDALWriteFloatDataType = GDT_Int16;
800
801 return true;
802 }
803
804 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Byte"))
805 {
806 m_bGDALCanWriteInt32 = false;
807
808 m_GDALWriteIntDataType = GDT_Byte;
809 m_lGDALMaxCanWrite = UINT8_MAX;
811
813 m_GDALWriteFloatDataType = GDT_Byte;
814
815 return true;
816 }
817
818 // This driver does not even support byte output
819 cerr << ERR << "Cannot write using raster GDAL driver '" << m_strRasterGISOutFormat << ", not even byte output is supported'. Choose another GIS raster format." << endl;
820 return false;
821}
822
823//===============================================================================================================================
825//===============================================================================================================================
827{
828 // Load the vector GDAL driver (this assumes that GDALAllRegister() has already been called)
829 GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName(m_strVectorGISOutFormat.c_str());
830 if (NULL == pDriver)
831 {
832 // Can't load vector GDAL driver. Incorrectly specified?
833 cerr << ERR << "Unknown vector GIS output format '" << m_strVectorGISOutFormat << "'." << endl;
834 return false;
835 }
836
837 // Get the metadata for this vector driver
838 char** papszMetadata = pDriver->GetMetadata();
839
840 // For GDAL2, need to test if this is a vector driver
841 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_VECTOR, FALSE))
842 {
843 // This is not a vector driver
844 cerr << ERR << "GDAL driver '" << m_strVectorGISOutFormat << "' is not a vector driver. Choose another format." << endl;
845 return false;
846 }
847
848 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATE, FALSE))
849 {
850 // Driver does not support create() method
851 cerr << ERR << "Cannot write vector GIS files using GDAL driver '" << m_strRasterGISOutFormat << "'. Choose another format." << endl;
852 return false;
853 }
854
855 // Driver is OK, now set some options for individual drivers
856 if (m_strVectorGISOutFormat == "ESRI Shapefile")
857 {
858 // Set this, so that just a single dataset-with-one-layer shapefile is created, rather than a directory
859 // (see http://www.gdal.org/ogr/drv_shapefile.html)
861 }
862 else if (m_strVectorGISOutFormat == "geojson")
863 {
865 }
866 else if (m_strVectorGISOutFormat == "gpkg")
867 {
869 }
870 // TODO 033 Others
871
872 return true;
873}
874
875//===============================================================================================================================
877//===============================================================================================================================
879{
880 // Increment file number
881 m_nGISSave++;
882
883 // Set for next save
884 if (m_bSaveRegular)
886 else
888
891 return false;
892
893 if (m_bTopSurfSave)
895 return false;
896
899 return false;
900
901 if (m_bSeaDepthSave)
903 return false;
904
907 return false;
908
911 return false;
912
913
914 // Don't write platform erosion files if there is no platform erosion
916 {
919 return false;
920
923 return false;
924
927 return false;
928
931 return false;
932
935 return false;
936
939 return false;
940
943 return false;
944
947 return false;
948
951 return false;
952
955 return false;
956
959 return false;
960
963 return false;
964 }
965
966 if (m_bLandformSave)
968 return false;
969
972 return false;
973
976 return false;
977
980 return false;
981
984 return false;
985
986 // Don't write suspended sediment files if there is no fine sediment
988 {
989 if (m_bSuspSedSave)
991 return false;
992
995 return false;
996 }
997
1000 return false;
1001
1002 for (int nLayer = 0; nLayer < m_nLayers; nLayer++)
1003 {
1005 {
1007 return false;
1008 }
1009
1011 {
1013 return false;
1014 }
1015
1017 {
1019 return false;
1020 }
1021
1023 {
1025 return false;
1026 }
1027
1029 {
1031 return false;
1032 }
1033
1035 {
1037 return false;
1038 }
1039 }
1040
1041 if (m_bSliceSave)
1042 {
1043 for (int i = 0; i < static_cast<int>(m_VdSliceElev.size()); i++)
1044 {
1046 return false;
1047 }
1048 }
1049
1051 {
1053 return false;
1054 }
1055
1057 {
1059 return false;
1060 }
1061
1063 {
1065 return false;
1066 }
1067
1068 // Don't write cliff collapse files if we aren't considering cliff collapse
1070 {
1072 {
1074 {
1076 return false;
1077 }
1078
1080 {
1082 return false;
1083 }
1084
1086 {
1088 return false;
1089 }
1090 }
1091
1093 {
1095 {
1097 return false;
1098 }
1099
1101 {
1103 return false;
1104 }
1105
1107 {
1109 return false;
1110 }
1111 }
1112
1114 {
1116 {
1118 return false;
1119 }
1120
1122 {
1124 return false;
1125 }
1126 }
1127
1129 {
1131 {
1133 return false;
1134 }
1135
1137 {
1139 return false;
1140 }
1141 }
1142 }
1143
1145 {
1147 return false;
1148 }
1149
1150
1151 if (m_bSeaMaskSave)
1152 {
1154 return false;
1155 }
1156
1157 if (m_bBeachMaskSave)
1158 {
1160 return false;
1161 }
1162
1164 {
1166 return false;
1167 }
1168
1170 {
1172 return false;
1173 }
1174
1176 {
1178 return false;
1179
1181 return false;
1182 }
1183
1185 {
1187 return false;
1188 }
1189
1191 {
1193 return false;
1194 }
1195
1197 {
1199 return false;
1200 }
1201
1203 {
1205 return false;
1206 }
1207
1209 {
1211 return false;
1212 }
1213
1215 {
1217 return false;
1218 }
1220 {
1222 return false;
1223 }
1224
1225 return true;
1226}
1227
1228//===============================================================================================================================
1230//===============================================================================================================================
1232{
1233 // Always written
1234 if (m_bCoastSave)
1235 {
1237 return false;
1238 }
1239
1240 if (m_bNormalsSave)
1241 {
1243 return false;
1244 }
1245
1247 {
1249 return false;
1250 }
1251
1253 {
1255 return false;
1256 }
1257
1259 {
1261 return false;
1262 }
1263
1265 {
1267 return false;
1268 }
1269
1271 {
1273 return false;
1274 }
1275
1277 {
1279 return false;
1280 }
1281
1283 {
1285 return false;
1286 }
1287
1289 {
1291 return false;
1292 }
1293
1295 {
1297 return false;
1298 }
1299
1301 {
1303 return false;
1304 }
1305
1307 {
1309 return false;
1310 }
1311
1313 {
1315 return false;
1316 }
1317
1319 {
1321 return false;
1322 }
1323
1324 if (m_bWaveSetupSave)
1325 {
1327 return false;
1328 }
1330 {
1332 return false;
1333 }
1334 if (m_bRunUpSave)
1335 {
1337 return false;
1338 }
1339
1341 {
1343 return false;
1344
1345 // if (! bWriteVectorGISFile(VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE, &VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE_TITLE))
1346 // return false;
1347
1348 // if (! bWriteVectorGISFile(VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE, &VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE_TITLE))
1349 // return false;
1350 }
1351 return true;
1352}
1353
1354//===============================================================================================================================
1356//===============================================================================================================================
1357void CSimulation::GetRasterOutputMinMax(int const nDataItem, double&dMin, double&dMax, int const nLayer, double const dElev)
1358{
1359 // If this is a binary mask layer, we already know the max and min values
1361 (nDataItem == RASTER_PLOT_INUNDATION_MASK) ||
1362 (nDataItem == RASTER_PLOT_BEACH_MASK) ||
1363 (nDataItem == RASTER_PLOT_COAST) ||
1364 // (nDataItem == RASTER_PLOT_NORMAL_PROFILE) ||
1365 (nDataItem == RASTER_PLOT_ACTIVE_ZONE) ||
1367 (nDataItem == RASTER_PLOT_SETUP_SURGE_FLOOD_MASK) ||
1369 (nDataItem == RASTER_PLOT_WAVE_FLOOD_LINE))
1370 {
1371 dMin = 0;
1372 dMax = 1;
1373
1374 return;
1375 }
1376
1377 // Not a binary mask layer, so we must find the max and min values
1378 dMin = DBL_MAX;
1379 dMax = DBL_MIN;
1380
1381 double dTmp = 0;
1382 for (int nY = 0; nY < m_nYGridSize; nY++)
1383 {
1384 for (int nX = 0; nX < m_nXGridSize; nX++)
1385 {
1386 switch (nDataItem)
1387 {
1388 case (RASTER_PLOT_SLICE):
1389 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetLayerAtElev(dElev);
1390 break;
1391
1392 case (RASTER_PLOT_LANDFORM):
1393 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFCategory();
1394 break;
1395
1397 dTmp = INT_NODATA;
1398 if (bIsInterventionCell(nX, nY))
1399 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFSubCategory();
1400 break;
1401
1403 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetInterventionHeight();
1404 break;
1405
1406 case (RASTER_PLOT_POLYGON):
1407 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1408 break;
1409
1411 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBasementElev();
1412 break;
1413
1415 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSedimentTopElev();
1416 break;
1417
1419 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetOverallTopElev();
1420 break;
1421
1423 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetLocalConsSlope();
1424 break;
1425
1426 case (RASTER_PLOT_SEA_DEPTH):
1427 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSeaDepth();
1428 break;
1429
1431 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSeaDepth() / static_cast<double>(m_ulIter);
1432 break;
1433
1435 if (! m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea())
1436 dTmp = m_dMissingValue;
1437 else
1438 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1439 break;
1440
1442 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveHeight() / static_cast<double>(m_ulIter);
1443 break;
1444
1446 if (! m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea())
1447 dTmp = m_dMissingValue;
1448 else
1449 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1450 break;
1451
1453 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveAngle() / static_cast<double>(m_ulIter);
1454 break;
1455
1457 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBeachProtectionFactor();
1458 if (! bFPIsEqual(dTmp, DBL_NODATA, TOLERANCE))
1459 dTmp = 1 - dTmp; // Output the inverse, seems more intuitive
1460 break;
1461
1463 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetPotentialPlatformErosion();
1464 break;
1465
1467 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetActualPlatformErosion();
1468 break;
1469
1471 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotPotentialPlatformErosion();
1472 break;
1473
1475 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotActualPlatformErosion();
1476 break;
1477
1479 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetPotentialBeachErosion();
1480 break;
1481
1483 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetActualBeachErosion();
1484 break;
1485
1487 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotPotentialBeachErosion();
1488 break;
1489
1491 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotActualBeachErosion();
1492 break;
1493
1495 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBeachDeposition();
1496 break;
1497
1499 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotBeachDeposition();
1500 break;
1501
1503 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
1504 break;
1505
1507 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSuspendedSediment() / static_cast<double>(m_ulIter);
1508 break;
1509
1511 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetFineDepth();
1512 break;
1513
1515 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetSandDepth();
1516 break;
1517
1519 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetCoarseDepth();
1520 break;
1521
1523 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetFineDepth();
1524 break;
1525
1527 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetSandDepth();
1528 break;
1529
1531 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetCoarseDepth();
1532 break;
1533
1535 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionFine();
1536 break;
1537
1539 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionSand();
1540 break;
1541
1543 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionCoarse();
1544 break;
1545
1547 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseFine();
1548 break;
1549
1551 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseSand();
1552 break;
1553
1555 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseCoarse();
1556 break;
1557
1559 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseSandTalusDeposition();
1560 break;
1561
1563 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseCoarseTalusDeposition();
1564 break;
1565
1567 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSandTalusDeposition();
1568 break;
1569
1571 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCoarseTalusDeposition();
1572 break;
1573
1575 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetShadowZoneNumber();
1576 break;
1577
1579 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1580 break;
1581
1583 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1584 break;
1585
1587 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1588 break;
1589
1591 int nPoly = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1592 if (nPoly == INT_NODATA)
1593 dTmp = m_dMissingValue;
1594 else
1595 dTmp = m_pVCoastPolygon[nPoly]->dGetBeachDepositionAndSuspensionAllUncons();
1596 break;
1597 }
1598
1599 if (! bFPIsEqual(dTmp, DBL_NODATA, TOLERANCE))
1600 {
1601 if (dTmp > dMax)
1602 dMax = dTmp;
1603
1604 if (dTmp < dMin)
1605 dMin = dTmp;
1606 }
1607 }
1608 }
1609}
1610
1611//===============================================================================================================================
1613//===============================================================================================================================
1615{
1616 string strDriver = strToLower(&m_strRasterGISOutFormat);
1617 string strComment = "Created by " + PROGRAM_NAME + " for " + PLATFORM + " " + strGetBuild() + " running on " + strGetComputerName();
1618
1619 // TODO 034 Do these for all commonly-used file types
1620 if (strDriver == "aaigrid")
1621 {
1622 }
1623
1624 else if (strDriver == "bmp")
1625 {
1626 }
1627
1628 else if (strDriver == "gtiff")
1629 {
1630 if (m_bWorldFile)
1631 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "TFW", "YES");
1632
1633 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NUM_THREADS", "ALL_CPUS");
1634 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMPRESS", "LZW");
1635 }
1636
1637 else if (strDriver == "hfa")
1638 {
1639 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NBITS", "4");
1640 }
1641
1642 else if (strDriver == "jpeg")
1643 {
1644 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1645 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "QUALITY", "95");
1646 }
1647
1648 else if (strDriver == "png")
1649 {
1650 if (m_bWorldFile)
1651 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "WORLDFILE", "YES");
1652
1653 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "TITLE", "This is the title");
1654 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "DESCRIPTION", "This is a description");
1655 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COPYRIGHT", "This is some copyright statement");
1656 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1657 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NBITS", "4");
1658 }
1659
1660 else if (strDriver == "rst")
1661 {
1662 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1663 }
1664
1665 else if (strDriver == "geojson")
1666 {
1667 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1668 }
1669
1670 else if (strDriver == "gpkg")
1671 {
1672 // TODO 065 Does GDAL support overwriting raster gpkg files yet?
1673 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "OVERWRITE", "YES");
1674 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "USE_TILE_EXTENT", "YES");
1675 }
1676 else if (strDriver == "netcdf")
1677 {
1678 }
1679}
1680
1681//===============================================================================================================================
1683//===============================================================================================================================
1684int CSimulation::nGetOppositeDirection(int const nDirection)
1685{
1686 switch (nDirection)
1687 {
1688 case NORTH:
1689 return SOUTH;
1690
1691 case NORTH_EAST:
1692 return SOUTH - WEST;
1693
1694 case EAST:
1695 return WEST;
1696
1697 case SOUTH_EAST:
1698 return NORTH - WEST;
1699
1700 case SOUTH:
1701 return NORTH;
1702
1703 case SOUTH_WEST:
1704 return NORTH - EAST;
1705
1706 case WEST:
1707 return EAST;
1708
1709 case NORTH_WEST:
1710 return SOUTH - EAST;
1711 }
1712
1713 // Should never get here
1714 return NO_DIRECTION;
1715}
1716
1717// //===============================================================================================================================
1718// //! Given two integer points, calculates the slope and intercept of the line passing through the points
1719// //===============================================================================================================================
1720// void CSimulation::GetSlopeAndInterceptFromPoints(CGeom2DIPoint const* pPti1, CGeom2DIPoint const* pPti2, double& dSlope, double& dIntercept)
1721// {
1722// int
1723// nX1 = pPti1->nGetX(),
1724// nY1 = pPti1->nGetY(),
1725// nX2 = pPti2->nGetX(),
1726// nY2 = pPti2->nGetY();
1727//
1728// double
1729// dXDiff = nX1 - nX2,
1730// dYDiff = nY1 - nY2;
1731//
1732// if (bFPIsEqual(dXDiff, 0.0, TOLERANCE))
1733// dSlope = 0;
1734// else
1735// dSlope = dYDiff / dXDiff;
1736//
1737// dIntercept = nY1 - (dSlope * nX1);
1738// }
1739
1740//===============================================================================================================================
1742//===============================================================================================================================
1744{
1745 unsigned int nMinSqDist = UINT_MAX;
1746 CGeom2DIPoint PtiCoastPoint;
1747
1748 // Do for every coast
1749 for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1750 {
1751 for (int j = 0; j < m_VCoast[nCoast].nGetCoastlineSize(); j++)
1752 {
1753 // Get the coords of the grid cell marked as coastline for the coastal landform object
1754 int
1755 nXCoast = m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(j)->nGetX(),
1756 nYCoast = m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(j)->nGetY();
1757
1758 // Calculate the squared distance between this point and the given point
1759 int
1760 nXDist = nX - nXCoast,
1761 nYDist = nY - nYCoast;
1762
1763 unsigned int nSqDist = (nXDist * nXDist) + (nYDist * nYDist);
1764
1765 // Is this the closest so dar?
1766 if (nSqDist < nMinSqDist)
1767 {
1768 nMinSqDist = nSqDist;
1769 PtiCoastPoint.SetXY(nXCoast, nYCoast);
1770 }
1771 }
1772 }
1773
1774 return PtiCoastPoint;
1775}
1776
1777//===============================================================================================================================
1779//===============================================================================================================================
1780int CSimulation::nConvertMetresToNumCells(double const dLen) const
1781{
1782 return nRound(dLen / m_dCellSide);
1783}
Geometry class used to represent 2D point objects with integer coordinates.
Definition 2di_point.h:29
void SetY(int const)
The integer parameter sets a value for the CGeom2DIPoint object's Y coordinate.
Definition 2di_point.cpp:72
int nGetY(void) const
Returns the CGeom2DIPoint object's integer Y coordinate.
Definition 2di_point.cpp:48
void SetXY(int const, int const)
The two integer parameters set values for the CGeom2DIPoint object's X and Y coordinates.
Definition 2di_point.cpp:78
void DivXDivY(double const, double const)
Divides the CGeom2DIPoint object's X coordinate by the first double parameter (rounded),...
void SetX(int const)
The integer parameter sets a value for the CGeom2DIPoint object's X coordinate.
Definition 2di_point.cpp:66
int * pnGetY()
Returns a reference to the CGeom2DIPoint object's integer Y coordinate.
Definition 2di_point.cpp:60
void AddXAddY(int const, int const)
The parameter is a pointer to a CGeom2DIPoint object, this is used to set values for the CGeom2DIPoin...
Definition 2di_point.cpp:92
int * pnGetX()
Returns a reference to the CGeom2DIPoint object's integer X coordinate.
Definition 2di_point.cpp:54
int nGetX(void) const
Returns the CGeom2DIPoint object's integer X coordinate.
Definition 2di_point.cpp:42
Geometry class used to represent 2D point objects with floating-point coordinates.
Definition 2d_point.h:27
void SetY(double const)
The double parameter sets a value for the CGeom2DIPoint object's Y coordinate.
Definition 2d_point.cpp:58
double dGetY(void) const
Returns the CGeom2DPoint object's double Y coordinate.
Definition 2d_point.cpp:46
double dGetX(void) const
Returns the CGeom2DPoint object's double X coordinate.
Definition 2d_point.cpp:40
void SetX(double const)
The double parameter sets a value for the CGeom2DIPoint object's X coordinate.
Definition 2d_point.cpp:52
bool m_bCliffCollapseSave
Save cliff collapse raster GIS files?
Definition simulation.h:204
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:93
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:231
bool bWriteRasterGISFile(int const, string const *, int const =0, double const =0)
Writes GIS raster files using GDAL, using data from the RasterGrid array.
bool m_bTopSurfSave
Save fop surface (sediment and sea) raster DEMs?
Definition simulation.h:84
string m_strOGRVectorOutputExtension
GDAL-OGR vector output drive file extension.
bool bCheckRasterGISOutputFormat(void)
Checks whether the selected raster GDAL driver supports file creation, 32-bit doubles,...
bool m_bSedimentTopSurfSave
Save sediment top surface raster DEMs?
Definition simulation.h:81
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:177
void GetRasterOutputMinMax(int const, double &, double &, int const, double const)
Finds the max and min values in order to scale raster output if we cannot write doubles.
bool m_bCoastSave
Save.
Definition simulation.h:249
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:429
static int nGetOppositeDirection(int const)
Returns the opposite direction.
CGeom2DIPoint PtiExtCRSToGridRound(CGeom2DPoint const *) const
Transforms a pointer to a CGeom2DPoint in the external CRS to the equivalent CGeom2DIPoint in the ras...
vector< CRWCoast > m_VCoast
The coastline objects.
bool bSaveAllVectorGISFiles(void)
The bSaveAllvectorGISFiles member function saves the vector GIS files TODO 081 Choose more files to o...
int m_nThisSave
Used in calculations of GIS save intervals.
Definition simulation.h:468
static string strGetComputerName(void)
Returns a string, hopefully giving the name of the computer on which the simulation is running.
Definition utils.cpp:1320
long m_lGDALMaxCanWrite
The maximum integer value which GDAL can write, can be UINT8_MAX, INT16_MAX, UINT16_MAX,...
Definition simulation.h:548
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:111
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:105
bool bWriteVectorGISFile(int const, string const *)
Writes vector GIS files using OGR.
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
Definition simulation.h:255
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:270
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:144
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:432
bool m_bRunUpSave
Are we saving runup? TODO 007.
Definition simulation.h:393
GDALDataType m_GDALWriteIntDataType
The data type used by GDAL for integer operations, can be GDT_Byte, GDT_Int16, GDT_UInt16,...
Definition simulation.h:542
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:210
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:138
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:240
double m_dGeoTransform[6]
GDAL geotransformation info (see http://www.gdal.org/classGDALDataset.html)
Definition simulation.h:653
static CGeom2DIPoint PtiGetPerpendicular(CGeom2DIPoint const *, CGeom2DIPoint const *, double const, int const)
Returns a CGeom2DIPoint (grid CRS) which is the 'other' point of a two-point vector passing through P...
string m_strVectorGISOutFormat
Base name for CME vector GIS output files.
double m_dMissingValue
Missing value.
Definition simulation.h:914
static double dGetDistanceBetween(CGeom2DPoint const *, CGeom2DPoint const *)
Returns the distance (in external CRS) between two points.
bool m_bBasementElevSave
Save basement raster DEMs?
Definition simulation.h:78
static CGeom2DPoint PtAverage(CGeom2DPoint const *, CGeom2DPoint const *)
Returns a point (external CRS) which is the average of (i.e. is midway between) two other external CR...
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
Definition simulation.h:183
static double dKeepWithin360(double const)
Constrains the supplied angle to be within 0 and 360 degrees.
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
Definition simulation.h:219
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:96
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:345
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:159
static string strTrim(string const *)
Trims whitespace from both sides of a string, does not change the original string.
Definition utils.cpp:2194
string m_strRasterGISOutFormat
Base name for CME raster GIS output files.
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:156
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:180
bool m_bTotCliffCollapseSave
Save total cliff collapse raster GIS files?
Definition simulation.h:207
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:336
bool m_bSliceSave
Save slices?
Definition simulation.h:87
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
Definition simulation.h:216
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:153
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:246
int m_nLayers
The number of sediment layers.
Definition simulation.h:435
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:366
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:252
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:99
static string strToLower(string const *)
Returns the lower case version of an string, leaving the original unchanged.
Definition utils.cpp:2219
string m_strGDALBasementDEMDriverCode
GDAL code for the basement DEM raster file type.
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
Definition simulation.h:72
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:465
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:90
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:108
bool m_bWorldFile
Write a GIS World file?
Definition simulation.h:357
bool bCheckVectorGISOutputFormat(void)
Checks whether the selected vector OGR driver supports file creation etc.
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
Definition simulation.h:198
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:201
double dGridCentroidYToExtCRSY(int const) const
Given the integer Y-axis ordinate of a cell in the raster grid CRS, returns the external CRS Y-axis o...
Definition gis_utils.cpp:71
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:234
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:120
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:258
int nConvertMetresToNumCells(double const) const
Given a length in m, this returns the rounded equivalent number of cells.
double dGridYToExtCRSY(double const) const
Given a real-valued Y-axis ordinate in the raster grid CRS (i.e. not the centroid of a cell),...
bool m_bGDALCanWriteInt32
Is the selected GDAL output file format capable of writing 32-bit integers to files?
Definition simulation.h:351
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:123
double m_dRegularSaveTime
The time of the next save, in hours from the start of the simulation, if we are saving regularly.
Definition simulation.h:638
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:261
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:135
void SetRasterFileCreationDefaults(void)
Sets per-driver defaults for raster files created using GDAL.
bool m_bSetupSurgeFloodMaskSave
Are we saving the setup surge flood mask? TODO 007.
Definition simulation.h:396
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:117
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:141
bool m_bSuspSedSave
Save suspended sediment raster GIS files?
Definition simulation.h:171
static double dAngleSubtended(CGeom2DIPoint const *, CGeom2DIPoint const *, CGeom2DIPoint const *)
Returns the signed angle BAC (in radians) subtended between three CGeom2DIPoints B A C....
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
Definition simulation.h:264
bool m_bStormSurgeSave
Are we saving the storm surge? TODO 007.
Definition simulation.h:390
double dExtCRSXToGridX(double const) const
Transforms an X-axis ordinate in the external CRS to the equivalent X-axis ordinate in the raster gri...
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:132
void KeepWithinValidGrid(int, int, int &, int &) const
Given two points in the grid CRS (the points assumed not to be coincident), this routine modifies the...
bool bSaveAllRasterGISFiles(void)
The bSaveAllRasterGISFiles member function saves the raster GIS files using values from the RasterGri...
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
Definition simulation.h:69
static string strGetBuild(void)
Returns the date and time on which the program was compiled.
Definition utils.cpp:1584
bool m_bTotalPotentialBeachErosionSave
Save total potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:147
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:462
static CGeom2DIPoint PtiWeightedAverage(CGeom2DIPoint const *, CGeom2DIPoint const *, double const)
Returns an integer point (grid CRS) which is the weighted average of two other grid CRS integer point...
bool m_bSeaMaskSave
Save sea mask raster GIS files?
Definition simulation.h:222
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:165
CGeom2DIPoint PtiFindClosestCoastPoint(int const, int const)
Finds the closest point on any coastline to a given point.
bool m_bTotalActualBeachErosionSave
Save total actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:150
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:195
static CGeom2DPoint PtGetPerpendicular(CGeom2DPoint const *, CGeom2DPoint const *, double const, int const)
Returns a CGeom2DPoint which is the 'other' point of a two-point vector passing through PtStart,...
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
Definition simulation.h:168
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:384
long m_lGDALMinCanWrite
The minimum integer value which GDAL can write, can be zero, INT16_MIN, INT32_MIN.
Definition simulation.h:551
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:189
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:378
static double dTriangleAreax2(CGeom2DPoint const *, CGeom2DPoint const *, CGeom2DPoint const *)
Returns twice the signed area of a triangle.
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
Definition simulation.h:75
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:641
bool m_bPolygonUnconsSedGainOrLossSave
Save polygon unconsolidated sediment gain or loss raster GIS files?
Definition simulation.h:243
string m_strGDALRasterOutputDriverLongname
GDAL raster output driver long name.
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
Definition simulation.h:114
double dExtCRSYToGridY(double const) const
Transforms a Y-axis ordinate in the external CRS to the equivalent Y-axis ordinate in the raster grid...
vector< double > m_VdSliceElev
Elevations for raster slice output.
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
Definition simulation.h:126
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:186
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:273
bool bIsWithinValidGrid(int const, int const) const
Checks whether the supplied point (an x-y pair, in the grid CRS) is within the raster grid,...
bool m_bDeepWaterWavePeriodSave
Save deep water wave period raster GIS files?
Definition simulation.h:237
double dGridXToExtCRSX(double const) const
Given a real-valued X-axis ordinate in the raster grid CRS (i.e. not the centroid of a cell),...
Definition gis_utils.cpp:92
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:192
CGeom2DPoint PtGridCentroidToExt(CGeom2DIPoint const *) const
Transforms a pointer to a CGeom2DIPoint in the raster grid CRS (assumed to be the centroid of a cell)...
Definition gis_utils.cpp:80
string m_strGDALRasterOutputDriverExtension
GDAL raster output driver file extension.
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:225
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:554
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:174
double dGridCentroidXToExtCRSX(int const) const
Given the integer X-axis ordinate of a cell in the raster grid CRS, returns the external CRS X-axis o...
Definition gis_utils.cpp:62
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:614
bool bIsInterventionCell(int const, int const) const
Returns true if the cell is an intervention.
Definition utils.cpp:2736
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:213
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:339
bool m_bSetupSurgeRunupFloodMaskSave
Are we saving the setup surge runup flood mask? TODO 007.
Definition simulation.h:399
bool m_bWaveSetupSave
Are we saving the wave setup? TODO 007.
Definition simulation.h:387
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:228
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:129
static CGeom2DIPoint PtiPolygonCentroid(vector< CGeom2DIPoint > *)
Returns an integer point (grid CRS) which is the centroid of a polygon, given by a vector of grid CRS...
GDALDataType m_GDALWriteFloatDataType
Thw data type used by GDAL for floating point operations, can be GDT_Byte, GDT_Int16,...
Definition simulation.h:545
bool m_bGDALCanWriteFloat
Is the selected GDAL output file format capable of writing floating-point values to files?
Definition simulation.h:348
char ** m_papszGDALRasterOptions
Options for GDAL when handling raster files.
Definition simulation.h:423
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:267
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:405
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:102
vector< CGeomCoastPolygon * > m_pVCoastPolygon
Pointers to coast polygon objects, in down-coast sequence TODO 044 Will need to use global polygon ID...
bool m_bLocalSlopeSave
Save local slope raster GIS files?
Definition simulation.h:162
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:365
int const RASTER_PLOT_POLYGON
Definition cme.h:524
string const RASTER_PLOT_POLYGON_UPDRIFT_OR_DOWNDRIFT_TITLE
Definition cme.h:978
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_COARSE_TITLE
Definition cme.h:960
string const VECTOR_PLOT_BREAKING_WAVE_HEIGHT_TITLE
Definition cme.h:1058
T tMin(T a, T b)
Definition cme.h:1138
string const VECTOR_PLOT_INVALID_NORMALS_TITLE
Definition cme.h:1064
double const TOLERANCE
Definition cme.h:699
string const VECTOR_PLOT_NORMALS_TITLE
Definition cme.h:1066
int const VECTOR_PLOT_STORM_SURGE
Definition cme.h:572
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_SAND_TITLE
Definition cme.h:959
string const RASTER_PLOT_COAST_TITLE
Definition cme.h:963
string const RASTER_PLOT_POLYGON_TITLE
Definition cme.h:977
int const VECTOR_PLOT_BREAKING_WAVE_HEIGHT
Definition cme.h:557
int const VECTOR_PLOT_POLYGON_NODES
Definition cme.h:567
int const RASTER_PLOT_LOCAL_SLOPE_OF_CONSOLIDATED_SEDIMENT
Definition cme.h:521
int const RASTER_PLOT_TOTAL_ACTUAL_BEACH_EROSION
Definition cme.h:537
string const RASTER_PLOT_BEACH_DEPOSITION_TITLE
Definition cme.h:953
int const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_SAND
Definition cme.h:507
int const RASTER_PLOT_BEACH_DEPOSITION
Definition cme.h:501
int const RASTER_PLOT_SUSPENDED_SEDIMENT
Definition cme.h:536
int const VECTOR_PLOT_NORMALS
Definition cme.h:565
string const RASTER_PLOT_DEEP_WATER_WAVE_ORIENTATION_TITLE
Definition cme.h:965
string const VECTOR_PLOT_CLIFF_NOTCH_SIZE_TITLE
Definition cme.h:1059
string const RASTER_PLOT_FINE_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:967
int const RASTER_PLOT_FINE_UNCONSOLIDATED_SEDIMENT
Definition cme.h:516
string const RASTER_PLOT_AVG_SEA_DEPTH_TITLE
Definition cme.h:948
string const VECTOR_PLOT_DOWNDRIFT_BOUNDARY_TITLE
Definition cme.h:1063
string const ERR
Definition cme.h:777
string const RASTER_PLOT_BEACH_MASK_TITLE
Definition cme.h:954
int const RASTER_PLOT_INUNDATION_MASK
Definition cme.h:519
string const RASTER_PLOT_AVG_WAVE_ORIENTATION_TITLE
Definition cme.h:951
string const RASTER_PLOT_SETUP_SURGE_FLOOD_MASK_TITLE
Definition cme.h:1003
int const RASTER_PLOT_SEDIMENT_TOP_ELEVATION_ELEV
Definition cme.h:532
string const RASTER_PLOT_ACTUAL_BEACH_EROSION_TITLE
Definition cme.h:946
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_FINE_TITLE
Definition cme.h:994
int const RASTER_PLOT_ACTUAL_BEACH_EROSION
Definition cme.h:494
string const RASTER_PLOT_POLYGON_GAIN_OR_LOSS_TITLE
Definition cme.h:976
string const VECTOR_PLOT_MEAN_WAVE_ENERGY_TITLE
Definition cme.h:1065
string const RASTER_PLOT_DEEP_WATER_WAVE_HEIGHT_TITLE
Definition cme.h:964
string const RASTER_PLOT_WAVE_ORIENTATION_TITLE
Definition cme.h:1000
string const RASTER_PLOT_BASEMENT_ELEVATION_TITLE
Definition cme.h:952
string const RASTER_PLOT_INTERVENTION_CLASS_TITLE
Definition cme.h:969
string const RASTER_PLOT_COARSE_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:962
string const VECTOR_PLOT_POLYGON_NODES_TITLE
Definition cme.h:1068
string const VECTOR_PLOT_RUN_UP_TITLE
Definition cme.h:1074
int const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_MASK
Definition cme.h:549
string const RASTER_PLOT_AVG_WAVE_HEIGHT_TITLE
Definition cme.h:950
string const RASTER_PLOT_TOTAL_POTENTIAL_PLATFORM_EROSION_TITLE
Definition cme.h:998
int const RASTER_PLOT_SAND_CONSOLIDATED_SEDIMENT
Definition cme.h:529
int const RASTER_PLOT_AVG_WAVE_HEIGHT
Definition cme.h:498
int const SOUTH_EAST
Definition cme.h:389
int const RASTER_PLOT_FINE_CONSOLIDATED_SEDIMENT
Definition cme.h:515
int const VECTOR_PLOT_DOWNDRIFT_BOUNDARY
Definition cme.h:562
int const RASTER_PLOT_ACTIVE_ZONE
Definition cme.h:493
int const VECTOR_PLOT_COAST_CURVATURE
Definition cme.h:560
string const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_COARSE_TITLE
Definition cme.h:957
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_SAND_TITLE
Definition cme.h:995
string const VECTOR_PLOT_WAVE_SETUP_TITLE
Definition cme.h:1072
string const RASTER_PLOT_LANDFORM_TITLE
Definition cme.h:972
int const RASTER_PLOT_DEEP_WATER_WAVE_PERIOD
Definition cme.h:514
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_SAND
Definition cme.h:543
string const RASTER_PLOT_WAVE_HEIGHT_TITLE
Definition cme.h:999
int const RASTER_PLOT_COAST
Definition cme.h:511
string const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1057
string const RASTER_PLOT_TOTAL_POTENTIAL_BEACH_EROSION_TITLE
Definition cme.h:997
string const VECTOR_PLOT_COAST_CURVATURE_TITLE
Definition cme.h:1060
string const RASTER_PLOT_POTENTIAL_BEACH_EROSION_TITLE
Definition cme.h:979
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1178
int const VECTOR_PLOT_RUN_UP
Definition cme.h:573
int const RASTER_PLOT_POLYGON_UPDRIFT_OR_DOWNDRIFT
Definition cme.h:526
int const VECTOR_PLOT_INVALID_NORMALS
Definition cme.h:563
string const RASTER_PLOT_SETUP_SURGE_RUNUP_FLOOD_MASK_TITLE
Definition cme.h:1004
int const RASTER_PLOT_POLYGON_GAIN_OR_LOSS
Definition cme.h:525
string const RASTER_PLOT_SAND_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:981
int const RASTER_PLOT_DEEP_WATER_WAVE_ORIENTATION
Definition cme.h:513
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_COARSE
Definition cme.h:542
string const RASTER_PLOT_ACTUAL_PLATFORM_EROSION_TITLE
Definition cme.h:947
int const RASTER_PLOT_COARSE_UNCONSOLIDATED_SEDIMENT
Definition cme.h:510
int const RASTER_PLOT_AVG_WAVE_ORIENTATION
Definition cme.h:499
string const RASTER_PLOT_TOTAL_BEACH_DEPOSITION_TITLE
Definition cme.h:991
int const RASTER_PLOT_WAVE_ORIENTATION
Definition cme.h:548
int const SOUTH_WEST
Definition cme.h:391
int const RASTER_PLOT_BEACH_MASK
Definition cme.h:502
int const RASTER_PLOT_WAVE_FLOOD_LINE
Definition cme.h:553
int const RASTER_PLOT_SEDIMENT_INPUT
Definition cme.h:550
int const RASTER_PLOT_POTENTIAL_BEACH_EROSION
Definition cme.h:527
int const NORTH_WEST
Definition cme.h:393
string const RASTER_PLOT_SEDIMENT_TOP_ELEVATION_ELEV_TITLE
Definition cme.h:984
int const RASTER_PLOT_AVG_SUSPENDED_SEDIMENT
Definition cme.h:497
int const VECTOR_PLOT_COAST
Definition cme.h:559
int const VECTOR_PLOT_FLOOD_LINE
Definition cme.h:574
string const RASTER_PLOT_BEACH_PROTECTION_TITLE
Definition cme.h:955
int const RASTER_PLOT_TOTAL_POTENTIAL_PLATFORM_EROSION
Definition cme.h:546
string const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_MASK_TITLE
Definition cme.h:1001
string const VECTOR_PLOT_COAST_TITLE
Definition cme.h:1061
int const VECTOR_PLOT_CLIFF_NOTCH_SIZE
Definition cme.h:558
string const PROGRAM_NAME
Definition cme.h:711
int const RASTER_PLOT_INTERVENTION_CLASS
Definition cme.h:517
string const VECTOR_PLOT_FLOOD_SWL_SETUP_LINE_TITLE
Definition cme.h:1076
int const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE
Definition cme.h:570
int const RASTER_PLOT_BEACH_PROTECTION
Definition cme.h:503
int const RASTER_PLOT_AVG_SEA_DEPTH
Definition cme.h:496
int const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:569
int const RASTER_PLOT_OVERALL_TOP_ELEVATION
Definition cme.h:523
string const RASTER_PLOT_SHADOW_ZONE_TITLE
Definition cme.h:986
int const RASTER_PLOT_TOTAL_BEACH_DEPOSITION
Definition cme.h:539
string const VECTOR_PLOT_SHADOW_BOUNDARY_TITLE
Definition cme.h:1069
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_FINE
Definition cme.h:540
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_SAND
Definition cme.h:541
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_FINE
Definition cme.h:504
int const SOUTH
Definition cme.h:390
int const NO_DIRECTION
Definition cme.h:385
string const RASTER_PLOT_AVG_SUSPENDED_SEDIMENT_TITLE
Definition cme.h:949
int const RASTER_PLOT_ACTUAL_PLATFORM_EROSION
Definition cme.h:495
int const VECTOR_PLOT_POLYGON_BOUNDARY
Definition cme.h:566
string const RASTER_PLOT_INTERVENTION_HEIGHT_TITLE
Definition cme.h:970
int const VECTOR_PLOT_MEAN_WAVE_ENERGY
Definition cme.h:564
int const EAST
Definition cme.h:388
string const VECTOR_PLOT_POLYGON_BOUNDARY_TITLE
Definition cme.h:1067
string const RASTER_PLOT_SEA_DEPTH_TITLE
Definition cme.h:983
string const RASTER_PLOT_TOTAL_ACTUAL_PLATFORM_EROSION_TITLE
Definition cme.h:990
string const RASTER_PLOT_SEDIMENT_INPUT_EVENT_TITLE
Definition cme.h:1002
int const RASTER_PLOT_INTERVENTION_HEIGHT
Definition cme.h:518
int const RASTER_PLOT_TOTAL_POTENTIAL_BEACH_EROSION
Definition cme.h:545
int const NORTH_EAST
Definition cme.h:387
int const RASTER_PLOT_SAND_UNCONSOLIDATED_SEDIMENT
Definition cme.h:530
string const RASTER_PLOT_FINE_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:968
string const RASTER_PLOT_NORMAL_PROFILE_TITLE
Definition cme.h:974
string const RASTER_PLOT_DEEP_WATER_WAVE_PERIOD_TITLE
Definition cme.h:966
int const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION
Definition cme.h:528
string const RASTER_PLOT_INUNDATION_MASK_TITLE
Definition cme.h:971
string const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_TITLE
Definition cme.h:980
int const RASTER_PLOT_NORMAL_PROFILE
Definition cme.h:522
double const DBL_NODATA
Definition cme.h:709
int const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_COARSE
Definition cme.h:508
int const RASTER_PLOT_WAVE_HEIGHT
Definition cme.h:547
int const RASTER_PLOT_SHADOW_ZONE
Definition cme.h:534
int const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:556
int const RASTER_PLOT_DEEP_WATER_WAVE_HEIGHT
Definition cme.h:512
string const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_SAND_TITLE
Definition cme.h:956
int const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:561
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_COARSE_TITLE
Definition cme.h:996
string const RASTER_PLOT_SHADOW_DOWNDRIFT_ZONE_TITLE
Definition cme.h:985
int const RASTER_PLOT_COARSE_CONSOLIDATED_SEDIMENT
Definition cme.h:509
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_SAND_TITLE
Definition cme.h:992
int const RASTER_PLOT_TOTAL_ACTUAL_PLATFORM_EROSION
Definition cme.h:538
int const VECTOR_PLOT_WAVE_SETUP
Definition cme.h:571
int const RASTER_PLOT_SETUP_SURGE_RUNUP_FLOOD_MASK
Definition cme.h:552
int const RASTER_PLOT_BASEMENT_ELEVATION
Definition cme.h:500
string const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE_TITLE
Definition cme.h:1071
int const RASTER_PLOT_LANDFORM
Definition cme.h:520
string const RASTER_PLOT_SUSPENDED_SEDIMENT_TITLE
Definition cme.h:988
int const RIGHT_HANDED
Definition cme.h:400
string const VECTOR_PLOT_STORM_SURGE_TITLE
Definition cme.h:1073
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_FINE_TITLE
Definition cme.h:958
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_COARSE
Definition cme.h:506
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_COARSE_TITLE
Definition cme.h:993
int const RASTER_PLOT_SHADOW_DOWNDRIFT_ZONE
Definition cme.h:533
string const RASTER_PLOT_SAND_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:982
int const RASTER_PLOT_SLICE
Definition cme.h:535
string const RASTER_PLOT_OVERALL_TOP_ELEVATION_TITLE
Definition cme.h:975
string const RASTER_PLOT_ACTIVE_ZONE_TITLE
Definition cme.h:945
int const VECTOR_PLOT_SHADOW_BOUNDARY
Definition cme.h:568
string const RASTER_PLOT_LOCAL_SLOPE_OF_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:973
string const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1070
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_COARSE
Definition cme.h:544
string const RASTER_PLOT_TOTAL_ACTUAL_BEACH_EROSION_TITLE
Definition cme.h:989
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_SAND
Definition cme.h:505
string const RASTER_PLOT_SLICE_TITLE
Definition cme.h:987
int const RASTER_PLOT_SEA_DEPTH
Definition cme.h:531
int const NORTH
Definition cme.h:386
string const RASTER_PLOT_COARSE_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:961
string const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1062
int const RASTER_PLOT_SETUP_SURGE_FLOOD_MASK
Definition cme.h:551
int const WEST
Definition cme.h:392
char const SPACE
Definition cme.h:342
Contains CRWCoast definitions.
Contains CGeomRasterGrid definitions.
Contains CSimulation definitions.
int nRound(double const d)
Version of the above that returns an int.