BMPPointSourceFactory.h
Go to the documentation of this file.
1/*!
2 * \file BMPPointSourceFactory.h
3 * \brief Point source pollution and BMP factory
4 * \author Liang-Jun Zhu
5 * \date July 2016
6 */
7#ifndef SEIMS_BMP_POINTSOURCE_H
8#define SEIMS_BMP_POINTSOURCE_H
9
10#include "basic.h"
11#include "BMPFactory.h"
12
13using namespace ccgl;
14using namespace bmps;
15
16namespace bmps {
17/*!
18 * \class bmps::PointSourceLocations
19 * \brief Base class of point BMP, mainly store location related parameters
20 *
21 */
23public:
24 /*!
25 * \brief Constructor, parse point BMP location related parameters from bson object
26 * \param[in] bsonTable Query result from MongoDB
27 * \param[in] iter Iterator of bsonTab
28 */
29 PointSourceLocations(const bson_t*& bsonTable, bson_iter_t& iter);
30
31 /// Destructor
32 //~PointSourceLocations() = default;
33
34 /// Output
35 void Dump(std::ostream* fs);
36
37 /// Get point source ID
38 int GetPointSourceID() { return m_pointSrcID; }
39
40 /// name
41 string GetPointSourceName() { return m_name; }
42
43 /// Lat
44 FLTPT GetLat() { return m_lat; }
45
46 /// Lon
47 FLTPT GetLon() { return m_lon; }
48
49 /// localX
50 FLTPT GetLocalX() { return m_localX; }
51
52 /// localY
53 FLTPT GetLocalY() { return m_localY; }
54
55 /// Located subbasin ID
56 int GetSubbasinID() { return m_subbasinID; }
57
58 /// size
59 FLTPT GetSize() { return m_size; }
60
61 /// Distance to the downstream reach
62 FLTPT GetDistanceDown() { return m_distDown; }
63
64private:
65 /// ID of point source
66 int m_pointSrcID;
67 /// name
68 string m_name;
69 /// Lat
70 FLTPT m_lat;
71 /// Lon
72 FLTPT m_lon;
73 /// localX
74 FLTPT m_localX;
75 /// localY
76 FLTPT m_localY;
77 /// Located subbasin ID
78 int m_subbasinID;
79 /// size
80 FLTPT m_size;
81 /// Distance to the downstream reach
82 FLTPT m_distDown;
83};
84
85/*!
86 * \class bmps::PointSourceMgtParams
87 * \brief Point source management parameters
88 *
89 */
91public:
92 /*!
93 * \brief Constructor, parse point source management parameters from bson object
94 * \param[in] bsonTable Query result from MongoDB
95 * \param[in] iter Iterator of bsonTab
96 */
97 PointSourceMgtParams(const bson_t*& bsonTable, bson_iter_t& iter);
98
99 /// Destructor
100 //~PointSourceMgtParams() = default;
101
102 /// Output
103 void Dump(std::ostream* fs);
104
105 /// Get start date of the current management operation
106 time_t GetStartDate() { return m_startDate; }
107
108 /// Get end date
109 time_t GetEndDate() { return m_endDate; }
110
111 /// Get sequence number
112 int GetSequence() { return m_seqence; }
113
114 /// Get subScenario name
115 string GetSubScenarioName() { return m_name; }
116
117 /// Get water volume
118 FLTPT GetWaterVolume() { return m_waterVolume; }
119
120 /// Get sediment concentration
121 FLTPT GetSedment() { return m_sedimentConc; }
122
123 /// Get sediment concentration
124 FLTPT GetTN() { return m_TNConc; }
125
126 /// Get NO3 concentration
127 FLTPT GetNO3() { return m_NO3Conc; }
128
129 /// Get NH4 concentration
130 FLTPT GetNH4() { return m_NH4Conc; }
131
132 /// Get OrgN concentration
133 FLTPT GetOrgN() { return m_OrgNConc; }
134
135 /// Get TP concentration
136 FLTPT GetTP() { return m_TPConc; }
137
138 /// Get SolP concentration
139 FLTPT GetSolP() { return m_SolPConc; }
140
141 /// Get OrgP concentration
142 FLTPT GetOrgP() { return m_OrgPConc; }
143
144 /// Get COD concentration
145 FLTPT GetCOD() { return m_COD; }
146
147private:
148 /// subSecenario name
149 string m_name;
150 /// Sequence number of management
151 int m_seqence;
152 /// Start date
153 time_t m_startDate;
154 /// End date
155 time_t m_endDate;
156 /// Q Water volume m3/'size'/day ('Size' may be one cattle or one pig, depends on PTSRC code)
157 FLTPT m_waterVolume;
158 /// Sed Sediment concentration g/cm3, or Mg/m3
159 FLTPT m_sedimentConc;
160 /// TN Total Nitrogen concentration mg/L
161 FLTPT m_TNConc;
162 /// NO3 Nitrate Nitrogen concentration mg/L
163 FLTPT m_NO3Conc;
164 /// NH4 Ammonium Nitrogen concentration mg/L
165 FLTPT m_NH4Conc;
166 /// ORGN Organic Nitrogen concentration mg/L
167 FLTPT m_OrgNConc;
168 /// TP Total phosphorus concentration mg/L
169 FLTPT m_TPConc;
170 /// SOLP Soluble phosphorus concentration mg/L
171 FLTPT m_SolPConc;
172 /// ORGP Organic phosphorus concentration mg/L
173 FLTPT m_OrgPConc;
174 /// COD mg/L
175 FLTPT m_COD;
176};
177
178/*!
179 * \class bmps::BMPPointSrcFactory
180 * \brief Base class of point source BMPs.
181 * Actually, include point pollution sources, such as sewage outlet of animal farm.
182 *
183 */
185public:
186 /// Constructor
187 BMPPointSrcFactory(int scenarioId, int bmpId, int subScenario,
188 int bmpType, int bmpPriority, vector<string>& distribution,
189 const string& collection, const string& location);
190 /// Destructor
192
193 /// Load BMP parameters from MongoDB
194 void loadBMP(MongoClient* conn, const string& bmpDBName) OVERRIDE;
195
196 /// Output
197 void Dump(std::ostream* fs) OVERRIDE;
198
199 /*!
200 * \brief Load point BMP location related parameters from MongoDB
201 * \param[in] conn MongoClient instance
202 * \param[in] bmpDBName BMP Scenario database
203 */
204 void ReadPointSourceManagements(MongoClient* conn, const string& bmpDBName);
205
206 /*!
207 * \brief Load point BMP location related parameters from MongoDB
208 * \param[in] conn MongoClient instance
209 * \param[in] bmpDBName BMP Scenario database
210 */
211 void ReadPointSourceLocations(MongoClient* conn, const string& bmpDBName);
212
213 vector<int>& GetPointSrcMgtSeqs();
214
215 map<int, PointSourceMgtParams *>& GetPointSrcMgtMap();
216
217 vector<int>& GetPointSrcIDs();
218
219 map<int, PointSourceLocations *>& GetPointSrcLocsMap();
220
221private:
222 /// Code of point source
223 int m_pointSrc;
224 /// Collection of point source management parameters
225 string m_pointSrcMgtTab;
226 /// Sequences of point source managements
227 vector<int> m_pointSrcMgtSeqs;
228 /*!
229 * Map of point source management parameters
230 * Key: Scheduled sequence number, unique
231 * Value: Pointer of PointBMPParamters instance
232 */
233 map<int, PointSourceMgtParams *> m_pointSrcMgtMap;
234 /// Collection of point source locations
235 string m_pointSrcDistTab;
236 /// IDs of point source of current subScenario
237 vector<int> m_pointSrcIDs;
238 /*!
239 * Map of point source BMP location related parameters
240 * Key: PTSRCID, unique
241 * Value: Pointer of PointBMPParamters instance
242 */
243 map<int, PointSourceLocations *> m_pointSrcLocsMap;
244};
245}
246#endif /* SEIMS_BMP_POINTSOURCE_H */
Base namespace for implementation of BMP configuration.
Basic definitions.
#define OVERRIDE
A compatible reference to override or blank if not supported by the compiler.
Definition: basic.h:160
Base class of all kind of BMPs Factory.
Definition: BMPFactory.h:33
int bmpType()
Get BMP type 1 - reach BMPs which are attached to specific reaches and will change the character of t...
int bmpPriority()
Get BMP priority.
Base class of point source BMPs.
Definition: BMPPointSourceFactory.h:184
void ReadPointSourceManagements(MongoClient *conn, const string &bmpDBName)
Load point BMP location related parameters from MongoDB.
~BMPPointSrcFactory()
Destructor.
void loadBMP(MongoClient *conn, const string &bmpDBName) OVERRIDE
Load BMP parameters from MongoDB.
void ReadPointSourceLocations(MongoClient *conn, const string &bmpDBName)
Load point BMP location related parameters from MongoDB.
void Dump(std::ostream *fs) OVERRIDE
Output.
BMPPointSrcFactory(int scenarioId, int bmpId, int subScenario, int bmpType, int bmpPriority, vector< string > &distribution, const string &collection, const string &location)
Constructor.
Base class of point BMP, mainly store location related parameters.
Definition: BMPPointSourceFactory.h:22
FLTPT GetLocalY()
localY
Definition: BMPPointSourceFactory.h:53
FLTPT GetLat()
Lat.
Definition: BMPPointSourceFactory.h:44
FLTPT GetDistanceDown()
Distance to the downstream reach.
Definition: BMPPointSourceFactory.h:62
FLTPT GetLon()
Lon.
Definition: BMPPointSourceFactory.h:47
string GetPointSourceName()
name
Definition: BMPPointSourceFactory.h:41
PointSourceLocations(const bson_t *&bsonTable, bson_iter_t &iter)
Constructor, parse point BMP location related parameters from bson object.
int GetPointSourceID()
Get point source ID.
Definition: BMPPointSourceFactory.h:38
void Dump(std::ostream *fs)
Destructor.
int GetSubbasinID()
Located subbasin ID.
Definition: BMPPointSourceFactory.h:56
FLTPT GetLocalX()
localX
Definition: BMPPointSourceFactory.h:50
FLTPT GetSize()
size
Definition: BMPPointSourceFactory.h:59
Point source management parameters.
Definition: BMPPointSourceFactory.h:90
FLTPT GetCOD()
Get COD concentration.
Definition: BMPPointSourceFactory.h:145
FLTPT GetNH4()
Get NH4 concentration.
Definition: BMPPointSourceFactory.h:130
FLTPT GetSedment()
Get sediment concentration.
Definition: BMPPointSourceFactory.h:121
FLTPT GetWaterVolume()
Get water volume.
Definition: BMPPointSourceFactory.h:118
FLTPT GetTN()
Get sediment concentration.
Definition: BMPPointSourceFactory.h:124
PointSourceMgtParams(const bson_t *&bsonTable, bson_iter_t &iter)
Constructor, parse point source management parameters from bson object.
FLTPT GetNO3()
Get NO3 concentration.
Definition: BMPPointSourceFactory.h:127
time_t GetEndDate()
Get end date.
Definition: BMPPointSourceFactory.h:109
time_t GetStartDate()
Get start date of the current management operation.
Definition: BMPPointSourceFactory.h:106
FLTPT GetSolP()
Get SolP concentration.
Definition: BMPPointSourceFactory.h:139
void Dump(std::ostream *fs)
Destructor.
int GetSequence()
Get sequence number.
Definition: BMPPointSourceFactory.h:112
FLTPT GetOrgN()
Get OrgN concentration.
Definition: BMPPointSourceFactory.h:133
FLTPT GetTP()
Get TP concentration.
Definition: BMPPointSourceFactory.h:136
string GetSubScenarioName()
Get subScenario name.
Definition: BMPPointSourceFactory.h:115
FLTPT GetOrgP()
Get OrgP concentration.
Definition: BMPPointSourceFactory.h:142
Base type of all interfaces.
Definition: basic.h:407
A simple wrapper of the class of MongoDB Client mongoc_client_t.
Definition: db_mongoc.h:46
All BMPs scenario related data, classes, and functions.
Definition: BMPArealSourceFactory.h:22
Common Cross-platform Geographic Library (CCGL)