seims.h
Go to the documentation of this file.
1/*!
2 * \file seims.h
3 * \brief The SEIMS related definitions and utilities header.
4 *
5 * Changelog:
6 * - 1. 2017-03-22 - lj - Initial implementation.
7 * - 2. 2021-04-06 - lj - Add Flow direction method enum.
8 *
9 * \author Liang-Jun Zhu
10 * \date 2017-3-22
11 */
12#ifndef SEIMS_HEADER
13#define SEIMS_HEADER
14
15#include "data_raster.hpp"
16using namespace ccgl;
17using namespace data_raster;
18
19/*!
20 * \enum LayeringMethod
21 * \ingroup util
22 * \brief Grid layering method for routing and parallel computing.
23 * Reference: Liu et al., 2014, EM&S, 51, 221-227. https://doi.org/10.1016/j.envsoft.2013.10.005
24 */
26 UP_DOWN, ///< layering-from-source method, default
27 DOWN_UP ///< layering-from-outlet method
28};
29const char* const LayeringMethodString[] = {"_UP_DOWN", "_DOWN_UP"};
30
31/*!
32 * \enum FlowDirMethod
33 * \ingroup util
34 * \brief Flow direction method for flow routing.
35 */
37 D8, ///< D8 (O'Callaghan and Mark, 1984), default
38 Dinf, ///< Dinf (Tarboton, 1997)
39 MFDmd ///< Multiple Flow Direction based on maximum downslope gradient (Qin et al., 2007)
40};
41const char* const FlowDirMethodString[] = { "_D8", "_DINF", "_MFDMD" };
42
43/*!
44 * \enum GroupMethod
45 * \ingroup util
46 * \brief Group method for parallel task scheduling.
47 */
49 KMETIS = 0, ///< KMETIS, default
50 PMETIS = 1 ///< PMETIS
51};
52const char* const GroupMethodString[] = {"KMETIS", "PMETIS"};
53
54/*!
55 * \enum ScheduleMethod
56 * \ingroup util
57 * \brief Parallel task scheduling strategy at subbasin level by MPI. TESTED!
58 */
60 SPATIAL = 0, ///< Sceduled by spatial, default, refers to Liu et al., 2016, EM&S
61 TEMPOROSPATIAL = 1 ///< Sceduled by temporal-spatial discretization method, refers to Wang et al., 2013, C&G
62};
63const char* const ScheduleMethodString[] = {"SPATIAL", "TEMPOROSPATIAL"};
64
65/*!
66 * \def DiagonalCCW
67 * \ingroup util
68 * \brief Whether diagonal counter clockwise from east
69 *
70 * \code
71 * // the first element is set to 0, for indexing convenient.
72 * // 1 0 1
73 * // 0 0
74 * // 1 0 1
75 * // e.g. the corresponding D8 flow direction of TauDEM rule:
76 * // 4 3 2
77 * // 5 1
78 * // 6 7 8
79 * // the flow direction of ArcGIS rule:
80 * // 32 64 128
81 * // 16 1
82 * // 8 4 2
83 * \endcode
84 */
85const int DiagonalCCW[9] = {0, 0, 1, 0, 1, 0, 1, 0, 1};
86/*!
87 * \def FlowDirCCW
88 * \ingroup util
89 * \brief Flow directions of ArcGIS rule
90 *
91 * 32 64 128
92 * 16 1
93 * 8 4 2
94 */
95const int FlowDirCCW[9] = { 0, 1, 128, 64, 32, 16, 8, 4, 2 };
96const int CCWDeltaRow[9] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 }; ///< Delta Row (Y-axis) according to FlowDirCCW
97const int CCWDeltaCol[9] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 }; ///< Delta Col (X-axis) according to FlowDirCCW
98
99#ifdef USE_FLOAT64
100typedef double FLTPT;
101#else
102typedef float FLTPT;
103#endif
104
105///
106/// Common used const.
107///
108const FLTPT _pi = 3.14159265358979323846; ///< PI
109const FLTPT _1div3 = 0.3333333333333333; ///< 1. / 3.
110const FLTPT _2div3 = 0.6666666666666666; ///< 2. / 3.
111const FLTPT _8div3 = 2.6666666666666665; ///< 8. / 3.
112const FLTPT SQ2 = 1.4142135623730951; ///< sqrt(2.0)
113const FLTPT deg2rad = 0.017453292519943295; ///< PI / 180.
114const FLTPT rad2deg = 57.29577951308232; ///< 180. / PI
115const FLTPT radWt = 0.01721420632103996f; /// PI * 2 / 365;
116
117const FLTPT MIN_FLUX = 1e-12; ///< minimum flux (m3/s) in kinematic wave
118const int MAX_ITERS_KW = 10; ///< maximum iterate number in kinematic wave method
119const FLTPT MIN_SLOPE = 1e-4; ///< minimum slope (tan value)
120
121#ifdef IntRaster
122#undef IntRaster
123#endif
124#ifndef IntRaster
125/*! Integer-typed raster */
126#define IntRaster ccgl::data_raster::clsRasterData<int>
127#endif
128#ifdef FloatRaster
129#undef FloatRaster
130#endif
131#ifndef FloatRaster
132/*! Float-typed raster with int-typed mask, specific for legacy SEIMS code */
133#define FloatRaster ccgl::data_raster::clsRasterData<FLTPT, int>
134#endif
135//#ifdef FltIntRaster
136//#undef FltIntRaster
137//#endif
138//#ifndef FltIntRaster
139///*! Float-typed raster with int-typed mask */
140//#define FltIntRaster ccgl::data_raster::clsRasterData<FLTPT, int>
141//#endif
142//#ifdef IntFltRaster
143//#undef IntFltRaster
144//#endif
145//#ifndef IntFltRaster
146///*! Int-typed raster with Flt-typed mask */
147//#define IntFltRaster ccgl::data_raster::clsRasterData<int, FLTPT>
148//#endif
149
150#endif /* SEIMS_HEADER */
ScheduleMethod
Parallel task scheduling strategy at subbasin level by MPI.
Definition: seims.h:59
GroupMethod
Group method for parallel task scheduling.
Definition: seims.h:48
LayeringMethod
Grid layering method for routing and parallel computing.
Definition: seims.h:25
FlowDirMethod
Flow direction method for flow routing.
Definition: seims.h:36
Common Cross-platform Geographic Library (CCGL)
const int CCWDeltaRow[9]
Delta Row (Y-axis) according to FlowDirCCW.
Definition: seims.h:96
const FLTPT SQ2
sqrt(2.0)
Definition: seims.h:112
const FLTPT rad2deg
Definition: seims.h:114
const int MAX_ITERS_KW
maximum iterate number in kinematic wave method
Definition: seims.h:118
const FLTPT deg2rad
PI / 180.
Definition: seims.h:113
const int CCWDeltaCol[9]
Delta Col (X-axis) according to FlowDirCCW.
Definition: seims.h:97
const FLTPT _pi
Common used const.
Definition: seims.h:108
const FLTPT MIN_SLOPE
minimum slope (tan value)
Definition: seims.h:119
const FLTPT _2div3
Definition: seims.h:110
const FLTPT _1div3
Definition: seims.h:109
const FLTPT _8div3
Definition: seims.h:111
const FLTPT MIN_FLUX
PI * 2 / 365;.
Definition: seims.h:117
@ SPATIAL
Sceduled by spatial, default, refers to Liu et al., 2016, EM&S.
Definition: seims.h:60
@ TEMPOROSPATIAL
Sceduled by temporal-spatial discretization method, refers to Wang et al., 2013, C&G.
Definition: seims.h:61
@ PMETIS
PMETIS.
Definition: seims.h:50
@ KMETIS
KMETIS, default.
Definition: seims.h:49
@ DOWN_UP
layering-from-outlet method
Definition: seims.h:27
@ UP_DOWN
layering-from-source method, default
Definition: seims.h:26
@ Dinf
Dinf (Tarboton, 1997)
Definition: seims.h:38
@ MFDmd
Multiple Flow Direction based on maximum downslope gradient (Qin et al., 2007)
Definition: seims.h:39
@ D8
D8 (O'Callaghan and Mark, 1984), default.
Definition: seims.h:37