lreis2415 / SEIMS

Spatially Explicit Integrated Modeling System --- open-source, cross-platform, and high performance computation
https://lreis2415.github.io/SEIMS/
GNU General Public License v3.0
50 stars 34 forks source link

更新了河道参数的输入和读取结构,并整理了部分模块的代码 #34

Closed crazyzlj closed 6 years ago

crazyzlj commented 6 years ago

SEIMS模型中河道汇流相关模块变量设计

SEIMS模型在数据预处理时将子流域(即河道,Subbasin/Stream/Reach/Channel ID)编号按1~N排序,并将河道相关参数导入MongoDB数据库中(REACHES表),河道参数在构建DataCenterMongoDB实例时由clsReaches读入内存中。

为了规范河道汇流相关模块变量的使用,尤其是数组下标的使用,特作此说明。

下图是一个简单的流域河道示例,共划分7个子流域。

+---------------------------------------------+
|                                             |
|                            X                |
|                            X ID: 1          |
|              ID:3         XX                |
|           XXX            XX                 |
|             XX         XXX                  |
|              XX     XXXX                    |
|               X    XX                       |
|               X  XX                         |
|               XXXX                          |
|  XXX ID:6      X                            |
|    XX          X ID:2           XX ID:4     |
|     XXX        X             XXX            |
|       XXXXXXXXXX            XX              |
|                XX ID:5    XXX               |
|                 XXX     XXX                 |
|                    XXXXXX                   |
|                       XXXXX      ID:7       |
|                           XXXXXXXX          |
|                                   XXXXX     |
|                                       XXXX  |
|                                             |
+---------------------------------------------+

C++中数组下标从0开始,而为了方便理解和编程,我们做如下约定:

变量举例(请保持变量名和含义的一致性):

int m_reachNum; // 7
vector<int> m_reachIDs; // 0, 1, 2, 3, 4, 5, 6, 7
vector<vector<int> > m_reachUpStream; // [[],[],[1,3],[],[],[2,6],[],[4,5]]
map<int, clsReach *> m_reachesMap; // {1: clsReach<1>; ...}
map<int, vector<int> > m_reachLayers; 
// 1. UpDown: {1:[1,3,4,6],2:[2],3:[5],4:[7]}
// 2. DownUp: {1:[1,3],2:[2,6],3:[4,5],4:[7]}

@liujunzhi321 @Shenfang1993