invoke.h
Go to the documentation of this file.
1/*!
2 * \file invoke.h
3 * \brief Parse the input arguments as a class which can be easily extended.
4 *
5 * Changelog:
6 * - 1. 2018-02-01 - lj - Initial implementation.
7 * - 2. 2018-06-06 - lj - Add parameters related to MPI version, e.g., group method.
8 * - 3. 2021-04-06 - lj - Add flow direction algorithm as an input argument
9 *
10 * \author Liangjun Zhu
11 */
12#ifndef SEIMS_INPUT_ARGUMENTS_H
13#define SEIMS_INPUT_ARGUMENTS_H
14
15#include "basic.h"
16
17#include "seims.h"
18
19using namespace ccgl;
20
21/// Full usage information
22void Usage(const string& appname, const string& error_msg = std::string());
23
24/*!
25 * \class InputArgs
26 * \ingroup module_setting
27 * \brief Parse the input arguments of SEIMS.
28 */
30public:
31 /*!
32 * \brief Constructor by detailed parameters
33 * \param[in] model_path path of the configuration of the Model
34 * \param[in] model_cfgname config name of specific model, the default is "", it corresponds to a subfolder
35 * \param[in] thread_num thread or processor number, which must be greater or equal than 1 (default)
36 * \param[in] fdir_mtd can be 0, 1, and 2, which means D8 (default), Dinf, and MFDmd, respectively
37 * \param[in] lyr_mtd can be 0 and 1, which means UP_DOWN (default) and DOWN_UP, respectively
38 * \param[in] host the address of MongoDB database, by default, MongoDB IP is 127.0.0.1 (i.e., localhost)
39 * \param[in] port port number, default is 27017
40 * \param[in] scenario_id the ID of BMPs Scenario which has been defined in BMPs database
41 * \param[in] calibration_id the ID of Calibration which has been defined in PARAMETERS table
42 * \param[in] subbasin_id the subbasin that will be executed, default is 0 which means the whole watershed
43 * \param[in] grp_mtd can be 0 and 1, which means KMETIS (default) and PMETIS, respectively
44 * \param[in] skd_mtd (TESTED) can be 0 and 1, which means SPATIAL (default) and TEMPOROSPATIAL, respectively
45 * \param[in] time_slices (TESTED) should be greater than 1, required when <skd_mtd> is 1
46 * \param[in] log_level logging level, the default is Info
47 * \param[in] mpi_version Optional, is running the MPI version?
48 */
49 InputArgs(const string& model_path, const string& model_cfgname,
51 const string& host, uint16_t port,
55 const string& log_level, bool mpi_version = false);
56
57 /*!
58 * \brief Initializer.
59 * \param[in] argc Number of arguments
60 * \param[in] argv \a char* Arguments
61 * \param[in] mpi_version Optional, is running the MPI version?
62 */
63 static InputArgs* Init(int argc, const char** argv, bool mpi_version = false);
64
65public:
66 string model_path; ///< full path of model folder which contains all inputs and outputs of all models
67 string model_cfgname; ///< config name of specific model, the default is "", it corresponds to a subfolder
68 string model_name; ///< model_name
69 string output_scene; ///< output identifier concatenated with scenario_id, calibration_id, lyr_mtd, fdir_mtd
70 string output_path; ///< full path of model outputs
71 int thread_num; ///< thread number for OpenMP
72 FlowDirMethod fdir_mtd; ///< Flow direction method for flow routing, default is 0 (D8)
73 LayeringMethod lyr_mtd; ///< Layering method for sequencing computing, default is 0
74 string host; ///< Host IP address or name of MongoDB database
75 uint16_t port; ///< port of MongoDB, 27017 is default
76 int scenario_id; ///< scenario ID defined in Database, -1 for no use.
77 int calibration_id; ///< calibration ID defined in Database (PARAMETERS), -1 for no use.
78 int subbasin_id; ///< Subbasin ID, which will be executed, 0 for whole basin, 9999 for field-version
79 GroupMethod grp_mtd; ///< Group method for parallel task scheduling, default is 0
80 ScheduleMethod skd_mtd; ///< Parallel task scheduling strategy at subbasin level by MPI
81 int time_slices; ///< Time slices for Temporal-Spatial discretization method, Wang et al. (2013). Unfinished!
82 string log_level; ///< logging level, i.e., Trace, Debug, Info (default), Warning, Error, and Fatal
83 bool mpi_version; ///< is running the MPI version?
84};
85
86#endif /* SEIMS_INPUT_ARGUMENTS_H */
Basic definitions.
Base type of all interfaces.
Definition: basic.h:407
bool mpi_version
is running the MPI version?
Definition: invoke.h:83
int thread_num
thread number for OpenMP
Definition: invoke.h:71
string model_cfgname
config name of specific model, the default is "", it corresponds to a subfolder
Definition: invoke.h:67
FlowDirMethod fdir_mtd
Flow direction method for flow routing, default is 0 (D8)
Definition: invoke.h:72
string model_path
full path of model folder which contains all inputs and outputs of all models
Definition: invoke.h:66
static InputArgs * Init(int argc, const char **argv, bool mpi_version=false)
Initializer.
int time_slices
Time slices for Temporal-Spatial discretization method, Wang et al. (2013). Unfinished!
Definition: invoke.h:81
string output_path
full path of model outputs
Definition: invoke.h:70
int subbasin_id
Subbasin ID, which will be executed, 0 for whole basin, 9999 for field-version.
Definition: invoke.h:78
GroupMethod grp_mtd
Group method for parallel task scheduling, default is 0.
Definition: invoke.h:79
string log_level
logging level, i.e., Trace, Debug, Info (default), Warning, Error, and Fatal
Definition: invoke.h:82
string output_scene
output identifier concatenated with scenario_id, calibration_id, lyr_mtd, fdir_mtd
Definition: invoke.h:69
ScheduleMethod skd_mtd
Parallel task scheduling strategy at subbasin level by MPI.
Definition: invoke.h:80
int scenario_id
scenario ID defined in Database, -1 for no use.
Definition: invoke.h:76
string host
Host IP address or name of MongoDB database.
Definition: invoke.h:74
uint16_t port
port of MongoDB, 27017 is default
Definition: invoke.h:75
int calibration_id
calibration ID defined in Database (PARAMETERS), -1 for no use.
Definition: invoke.h:77
string model_name
model_name
Definition: invoke.h:68
LayeringMethod lyr_mtd
Layering method for sequencing computing, default is 0.
Definition: invoke.h:73
InputArgs(const string &model_path, const string &model_cfgname, int thread_num, FlowDirMethod fdir_mtd, LayeringMethod lyr_mtd, const string &host, uint16_t port, int scenario_id, int calibration_id, int subbasin_id, GroupMethod grp_mtd, ScheduleMethod skd_mtd, int time_slices, const string &log_level, bool mpi_version=false)
Constructor by detailed parameters.
Parse the input arguments of SEIMS.
Definition: invoke.h:29
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
void Usage(const string &appname, const string &error_msg=std::string())
Full usage information.
Common Cross-platform Geographic Library (CCGL)
The SEIMS related definitions and utilities header.