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
29 This file is part of CoastalME, the Coastal Modelling Environment.
30
31 CoastalME 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
33 This 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
35 You 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 "coast.h"
56#include "raster_grid.h"
57#include "simulation.h"
58
59//===============================================================================================================================
61//===============================================================================================================================
62double CSimulation::dGridCentroidXToExtCRSX(int const nGridX) const {
63 // TODO 064
64 return (m_dGeoTransform[0] + (nGridX * m_dGeoTransform[1]) + (m_dGeoTransform[1] / 2));
65}
66
67//===============================================================================================================================
69//===============================================================================================================================
70double CSimulation::dGridCentroidYToExtCRSY(int const nGridY) const {
71 // TODO 064
72 return (m_dGeoTransform[3] + (nGridY * m_dGeoTransform[5]) + (m_dGeoTransform[5] / 2));
73}
74
75//===============================================================================================================================
77//===============================================================================================================================
79 // TODO 064
80 double dX = m_dGeoTransform[0] + (pPtiIn->nGetX() * m_dGeoTransform[1]) + (m_dGeoTransform[1] / 2);
81 double dY = m_dGeoTransform[3] + (pPtiIn->nGetY() * m_dGeoTransform[5]) + (m_dGeoTransform[5] / 2);
82
83 return CGeom2DPoint(dX, dY);
84}
85
86//===============================================================================================================================
88//===============================================================================================================================
89double CSimulation::dGridXToExtCRSX(double const dGridX) const {
90 // TODO 064 Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2)
91 return m_dGeoTransform[0] + (dGridX * m_dGeoTransform[1]) - 1;
92}
93
94//===============================================================================================================================
96//===============================================================================================================================
97double CSimulation::dGridYToExtCRSY(double const dGridY) const {
98 // TODO 064 Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5)
99 return m_dGeoTransform[3] + (dGridY * m_dGeoTransform[5]) - 1;
100}
101
102//===============================================================================================================================
104//===============================================================================================================================
105double CSimulation::dExtCRSXToGridX(double const dExtCRSX) const {
106 // TODO 064
107 return ((dExtCRSX - m_dGeoTransform[0]) / m_dGeoTransform[1]) - 1;
108}
109
110//===============================================================================================================================
112//===============================================================================================================================
113double CSimulation::dExtCRSYToGridY(double const dExtCRSY) const {
114 // TODO 064
115 return ((dExtCRSY - m_dGeoTransform[3]) / m_dGeoTransform[5]) - 1;
116}
117
118//===============================================================================================================================
120//===============================================================================================================================
122 // TODO 064
123 int nX = nRound(((pPtIn->dGetX() - m_dGeoTransform[0]) / m_dGeoTransform[1]) - 1);
124 int nY = nRound(((pPtIn->dGetY() - m_dGeoTransform[3]) / m_dGeoTransform[5]) - 1);
125
126 return CGeom2DIPoint(nX, nY);
127}
128
129//===============================================================================================================================
131//===============================================================================================================================
133 double dXDist = Pt1->dGetX() - Pt2->dGetX();
134 double dYDist = Pt1->dGetY() - Pt2->dGetY();
135
136 return hypot(dXDist, dYDist);
137}
138
139//===============================================================================================================================
141//===============================================================================================================================
143 double dXDist = Pti1->nGetX() - Pti2->nGetX();
144 double dYDist = Pti1->nGetY() - Pti2->nGetY();
145
146 return hypot(dXDist, dYDist);
147}
148
149//===============================================================================================================================
151//===============================================================================================================================
152double CSimulation::dTriangleAreax2(CGeom2DPoint const *pPtA, CGeom2DPoint const *pPtB, CGeom2DPoint const *pPtC) {
153 return (pPtB->dGetX() - pPtA->dGetX()) * (pPtC->dGetY() - pPtA->dGetY()) - (pPtB->dGetY() - pPtA->dGetY()) * (pPtC->dGetX() - pPtA->dGetX());
154}
155
156//===============================================================================================================================
158//===============================================================================================================================
159bool CSimulation::bIsWithinValidGrid(int const nX, int const nY) const {
160 if ((nX < 0) || (nX >= m_nXGridSize))
161 return false;
162
163 if ((nY < 0) || (nY >= m_nYGridSize))
164 return false;
165
166 if (m_pRasterGrid->m_Cell[nX][nY].bBasementElevIsMissingValue())
167 return false;
168
169 return true;
170}
171
172//===============================================================================================================================
174//===============================================================================================================================
176 int nX = Pti->nGetX();
177 int nY = Pti->nGetY();
178
179 return this->bIsWithinValidGrid(nX, nY);
180}
181
182//===============================================================================================================================
184//===============================================================================================================================
185void CSimulation::KeepWithinValidGrid(int &nX, int &nY) const {
186 nX = tMax(nX, 0);
187 nX = tMin(nX, m_nXGridSize - 1);
188
189 nY = tMax(nY, 0);
190 nY = tMin(nY, m_nYGridSize - 1);
191}
192
193//===============================================================================================================================
195//===============================================================================================================================
197 KeepWithinValidGrid(Pti0->nGetX(), Pti0->nGetY(), *Pti1->pnGetX(), *Pti1->pnGetY());
198}
199
200//===============================================================================================================================
202//===============================================================================================================================
203void CSimulation::KeepWithinValidGrid(int nX0, int nY0, int &nX1, int &nY1) const {
204 // Safety check: make sure that the first point is within the valid grid
205 if (nX0 >= m_nXGridSize)
206 nX0 = m_nXGridSize - 1;
207
208 else if (nX0 < 0)
209 nX0 = 0;
210
211 if (nY0 >= m_nYGridSize)
212 nY0 = m_nYGridSize - 1;
213
214 else if (nY0 < 0)
215 nY0 = 0;
216
217 // OK let's go
218 int nDiffX = nX0 - nX1;
219 int nDiffY = nY0 - nY1;
220
221 if (nDiffX == 0) {
222 // The two points have the same x coordinates, so we just need to constrain the y co-ord
223 if (nY1 < nY0) {
224 nY1 = -1;
225
226 do {
227 nY1++;
228 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
229
230 return;
231 }
232
233 else {
234 nY1 = m_nYGridSize;
235
236 do {
237 nY1--;
238 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
239
240 return;
241 }
242 }
243
244 else if (nDiffY == 0) {
245 // The two points have the same y coordinates, so we just need to constrain the x co-ord
246 if (nX1 < nX0) {
247 nX1 = -1;
248
249 do {
250 nX1++;
251 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
252
253 return;
254 }
255
256 else {
257 nX1 = m_nXGridSize;
258
259 do {
260 nX1--;
261 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
262
263 return;
264 }
265 }
266
267 else {
268 // 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
269 int nXDistanceOutside = 0;
270 int nYDistanceOutside = 0;
271
272 if (nX1 < 0)
273 nXDistanceOutside = -nX1;
274
275 else if (nX1 >= m_nXGridSize)
276 nXDistanceOutside = nX1 - m_nXGridSize + 1;
277
278 if (nY1 < 0)
279 nYDistanceOutside = -nY1;
280
281 else if (nY1 >= m_nYGridSize)
282 nXDistanceOutside = nY1 - m_nYGridSize + 1;
283
284 if (nXDistanceOutside >= nYDistanceOutside) {
285 // Constrain the x co-ord
286 if (nX1 < nX0) {
287 // The incorrect x co-ord is less than the correct x co-ord: constrain it and find the y co-ord
288 nX1 = -1;
289
290 do {
291 nX1++;
292
293 nY1 = nY0 + nRound(((nX1 - nX0) * nDiffY) / static_cast<double>(nDiffX));
294 } while ((nY1 < 0) || (nY1 >= m_nYGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
295
296 return;
297 }
298
299 else {
300 // The incorrect x co-ord is greater than the correct x-co-ord: constrain it and find the y co-ord
301 nX1 = m_nXGridSize;
302
303 do {
304 nX1--;
305
306 nY1 = nY0 + nRound(((nX1 - nX0) * nDiffY) / static_cast<double>(nDiffX));
307 } while ((nY1 < 0) || (nY1 >= m_nYGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
308
309 return;
310 }
311 }
312
313 else {
314 // Constrain the y co-ord
315 if (nY1 < nY0) {
316 // The incorrect y co-ord is less than the correct y-co-ord: constrain it and find the x co-ord
317 nY1 = -1;
318
319 do {
320 nY1++;
321
322 nX1 = nX0 + nRound(((nY1 - nY0) * nDiffX) / static_cast<double>(nDiffY));
323 } while ((nX1 < 0) || (nX1 >= m_nXGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
324
325 return;
326 }
327
328 else {
329 // The incorrect y co-ord is greater than the correct y co-ord: constrain it and find the x co-ord
330 nY1 = m_nYGridSize;
331
332 do {
333 nY1--;
334
335 nX1 = nX0 + nRound(((nY1 - nY0) * nDiffX) / static_cast<double>(nDiffY));
336 } while ((nX1 < 0) || (nX1 >= m_nXGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
337
338 return;
339 }
340 }
341 }
342}
343
344//===============================================================================================================================
346//===============================================================================================================================
347double CSimulation::dKeepWithin360(double const dAngle) {
348 double dNewAngle = dAngle;
349
350 // Sort out -ve angles
351 while (dNewAngle < 0)
352 dNewAngle += 360;
353
354 // Sort out angles > 360
355 while (dNewAngle > 360)
356 dNewAngle -= 360;
357
358 return dNewAngle;
359}
360
361//===============================================================================================================================
363//===============================================================================================================================
365 double dPt1X = pPt1->dGetX();
366 double dPt1Y = pPt1->dGetY();
367 double dPt2X = pPt2->dGetX();
368 double dPt2Y = pPt2->dGetY();
369 double dPtAvgX = (dPt1X + dPt2X) / 2;
370 double dPtAvgY = (dPt1Y + dPt2Y) / 2;
371
372 return CGeom2DPoint(dPtAvgX, dPtAvgY);
373}
374
375// //===============================================================================================================================
376// //! Returns an integer point (grid CRS) which is the approximate average of (i.e. is midway between) two other grid CRS integer points
377// //===============================================================================================================================
378// CGeom2DIPoint CSimulation::PtiAverage(CGeom2DIPoint const* pPti1, CGeom2DIPoint const* pPti2)
379// {
380// int nPti1X = pPti1->nGetX();
381// int nPti1Y = pPti1->nGetY();
382// int nPti2X = pPti2->nGetX();
383// int nPti2Y = pPti2->nGetY();
384// int nPtiAvgX = (nPti1X + nPti2X) / 2;
385// int nPtiAvgY = (nPti1Y + nPti2Y) / 2;
386//
387// return CGeom2DIPoint(nPtiAvgX, nPtiAvgY);
388// }
389
390//===============================================================================================================================
392//===============================================================================================================================
393CGeom2DIPoint CSimulation::PtiWeightedAverage(CGeom2DIPoint const *pPti1, CGeom2DIPoint const *pPti2, double const dWeight) {
394 int nPti1X = pPti1->nGetX();
395 int nPti1Y = pPti1->nGetY();
396 int nPti2X = pPti2->nGetX();
397 int nPti2Y = pPti2->nGetY();
398 double dOtherWeight = 1.0 - dWeight;
399
400 int nPtiWeightAvgX = nRound((dWeight * nPti2X) + (dOtherWeight * nPti1X));
401 int nPtiWeightAvgY = nRound((dWeight * nPti2Y) + (dOtherWeight * nPti1Y));
402
403 return CGeom2DIPoint(nPtiWeightAvgX, nPtiWeightAvgY);
404}
405
406//===============================================================================================================================
408//===============================================================================================================================
409CGeom2DPoint CSimulation::PtAverage(vector<CGeom2DPoint> *pVIn) {
410 int nSize = static_cast<int>(pVIn->size());
411
412 if (nSize == 0)
414
415 double dAvgX = 0;
416 double dAvgY = 0;
417
418 for (int n = 0; n < nSize; n++) {
419 dAvgX += pVIn->at(n).dGetX();
420 dAvgY += pVIn->at(n).dGetY();
421 }
422
423 dAvgX /= nSize;
424 dAvgY /= nSize;
425
426 return CGeom2DPoint(dAvgX, dAvgY);
427}
428
429// //===============================================================================================================================
430// //! Returns a point (grid CRS) which is the average of a vector of grid CRS points
431// //===============================================================================================================================
432// CGeom2DIPoint CSimulation::PtiAverage(vector<CGeom2DIPoint>* pVIn)
433// {
434// int nSize = static_cast<int>(pVIn->size());
435// if (nSize == 0)
436// return CGeom2DIPoint(INT_NODATA, INT_NODATA);
437//
438// double dAvgX = 0;
439// double dAvgY = 0;
440//
441// for (int n = 0; n < nSize; n++)
442// {
443// dAvgX += pVIn->at(n).nGetX();
444// dAvgY += pVIn->at(n).nGetY();
445// }
446//
447// dAvgX /= nSize;
448// dAvgY /= nSize;
449//
450// return CGeom2DIPoint(nRound(dAvgX), nRound(dAvgY));
451// }
452
453//===============================================================================================================================
455//===============================================================================================================================
456CGeom2DIPoint CSimulation::PtiPolygonCentroid(vector<CGeom2DIPoint> *pVIn) {
457 CGeom2DIPoint PtiCentroid(0, 0);
458 int nSize = static_cast<int>(pVIn->size());
459 int nX0 = 0; // Current vertex X
460 int nY0 = 0; // Current vertex Y
461 int nX1 = 0; // Next vertex X
462 int nY1 = 0; // Next vertex Y
463
464 double dA = 0; // Partial signed area
465 double dSignedArea = 0.0;
466
467 // For all vertices except last
468 for (int i = 0; i < nSize - 1; ++i) {
469 nX0 = pVIn->at(i).nGetX();
470 nY0 = pVIn->at(i).nGetY();
471 nX1 = pVIn->at(i + 1).nGetX();
472 nY1 = pVIn->at(i + 1).nGetY();
473
474 dA = (nX0 * nY1) - (nX1 * nY0);
475 dSignedArea += dA;
476 PtiCentroid.AddXAddY((nX0 + nX1) * dA, (nY0 + nY1) * dA);
477 }
478
479 // Do last vertex separately to avoid performing an expensive modulus operation in each iteration
480 nX0 = pVIn->at(nSize - 1).nGetX();
481 nY0 = pVIn->at(nSize - 1).nGetY();
482 nX1 = pVIn->at(0).nGetX();
483 nY1 = pVIn->at(0).nGetY();
484
485 dA = (nX0 * nY1) - (nX1 * nY0);
486 dSignedArea += dA;
487 PtiCentroid.AddXAddY((nX0 + nX1) * dA, (nY0 + nY1) * dA);
488
489 dSignedArea *= 0.5;
490 PtiCentroid.DivXDivY(6.0 * dSignedArea, 6.0 * dSignedArea);
491
492 return PtiCentroid;
493}
494
495/* ==============================================================================================================================
496
497 Returns a vector which is perpendicular to an existing vector
498
499===============================================================================================================================*/
500// vector<CGeom2DPoint> CSimulation::VGetPerpendicular(CGeom2DPoint const* PtStart, CGeom2DPoint const* PtNext, double const dDesiredLength, int const nHandedness)
501// {
502// // Returns a two-point vector which passes through PtStart with a scaled length
503// double dXLen = PtNext->dGetX() - PtStart->dGetX();
504// double dYLen = PtNext->dGetY() - PtStart->dGetY();
505//
506// double dLength = hypot(dXLen, dYLen);
507// double dScaleFactor = dDesiredLength / dLength;
508//
509// // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
510// CGeom2DPoint EndPt;
511// if (nHandedness == RIGHT_HANDED)
512// {
513// EndPt.SetX(PtStart->dGetX() + (dScaleFactor * dYLen));
514// EndPt.SetY(PtStart->dGetY() - (dScaleFactor * dXLen));
515// }
516// else
517// {
518// EndPt.SetX(PtStart->dGetX() - (dScaleFactor * dYLen));
519// EndPt.SetY(PtStart->dGetY() + (dScaleFactor * dXLen));
520// }
521//
522// vector<CGeom2DPoint> VNew;
523// VNew.push_back(*PtStart);
524// VNew.push_back(EndPt);
525// return VNew;
526// }
527
528//===============================================================================================================================
530//===============================================================================================================================
531CGeom2DPoint CSimulation::PtGetPerpendicular(CGeom2DPoint const *PtStart, CGeom2DPoint const *PtNext, double const dDesiredLength, int const nHandedness) {
532 double dXLen = PtNext->dGetX() - PtStart->dGetX();
533 double dYLen = PtNext->dGetY() - PtStart->dGetY();
534 double dLength;
535
536 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
537 dLength = dYLen;
538
539 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
540 dLength = dXLen;
541
542 else
543 dLength = hypot(dXLen, dYLen);
544
545 double dScaleFactor = dDesiredLength / dLength;
546
547 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
548 CGeom2DPoint EndPt;
549
550 if (nHandedness == RIGHT_HANDED) {
551 EndPt.SetX(PtStart->dGetX() + (dScaleFactor * dYLen));
552 EndPt.SetY(PtStart->dGetY() - (dScaleFactor * dXLen));
553 }
554
555 else {
556 EndPt.SetX(PtStart->dGetX() - (dScaleFactor * dYLen));
557 EndPt.SetY(PtStart->dGetY() + (dScaleFactor * dXLen));
558 }
559
560 return EndPt;
561}
562
563//===============================================================================================================================
565//===============================================================================================================================
566CGeom2DIPoint CSimulation::PtiGetPerpendicular(CGeom2DIPoint const *PtiStart, CGeom2DIPoint const *PtiNext, double const dDesiredLength, int const nHandedness) {
567 double dXLen = PtiNext->nGetX() - PtiStart->nGetX();
568 double dYLen = PtiNext->nGetY() - PtiStart->nGetY();
569 double dLength;
570
571 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
572 dLength = dYLen;
573
574 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
575 dLength = dXLen;
576
577 else
578 dLength = hypot(dXLen, dYLen);
579
580 double dScaleFactor = dDesiredLength / dLength;
581
582 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
583 CGeom2DIPoint EndPti;
584
585 if (nHandedness == RIGHT_HANDED) {
586 EndPti.SetX(PtiStart->nGetX() + nRound(dScaleFactor * dYLen));
587 EndPti.SetY(PtiStart->nGetY() - nRound(dScaleFactor * dXLen));
588 }
589
590 else {
591 EndPti.SetX(PtiStart->nGetX() - nRound(dScaleFactor * dYLen));
592 EndPti.SetY(PtiStart->nGetY() + nRound(dScaleFactor * dXLen));
593 }
594
595 return EndPti;
596}
597
598//===============================================================================================================================
600//===============================================================================================================================
601CGeom2DIPoint CSimulation::PtiGetPerpendicular(int const nStartX, int const nStartY, int const nNextX, int const nNextY, double const dDesiredLength, int const nHandedness) {
602 double dXLen = nNextX - nStartX;
603 double dYLen = nNextY - nStartY;
604 double dLength;
605
606 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
607 dLength = dYLen;
608
609 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
610 dLength = dXLen;
611
612 else
613 dLength = hypot(dXLen, dYLen);
614
615 double dScaleFactor = dDesiredLength / dLength;
616
617 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
618 CGeom2DIPoint EndPti;
619
620 if (nHandedness == RIGHT_HANDED) {
621 EndPti.SetX(nStartX + nRound(dScaleFactor * dYLen));
622 EndPti.SetY(nStartY - nRound(dScaleFactor * dXLen));
623 }
624
625 else {
626 EndPti.SetX(nStartX - nRound(dScaleFactor * dYLen));
627 EndPti.SetY(nStartY + nRound(dScaleFactor * dXLen));
628 }
629
630 return EndPti;
631}
632
633//===============================================================================================================================
635//===============================================================================================================================
636double CSimulation::dAngleSubtended(CGeom2DIPoint const *pPtiA, CGeom2DIPoint const *pPtiB, CGeom2DIPoint const *pPtiC) {
637 double
638 dXDistBtoA = pPtiB->nGetX() - pPtiA->nGetX(),
639 dYDistBtoA = pPtiB->nGetY() - pPtiA->nGetY(),
640 dXDistCtoA = pPtiC->nGetX() - pPtiA->nGetX(),
641 dYDistCtoA = pPtiC->nGetY() - pPtiA->nGetY(),
642 dDotProduct = dXDistBtoA * dXDistCtoA + dYDistBtoA * dYDistCtoA,
643 dPseudoCrossProduct = dXDistBtoA * dYDistCtoA - dYDistBtoA * dXDistCtoA,
644 dAngle = atan2(dPseudoCrossProduct, dDotProduct);
645
646 return dAngle;
647}
648
649//===============================================================================================================================
651//===============================================================================================================================
653 // Register all available GDAL raster and vector drivers (GDAL 2)
654 GDALAllRegister();
655
656 // If the user hasn't specified a GIS output format, assume that we will use the same GIS format as the input basement DEM
657 if (m_strRasterGISOutFormat.empty())
659
660 // Load the raster GDAL driver
661 GDALDriver *pDriver = GetGDALDriverManager()->GetDriverByName(m_strRasterGISOutFormat.c_str());
662
663 if (NULL == pDriver) {
664 // Can't load raster GDAL driver. Incorrectly specified?
665 cerr << ERR << "Unknown raster GIS output format '" << m_strRasterGISOutFormat << "'." << endl;
666 return false;
667 }
668
669 // Get the metadata for this raster driver
670 char **papszMetadata = pDriver->GetMetadata();
671
672 // for (int i = 0; papszMetadata[i] != NULL; i++)
673 // cout << papszMetadata[i] << endl;
674 // cout << endl;
675
676 // Need to test if this is a raster driver
677 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_RASTER, FALSE)) {
678 // This is not a raster driver
679 cerr << ERR << "GDAL driver '" << m_strRasterGISOutFormat << "' is not a raster driver. Choose another format." << endl;
680 return false;
681 }
682
683 // This driver is OK, so store its longname and the default file extension
684 string strTmp = CSLFetchNameValue(papszMetadata, "DMD_LONGNAME");
686 strTmp = CSLFetchNameValue(papszMetadata, "DMD_EXTENSIONS"); // Note DMD_EXTENSION (no S, is a single value) appears not to be implemented for newer drivers
687 strTmp = strTrim(&strTmp);
688
689 // We have a space-separated list of one or more file extensions: use the first extension in the list
690 long unsigned int nPos = strTmp.find(SPACE);
691
692 if (nPos == string::npos) {
693 // No space i.e. just one extension
695 }
696
697 else {
698 // There's a space, so we must have more than one extension
699 m_strGDALRasterOutputDriverExtension = strTmp.substr(0, nPos);
700 }
701
702 // Set up any defaults for raster files that are created using this driver
704
705 // Now do various tests of the driver's capabilities
706 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATE, FALSE)) {
707 // This raster driver does not support the Create() method, does it support CreateCopy()?
708 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATECOPY, FALSE)) {
709 cerr << ERR << "Cannot write using raster GDAL driver '" << m_strRasterGISOutFormat << " since neither Create() or CreateCopy() are supported'. Choose another GDAL raster format." << endl;
710 return false;
711 }
712
713 // Can't use Create() but can use CreateCopy()
714 m_bGDALCanCreate = false;
715 }
716
717 // Next, test to see what data types the driver can write and from this, work out the largest int and float we can write
718 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Float")) {
720 m_GDALWriteFloatDataType = GDT_Float32;
721 }
722
723 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "UInt32")) {
725
726 m_GDALWriteIntDataType = GDT_UInt32;
727 m_lGDALMaxCanWrite = UINT32_MAX;
729
731 m_GDALWriteFloatDataType = GDT_UInt32;
732
733 return true;
734 }
735
736 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Int32")) {
738
739 m_GDALWriteIntDataType = GDT_Int32;
740 m_lGDALMaxCanWrite = INT32_MAX;
741 m_lGDALMinCanWrite = INT32_MIN;
742
744 m_GDALWriteFloatDataType = GDT_Int32;
745
746 return true;
747 }
748
749 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "UInt16")) {
750 m_bGDALCanWriteInt32 = false;
751
752 m_GDALWriteIntDataType = GDT_UInt16;
753 m_lGDALMaxCanWrite = UINT16_MAX;
755
757 m_GDALWriteFloatDataType = GDT_UInt16;
758
759 return true;
760 }
761
762 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Int16")) {
763 m_bGDALCanWriteInt32 = false;
764
765 m_GDALWriteIntDataType = GDT_Int16;
766 m_lGDALMaxCanWrite = INT16_MAX;
767 m_lGDALMinCanWrite = INT16_MIN;
768
770 m_GDALWriteFloatDataType = GDT_Int16;
771
772 return true;
773 }
774
775 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Byte")) {
776 m_bGDALCanWriteInt32 = false;
777
778 m_GDALWriteIntDataType = GDT_Byte;
779 m_lGDALMaxCanWrite = UINT8_MAX;
781
783 m_GDALWriteFloatDataType = GDT_Byte;
784
785 return true;
786 }
787
788 // This driver does not even support byte output
789 cerr << ERR << "Cannot write using raster GDAL driver '" << m_strRasterGISOutFormat << ", not even byte output is supported'. Choose another GIS raster format." << endl;
790 return false;
791}
792
793//===============================================================================================================================
795//===============================================================================================================================
797 // Load the vector GDAL driver (this assumes that GDALAllRegister() has already been called)
798 GDALDriver *pDriver = GetGDALDriverManager()->GetDriverByName(m_strVectorGISOutFormat.c_str());
799
800 if (NULL == pDriver) {
801 // Can't load vector GDAL driver. Incorrectly specified?
802 cerr << ERR << "Unknown vector GIS output format '" << m_strVectorGISOutFormat << "'." << endl;
803 return false;
804 }
805
806 // Get the metadata for this vector driver
807 char **papszMetadata = pDriver->GetMetadata();
808
809 // For GDAL2, need to test if this is a vector driver
810 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_VECTOR, FALSE)) {
811 // This is not a vector driver
812 cerr << ERR << "GDAL driver '" << m_strVectorGISOutFormat << "' is not a vector driver. Choose another format." << endl;
813 return false;
814 }
815
816 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATE, FALSE)) {
817 // Driver does not support create() method
818 cerr << ERR << "Cannot write vector GIS files using GDAL driver '" << m_strRasterGISOutFormat << "'. Choose another format." << endl;
819 return false;
820 }
821
822 // Driver is OK, now set some options for individual drivers
823 if (m_strVectorGISOutFormat == "ESRI Shapefile") {
824 // Set this, so that just a single dataset-with-one-layer shapefile is created, rather than a directory
825 // (see http://www.gdal.org/ogr/drv_shapefile.html)
827 }
828
829 else if (m_strVectorGISOutFormat == "geojson") {
831 }
832
833 else if (m_strVectorGISOutFormat == "gpkg") {
835 }
836
837 // TODO 033 Others
838
839 return true;
840}
841
842//===============================================================================================================================
844//===============================================================================================================================
846 // Increment file number
847 m_nGISSave++;
848
849 // Set for next save
850 if (m_bSaveRegular) {
852 }
853
854 else {
855 if (m_nThisSave < m_nUSave - 1) {
856 // Still have user-defined save times remaining
857 m_nThisSave++;
858 }
859
860 else {
861 // Finished user-defined times, switch to regular interval using last value as interval
862 double dLastInterval;
863
864 if (m_nUSave > 1)
865 dLastInterval = m_dUSaveTime[m_nUSave - 1] - m_dUSaveTime[m_nUSave - 2];
866
867 else
868 dLastInterval = m_dUSaveTime[m_nUSave - 1];
869
870 m_dRegularSaveTime = m_dSimElapsed + dLastInterval;
871 m_dRegularSaveInterval = dLastInterval;
872 m_bSaveRegular = true;
873 }
874 }
875
878 return false;
879
880 if (m_bTopSurfSave)
882 return false;
883
886 return false;
887
888 if (m_bSlopeSave)
890 return false;
891
892 if (m_bCliffSave)
894 return false;
895
896 if (m_bSeaDepthSave)
898 return false;
899
902 return false;
903
906 return false;
907
908 // Don't write platform erosion files if there is no platform erosion
912 return false;
913
916 return false;
917
920 return false;
921
924 return false;
925
928 return false;
929
932 return false;
933
936 return false;
937
940 return false;
941
944 return false;
945
948 return false;
949
952 return false;
953
956 return false;
957 }
958
959 if (m_bLandformSave)
961 return false;
962
965 return false;
966
969 return false;
970
973 return false;
974
977 return false;
978
979 // Don't write suspended sediment files if there is no fine sediment
981 if (m_bSuspSedSave)
983 return false;
984
987 return false;
988 }
989
992 return false;
993
994 for (int nLayer = 0; nLayer < m_nLayers; nLayer++) {
997 return false;
998 }
999
1002 return false;
1003 }
1004
1007 return false;
1008 }
1009
1012 return false;
1013 }
1014
1017 return false;
1018 }
1019
1022 return false;
1023 }
1024 }
1025
1026 if (m_bSliceSave) {
1027 for (int i = 0; i < static_cast<int>(m_VdSliceElev.size()); i++) {
1029 return false;
1030 }
1031 }
1032
1035 return false;
1036 }
1037
1040 return false;
1041 }
1042
1043 if (m_bActiveZoneSave) {
1045 return false;
1046 }
1047
1048 // Don't write cliff collapse files if we aren't considering cliff collapse
1049 if (m_bDoCliffCollapse) {
1051 if (m_bHaveFineSediment) {
1053 return false;
1054 }
1055
1056 if (m_bHaveSandSediment) {
1058 return false;
1059 }
1060
1063 return false;
1064 }
1065 }
1066
1068 if (m_bHaveFineSediment) {
1070 return false;
1071 }
1072
1073 if (m_bHaveSandSediment) {
1075 return false;
1076 }
1077
1080 return false;
1081 }
1082 }
1083
1085 if (m_bHaveSandSediment) {
1087 return false;
1088 }
1089
1092 return false;
1093 }
1094 }
1095
1097 if (m_bHaveSandSediment) {
1099 return false;
1100 }
1101
1104 return false;
1105 }
1106 }
1107 }
1108
1111 return false;
1112 }
1113
1114 if (m_bSeaMaskSave) {
1116 return false;
1117 }
1118
1119 if (m_bBeachMaskSave) {
1121 return false;
1122 }
1123
1126 return false;
1127 }
1128
1131 return false;
1132 }
1133
1136 return false;
1137
1139 return false;
1140 }
1141
1144 return false;
1145 }
1146
1149 return false;
1150 }
1151
1154 return false;
1155 }
1156
1159 return false;
1160 }
1161
1164 return false;
1165 }
1166
1169 return false;
1170 }
1171
1174 return false;
1175 }
1176
1177 return true;
1178}
1179
1180//===============================================================================================================================
1182//===============================================================================================================================
1184 // Always written
1185 if (m_bCoastSave) {
1187 return false;
1188 }
1189
1190 if (m_bCliffEdgeSave) {
1192 return false;
1193 }
1194
1195 if (m_bNormalsSave) {
1197 return false;
1198 }
1199
1202 return false;
1203 }
1204
1207 return false;
1208 }
1209
1212 return false;
1213 }
1214
1217 return false;
1218 }
1219
1222 return false;
1223 }
1224
1227 return false;
1228 }
1229
1232 return false;
1233 }
1234
1235 if (m_bPolygonNodeSave) {
1237 return false;
1238 }
1239
1242 return false;
1243 }
1244
1245 if (m_bCliffNotchSave) {
1247 return false;
1248 }
1249
1252 return false;
1253 }
1254
1257 return false;
1258 }
1259
1262 return false;
1263 }
1264
1265 if (m_bWaveSetupSave) {
1267 return false;
1268 }
1269
1270 if (m_bStormSurgeSave) {
1272 return false;
1273 }
1274
1275 if (m_bRunUpSave) {
1277 return false;
1278 }
1279
1282 return false;
1283
1284 // if (! bWriteVectorGISFile(VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE, &VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE_TITLE))
1285 // return false;
1286
1287 // if (! bWriteVectorGISFile(VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE, &VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE_TITLE))
1288 // return false;
1289 }
1290
1291 return true;
1292}
1293
1294//===============================================================================================================================
1296//===============================================================================================================================
1297void CSimulation::GetRasterOutputMinMax(int const nDataItem, double &dMin, double &dMax, int const nLayer, double const dElev) {
1298 // If this is a binary mask layer, we already know the max and min values
1300 (nDataItem == RASTER_PLOT_INUNDATION_MASK) ||
1301 (nDataItem == RASTER_PLOT_BEACH_MASK) ||
1302 (nDataItem == RASTER_PLOT_COAST) ||
1303 (nDataItem == RASTER_PLOT_NORMAL_PROFILE) ||
1304 (nDataItem == RASTER_PLOT_ACTIVE_ZONE) ||
1306 (nDataItem == RASTER_PLOT_SETUP_SURGE_FLOOD_MASK) ||
1308 (nDataItem == RASTER_PLOT_WAVE_FLOOD_LINE)) {
1309 dMin = 0;
1310 dMax = 1;
1311
1312 return;
1313 }
1314
1315 // Not a binary mask layer, so we must find the max and min values
1316 dMin = DBL_MAX;
1317 dMax = DBL_MIN;
1318
1319 double dTmp = 0;
1320
1321 for (int nY = 0; nY < m_nYGridSize; nY++) {
1322 for (int nX = 0; nX < m_nXGridSize; nX++) {
1323 switch (nDataItem) {
1324 case (RASTER_PLOT_SLICE):
1325 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetLayerAtElev(dElev);
1326 break;
1327
1328 case (RASTER_PLOT_LANDFORM):
1329 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFCategory();
1330 break;
1331
1333 dTmp = INT_NODATA;
1334
1335 if (bIsInterventionCell(nX, nY))
1336 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFSubCategory();
1337
1338 break;
1339
1341 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetInterventionHeight();
1342 break;
1343
1344 case (RASTER_PLOT_POLYGON):
1345 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1346 break;
1347
1349 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBasementElev();
1350 break;
1351
1353 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSedimentTopElev();
1354 break;
1355
1357 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetOverallTopElev();
1358 break;
1359
1361 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetLocalConsSlope();
1362 break;
1363
1364 case (RASTER_PLOT_SEA_DEPTH):
1365 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSeaDepth();
1366 break;
1367
1369 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSeaDepth() / static_cast<double>(m_ulIter);
1370 break;
1371
1373 if (!m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea())
1374 dTmp = m_dMissingValue;
1375
1376 else
1377 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1378
1379 break;
1380
1382 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveHeight() / static_cast<double>(m_ulIter);
1383 break;
1384
1386 if (!m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea())
1387 dTmp = m_dMissingValue;
1388
1389 else
1390 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1391
1392 break;
1393
1395 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveAngle() / static_cast<double>(m_ulIter);
1396 break;
1397
1399 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBeachProtectionFactor();
1400
1401 if (!bFPIsEqual(dTmp, DBL_NODATA, TOLERANCE))
1402 dTmp = 1 - dTmp; // Output the inverse, seems more intuitive
1403
1404 break;
1405
1407 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetPotentialPlatformErosion();
1408 break;
1409
1411 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetActualPlatformErosion();
1412 break;
1413
1415 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotPotentialPlatformErosion();
1416 break;
1417
1419 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotActualPlatformErosion();
1420 break;
1421
1423 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetPotentialBeachErosion();
1424 break;
1425
1427 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetActualBeachErosion();
1428 break;
1429
1431 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotPotentialBeachErosion();
1432 break;
1433
1435 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotActualBeachErosion();
1436 break;
1437
1439 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBeachDeposition();
1440 break;
1441
1443 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotBeachDeposition();
1444 break;
1445
1447 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
1448 break;
1449
1451 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSuspendedSediment() / static_cast<double>(m_ulIter);
1452 break;
1453
1455 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetFineDepth();
1456 break;
1457
1459 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetSandDepth();
1460 break;
1461
1463 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetCoarseDepth();
1464 break;
1465
1467 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetFineDepth();
1468 break;
1469
1471 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetSandDepth();
1472 break;
1473
1475 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetCoarseDepth();
1476 break;
1477
1479 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionFine();
1480 break;
1481
1483 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionSand();
1484 break;
1485
1487 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionCoarse();
1488 break;
1489
1491 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseFine();
1492 break;
1493
1495 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseSand();
1496 break;
1497
1499 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseCoarse();
1500 break;
1501
1503 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseSandTalusDeposition();
1504 break;
1505
1507 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseCoarseTalusDeposition();
1508 break;
1509
1511 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSandTalusDeposition();
1512 break;
1513
1515 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCoarseTalusDeposition();
1516 break;
1517
1519 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetShadowZoneNumber();
1520 break;
1521
1523 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1524 break;
1525
1527 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1528 break;
1529
1531 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1532 break;
1533
1535 int nPoly = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1536
1537 if (nPoly == INT_NODATA)
1538 dTmp = m_dMissingValue;
1539
1540 else
1541 dTmp = m_pVCoastPolygon[nPoly]->dGetBeachDepositionAndSuspensionAllUncons();
1542
1543 break;
1544 }
1545
1546 if (!bFPIsEqual(dTmp, DBL_NODATA, TOLERANCE)) {
1547 if (dTmp > dMax)
1548 dMax = dTmp;
1549
1550 if (dTmp < dMin)
1551 dMin = dTmp;
1552 }
1553 }
1554 }
1555}
1556
1557//===============================================================================================================================
1559//===============================================================================================================================
1561 string strDriver = strToLower(&m_strRasterGISOutFormat);
1562 string strComment = "Created by " + PROGRAM_NAME + " for " + PLATFORM + " " + strGetBuild() + " running on " + strGetComputerName();
1563
1564 // TODO 034 Do these for all commonly-used file types
1565 if (strDriver == "aaigrid") {
1566 }
1567
1568 else if (strDriver == "bmp") {
1569 }
1570
1571 else if (strDriver == "gtiff") {
1572 if (m_bWorldFile)
1573 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "TFW", "YES");
1574
1575 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NUM_THREADS", "ALL_CPUS");
1576 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMPRESS", "LZW");
1577 }
1578
1579 else if (strDriver == "hfa") {
1580 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NBITS", "4");
1581 }
1582
1583 else if (strDriver == "jpeg") {
1584 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1585 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "QUALITY", "95");
1586 }
1587
1588 else if (strDriver == "png") {
1589 if (m_bWorldFile)
1590 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "WORLDFILE", "YES");
1591
1592 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "TITLE", "This is the title");
1593 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "DESCRIPTION", "This is a description");
1594 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COPYRIGHT", "This is some copyright statement");
1595 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1596 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NBITS", "4");
1597 }
1598
1599 else if (strDriver == "rst") {
1600 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1601 }
1602
1603 else if (strDriver == "geojson") {
1604 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1605 }
1606
1607 else if (strDriver == "gpkg") {
1608 // TODO 065 Does GDAL support overwriting raster gpkg files yet?
1609 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "OVERWRITE", "YES");
1610 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "USE_TILE_EXTENT", "YES");
1611 }
1612
1613 else if (strDriver == "netcdf") {
1614 }
1615}
1616
1617//===============================================================================================================================
1619//===============================================================================================================================
1620int CSimulation::nGetOppositeDirection(int const nDirection) {
1621 switch (nDirection) {
1622 case NORTH:
1623 return SOUTH;
1624
1625 case NORTH_EAST:
1626 return SOUTH - WEST;
1627
1628 case EAST:
1629 return WEST;
1630
1631 case SOUTH_EAST:
1632 return NORTH - WEST;
1633
1634 case SOUTH:
1635 return NORTH;
1636
1637 case SOUTH_WEST:
1638 return NORTH - EAST;
1639
1640 case WEST:
1641 return EAST;
1642
1643 case NORTH_WEST:
1644 return SOUTH - EAST;
1645 }
1646
1647 // Should never get here
1648 return NO_DIRECTION;
1649}
1650
1651// //===============================================================================================================================
1652// //! Given two integer points, calculates the slope and intercept of the line passing through the points
1653// //===============================================================================================================================
1654// void CSimulation::GetSlopeAndInterceptFromPoints(CGeom2DIPoint const* pPti1, CGeom2DIPoint const* pPti2, double& dSlope, double& dIntercept)
1655// {
1656// int
1657// nX1 = pPti1->nGetX(),
1658// nY1 = pPti1->nGetY(),
1659// nX2 = pPti2->nGetX(),
1660// nY2 = pPti2->nGetY();
1661//
1662// double
1663// dXDiff = nX1 - nX2,
1664// dYDiff = nY1 - nY2;
1665//
1666// if (bFPIsEqual(dXDiff, 0.0, TOLERANCE))
1667// dSlope = 0;
1668// else
1669// dSlope = dYDiff / dXDiff;
1670//
1671// dIntercept = nY1 - (dSlope * nX1);
1672// }
1673
1674//===============================================================================================================================
1676//===============================================================================================================================
1678 unsigned int nMinSqDist = UINT_MAX;
1679 CGeom2DIPoint PtiCoastPoint;
1680
1681 // Do for every coast
1682 for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++) {
1683 for (int j = 0; j < m_VCoast[nCoast].nGetCoastlineSize(); j++) {
1684 // Get the coords of the grid cell marked as coastline for the coastal landform object
1685 int
1686 nXCoast = m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(j)->nGetX(),
1687 nYCoast = m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(j)->nGetY();
1688
1689 // Calculate the squared distance between this point and the given point
1690 int
1691 nXDist = nX - nXCoast,
1692 nYDist = nY - nYCoast;
1693
1694 unsigned int nSqDist = (nXDist * nXDist) + (nYDist * nYDist);
1695
1696 // Is this the closest so dar?
1697 if (nSqDist < nMinSqDist) {
1698 nMinSqDist = nSqDist;
1699 PtiCoastPoint.SetXY(nXCoast, nYCoast);
1700 }
1701 }
1702 }
1703
1704 return PtiCoastPoint;
1705}
1706
1707//===============================================================================================================================
1709//===============================================================================================================================
1710int CSimulation::nConvertMetresToNumCells(double const dLen) const {
1711 return nRound(dLen / m_dCellSide);
1712}
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:221
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:106
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:248
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:91
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:88
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:194
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:266
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:462
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:518
static string strGetComputerName(void)
Returns a string, hopefully giving the name of the computer on which the simulation is running.
Definition utils.cpp:1359
long m_lGDALMaxCanWrite
Definition simulation.h:611
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:124
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:118
bool m_bCliffEdgeSave
Save cliff edge vector GIS files?
Definition simulation.h:269
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:275
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:290
vector< CGeomCoastPolygon * > m_pVCoastPolygon
bool m_bActualBeachErosionSave
Definition simulation.h:159
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:465
bool m_bRunUpSave
Are we saving runup? TODO 007.
Definition simulation.h:421
GDALDataType m_GDALWriteIntDataType
Definition simulation.h:603
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:227
bool m_bTotalActualPlatformErosionSave
Definition simulation.h:152
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:257
double m_dGeoTransform[6]
Definition simulation.h:731
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
Used by CoastalME for floating-point missing values.
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:85
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:200
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:236
void KeepWithinValidGrid(int &, int &) const
Constrains the supplied point (in the grid CRS) to be a valid cell within the raster grid.
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:109
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:370
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:176
static string strTrim(string const *)
Trims whitespace from both sides of a string, does not change the original string.
Definition utils.cpp:2363
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:173
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:197
bool m_bTotCliffCollapseSave
Save total cliff collapse raster GIS files?
Definition simulation.h:224
bool m_bCliffSave
Save cliff region raster grids?
Definition simulation.h:97
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:361
bool m_bSliceSave
Save slices?
Definition simulation.h:100
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
Definition simulation.h:233
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:170
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:263
int m_nLayers
The number of sediment layers.
Definition simulation.h:468
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:394
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:272
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:112
static string strToLower(string const *)
Returns the lower case version of an string, leaving the original unchanged.
Definition utils.cpp:2388
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:79
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:515
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:103
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:121
bool m_bWorldFile
Write a GIS World file?
Definition simulation.h:384
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:215
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:218
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:70
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:251
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:133
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:710
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:278
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),...
Definition gis_utils.cpp:97
bool m_bGDALCanWriteInt32
Definition simulation.h:378
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:136
double m_dRegularSaveTime
Definition simulation.h:714
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:281
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:148
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:424
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:130
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:155
bool m_bSuspSedSave
Save suspended sediment raster GIS files?
Definition simulation.h:188
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:284
bool m_bStormSurgeSave
Are we saving the storm surge? TODO 007.
Definition simulation.h:418
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:145
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:76
static string strGetBuild(void)
Returns the date and time on which the program was compiled.
Definition utils.cpp:1633
bool m_bTotalPotentialBeachErosionSave
Definition simulation.h:163
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:512
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:239
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:182
CGeom2DIPoint PtiFindClosestCoastPoint(int const, int const)
Finds the closest point on any coastline to a given point.
bool m_bTotalActualBeachErosionSave
Definition simulation.h:167
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:212
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:185
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:412
long m_lGDALMinCanWrite
Definition simulation.h:615
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:206
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:406
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:82
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:717
bool m_bPolygonUnconsSedGainOrLossSave
Save polygon unconsolidated sediment gain or loss raster GIS files?
Definition simulation.h:260
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:127
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:139
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:203
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:293
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:254
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:89
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:209
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:78
string m_strGDALRasterOutputDriverExtension
GDAL raster output driver file extension.
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:242
bool m_bSlopeSave
Save slope raster grids?
Definition simulation.h:94
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:618
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:191
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:689
bool bIsInterventionCell(int const, int const) const
Returns true if the cell is an intervention.
Definition utils.cpp:2918
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:230
double m_dUSaveTime[SAVEMAX]
Definition simulation.h:721
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:364
bool m_bSetupSurgeRunupFloodMaskSave
Are we saving the setup surge runup flood mask? TODO 007.
Definition simulation.h:427
bool m_bWaveSetupSave
Are we saving the wave setup? TODO 007.
Definition simulation.h:415
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:245
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:142
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
Definition simulation.h:607
bool m_bGDALCanWriteFloat
Definition simulation.h:374
char ** m_papszGDALRasterOptions
Options for GDAL when handling raster files.
Definition simulation.h:456
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:287
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:433
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:115
bool m_bLocalSlopeSave
Save local slope raster GIS files?
Definition simulation.h:179
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:474
int const RASTER_PLOT_POLYGON
Definition cme.h:633
string const RASTER_PLOT_POLYGON_UPDRIFT_OR_DOWNDRIFT_TITLE
Definition cme.h:1090
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_COARSE_TITLE
Definition cme.h:1070
string const VECTOR_PLOT_BREAKING_WAVE_HEIGHT_TITLE
Definition cme.h:1172
string const RASTER_PLOT_CLIFF_TITLE
Definition cme.h:1085
T tMin(T a, T b)
Definition cme.h:1251
string const VECTOR_PLOT_INVALID_NORMALS_TITLE
Definition cme.h:1179
double const TOLERANCE
Definition cme.h:811
string const VECTOR_PLOT_NORMALS_TITLE
Definition cme.h:1181
int const VECTOR_PLOT_STORM_SURGE
Definition cme.h:684
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_SAND_TITLE
Definition cme.h:1069
string const RASTER_PLOT_COAST_TITLE
Definition cme.h:1073
string const RASTER_PLOT_POLYGON_TITLE
Definition cme.h:1089
int const VECTOR_PLOT_BREAKING_WAVE_HEIGHT
Definition cme.h:668
int const VECTOR_PLOT_POLYGON_NODES
Definition cme.h:679
int const RASTER_PLOT_LOCAL_SLOPE_OF_CONSOLIDATED_SEDIMENT
Definition cme.h:630
int const RASTER_PLOT_TOTAL_ACTUAL_BEACH_EROSION
Definition cme.h:646
string const RASTER_PLOT_BEACH_DEPOSITION_TITLE
Definition cme.h:1063
int const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_SAND
Definition cme.h:616
int const RASTER_PLOT_BEACH_DEPOSITION
Definition cme.h:610
int const RASTER_PLOT_SUSPENDED_SEDIMENT
Definition cme.h:645
int const VECTOR_PLOT_NORMALS
Definition cme.h:677
string const RASTER_PLOT_DEEP_WATER_WAVE_ORIENTATION_TITLE
Definition cme.h:1075
string const VECTOR_PLOT_CLIFF_NOTCH_SIZE_TITLE
Definition cme.h:1173
string const RASTER_PLOT_FINE_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1077
int const RASTER_PLOT_FINE_UNCONSOLIDATED_SEDIMENT
Definition cme.h:625
string const RASTER_PLOT_AVG_SEA_DEPTH_TITLE
Definition cme.h:1058
string const VECTOR_PLOT_DOWNDRIFT_BOUNDARY_TITLE
Definition cme.h:1178
string const ERR
Definition cme.h:890
string const RASTER_PLOT_BEACH_MASK_TITLE
Definition cme.h:1064
int const RASTER_PLOT_INUNDATION_MASK
Definition cme.h:628
string const RASTER_PLOT_AVG_WAVE_ORIENTATION_TITLE
Definition cme.h:1061
string const RASTER_PLOT_SETUP_SURGE_FLOOD_MASK_TITLE
Definition cme.h:1115
int const RASTER_PLOT_SEDIMENT_TOP_ELEVATION_ELEV
Definition cme.h:641
string const RASTER_PLOT_ACTUAL_BEACH_EROSION_TITLE
Definition cme.h:1056
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_FINE_TITLE
Definition cme.h:1106
int const RASTER_PLOT_ACTUAL_BEACH_EROSION
Definition cme.h:603
string const RASTER_PLOT_POLYGON_GAIN_OR_LOSS_TITLE
Definition cme.h:1088
string const VECTOR_PLOT_MEAN_WAVE_ENERGY_TITLE
Definition cme.h:1180
string const RASTER_PLOT_DEEP_WATER_WAVE_HEIGHT_TITLE
Definition cme.h:1074
string const RASTER_PLOT_WAVE_ORIENTATION_TITLE
Definition cme.h:1112
string const RASTER_PLOT_BASEMENT_ELEVATION_TITLE
Definition cme.h:1062
string const RASTER_PLOT_INTERVENTION_CLASS_TITLE
Definition cme.h:1079
string const RASTER_PLOT_COARSE_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1072
string const VECTOR_PLOT_POLYGON_NODES_TITLE
Definition cme.h:1183
string const VECTOR_PLOT_RUN_UP_TITLE
Definition cme.h:1189
int const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_MASK
Definition cme.h:658
string const RASTER_PLOT_AVG_WAVE_HEIGHT_TITLE
Definition cme.h:1060
string const RASTER_PLOT_TOTAL_POTENTIAL_PLATFORM_EROSION_TITLE
Definition cme.h:1110
int const RASTER_PLOT_SAND_CONSOLIDATED_SEDIMENT
Definition cme.h:638
int const RASTER_PLOT_AVG_WAVE_HEIGHT
Definition cme.h:607
string const VECTOR_PLOT_CLIFF_EDGE_TITLE
Definition cme.h:1176
int const SOUTH_EAST
Definition cme.h:498
int const RASTER_PLOT_FINE_CONSOLIDATED_SEDIMENT
Definition cme.h:624
int const VECTOR_PLOT_DOWNDRIFT_BOUNDARY
Definition cme.h:674
int const RASTER_PLOT_ACTIVE_ZONE
Definition cme.h:602
int const VECTOR_PLOT_COAST_CURVATURE
Definition cme.h:671
string const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_COARSE_TITLE
Definition cme.h:1067
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_SAND_TITLE
Definition cme.h:1107
string const VECTOR_PLOT_WAVE_SETUP_TITLE
Definition cme.h:1187
string const RASTER_PLOT_LANDFORM_TITLE
Definition cme.h:1082
int const RASTER_PLOT_DEEP_WATER_WAVE_PERIOD
Definition cme.h:623
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_SAND
Definition cme.h:652
string const RASTER_PLOT_WAVE_HEIGHT_TITLE
Definition cme.h:1111
int const RASTER_PLOT_COAST
Definition cme.h:620
string const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1171
string const RASTER_PLOT_TOTAL_POTENTIAL_BEACH_EROSION_TITLE
Definition cme.h:1109
string const VECTOR_PLOT_COAST_CURVATURE_TITLE
Definition cme.h:1174
string const RASTER_PLOT_POTENTIAL_BEACH_EROSION_TITLE
Definition cme.h:1091
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1284
int const VECTOR_PLOT_RUN_UP
Definition cme.h:685
int const RASTER_PLOT_POLYGON_UPDRIFT_OR_DOWNDRIFT
Definition cme.h:635
int const VECTOR_PLOT_INVALID_NORMALS
Definition cme.h:675
string const RASTER_PLOT_SETUP_SURGE_RUNUP_FLOOD_MASK_TITLE
Definition cme.h:1116
int const RASTER_PLOT_POLYGON_GAIN_OR_LOSS
Definition cme.h:634
string const RASTER_PLOT_SAND_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1093
int const RASTER_PLOT_DEEP_WATER_WAVE_ORIENTATION
Definition cme.h:622
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_COARSE
Definition cme.h:651
int const RASTER_PLOT_SLOPE
Definition cme.h:663
string const RASTER_PLOT_ACTUAL_PLATFORM_EROSION_TITLE
Definition cme.h:1057
int const RASTER_PLOT_COARSE_UNCONSOLIDATED_SEDIMENT
Definition cme.h:619
int const RASTER_PLOT_AVG_WAVE_ORIENTATION
Definition cme.h:608
string const RASTER_PLOT_TOTAL_BEACH_DEPOSITION_TITLE
Definition cme.h:1103
int const RASTER_PLOT_WAVE_ORIENTATION
Definition cme.h:657
int const SOUTH_WEST
Definition cme.h:500
string const RASTER_PLOT_SLOPE_TITLE
Definition cme.h:1084
int const RASTER_PLOT_BEACH_MASK
Definition cme.h:611
int const RASTER_PLOT_WAVE_FLOOD_LINE
Definition cme.h:662
T tMax(T a, T b)
Definition cme.h:1240
int const RASTER_PLOT_SEDIMENT_INPUT
Definition cme.h:659
int const RASTER_PLOT_POTENTIAL_BEACH_EROSION
Definition cme.h:636
int const NORTH_WEST
Definition cme.h:502
string const RASTER_PLOT_SEDIMENT_TOP_ELEVATION_ELEV_TITLE
Definition cme.h:1096
int const RASTER_PLOT_AVG_SUSPENDED_SEDIMENT
Definition cme.h:606
int const VECTOR_PLOT_COAST
Definition cme.h:670
int const VECTOR_PLOT_FLOOD_LINE
Definition cme.h:686
string const RASTER_PLOT_BEACH_PROTECTION_TITLE
Definition cme.h:1065
int const RASTER_PLOT_TOTAL_POTENTIAL_PLATFORM_EROSION
Definition cme.h:655
string const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_MASK_TITLE
Definition cme.h:1113
string const VECTOR_PLOT_COAST_TITLE
Definition cme.h:1175
int const VECTOR_PLOT_CLIFF_NOTCH_SIZE
Definition cme.h:669
string const PROGRAM_NAME
Definition cme.h:824
int const RASTER_PLOT_INTERVENTION_CLASS
Definition cme.h:626
int const RASTER_PLOT_CLIFF
Definition cme.h:664
string const VECTOR_PLOT_FLOOD_SWL_SETUP_LINE_TITLE
Definition cme.h:1191
int const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE
Definition cme.h:682
int const RASTER_PLOT_BEACH_PROTECTION
Definition cme.h:612
int const RASTER_PLOT_AVG_SEA_DEPTH
Definition cme.h:605
int const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:681
int const RASTER_PLOT_OVERALL_TOP_ELEVATION
Definition cme.h:632
string const RASTER_PLOT_SHADOW_ZONE_TITLE
Definition cme.h:1098
int const RASTER_PLOT_TOTAL_BEACH_DEPOSITION
Definition cme.h:648
string const VECTOR_PLOT_SHADOW_BOUNDARY_TITLE
Definition cme.h:1184
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_FINE
Definition cme.h:649
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_SAND
Definition cme.h:650
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_FINE
Definition cme.h:613
int const SOUTH
Definition cme.h:499
int const NO_DIRECTION
Definition cme.h:494
int const VECTOR_PLOT_CLIFF_EDGE
Definition cme.h:672
string const RASTER_PLOT_AVG_SUSPENDED_SEDIMENT_TITLE
Definition cme.h:1059
int const RASTER_PLOT_ACTUAL_PLATFORM_EROSION
Definition cme.h:604
int const VECTOR_PLOT_POLYGON_BOUNDARY
Definition cme.h:678
string const RASTER_PLOT_INTERVENTION_HEIGHT_TITLE
Definition cme.h:1080
int const VECTOR_PLOT_MEAN_WAVE_ENERGY
Definition cme.h:676
int const EAST
Definition cme.h:497
string const VECTOR_PLOT_POLYGON_BOUNDARY_TITLE
Definition cme.h:1182
string const RASTER_PLOT_SEA_DEPTH_TITLE
Definition cme.h:1095
string const RASTER_PLOT_TOTAL_ACTUAL_PLATFORM_EROSION_TITLE
Definition cme.h:1102
string const RASTER_PLOT_SEDIMENT_INPUT_EVENT_TITLE
Definition cme.h:1114
int const RASTER_PLOT_INTERVENTION_HEIGHT
Definition cme.h:627
int const RASTER_PLOT_TOTAL_POTENTIAL_BEACH_EROSION
Definition cme.h:654
int const NORTH_EAST
Definition cme.h:496
int const RASTER_PLOT_SAND_UNCONSOLIDATED_SEDIMENT
Definition cme.h:639
string const RASTER_PLOT_FINE_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1078
string const RASTER_PLOT_NORMAL_PROFILE_TITLE
Definition cme.h:1086
string const RASTER_PLOT_DEEP_WATER_WAVE_PERIOD_TITLE
Definition cme.h:1076
int const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION
Definition cme.h:637
string const RASTER_PLOT_INUNDATION_MASK_TITLE
Definition cme.h:1081
string const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_TITLE
Definition cme.h:1092
int const RASTER_PLOT_NORMAL_PROFILE
Definition cme.h:631
double const DBL_NODATA
Definition cme.h:822
int const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_COARSE
Definition cme.h:617
int const RASTER_PLOT_WAVE_HEIGHT
Definition cme.h:656
int const RASTER_PLOT_SHADOW_ZONE
Definition cme.h:643
int const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:667
int const RASTER_PLOT_DEEP_WATER_WAVE_HEIGHT
Definition cme.h:621
string const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_SAND_TITLE
Definition cme.h:1066
int const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:673
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_COARSE_TITLE
Definition cme.h:1108
string const RASTER_PLOT_SHADOW_DOWNDRIFT_ZONE_TITLE
Definition cme.h:1097
int const RASTER_PLOT_COARSE_CONSOLIDATED_SEDIMENT
Definition cme.h:618
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_SAND_TITLE
Definition cme.h:1104
int const RASTER_PLOT_TOTAL_ACTUAL_PLATFORM_EROSION
Definition cme.h:647
int const VECTOR_PLOT_WAVE_SETUP
Definition cme.h:683
int const RASTER_PLOT_SETUP_SURGE_RUNUP_FLOOD_MASK
Definition cme.h:661
int const RASTER_PLOT_BASEMENT_ELEVATION
Definition cme.h:609
string const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE_TITLE
Definition cme.h:1186
int const RASTER_PLOT_LANDFORM
Definition cme.h:629
string const RASTER_PLOT_SUSPENDED_SEDIMENT_TITLE
Definition cme.h:1100
int const RIGHT_HANDED
Definition cme.h:509
string const VECTOR_PLOT_STORM_SURGE_TITLE
Definition cme.h:1188
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_FINE_TITLE
Definition cme.h:1068
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_COARSE
Definition cme.h:615
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_COARSE_TITLE
Definition cme.h:1105
int const RASTER_PLOT_SHADOW_DOWNDRIFT_ZONE
Definition cme.h:642
string const RASTER_PLOT_SAND_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1094
int const RASTER_PLOT_SLICE
Definition cme.h:644
string const RASTER_PLOT_OVERALL_TOP_ELEVATION_TITLE
Definition cme.h:1087
string const RASTER_PLOT_ACTIVE_ZONE_TITLE
Definition cme.h:1055
int const VECTOR_PLOT_SHADOW_BOUNDARY
Definition cme.h:680
string const RASTER_PLOT_LOCAL_SLOPE_OF_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1083
string const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1185
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_COARSE
Definition cme.h:653
string const RASTER_PLOT_TOTAL_ACTUAL_BEACH_EROSION_TITLE
Definition cme.h:1101
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_SAND
Definition cme.h:614
string const RASTER_PLOT_SLICE_TITLE
Definition cme.h:1099
int const RASTER_PLOT_SEA_DEPTH
Definition cme.h:640
int const NORTH
Definition cme.h:495
string const RASTER_PLOT_COARSE_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1071
string const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1177
int const RASTER_PLOT_SETUP_SURGE_FLOOD_MASK
Definition cme.h:660
int const WEST
Definition cme.h:501
char const SPACE
Definition cme.h:451
Contains CRWCoast definitions.
Contains CGeomRasterGrid definitions.
Contains CSimulation definitions.
int nRound(double const d)
Version of the above that returns an int.