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 tMax(((dExtCRSX - m_dGeoTransform[0]) / m_dGeoTransform[1]) - 1, 0.0);
114}
115
116//===============================================================================================================================
118//===============================================================================================================================
119double CSimulation::dExtCRSYToGridY(double const dExtCRSY) const
120{
121 // TODO 064
122 return tMax(((dExtCRSY - m_dGeoTransform[3]) / m_dGeoTransform[5]) - 1, 0.0);
123}
124
125//===============================================================================================================================
127//===============================================================================================================================
129{
130 // TODO 064
131 int nX = tMax(nRound(((pPtIn->dGetX() - m_dGeoTransform[0]) / m_dGeoTransform[1]) - 1), 0);
132 int nY = tMax(nRound(((pPtIn->dGetY() - m_dGeoTransform[3]) / m_dGeoTransform[5]) - 1), 0);
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) || (nY < 0) || (nY >= m_nYGridSize) || m_pRasterGrid->m_Cell[nX][nY].bBasementElevIsMissingValue())
173 return false;
174
175 return true;
176}
177
178//===============================================================================================================================
180//===============================================================================================================================
182{
183 int nX = Pti->nGetX();
184
185 if ((nX < 0) || (nX >= m_nXGridSize))
186 return false;
187
188 int nY = Pti->nGetY();
189
190 if ((nY < 0) || (nY >= m_nYGridSize))
191 return false;
192
193 if (m_pRasterGrid->m_Cell[nX][nY].bBasementElevIsMissingValue())
194 return false;
195
196 return true;
197}
198
199//===============================================================================================================================
201//===============================================================================================================================
203{
204 KeepWithinValidGrid(Pti0->nGetX(), Pti0->nGetY(), *Pti1->pnGetX(), *Pti1->pnGetY());
205}
206
207//===============================================================================================================================
209//===============================================================================================================================
210void CSimulation::KeepWithinValidGrid(int nX0, int nY0, int &nX1, int &nY1) const
211{
212 // Safety check: make sure that the first point is within the valid grid
213 if (nX0 >= m_nXGridSize)
214 nX0 = m_nXGridSize - 1;
215 else if (nX0 < 0)
216 nX0 = 0;
217
218 if (nY0 >= m_nYGridSize)
219 nY0 = m_nYGridSize - 1;
220 else if (nY0 < 0)
221 nY0 = 0;
222
223 // OK let's go
224 int nDiffX = nX0 - nX1;
225 int nDiffY = nY0 - nY1;
226
227 if (nDiffX == 0)
228 {
229 // The two points have the same x coordinates, so we just need to constrain the y co-ord
230 if (nY1 < nY0)
231 {
232 nY1 = -1;
233
234 do
235 {
236 nY1++;
237 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
238
239 return;
240 }
241 else
242 {
243 nY1 = m_nYGridSize;
244
245 do
246 {
247 nY1--;
248 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
249
250 return;
251 }
252 }
253 else if (nDiffY == 0)
254 {
255 // The two points have the same y coordinates, so we just need to constrain the x co-ord
256 if (nX1 < nX0)
257 {
258 nX1 = -1;
259
260 do
261 {
262 nX1++;
263 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
264
265 return;
266 }
267 else
268 {
269 nX1 = m_nXGridSize;
270
271 do
272 {
273 nX1--;
274 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
275
276 return;
277 }
278 }
279 else
280 {
281 // 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
282 int nXDistanceOutside = 0;
283 int nYDistanceOutside = 0;
284
285 if (nX1 < 0)
286 nXDistanceOutside = -nX1;
287 else if (nX1 >= m_nXGridSize)
288 nXDistanceOutside = nX1 - m_nXGridSize + 1;
289
290 if (nY1 < 0)
291 nYDistanceOutside = -nY1;
292 else if (nY1 >= m_nYGridSize)
293 nXDistanceOutside = nY1 - m_nYGridSize + 1;
294
295 if (nXDistanceOutside >= nYDistanceOutside)
296 {
297 // Constrain the x co-ord
298 if (nX1 < nX0)
299 {
300 // The incorrect x co-ord is less than the correct x co-ord: constrain it and find the y co-ord
301 nX1 = -1;
302
303 do
304 {
305 nX1++;
306
307 nY1 = nY0 + nRound(((nX1 - nX0) * nDiffY) / static_cast<double>(nDiffX));
308 } while ((nY1 < 0) || (nY1 >= m_nYGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
309
310 return;
311 }
312
313 else
314 {
315 // The incorrect x co-ord is greater than the correct x-co-ord: constrain it and find the y co-ord
316 nX1 = m_nXGridSize;
317
318 do
319 {
320 nX1--;
321
322 nY1 = nY0 + nRound(((nX1 - nX0) * nDiffY) / static_cast<double>(nDiffX));
323 } while ((nY1 < 0) || (nY1 >= m_nYGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
324
325 return;
326 }
327 }
328 else
329 {
330 // Constrain the y co-ord
331 if (nY1 < nY0)
332 {
333 // The incorrect y co-ord is less than the correct y-co-ord: constrain it and find the x co-ord
334 nY1 = -1;
335
336 do
337 {
338 nY1++;
339
340 nX1 = nX0 + nRound(((nY1 - nY0) * nDiffX) / static_cast<double>(nDiffY));
341 } while ((nX1 < 0) || (nX1 >= m_nXGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
342
343 return;
344 }
345
346 else
347 {
348 // The incorrect y co-ord is greater than the correct y co-ord: constrain it and find the x co-ord
349 nY1 = m_nYGridSize;
350
351 do
352 {
353 nY1--;
354
355 nX1 = nX0 + nRound(((nY1 - nY0) * nDiffX) / static_cast<double>(nDiffY));
356 } while ((nX1 < 0) || (nX1 >= m_nXGridSize) || (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
357
358 return;
359 }
360 }
361 }
362}
363
364//===============================================================================================================================
366//===============================================================================================================================
367double CSimulation::dKeepWithin360(double const dAngle)
368{
369 double dNewAngle = dAngle;
370
371 // Sort out -ve angles
372 while (dNewAngle < 0)
373 dNewAngle += 360;
374
375 // Sort out angles > 360
376 while (dNewAngle > 360)
377 dNewAngle -= 360;
378
379 return dNewAngle;
380}
381
382//===============================================================================================================================
384//===============================================================================================================================
386{
387 double dPt1X = pPt1->dGetX();
388 double dPt1Y = pPt1->dGetY();
389 double dPt2X = pPt2->dGetX();
390 double dPt2Y = pPt2->dGetY();
391 double dPtAvgX = (dPt1X + dPt2X) / 2;
392 double dPtAvgY = (dPt1Y + dPt2Y) / 2;
393
394 return CGeom2DPoint(dPtAvgX, dPtAvgY);
395}
396
397// //===============================================================================================================================
398// //! Returns an integer point (grid CRS) which is the approximate average of (i.e. is midway between) two other grid CRS integer points
399// //===============================================================================================================================
400// CGeom2DIPoint CSimulation::PtiAverage(CGeom2DIPoint const* pPti1, CGeom2DIPoint const* pPti2)
401// {
402// int nPti1X = pPti1->nGetX();
403// int nPti1Y = pPti1->nGetY();
404// int nPti2X = pPti2->nGetX();
405// int nPti2Y = pPti2->nGetY();
406// int nPtiAvgX = (nPti1X + nPti2X) / 2;
407// int nPtiAvgY = (nPti1Y + nPti2Y) / 2;
408//
409// return CGeom2DIPoint(nPtiAvgX, nPtiAvgY);
410// }
411
412//===============================================================================================================================
414//===============================================================================================================================
415CGeom2DIPoint CSimulation::PtiWeightedAverage(CGeom2DIPoint const* pPti1, CGeom2DIPoint const* pPti2, double const dWeight)
416{
417 int nPti1X = pPti1->nGetX();
418 int nPti1Y = pPti1->nGetY();
419 int nPti2X = pPti2->nGetX();
420 int nPti2Y = pPti2->nGetY();
421 double dOtherWeight = 1.0 - dWeight;
422
423 int nPtiWeightAvgX = nRound((dWeight * nPti2X) + (dOtherWeight * nPti1X));
424 int nPtiWeightAvgY = nRound((dWeight * nPti2Y) + (dOtherWeight * nPti1Y));
425
426 return CGeom2DIPoint(nPtiWeightAvgX, nPtiWeightAvgY);
427}
428
429//===============================================================================================================================
431//===============================================================================================================================
432CGeom2DPoint CSimulation::PtAverage(vector<CGeom2DPoint>* pVIn)
433{
434 int nSize = static_cast<int>(pVIn->size());
435 if (nSize == 0)
437
438 double dAvgX = 0;
439 double dAvgY = 0;
440
441 for (int n = 0; n < nSize; n++)
442 {
443 dAvgX += pVIn->at(n).dGetX();
444 dAvgY += pVIn->at(n).dGetY();
445 }
446
447 dAvgX /= nSize;
448 dAvgY /= nSize;
449
450 return CGeom2DPoint(dAvgX, dAvgY);
451}
452
453// //===============================================================================================================================
454// //! Returns a point (grid CRS) which is the average of a vector of grid CRS points
455// //===============================================================================================================================
456// CGeom2DIPoint CSimulation::PtiAverage(vector<CGeom2DIPoint>* pVIn)
457// {
458// int nSize = static_cast<int>(pVIn->size());
459// if (nSize == 0)
460// return CGeom2DIPoint(INT_NODATA, INT_NODATA);
461//
462// double dAvgX = 0;
463// double dAvgY = 0;
464//
465// for (int n = 0; n < nSize; n++)
466// {
467// dAvgX += pVIn->at(n).nGetX();
468// dAvgY += pVIn->at(n).nGetY();
469// }
470//
471// dAvgX /= nSize;
472// dAvgY /= nSize;
473//
474// return CGeom2DIPoint(nRound(dAvgX), nRound(dAvgY));
475// }
476
477//===============================================================================================================================
479//===============================================================================================================================
481{
482 CGeom2DIPoint PtiCentroid(0, 0);
483 int nSize = static_cast<int>(pVIn->size());
484 int nX0 = 0; // Current vertex X
485 int nY0 = 0; // Current vertex Y
486 int nX1 = 0; // Next vertex X
487 int nY1 = 0; // Next vertex Y
488
489 double dA = 0; // Partial signed area
490 double dSignedArea = 0.0;
491
492 // For all vertices except last
493 for (int i = 0; i < nSize - 1; ++i)
494 {
495 nX0 = pVIn->at(i).nGetX();
496 nY0 = pVIn->at(i).nGetY();
497 nX1 = pVIn->at(i + 1).nGetX();
498 nY1 = pVIn->at(i + 1).nGetY();
499
500 dA = (nX0 * nY1) - (nX1 * nY0);
501 dSignedArea += dA;
502 PtiCentroid.AddXAddY((nX0 + nX1) * dA, (nY0 + nY1) * dA);
503 }
504
505 // Do last vertex separately to avoid performing an expensive modulus operation in each iteration
506 nX0 = pVIn->at(nSize - 1).nGetX();
507 nY0 = pVIn->at(nSize - 1).nGetY();
508 nX1 = pVIn->at(0).nGetX();
509 nY1 = pVIn->at(0).nGetY();
510
511 dA = (nX0 * nY1) - (nX1 * nY0);
512 dSignedArea += dA;
513 PtiCentroid.AddXAddY((nX0 + nX1) * dA, (nY0 + nY1) * dA);
514
515 dSignedArea *= 0.5;
516 PtiCentroid.DivXDivY(6.0 * dSignedArea, 6.0 * dSignedArea);
517
518 return PtiCentroid;
519}
520
521/*==============================================================================================================================
522
523Returns a vector which is perpendicular to an existing vector
524
525===============================================================================================================================*/
526// vector<CGeom2DPoint> CSimulation::VGetPerpendicular(CGeom2DPoint const* PtStart, CGeom2DPoint const* PtNext, double const dDesiredLength, int const nHandedness)
527// {
528// // Returns a two-point vector which passes through PtStart with a scaled length
529// double dXLen = PtNext->dGetX() - PtStart->dGetX();
530// double dYLen = PtNext->dGetY() - PtStart->dGetY();
531//
532// double dLength = hypot(dXLen, dYLen);
533// double dScaleFactor = dDesiredLength / dLength;
534//
535// // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
536// CGeom2DPoint EndPt;
537// if (nHandedness == RIGHT_HANDED)
538// {
539// EndPt.SetX(PtStart->dGetX() + (dScaleFactor * dYLen));
540// EndPt.SetY(PtStart->dGetY() - (dScaleFactor * dXLen));
541// }
542// else
543// {
544// EndPt.SetX(PtStart->dGetX() - (dScaleFactor * dYLen));
545// EndPt.SetY(PtStart->dGetY() + (dScaleFactor * dXLen));
546// }
547//
548// vector<CGeom2DPoint> VNew;
549// VNew.push_back(*PtStart);
550// VNew.push_back(EndPt);
551// return VNew;
552// }
553
554//===============================================================================================================================
556//===============================================================================================================================
557CGeom2DPoint CSimulation::PtGetPerpendicular(CGeom2DPoint const *PtStart, CGeom2DPoint const *PtNext, double const dDesiredLength, int const nHandedness)
558{
559 double dXLen = PtNext->dGetX() - PtStart->dGetX();
560 double dYLen = PtNext->dGetY() - PtStart->dGetY();
561 double dLength;
562
563 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
564 dLength = dYLen;
565 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
566 dLength = dXLen;
567 else
568 dLength = hypot(dXLen, dYLen);
569
570 double dScaleFactor = dDesiredLength / dLength;
571
572 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
573 CGeom2DPoint EndPt;
574 if (nHandedness == RIGHT_HANDED)
575 {
576 EndPt.SetX(PtStart->dGetX() + (dScaleFactor * dYLen));
577 EndPt.SetY(PtStart->dGetY() - (dScaleFactor * dXLen));
578 }
579 else
580 {
581 EndPt.SetX(PtStart->dGetX() - (dScaleFactor * dYLen));
582 EndPt.SetY(PtStart->dGetY() + (dScaleFactor * dXLen));
583 }
584
585 return EndPt;
586}
587
588//===============================================================================================================================
590//===============================================================================================================================
591CGeom2DIPoint CSimulation::PtiGetPerpendicular(CGeom2DIPoint const *PtiStart, CGeom2DIPoint const *PtiNext, double const dDesiredLength, int const nHandedness)
592{
593 double dXLen = PtiNext->nGetX() - PtiStart->nGetX();
594 double dYLen = PtiNext->nGetY() - PtiStart->nGetY();
595 double dLength;
596
597 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
598 dLength = dYLen;
599 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
600 dLength = dXLen;
601 else
602 dLength = hypot(dXLen, dYLen);
603
604 double dScaleFactor = dDesiredLength / dLength;
605
606 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
607 CGeom2DIPoint EndPti;
608 if (nHandedness == RIGHT_HANDED)
609 {
610 EndPti.SetX(PtiStart->nGetX() + nRound(dScaleFactor * dYLen));
611 EndPti.SetY(PtiStart->nGetY() - nRound(dScaleFactor * dXLen));
612 }
613 else
614 {
615 EndPti.SetX(PtiStart->nGetX() - nRound(dScaleFactor * dYLen));
616 EndPti.SetY(PtiStart->nGetY() + nRound(dScaleFactor * dXLen));
617 }
618
619 return EndPti;
620}
621
622//===============================================================================================================================
624//===============================================================================================================================
625CGeom2DIPoint CSimulation::PtiGetPerpendicular(int const nStartX, int const nStartY, int const nNextX, int const nNextY, double const dDesiredLength, int const nHandedness)
626{
627 double dXLen = nNextX - nStartX;
628 double dYLen = nNextY - nStartY;
629 double dLength;
630
631 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
632 dLength = dYLen;
633 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
634 dLength = dXLen;
635 else
636 dLength = hypot(dXLen, dYLen);
637
638 double dScaleFactor = dDesiredLength / dLength;
639
640 // The difference vector is (dXLen, dYLen), so the perpendicular difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
641 CGeom2DIPoint EndPti;
642 if (nHandedness == RIGHT_HANDED)
643 {
644 EndPti.SetX(nStartX + nRound(dScaleFactor * dYLen));
645 EndPti.SetY(nStartY - nRound(dScaleFactor * dXLen));
646 }
647 else
648 {
649 EndPti.SetX(nStartX - nRound(dScaleFactor * dYLen));
650 EndPti.SetY(nStartY + nRound(dScaleFactor * dXLen));
651 }
652
653 return EndPti;
654}
655
656//===============================================================================================================================
658//===============================================================================================================================
659double CSimulation::dAngleSubtended(CGeom2DIPoint const* pPtiA, CGeom2DIPoint const* pPtiB, CGeom2DIPoint const* pPtiC)
660{
661 double
662 dXDistBtoA = pPtiB->nGetX() - pPtiA->nGetX(),
663 dYDistBtoA = pPtiB->nGetY() - pPtiA->nGetY(),
664 dXDistCtoA = pPtiC->nGetX() - pPtiA->nGetX(),
665 dYDistCtoA = pPtiC->nGetY() - pPtiA->nGetY(),
666 dDotProduct = dXDistBtoA * dXDistCtoA + dYDistBtoA * dYDistCtoA,
667 dPseudoCrossProduct = dXDistBtoA * dYDistCtoA - dYDistBtoA * dXDistCtoA,
668 dAngle = atan2(dPseudoCrossProduct, dDotProduct);
669
670 return dAngle;
671}
672
673//===============================================================================================================================
675//===============================================================================================================================
677{
678 // Register all available GDAL raster and vector drivers (GDAL 2)
679 GDALAllRegister();
680
681 // If the user hasn't specified a GIS output format, assume that we will use the same GIS format as the input basement DEM
682 if (m_strRasterGISOutFormat.empty())
684
685 // Load the raster GDAL driver
686 GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName(m_strRasterGISOutFormat.c_str());
687 if (NULL == pDriver)
688 {
689 // Can't load raster GDAL driver. Incorrectly specified?
690 cerr << ERR << "Unknown raster GIS output format '" << m_strRasterGISOutFormat << "'." << endl;
691 return false;
692 }
693
694 // Get the metadata for this raster driver
695 char** papszMetadata = pDriver->GetMetadata();
696
697 // for (int i = 0; papszMetadata[i] != NULL; i++)
698 // cout << papszMetadata[i] << endl;
699 // cout << endl;
700
701 // Need to test if this is a raster driver
702 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_RASTER, FALSE))
703 {
704 // This is not a raster driver
705 cerr << ERR << "GDAL driver '" << m_strRasterGISOutFormat << "' is not a raster driver. Choose another format." << endl;
706 return false;
707 }
708
709 // This driver is OK, so store its longname and the default file extension
710 string strTmp = CSLFetchNameValue(papszMetadata, "DMD_LONGNAME");
712 strTmp = CSLFetchNameValue(papszMetadata, "DMD_EXTENSIONS"); // Note DMD_EXTENSION (no S, is a single value) appears not to be implemented for newer drivers
713 strTmp = strTrim(&strTmp);
714
715 // We have a space-separated list of one or more file extensions: use the first extension in the list
716 long unsigned int nPos = strTmp.find(SPACE);
717 if (nPos == string::npos)
718 {
719 // No space i.e. just one extension
721 }
722 else
723 {
724 // There's a space, so we must have more than one extension
725 m_strGDALRasterOutputDriverExtension = strTmp.substr(0, nPos);
726 }
727
728 // Set up any defaults for raster files that are created using this driver
730
731 // Now do various tests of the driver's capabilities
732 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATE, FALSE))
733 {
734 // This raster driver does not support the Create() method, does it support CreateCopy()?
735 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATECOPY, FALSE))
736 {
737 cerr << ERR << "Cannot write using raster GDAL driver '" << m_strRasterGISOutFormat << " since neither Create() or CreateCopy() are supported'. Choose another GDAL raster format." << endl;
738 return false;
739 }
740
741 // Can't use Create() but can use CreateCopy()
742 m_bGDALCanCreate = false;
743 }
744
745 // Next, test to see what data types the driver can write and from this, work out the largest int and float we can write
746 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Float"))
747 {
749 m_GDALWriteFloatDataType = GDT_Float32;
750 }
751
752 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "UInt32"))
753 {
755
756 m_GDALWriteIntDataType = GDT_UInt32;
757 m_lGDALMaxCanWrite = UINT32_MAX;
759
761 m_GDALWriteFloatDataType = GDT_UInt32;
762
763 return true;
764 }
765
766 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Int32"))
767 {
769
770 m_GDALWriteIntDataType = GDT_Int32;
771 m_lGDALMaxCanWrite = INT32_MAX;
772 m_lGDALMinCanWrite = INT32_MIN;
773
775 m_GDALWriteFloatDataType = GDT_Int32;
776
777 return true;
778 }
779
780 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "UInt16"))
781 {
782 m_bGDALCanWriteInt32 = false;
783
784 m_GDALWriteIntDataType = GDT_UInt16;
785 m_lGDALMaxCanWrite = UINT16_MAX;
787
789 m_GDALWriteFloatDataType = GDT_UInt16;
790
791 return true;
792 }
793
794 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Int16"))
795 {
796 m_bGDALCanWriteInt32 = false;
797
798 m_GDALWriteIntDataType = GDT_Int16;
799 m_lGDALMaxCanWrite = INT16_MAX;
800 m_lGDALMinCanWrite = INT16_MIN;
801
803 m_GDALWriteFloatDataType = GDT_Int16;
804
805 return true;
806 }
807
808 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"), "Byte"))
809 {
810 m_bGDALCanWriteInt32 = false;
811
812 m_GDALWriteIntDataType = GDT_Byte;
813 m_lGDALMaxCanWrite = UINT8_MAX;
815
817 m_GDALWriteFloatDataType = GDT_Byte;
818
819 return true;
820 }
821
822 // This driver does not even support byte output
823 cerr << ERR << "Cannot write using raster GDAL driver '" << m_strRasterGISOutFormat << ", not even byte output is supported'. Choose another GIS raster format." << endl;
824 return false;
825}
826
827//===============================================================================================================================
829//===============================================================================================================================
831{
832 // Load the vector GDAL driver (this assumes that GDALAllRegister() has already been called)
833 GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName(m_strVectorGISOutFormat.c_str());
834 if (NULL == pDriver)
835 {
836 // Can't load vector GDAL driver. Incorrectly specified?
837 cerr << ERR << "Unknown vector GIS output format '" << m_strVectorGISOutFormat << "'." << endl;
838 return false;
839 }
840
841 // Get the metadata for this vector driver
842 char** papszMetadata = pDriver->GetMetadata();
843
844 // For GDAL2, need to test if this is a vector driver
845 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_VECTOR, FALSE))
846 {
847 // This is not a vector driver
848 cerr << ERR << "GDAL driver '" << m_strVectorGISOutFormat << "' is not a vector driver. Choose another format." << endl;
849 return false;
850 }
851
852 if (! CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATE, FALSE))
853 {
854 // Driver does not support create() method
855 cerr << ERR << "Cannot write vector GIS files using GDAL driver '" << m_strRasterGISOutFormat << "'. Choose another format." << endl;
856 return false;
857 }
858
859 // Driver is OK, now set some options for individual drivers
860 if (m_strVectorGISOutFormat == "ESRI Shapefile")
861 {
862 // Set this, so that just a single dataset-with-one-layer shapefile is created, rather than a directory
863 // (see http://www.gdal.org/ogr/drv_shapefile.html)
865 }
866 else if (m_strVectorGISOutFormat == "geojson")
867 {
869 }
870 else if (m_strVectorGISOutFormat == "gpkg")
871 {
873 }
874 // TODO 033 Others
875
876 return true;
877}
878
879//===============================================================================================================================
881//===============================================================================================================================
883{
884 // Increment file number
885 m_nGISSave++;
886
887 // Set for next save
888 if (m_bSaveRegular)
890 else
892
895 return false;
896
897 if (m_bTopSurfSave)
899 return false;
900
903 return false;
904
905 if (m_bSeaDepthSave)
907 return false;
908
911 return false;
912
915 return false;
916
917
918 // Don't write platform erosion files if there is no platform erosion
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
967 return false;
968 }
969
970 if (m_bLandformSave)
972 return false;
973
976 return false;
977
980 return false;
981
984 return false;
985
988 return false;
989
990 // Don't write suspended sediment files if there is no fine sediment
992 {
993 if (m_bSuspSedSave)
995 return false;
996
999 return false;
1000 }
1001
1004 return false;
1005
1006 for (int nLayer = 0; nLayer < m_nLayers; nLayer++)
1007 {
1009 {
1011 return false;
1012 }
1013
1015 {
1017 return false;
1018 }
1019
1021 {
1023 return false;
1024 }
1025
1027 {
1029 return false;
1030 }
1031
1033 {
1035 return false;
1036 }
1037
1039 {
1041 return false;
1042 }
1043 }
1044
1045 if (m_bSliceSave)
1046 {
1047 for (int i = 0; i < static_cast<int>(m_VdSliceElev.size()); i++)
1048 {
1050 return false;
1051 }
1052 }
1053
1055 {
1057 return false;
1058 }
1059
1061 {
1063 return false;
1064 }
1065
1067 {
1069 return false;
1070 }
1071
1072 // Don't write cliff collapse files if we aren't considering cliff collapse
1074 {
1076 {
1078 {
1080 return false;
1081 }
1082
1084 {
1086 return false;
1087 }
1088
1090 {
1092 return false;
1093 }
1094 }
1095
1097 {
1099 {
1101 return false;
1102 }
1103
1105 {
1107 return false;
1108 }
1109
1111 {
1113 return false;
1114 }
1115 }
1116
1118 {
1120 {
1122 return false;
1123 }
1124
1126 {
1128 return false;
1129 }
1130 }
1131
1133 {
1135 {
1137 return false;
1138 }
1139
1141 {
1143 return false;
1144 }
1145 }
1146 }
1147
1149 {
1151 return false;
1152 }
1153
1154
1155 if (m_bSeaMaskSave)
1156 {
1158 return false;
1159 }
1160
1161 if (m_bBeachMaskSave)
1162 {
1164 return false;
1165 }
1166
1168 {
1170 return false;
1171 }
1172
1174 {
1176 return false;
1177 }
1178
1180 {
1182 return false;
1183
1185 return false;
1186 }
1187
1189 {
1191 return false;
1192 }
1193
1195 {
1197 return false;
1198 }
1199
1201 {
1203 return false;
1204 }
1205
1207 {
1209 return false;
1210 }
1211
1213 {
1215 return false;
1216 }
1217
1219 {
1221 return false;
1222 }
1224 {
1226 return false;
1227 }
1228
1229 return true;
1230}
1231
1232//===============================================================================================================================
1234//===============================================================================================================================
1236{
1237 // Always written
1238 if (m_bCoastSave)
1239 {
1241 return false;
1242 }
1243
1244 if (m_bNormalsSave)
1245 {
1247 return false;
1248 }
1249
1251 {
1253 return false;
1254 }
1255
1257 {
1259 return false;
1260 }
1261
1263 {
1265 return false;
1266 }
1267
1269 {
1271 return false;
1272 }
1273
1275 {
1277 return false;
1278 }
1279
1281 {
1283 return false;
1284 }
1285
1287 {
1289 return false;
1290 }
1291
1293 {
1295 return false;
1296 }
1297
1299 {
1301 return false;
1302 }
1303
1305 {
1307 return false;
1308 }
1309
1311 {
1313 return false;
1314 }
1315
1317 {
1319 return false;
1320 }
1321
1323 {
1325 return false;
1326 }
1327
1328 if (m_bWaveSetupSave)
1329 {
1331 return false;
1332 }
1334 {
1336 return false;
1337 }
1338 if (m_bRunUpSave)
1339 {
1341 return false;
1342 }
1343
1345 {
1347 return false;
1348
1349 // if (! bWriteVectorGISFile(VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE, &VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE_TITLE))
1350 // return false;
1351
1352 // if (! bWriteVectorGISFile(VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE, &VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE_TITLE))
1353 // return false;
1354 }
1355 return true;
1356}
1357
1358//===============================================================================================================================
1360//===============================================================================================================================
1361void CSimulation::GetRasterOutputMinMax(int const nDataItem, double&dMin, double&dMax, int const nLayer, double const dElev)
1362{
1363 // If this is a binary mask layer, we already know the max and min values
1365 (nDataItem == RASTER_PLOT_INUNDATION_MASK) ||
1366 (nDataItem == RASTER_PLOT_BEACH_MASK) ||
1367 (nDataItem == RASTER_PLOT_COAST) ||
1368 (nDataItem == RASTER_PLOT_NORMAL) ||
1369 (nDataItem == RASTER_PLOT_ACTIVE_ZONE) ||
1371 (nDataItem == RASTER_PLOT_SETUP_SURGE_FLOOD_MASK) ||
1373 (nDataItem == RASTER_PLOT_WAVE_FLOOD_LINE))
1374 {
1375 dMin = 0;
1376 dMax = 1;
1377
1378 return;
1379 }
1380
1381 // Not a binary mask layer, so we must find the max and min values
1382 dMin = DBL_MAX;
1383 dMax = DBL_MIN;
1384
1385 double dTmp = 0;
1386 for (int nY = 0; nY < m_nYGridSize; nY++)
1387 {
1388 for (int nX = 0; nX < m_nXGridSize; nX++)
1389 {
1390 switch (nDataItem)
1391 {
1392 case (RASTER_PLOT_SLICE):
1393 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetLayerAtElev(dElev);
1394 break;
1395
1396 case (RASTER_PLOT_LANDFORM):
1397 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFCategory();
1398 break;
1399
1401 dTmp = INT_NODATA;
1402 if (bIsInterventionCell(nX, nY))
1403 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFSubCategory();
1404 break;
1405
1407 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetInterventionHeight();
1408 break;
1409
1410 case (RASTER_PLOT_POLYGON):
1411 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1412 break;
1413
1415 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBasementElev();
1416 break;
1417
1419 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSedimentTopElev();
1420 break;
1421
1423 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetOverallTopElev();
1424 break;
1425
1427 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetLocalConsSlope();
1428 break;
1429
1430 case (RASTER_PLOT_SEA_DEPTH):
1431 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSeaDepth();
1432 break;
1433
1435 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSeaDepth() / static_cast<double>(m_ulIter);
1436 break;
1437
1439 if (! m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea())
1440 dTmp = m_dMissingValue;
1441 else
1442 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1443 break;
1444
1446 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveHeight() / static_cast<double>(m_ulIter);
1447 break;
1448
1450 if (! m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea())
1451 dTmp = m_dMissingValue;
1452 else
1453 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1454 break;
1455
1457 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveAngle() / static_cast<double>(m_ulIter);
1458 break;
1459
1461 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBeachProtectionFactor();
1462 if (! bFPIsEqual(dTmp, DBL_NODATA, TOLERANCE))
1463 dTmp = 1 - dTmp; // Output the inverse, seems more intuitive
1464 break;
1465
1467 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetPotentialPlatformErosion();
1468 break;
1469
1471 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetActualPlatformErosion();
1472 break;
1473
1475 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotPotentialPlatformErosion();
1476 break;
1477
1479 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotActualPlatformErosion();
1480 break;
1481
1483 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetPotentialBeachErosion();
1484 break;
1485
1487 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetActualBeachErosion();
1488 break;
1489
1491 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotPotentialBeachErosion();
1492 break;
1493
1495 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotActualBeachErosion();
1496 break;
1497
1499 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBeachDeposition();
1500 break;
1501
1503 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotBeachDeposition();
1504 break;
1505
1507 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
1508 break;
1509
1511 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSuspendedSediment() / static_cast<double>(m_ulIter);
1512 break;
1513
1515 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetFineDepth();
1516 break;
1517
1519 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetSandDepth();
1520 break;
1521
1523 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetUnconsolidatedSediment()->dGetCoarseDepth();
1524 break;
1525
1527 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetFineDepth();
1528 break;
1529
1531 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetSandDepth();
1532 break;
1533
1535 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->pGetConsolidatedSediment()->dGetCoarseDepth();
1536 break;
1537
1539 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionFine();
1540 break;
1541
1543 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionSand();
1544 break;
1545
1547 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseErosionCoarse();
1548 break;
1549
1551 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseFine();
1552 break;
1553
1555 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseSand();
1556 break;
1557
1559 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseCoarse();
1560 break;
1561
1563 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseSandTalusDeposition();
1564 break;
1565
1567 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetThisIterCliffCollapseCoarseTalusDeposition();
1568 break;
1569
1571 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSandTalusDeposition();
1572 break;
1573
1575 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCoarseTalusDeposition();
1576 break;
1577
1579 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetShadowZoneNumber();
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 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1592 break;
1593
1595 int nPoly = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1596 if (nPoly == INT_NODATA)
1597 dTmp = m_dMissingValue;
1598 else
1599 dTmp = m_pVCoastPolygon[nPoly]->dGetBeachDepositionAndSuspensionAllUncons();
1600 break;
1601 }
1602
1603 if (! bFPIsEqual(dTmp, DBL_NODATA, TOLERANCE))
1604 {
1605 if (dTmp > dMax)
1606 dMax = dTmp;
1607
1608 if (dTmp < dMin)
1609 dMin = dTmp;
1610 }
1611 }
1612 }
1613}
1614
1615//===============================================================================================================================
1617//===============================================================================================================================
1619{
1620 string strDriver = strToLower(&m_strRasterGISOutFormat);
1621 string strComment = "Created by " + PROGRAM_NAME + " for " + PLATFORM + " " + strGetBuild() + " running on " + strGetComputerName();
1622
1623 // TODO 034 Do these for all commonly-used file types
1624 if (strDriver == "aaigrid")
1625 {
1626 }
1627
1628 else if (strDriver == "bmp")
1629 {
1630 }
1631
1632 else if (strDriver == "gtiff")
1633 {
1634 if (m_bWorldFile)
1635 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "TFW", "YES");
1636
1637 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NUM_THREADS", "ALL_CPUS");
1638 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMPRESS", "LZW");
1639 }
1640
1641 else if (strDriver == "hfa")
1642 {
1643 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NBITS", "4");
1644 }
1645
1646 else if (strDriver == "jpeg")
1647 {
1648 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1649 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "QUALITY", "95");
1650 }
1651
1652 else if (strDriver == "png")
1653 {
1654 if (m_bWorldFile)
1655 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "WORLDFILE", "YES");
1656
1657 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "TITLE", "This is the title");
1658 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "DESCRIPTION", "This is a description");
1659 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COPYRIGHT", "This is some copyright statement");
1660 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1661 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "NBITS", "4");
1662 }
1663
1664 else if (strDriver == "rst")
1665 {
1666 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1667 }
1668
1669 else if (strDriver == "geojson")
1670 {
1671 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "COMMENT", strComment.c_str());
1672 }
1673
1674 else if (strDriver == "gpkg")
1675 {
1676 // TODO 065 Does GDAL support overwriting raster gpkg files yet?
1677 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "OVERWRITE", "YES");
1678 m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions, "USE_TILE_EXTENT", "YES");
1679 }
1680 else if (strDriver == "netcdf")
1681 {
1682 }
1683}
1684
1685//===============================================================================================================================
1687//===============================================================================================================================
1688int CSimulation::nGetOppositeDirection(int const nDirection)
1689{
1690 switch (nDirection)
1691 {
1692 case NORTH:
1693 return SOUTH;
1694
1695 case NORTH_EAST:
1696 return SOUTH - WEST;
1697
1698 case EAST:
1699 return WEST;
1700
1701 case SOUTH_EAST:
1702 return NORTH - WEST;
1703
1704 case SOUTH:
1705 return NORTH;
1706
1707 case SOUTH_WEST:
1708 return NORTH - EAST;
1709
1710 case WEST:
1711 return EAST;
1712
1713 case NORTH_WEST:
1714 return SOUTH - EAST;
1715 }
1716
1717 // Should never get here
1718 return NO_DIRECTION;
1719}
1720
1721// //===============================================================================================================================
1722// //! Given two integer points, calculates the slope and intercept of the line passing through the points
1723// //===============================================================================================================================
1724// void CSimulation::GetSlopeAndInterceptFromPoints(CGeom2DIPoint const* pPti1, CGeom2DIPoint const* pPti2, double& dSlope, double& dIntercept)
1725// {
1726// int
1727// nX1 = pPti1->nGetX(),
1728// nY1 = pPti1->nGetY(),
1729// nX2 = pPti2->nGetX(),
1730// nY2 = pPti2->nGetY();
1731//
1732// double
1733// dXDiff = nX1 - nX2,
1734// dYDiff = nY1 - nY2;
1735//
1736// if (bFPIsEqual(dXDiff, 0.0, TOLERANCE))
1737// dSlope = 0;
1738// else
1739// dSlope = dYDiff / dXDiff;
1740//
1741// dIntercept = nY1 - (dSlope * nX1);
1742// }
1743
1744//===============================================================================================================================
1746//===============================================================================================================================
1748{
1749 unsigned int nMinSqDist = UINT_MAX;
1750 CGeom2DIPoint PtiCoastPoint;
1751
1752 // Do for every coast
1753 for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1754 {
1755 for (int j = 0; j < m_VCoast[nCoast].nGetCoastlineSize(); j++)
1756 {
1757 // Get the coords of the grid cell marked as coastline for the coastal landform object
1758 int
1759 nXCoast = m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(j)->nGetX(),
1760 nYCoast = m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(j)->nGetY();
1761
1762 // Calculate the squared distance between this point and the given point
1763 int
1764 nXDist = nX - nXCoast,
1765 nYDist = nY - nYCoast;
1766
1767 unsigned int nSqDist = (nXDist * nXDist) + (nYDist * nYDist);
1768
1769 // Is this the closest so dar?
1770 if (nSqDist < nMinSqDist)
1771 {
1772 nMinSqDist = nSqDist;
1773 PtiCoastPoint.SetXY(nXCoast, nYCoast);
1774 }
1775 }
1776 }
1777
1778 return PtiCoastPoint;
1779}
1780
1781//===============================================================================================================================
1783//===============================================================================================================================
1784int CSimulation::nConvertMetresToNumCells(double const dLen) const
1785{
1786 return nRound(dLen / m_dCellSide);
1787}
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:206
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:95
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:233
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:86
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:83
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:179
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:251
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:431
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:467
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:547
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:113
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:107
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:257
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:272
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:146
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:434
bool m_bRunUpSave
Are we saving runup? TODO 007.
Definition simulation.h:395
GDALDataType m_GDALWriteIntDataType
The data type used by GDAL for integer operations, can be GDT_Byte, GDT_Int16, GDT_UInt16,...
Definition simulation.h:541
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:212
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:140
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:242
double m_dGeoTransform[6]
GDAL geotransformation info (see http://www.gdal.org/classGDALDataset.html)
Definition simulation.h:652
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:910
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:80
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:185
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:221
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:98
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:347
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:161
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:158
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:182
bool m_bTotCliffCollapseSave
Save total cliff collapse raster GIS files?
Definition simulation.h:209
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:338
bool m_bSliceSave
Save slices?
Definition simulation.h:89
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
Definition simulation.h:218
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:155
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:248
int m_nLayers
The number of sediment layers.
Definition simulation.h:437
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:368
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:254
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:101
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:74
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:464
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:92
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:110
bool m_bWorldFile
Write a GIS World file?
Definition simulation.h:359
bool bCheckVectorGISOutputFormat(void)
Checks whether the selected vector OGR driver supports file creation etc.
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:203
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:236
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:122
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:260
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:353
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:125
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:637
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:263
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:137
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:398
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:119
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:143
bool m_bSuspSedSave
Save suspended sediment raster GIS files?
Definition simulation.h:173
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:266
bool m_bStormSurgeSave
Are we saving the storm surge? TODO 007.
Definition simulation.h:392
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:134
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:71
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:149
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:461
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:224
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:167
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:152
bool m_bRasterCoastlineSave
Save raster coastline GIS files?
Definition simulation.h:197
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:170
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:386
long m_lGDALMinCanWrite
The minimum integer value which GDAL can write, can be zero, INT16_MIN, INT32_MIN.
Definition simulation.h:550
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:191
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:380
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:77
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:640
bool m_bPolygonUnconsSedGainOrLossSave
Save polygon unconsolidated sediment gain or loss raster GIS files?
Definition simulation.h:245
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:116
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:128
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:188
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:275
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:239
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:194
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:227
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:553
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:176
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:613
bool bIsInterventionCell(int const, int const) const
Returns true if the cell is an intervention.
Definition utils.cpp:2736
bool m_bRasterNormalSave
Save raster coastline-normal GIS files?
Definition simulation.h:200
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:215
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:341
bool m_bSetupSurgeRunupFloodMaskSave
Are we saving the setup surge runup flood mask? TODO 007.
Definition simulation.h:401
bool m_bWaveSetupSave
Are we saving the wave setup? TODO 007.
Definition simulation.h:389
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:230
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:131
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:544
bool m_bGDALCanWriteFloat
Is the selected GDAL output file format capable of writing floating-point values to files?
Definition simulation.h:350
char ** m_papszGDALRasterOptions
Options for GDAL when handling raster files.
Definition simulation.h:425
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:269
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:407
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:104
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:164
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:362
int const RASTER_PLOT_POLYGON
Definition cme.h:521
string const RASTER_PLOT_POLYGON_UPDRIFT_OR_DOWNDRIFT_TITLE
Definition cme.h:976
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_COARSE_TITLE
Definition cme.h:958
string const VECTOR_PLOT_BREAKING_WAVE_HEIGHT_TITLE
Definition cme.h:1056
T tMin(T a, T b)
Definition cme.h:1136
string const VECTOR_PLOT_INVALID_NORMALS_TITLE
Definition cme.h:1062
double const TOLERANCE
Definition cme.h:698
string const VECTOR_PLOT_NORMALS_TITLE
Definition cme.h:1064
int const VECTOR_PLOT_STORM_SURGE
Definition cme.h:569
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_SAND_TITLE
Definition cme.h:957
string const RASTER_PLOT_COAST_TITLE
Definition cme.h:961
string const RASTER_PLOT_POLYGON_TITLE
Definition cme.h:975
int const VECTOR_PLOT_BREAKING_WAVE_HEIGHT
Definition cme.h:554
int const VECTOR_PLOT_POLYGON_NODES
Definition cme.h:564
int const RASTER_PLOT_LOCAL_SLOPE_OF_CONSOLIDATED_SEDIMENT
Definition cme.h:518
int const RASTER_PLOT_TOTAL_ACTUAL_BEACH_EROSION
Definition cme.h:534
string const RASTER_PLOT_BEACH_DEPOSITION_TITLE
Definition cme.h:951
int const RASTER_PLOT_BEACH_DEPOSITION
Definition cme.h:498
int const RASTER_PLOT_SUSPENDED_SEDIMENT
Definition cme.h:533
int const VECTOR_PLOT_NORMALS
Definition cme.h:562
string const RASTER_PLOT_DEEP_WATER_WAVE_ORIENTATION_TITLE
Definition cme.h:963
string const VECTOR_PLOT_CLIFF_NOTCH_SIZE_TITLE
Definition cme.h:1057
string const RASTER_PLOT_FINE_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:965
int const RASTER_PLOT_FINE_UNCONSOLIDATED_SEDIMENT
Definition cme.h:513
string const RASTER_PLOT_AVG_SEA_DEPTH_TITLE
Definition cme.h:946
string const VECTOR_PLOT_DOWNDRIFT_BOUNDARY_TITLE
Definition cme.h:1061
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSIT_COARSE_TITLE
Definition cme.h:991
string const ERR
Definition cme.h:775
string const RASTER_PLOT_BEACH_MASK_TITLE
Definition cme.h:952
int const RASTER_PLOT_INUNDATION_MASK
Definition cme.h:516
string const RASTER_PLOT_AVG_WAVE_ORIENTATION_TITLE
Definition cme.h:949
string const RASTER_PLOT_SETUP_SURGE_FLOOD_MASK_TITLE
Definition cme.h:1001
int const RASTER_PLOT_SEDIMENT_TOP_ELEVATION_ELEV
Definition cme.h:529
string const RASTER_PLOT_ACTUAL_BEACH_EROSION_TITLE
Definition cme.h:944
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_FINE_TITLE
Definition cme.h:992
int const RASTER_PLOT_ACTUAL_BEACH_EROSION
Definition cme.h:491
string const RASTER_PLOT_POLYGON_GAIN_OR_LOSS_TITLE
Definition cme.h:974
string const VECTOR_PLOT_MEAN_WAVE_ENERGY_TITLE
Definition cme.h:1063
string const RASTER_PLOT_DEEP_WATER_WAVE_HEIGHT_TITLE
Definition cme.h:962
string const RASTER_PLOT_WAVE_ORIENTATION_TITLE
Definition cme.h:998
string const RASTER_PLOT_BASEMENT_ELEVATION_TITLE
Definition cme.h:950
string const RASTER_PLOT_INTERVENTION_CLASS_TITLE
Definition cme.h:967
string const RASTER_PLOT_COARSE_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:960
string const VECTOR_PLOT_POLYGON_NODES_TITLE
Definition cme.h:1066
string const VECTOR_PLOT_RUN_UP_TITLE
Definition cme.h:1072
int const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_MASK
Definition cme.h:546
string const RASTER_PLOT_AVG_WAVE_HEIGHT_TITLE
Definition cme.h:948
string const RASTER_PLOT_TOTAL_POTENTIAL_PLATFORM_EROSION_TITLE
Definition cme.h:996
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSIT_COARSE
Definition cme.h:541
int const RASTER_PLOT_SAND_CONSOLIDATED_SEDIMENT
Definition cme.h:526
int const RASTER_PLOT_AVG_WAVE_HEIGHT
Definition cme.h:495
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSIT_SAND_TITLE
Definition cme.h:990
int const SOUTH_EAST
Definition cme.h:386
int const RASTER_PLOT_FINE_CONSOLIDATED_SEDIMENT
Definition cme.h:512
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSIT_SAND
Definition cme.h:540
int const VECTOR_PLOT_DOWNDRIFT_BOUNDARY
Definition cme.h:559
int const RASTER_PLOT_ACTIVE_ZONE
Definition cme.h:490
int const VECTOR_PLOT_COAST_CURVATURE
Definition cme.h:557
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_SAND_TITLE
Definition cme.h:993
string const VECTOR_PLOT_WAVE_SETUP_TITLE
Definition cme.h:1070
string const RASTER_PLOT_LANDFORM_TITLE
Definition cme.h:970
int const RASTER_PLOT_DEEP_WATER_WAVE_PERIOD
Definition cme.h:511
string const RASTER_PLOT_WAVE_HEIGHT_TITLE
Definition cme.h:997
int const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSIT_SAND
Definition cme.h:504
int const RASTER_PLOT_COAST
Definition cme.h:508
string const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1055
string const RASTER_PLOT_TOTAL_POTENTIAL_BEACH_EROSION_TITLE
Definition cme.h:995
string const VECTOR_PLOT_COAST_CURVATURE_TITLE
Definition cme.h:1058
string const RASTER_PLOT_POTENTIAL_BEACH_EROSION_TITLE
Definition cme.h:977
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1176
int const VECTOR_PLOT_RUN_UP
Definition cme.h:570
int const RASTER_PLOT_POLYGON_UPDRIFT_OR_DOWNDRIFT
Definition cme.h:523
int const VECTOR_PLOT_INVALID_NORMALS
Definition cme.h:560
string const RASTER_PLOT_SETUP_SURGE_RUNUP_FLOOD_MASK_TITLE
Definition cme.h:1002
int const RASTER_PLOT_POLYGON_GAIN_OR_LOSS
Definition cme.h:522
string const RASTER_PLOT_SAND_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:979
int const RASTER_PLOT_DEEP_WATER_WAVE_ORIENTATION
Definition cme.h:510
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_COARSE
Definition cme.h:539
string const RASTER_PLOT_ACTUAL_PLATFORM_EROSION_TITLE
Definition cme.h:945
int const RASTER_PLOT_COARSE_UNCONSOLIDATED_SEDIMENT
Definition cme.h:507
string const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSIT_COARSE_TITLE
Definition cme.h:955
int const RASTER_PLOT_AVG_WAVE_ORIENTATION
Definition cme.h:496
string const RASTER_PLOT_TOTAL_BEACH_DEPOSITION_TITLE
Definition cme.h:989
int const RASTER_PLOT_WAVE_ORIENTATION
Definition cme.h:545
int const SOUTH_WEST
Definition cme.h:388
int const RASTER_PLOT_BEACH_MASK
Definition cme.h:499
int const RASTER_PLOT_WAVE_FLOOD_LINE
Definition cme.h:550
T tMax(T a, T b)
Definition cme.h:1123
int const RASTER_PLOT_SEDIMENT_INPUT
Definition cme.h:547
int const RASTER_PLOT_POTENTIAL_BEACH_EROSION
Definition cme.h:524
int const NORTH_WEST
Definition cme.h:390
string const RASTER_PLOT_SEDIMENT_TOP_ELEVATION_ELEV_TITLE
Definition cme.h:982
int const RASTER_PLOT_AVG_SUSPENDED_SEDIMENT
Definition cme.h:494
int const VECTOR_PLOT_COAST
Definition cme.h:556
int const VECTOR_PLOT_FLOOD_LINE
Definition cme.h:571
string const RASTER_PLOT_BEACH_PROTECTION_TITLE
Definition cme.h:953
int const RASTER_PLOT_TOTAL_POTENTIAL_PLATFORM_EROSION
Definition cme.h:543
string const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_MASK_TITLE
Definition cme.h:999
string const VECTOR_PLOT_COAST_TITLE
Definition cme.h:1059
int const VECTOR_PLOT_CLIFF_NOTCH_SIZE
Definition cme.h:555
string const PROGRAM_NAME
Definition cme.h:709
int const RASTER_PLOT_INTERVENTION_CLASS
Definition cme.h:514
string const VECTOR_PLOT_FLOOD_SWL_SETUP_LINE_TITLE
Definition cme.h:1074
int const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE
Definition cme.h:567
int const RASTER_PLOT_BEACH_PROTECTION
Definition cme.h:500
int const RASTER_PLOT_AVG_SEA_DEPTH
Definition cme.h:493
int const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:566
string const RASTER_PLOT_NORMAL_TITLE
Definition cme.h:972
int const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSIT_COARSE
Definition cme.h:505
int const RASTER_PLOT_OVERALL_TOP_ELEVATION
Definition cme.h:520
string const RASTER_PLOT_SHADOW_ZONE_TITLE
Definition cme.h:984
int const RASTER_PLOT_TOTAL_BEACH_DEPOSITION
Definition cme.h:536
string const VECTOR_PLOT_SHADOW_BOUNDARY_TITLE
Definition cme.h:1067
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_FINE
Definition cme.h:537
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_SAND
Definition cme.h:538
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_FINE
Definition cme.h:501
int const SOUTH
Definition cme.h:387
int const NO_DIRECTION
Definition cme.h:382
string const RASTER_PLOT_AVG_SUSPENDED_SEDIMENT_TITLE
Definition cme.h:947
int const RASTER_PLOT_ACTUAL_PLATFORM_EROSION
Definition cme.h:492
int const VECTOR_PLOT_POLYGON_BOUNDARY
Definition cme.h:563
string const RASTER_PLOT_INTERVENTION_HEIGHT_TITLE
Definition cme.h:968
int const VECTOR_PLOT_MEAN_WAVE_ENERGY
Definition cme.h:561
int const EAST
Definition cme.h:385
string const VECTOR_PLOT_POLYGON_BOUNDARY_TITLE
Definition cme.h:1065
string const RASTER_PLOT_SEA_DEPTH_TITLE
Definition cme.h:981
string const RASTER_PLOT_TOTAL_ACTUAL_PLATFORM_EROSION_TITLE
Definition cme.h:988
string const RASTER_PLOT_SEDIMENT_INPUT_EVENT_TITLE
Definition cme.h:1000
int const RASTER_PLOT_INTERVENTION_HEIGHT
Definition cme.h:515
int const RASTER_PLOT_TOTAL_POTENTIAL_BEACH_EROSION
Definition cme.h:542
int const NORTH_EAST
Definition cme.h:384
int const RASTER_PLOT_SAND_UNCONSOLIDATED_SEDIMENT
Definition cme.h:527
string const RASTER_PLOT_FINE_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:966
string const RASTER_PLOT_DEEP_WATER_WAVE_PERIOD_TITLE
Definition cme.h:964
int const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION
Definition cme.h:525
string const RASTER_PLOT_INUNDATION_MASK_TITLE
Definition cme.h:969
string const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_TITLE
Definition cme.h:978
double const DBL_NODATA
Definition cme.h:707
int const RASTER_PLOT_WAVE_HEIGHT
Definition cme.h:544
int const RASTER_PLOT_SHADOW_ZONE
Definition cme.h:531
int const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:553
int const RASTER_PLOT_DEEP_WATER_WAVE_HEIGHT
Definition cme.h:509
int const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:558
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_COARSE_TITLE
Definition cme.h:994
string const RASTER_PLOT_SHADOW_DOWNDRIFT_ZONE_TITLE
Definition cme.h:983
int const RASTER_PLOT_COARSE_CONSOLIDATED_SEDIMENT
Definition cme.h:506
int const RASTER_PLOT_TOTAL_ACTUAL_PLATFORM_EROSION
Definition cme.h:535
int const VECTOR_PLOT_WAVE_SETUP
Definition cme.h:568
int const RASTER_PLOT_SETUP_SURGE_RUNUP_FLOOD_MASK
Definition cme.h:549
int const RASTER_PLOT_BASEMENT_ELEVATION
Definition cme.h:497
string const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE_TITLE
Definition cme.h:1069
int const RASTER_PLOT_LANDFORM
Definition cme.h:517
string const RASTER_PLOT_SUSPENDED_SEDIMENT_TITLE
Definition cme.h:986
int const RIGHT_HANDED
Definition cme.h:397
string const VECTOR_PLOT_STORM_SURGE_TITLE
Definition cme.h:1071
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_FINE_TITLE
Definition cme.h:956
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_COARSE
Definition cme.h:503
int const RASTER_PLOT_SHADOW_DOWNDRIFT_ZONE
Definition cme.h:530
string const RASTER_PLOT_SAND_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:980
int const RASTER_PLOT_SLICE
Definition cme.h:532
string const RASTER_PLOT_OVERALL_TOP_ELEVATION_TITLE
Definition cme.h:973
string const RASTER_PLOT_ACTIVE_ZONE_TITLE
Definition cme.h:943
int const VECTOR_PLOT_SHADOW_BOUNDARY
Definition cme.h:565
string const RASTER_PLOT_LOCAL_SLOPE_OF_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:971
string const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1068
string const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSIT_SAND_TITLE
Definition cme.h:954
string const RASTER_PLOT_TOTAL_ACTUAL_BEACH_EROSION_TITLE
Definition cme.h:987
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_SAND
Definition cme.h:502
string const RASTER_PLOT_SLICE_TITLE
Definition cme.h:985
int const RASTER_PLOT_SEA_DEPTH
Definition cme.h:528
int const NORTH
Definition cme.h:383
string const RASTER_PLOT_COARSE_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:959
string const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1060
int const RASTER_PLOT_SETUP_SURGE_FLOOD_MASK
Definition cme.h:548
int const RASTER_PLOT_NORMAL
Definition cme.h:519
int const WEST
Definition cme.h:389
char const SPACE
Definition cme.h:341
Contains CRWCoast definitions.
Contains CGeomRasterGrid definitions.
Contains CSimulation definitions.
int nRound(double const d)
Version of the above that returns an int.