-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLSDModelDriver.hpp
199 lines (162 loc) · 6.21 KB
/
LSDModelDriver.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// LSDModelDriver
// Land Surface Dynamics Model(s) Driver
//
// This object parses parameter files and drives the models:
//
// LSDRasterModel
// LSDCatchmentModel (coming soon to a repository near you)
//
// Its purpose is to stop having to write a bunch of .cpp driver functions and instead
// be able to write a parameter files without compiling
//
// Developed by:
// Simon M. Mudd
// Martin D. Hurst
// David T. Milodowski
// Stuart W.D. Grieve
// Declan A. Valters
// Fiona Clubb
//
// Copyright (C) 2014 Simon M. Mudd 2014
//
// Developer can be contacted by simon.m.mudd _at_ ed.ac.uk
//
// Simon Mudd
// University of Edinburgh
// School of GeoSciences
// Drummond Street
// Edinburgh, EH8 9XP
// Scotland
// United Kingdom
//
// This program 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 2 of the License, or (at your option) any later version.
//
// This 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.
//
// You should have received a copy of the
// GNU General Public License along with this program;
// if not, write to:
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301
// USA
//
///=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
///
/// This object is written by
/// @author Simon M. Mudd, University of Edinburgh
/// @author David T. Milodowski, University of Edinburgh
/// @author Martin D. Hurst, British Geological Survey
/// @author Fiona Clubb, University of Edinburgh
/// @author Stuart Grieve, University of Edinburgh
/// @author James Jenkinson, University of Edinburgh
/// @author Declan Valters, University of Manchester
///
///=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
///
/// Version 0.0.1 2015-01-15
///=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <string>
#include "LSDAnalysisDriver.hpp"
#include "LSDRasterModel.hpp"
#include "LSDCatchmentModel.hpp"
#ifndef LSDModelDriver_H
#define LSDModelDriver_H
/// @brief This is a class to manage running LSDTopoTools. It parses a parameter
/// file and then manages running of analyses.
/// @details The intention of this object is to run analyses via parameter
/// files and not through numerous compiled driver functions. We eventually
/// will want some kind of 'recorder' so that any time this object
/// runs an analysis it gives a full report of what analyses were run so that
/// results are reproducable
class LSDModelDriver : public LSDCatchmentModel, LSDRasterModel //(not sure about this - perhaps keep them totally separate for now?)
{
public:
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//
// Constructors
//
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/// @brief The default constructor.
/// @details this asks for a pathname and a filename of the parameter file
/// It then opens the paramter file and ingests the information
/// @author DAV
/// @date 2015-01-16
LSDModelDriver()
{
create();
}
/// @brief this constructor just reads the param file given by the path and
/// filename. You must give the parameter file extension!
/// @param pname the pathname to the parameter file
/// @param fname the filename of the parameter file !!INCLUDING EXTENSION!!
/// @author DAV
/// @date 2015-01-16
LSDModelDriver(string pname, string pfname)
{
create(pname, pfname);
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//
// Main drivers of reading, computation and writing of data
//
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/// @brief This is the main function for parsing the parameter file
/// @param pathname the path to the paramter file
/// @param param_fname the name of the parameter file
/// @author SMM
/// @date 29/07/2014
void ingest_data(string pname, string p_fname);
void select_model_from_model_map();
void run_LSDCatchmentModel_components();
void run_LSDRasterModel_components();
protected:
/// the path to the datafiles
string pathname;
/// the name of the parameter file
string param_fname;
/// Extension for reading DEMs. Correspondence with write extensions is checked
string dem_read_extension;
/// Extension for writing DEMs. Correspondence with read extensions is checked
string dem_write_extension;
/// Path to files being written. Default is pathname
string write_path;
/// file prefix of files to be written. Default is the param name prefix
string write_fname;
/// Path to files being read. Default is pathname
string read_path;
/// file prefix of files to be written. Default is the param name prefix
string read_fname;
private:
void check_pathname_for_slash();
/// This holds names of the different model cores that can be run from the
/// Model Driver
std::map<string,string> model_map;
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//
// CREATE FUNCTIONS
//
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/// @brief default create function
/// @details this asks for a pathname and a filename of the parameter file
/// It then opens the paramter file and ingests the information
/// @author DAV
/// @date 2015-01-16
void create();
/// @brief create function
/// @param pname the pathname to the parameter file
/// @param fname the filename of the parameter file !!INCLUDING EXTENSION!!
/// @author DAV
/// @date 201-01-16
void create(string pname, string fname);
};
#endif