FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTmodelparser.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2019 Gouvernement du Québec
3
4SPDX-License-Identifier: LiLiQ-R-1.1
5License-Filename: LICENSES/EN/LiLiQ-R11unicode.txt
6*/
7
8#ifndef FMTmodelparser_H_INCLUDED
9#define FMTmodelparser_H_INCLUDED
10
11
12#include <map>
13#include <string>
14#include <vector>
15#include "FMTparser.hpp"
16//#include "FMToutput.hpp"
17#include "FMToutputnode.hpp"
18#include "FMTconstants.hpp"
19
20
21namespace Models {
22 class FMTmodel;
23}
24
25
26namespace Core {
27 class FMTschedule;
28 class FMTconstraint;
29 class FMToutput;
30}
31
32
33namespace Parser
34{
35class FMTconstantparser;
36class FMTlandscapeparser;
37class FMTareaparser;
38class FMTyieldparser;
39class FMTactionparser;
40class FMTlifespanparser;
41class FMToutputparser;
42class FMToptimizationparser;
43class FMTscheduleparser;
44// DocString: FMTmodelparser
51 {
52 // DocString: FMTmodelparser::referenceread
58 Models::FMTmodel referenceread(std::map<std::string, std::vector<int>>& common_sections,
59 std::vector<Models::FMTmodel>& models,
60 const std::string& con, const std::string& lan,
61 const std::string& lif, const std::string& are, const std::string& yld,
62 const std::string& act, const std::string& tr, const std::string& out,
63 std::string opt = std::string(),bool allow_mapping=false);
64 // DocString: FMTmodelparser::readfromfolder
69 std::vector<Models::FMTmodel>readfromfolder(const std::string& primary_location,
70 const std::string& folder,
71 std::vector<std::string>scenarios,
72 bool validatescenarioname,
73 bool readarea=true, bool readoutputs=true, bool readoptimize=true);
74 protected:
75 #ifdef FMTWITHGDAL
76 // DocString: FMTmodelparser::getiterationsvalues()
80 std::map<std::string,std::vector<std::vector<double>>>getiterationsvalues(OGRLayer* layer) const;
81 // DocString: FMTmodelparser::createdriftlayer()
85 OGRLayer* createdriftlayer(GDALDataset* dataset, std::vector<std::string> creationoptions = std::vector<std::string>()) const;
86 // DocString: FMTmodelparser::writedriftr()
90 void writedrift(OGRLayer* layer,const std::map<std::string,std::map<double,std::vector<double>>>& lowervalues,
91 const std::map<std::string, std::map<double, std::vector<double>>>& uppervalues) const;
92 #endif
93 // DocString: FMTmodelparser::writeprimary()
98 const std::string& location,
99 const std::string& lanfile,
100 const std::string& arefile,
101 const std::string& yldfile,
102 const std::string& actfile,
103 const std::string& trnfile,
104 const std::string& outfile,
105 const std::string& optfile,
106 const std::string& liffile,
107 std::string seqfile=std::string()) const;
108 // DocString: FMTmodelparser::writemodel
112 void writemodel(const Models::FMTmodel& model,
113 const std::string& lanfile,
114 const std::string& arefile,
115 const std::string& yldfile,
116 const std::string& actfile,
117 const std::string& trnfile,
118 const std::string& outfile,
119 const std::string& optfile,
120 const std::string& liffile,
121 const std::string& seqfile) const;
122 public:
123 // DocString: FMTmodelparser()
128 // DocString: ~FMTmodelparser()
132 virtual ~FMTmodelparser() = default;
133 // DocString: FMTmodelparser(const FMTmodelparser&)
138 // DocString: FMTmodelparser::operator=
142 FMTmodelparser& operator = (const FMTmodelparser& rhs);
143 // DocString: FMTmodelparser::read
149 Models::FMTmodel read(const std::string& con,const std::string& lan,
150 const std::string& lif,const std::string& are,const std::string& yld,
151 const std::string& act,const std::string& tr,const std::string& out,
152 std::string opt = std::string());
153 // DocString: FMTmodelparser::readtemplate
159 std::vector<Models::FMTmodel>readtemplates(const std::string& primary_location,const std::string& templatefolder);
160 // DocString: FMTmodelparser::readproject
169 std::vector<Models::FMTmodel>readproject(const std::string& primary_location,
170 std::vector<std::string>scenarios = std::vector<std::string>(),
171 bool readarea = true,bool readoutputs = true, bool readoptimize = true);
172 // DocString: FMTmodelparser::writetoproject
178 void writetoproject(const std::string& primary_location,
179 const Models::FMTmodel& model);
180 // DocString: FMTmodelparser::readschedules
187 std::vector<std::vector<Core::FMTschedule>>readschedules(const std::string& primary_location,
188 const std::vector<Models::FMTmodel>& models);
189 // DocString: FMTmodelparser::getconstraintsfromstring
193 std::vector<Core::FMTconstraint>getconstraintsfromstring(std::string constraintstr,
194 const Models::FMTmodel& model,Core::FMTconstants constants = Core::FMTconstants());
195 // DocString: FMTmodelparser::write
200 void write(const Models::FMTmodel& model,const std::string& folder) const;
201 #ifdef FMTWITHGDAL
202 // DocString: FMTmodelparser::createresultslayer
206 OGRLayer* createresultslayer(const Models::FMTmodel& model,
207 GDALDataset* dataset, std::vector<std::string> creationoptions=std::vector<std::string>())const;
208 // DocString: FMTmodelparser::fillupinfeasibles
212 void fillupinfeasibles(OGRLayer* layer,
213 const std::vector<Core::FMToutput>&theoutputs,
214 const int& iteration,const int& firstperiod, const int&lastperiod) const;
215 // DocString: FMTmodelparser::writefeatures
219 void writefeatures(OGRLayer* layer,const int& firstperiod, const int& iteration,
220 const std::vector<Core::FMToutput>&theoutputs,
221 const std::map<std::string,std::vector<std::vector<double>>>& values, bool writeNaN = false)const;
222 // DocString: FMTmodelparser::writeresults
228 const std::vector<Core::FMToutput>&theoutputs,
229 const int& firstperiod, const int& lastperiod,
230 const std::string& location,
232 std::string gdaldrivername= "CSV") const;
233 #endif
234 };
235}
236
237#endif // FMTmodelparser_H_INCLUDED
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTconstants.hpp:29
Definition: FMTmodel.hpp:60
Definition: FMTmodelparser.hpp:51
void write(const Models::FMTmodel &model, const std::string &folder) const
OGRLayer * createresultslayer(const Models::FMTmodel &model, GDALDataset *dataset, std::vector< std::string > creationoptions=std::vector< std::string >()) const
virtual ~FMTmodelparser()=default
void writetoproject(const std::string &primary_location, const Models::FMTmodel &model)
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
std::vector< Core::FMTconstraint > getconstraintsfromstring(std::string constraintstr, const Models::FMTmodel &model, Core::FMTconstants constants=Core::FMTconstants())
OGRLayer * createdriftlayer(GDALDataset *dataset, std::vector< std::string > creationoptions=std::vector< std::string >()) const
std::vector< Models::FMTmodel > readtemplates(const std::string &primary_location, const std::string &templatefolder)
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
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
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
std::vector< Models::FMTmodel > readproject(const std::string &primary_location, std::vector< std::string >scenarios=std::vector< std::string >(), bool readarea=true, bool readoutputs=true, bool readoptimize=true)
FMTmodelparser(const FMTmodelparser &rhs)
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())
void fillupinfeasibles(OGRLayer *layer, const std::vector< Core::FMToutput > &theoutputs, const int &iteration, const int &firstperiod, const int &lastperiod) const
std::vector< std::vector< Core::FMTschedule > > readschedules(const std::string &primary_location, const std::vector< Models::FMTmodel > &models)
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
std::map< std::string, std::vector< std::vector< double > > > getiterationsvalues(OGRLayer *layer) const
Definition: FMTparser.hpp:66
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31
FMToutputlevel
Definition: FMTutility.hpp:17
@ standard
Definition: FMTutility.hpp:18
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTareaparser.hpp:50
Namespace handling all FMT's parsers. Everything related to I/O should be located in this namespace.
Definition: FMTactionparser.hpp:26