8#ifndef FMTmodelparser_Hm_included
9#define FMTmodelparser_Hm_included
34class FMTConstantParser;
35class FMTLandscapeParser;
39class FMTLifespanParser;
41class FMTOptimizationParser;
42class FMTScheduleParser;
88 const std::string& lif,
const std::string& are,
const std::string& yld,
89 const std::string& act,
const std::string& tr,
const std::string& out,
90 std::string opt = std::string());
98 std::vector<Models::FMTModel>
readTemplates(
const std::string& primarym_location,
const std::string& templatefolder);
109 std::vector<Models::FMTModel>
readproject(
const std::string& primarym_location,
110 std::vector<std::string>scenarios = std::vector<std::string>(),
111 bool readarea =
true,
bool readoutputs =
true,
bool readoptimize =
true);
127 std::vector<std::vector<Core::FMTSchedule>>
readSchedules(
const std::string& primarym_location,
128 const std::vector<Models::FMTModel>& models);
156 const std::string& p_modelName,
157 GDALDataset* p_dataset,
158 std::vector<std::string> p_creationOptions = std::vector<std::string>())
const;
169 const std::vector<Core::FMTOutput>&theoutputs,
170 const int& iteration,
const int& firstPeriod,
const int&lastPeriod)
const;
181 void writeFeatures(OGRLayer* layer,
const int& firstPeriod,
const int& iteration,
182 const std::vector<Core::FMTOutput>&theoutputs,
183 const std::map<std::string,std::vector<std::vector<double>>>& values,
bool writeNaN =
false)
const;
196 const std::vector<Core::FMTOutput>&theoutputs,
197 const int& firstPeriod,
const int& lastPeriod,
198 const std::string& location,
200 std::string gdaldrivername=
"CSV")
const;
218 OGRLayer*
createDriftLayer(GDALDataset* dataset, std::vector<std::string> creationoptions = std::vector<std::string>())
const;
226 void writeDrift(OGRLayer* layer,
const std::map<std::string, std::map<
double, std::vector<double>>>& lowervalues,
227 const std::map<std::string, std::map<
double, std::vector<double>>>& uppervalues)
const;
244 const std::string& location,
245 const std::string& lanfile,
246 const std::string& arefile,
247 const std::string& yldfile,
248 const std::string& actfile,
249 const std::string& trnfile,
250 const std::string& outfile,
251 const std::string& optfile,
252 const std::string& liffile,
253 std::string seqfile = std::string())
const;
269 const std::string& lanfile,
270 const std::string& arefile,
271 const std::string& yldfile,
272 const std::string& actfile,
273 const std::string& trnfile,
274 const std::string& outfile,
275 const std::string& optfile,
276 const std::string& liffile,
277 const std::string& seqfile)
const;
296 Models::FMTModel referenceRead(std::map<std::string, std::vector<int>>& commonm_sections,
297 std::vector<Models::FMTModel>& models,
298 const std::string& con,
const std::string& lan,
299 const std::string& lif,
const std::string& are,
const std::string& yld,
300 const std::string& act,
const std::string& tr,
const std::string& out,
301 std::string opt = std::string(),
bool allow_mapping =
false);
314 std::vector<Models::FMTModel>readFromFolder(
const std::string& primarym_location,
315 const std::string& folder,
316 std::vector<std::string>scenarios,
317 bool validatescenarioname,
318 bool readarea =
true,
bool readoutputs =
true,
bool readoptimize =
true);
325 void setSolverParameters(
Models::FMTModel& p_model,
const std::string& p_optimize_file)
const;
#define FMTEXPORT
Definition: FMTutility.h:125
Class holding the constants defined in the constants section of a model, used by the parsers.
Definition: FMTConstants.h:28
Base class for the different models in FMT.
Definition: FMTModel.h:62
Main parser reading and writing model files, for single or multiple scenarios, using all the other FM...
Definition: FMTModelParser.h:48
std::vector< Core::FMTConstraint > getConstraintsFromString(std::string constraintstr, const Models::FMTModel &model, Core::FMTConstants constants=Core::FMTConstants())
Get constraints from a string.
FMTModelParser()
Default constructor for FMTModelParser.
FMTModelParser(const FMTModelParser &rhs)
Copy constructor for FMTModelParser.
OGRLayer * createDriftLayer(GDALDataset *dataset, std::vector< std::string > creationoptions=std::vector< std::string >()) const
Create an output drift layer.
void writePrimary(const std::string &location, const std::string &lanfile, const std::string &arefile, const std::string &yldfile, const std::string &actfile, const std::string &trnfile, const std::string &outfile, const std::string &optfile, const std::string &liffile, std::string seqfile=std::string()) const
Write the primary file with the section file names.
std::vector< Models::FMTModel > readTemplates(const std::string &primarym_location, const std::string &templatefolder)
Read the base model then load each folder in the template folder as a scenario of the base model.
void writeResults(const Models::FMTModel &model, const std::vector< Core::FMTOutput > &theoutputs, const int &firstPeriod, const int &lastPeriod, const std::string &location, Core::FMToutputlevel level=Core::FMToutputlevel::standard, std::string gdaldrivername="CSV") const
Write the results of a model from the first to the last period for a vector of outputs into a GDAL dr...
void writeDrift(OGRLayer *layer, const std::map< std::string, std::map< double, std::vector< double > > > &lowervalues, const std::map< std::string, std::map< double, std::vector< double > > > &uppervalues) const
Write the drift lower and upper values to a layer.
std::vector< std::vector< Core::FMTSchedule > > readSchedules(const std::string &primarym_location, const std::vector< Models::FMTModel > &models)
Read the schedule files of the models based on a primary file.
std::map< std::string, std::vector< std::vector< double > > > getIterationsValues(OGRLayer *layer) const
Return all the values per iteration and period from a layer.
void write(const Models::FMTModel &model, const std::string &folder) const
Write a model into a folder, naming the files based on the model name.
Models::FMTModel read(const std::string &con, const std::string &lan, const std::string &lif, const std::string &are, const std::string &yld, const std::string &act, const std::string &tr, const std::string &out, std::string opt=std::string())
Read a single model and return it as a FMTModel.
virtual ~FMTModelParser()=default
Default virtual destructor for FMTModelParser.
OGRLayer * createResultsLayer(const std::string &p_modelName, GDALDataset *p_dataset, std::vector< std::string > p_creationOptions=std::vector< std::string >()) const
Create a results layer on a dataset for a given model name.
void fillUpInfeasibles(OGRLayer *layer, const std::vector< Core::FMTOutput > &theoutputs, const int &iteration, const int &firstPeriod, const int &lastPeriod) const
Fill up an OGR layer with infeasible values.
std::vector< Models::FMTModel > readproject(const std::string &primarym_location, std::vector< std::string >scenarios=std::vector< std::string >(), bool readarea=true, bool readoutputs=true, bool readoptimize=true)
Read multiple scenarios based on a primary file location.
void writeModel(const Models::FMTModel &model, const std::string &lanfile, const std::string &arefile, const std::string &yldfile, const std::string &actfile, const std::string &trnfile, const std::string &outfile, const std::string &optfile, const std::string &liffile, const std::string &seqfile) const
Write the sections of a model, and the schedules if the schedule file is not empty.
void writeToProject(const std::string &primarym_location, const Models::FMTModel &model)
Create a primary file if needed and write the model as a root scenario, or as a new scenario if the p...
void writeFeatures(OGRLayer *layer, const int &firstPeriod, const int &iteration, const std::vector< Core::FMTOutput > &theoutputs, const std::map< std::string, std::vector< std::vector< double > > > &values, bool writeNaN=false) const
Write multiple features to a layer.
Main parent class of all the parsers in FMT.
Definition: FMTParser.h:72
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
FMToutputlevel
Enumerator describing the level of detail of an output (standard, total only, development).
Definition: FMTutility.h:22
@ standard
Definition: FMTutility.h:23
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTAreaParser.h:54
Namespace handling all FMT's parsers. Everything related to I/O should be located in this namespace.
Definition: FMTActionParser.h:27