FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTparallelwriter.hpp
Go to the documentation of this file.
1#ifndef FMTparallelwriter_H_INCLUDED
2#define FMTparallelwriter_H_INCLUDED
3#include "FMTmodelparser.hpp"
4#include <vector>
5#include <string>
6#include <memory>
7#include <boost/thread/recursive_mutex.hpp>
8#include "FMTutility.hpp"
9
10#ifdef FMTWITHGDAL
11class GDALDataset;
12class OGRLayer;
13#endif
14
15namespace Models {
16 class FMTmodel;
17}
18
19
20namespace Parallel
21{
22 // DocString: FMTparallelwriter
27 {
28 // DocString: FMTparallelwriter::outputstowrite
30 std::vector<Core::FMToutput>outputstowrite;
31 #ifdef FMTWITHGDAL
32 // DocString: FMTparallelwriter::resultsdataset
34 GDALDataset* resultsdataset;
35 // DocString: FMTparallelwriter::resultslayer
37 std::map<std::string,OGRLayer*> resultslayer;
38 // DocString: FMTparallelwriter::driftlayer
40 OGRLayer* driftlayer;
41 #endif
42 // DocString: FMTparallelwriter::mtx
44 mutable boost::recursive_mutex mtx;
45 // DocString: FMTparallelwriter::resultsminimaldrift;
47 double resultsminimaldrift;
48 // DocString: FMTparallelwriter::outputslevel
50 Core::FMToutputlevel outputslevel;
51 // DocString: FMTparallelwriter::alllayeroptions
53 std::vector<std::string> alllayeroptions;
54 // DocString: FMTparallelwriter::outputfirstperiod
56 int outputfirstperiod;
57 // DocString: FMTparallelwriter::outputlastperiod;
59 int outputlastperiod;
60 // DocString: FMTparallelwriter::projectdirectory;
62 std::string projectdirectory;
63 // DocString: FMTparallelwriter::projectname;
65 std::string projectname;
66 protected:
67 // DocString: FMTparallelwriter::getdriftprobability()
71 const std::map<std::string, std::map<double, std::vector<double>>>getdriftprobability(
72 const std::map<std::string, std::vector<std::vector<double>>>& globalvalues,
73 const std::map<std::string, std::vector<std::vector<double>>>& localvalues,
74 const bool lower = true) const;
75 public:
76 // DocString: FMTparallelwriter::FMTparallelwriter()
80 FMTparallelwriter() = default;
81 // DocString: ~FMTparallelwrite()
86 // DocString: FMTparallelwriter::FMTparallelwriter(const FMTparallelwriter&)
90 FMTparallelwriter(const FMTparallelwriter& rhs) = default;
91 // DocString: FMTparallelwriter::operator=()
95 FMTparallelwriter& operator = (const FMTparallelwriter& rhs) = default;
96 // DocString: FMTparallelwriter::FMTparallelwriter(const std::string&,const std::string&,const std::vector<Core::FMToutput>&,const Models::FMTmodel&)
100 FMTparallelwriter(const std::string& location,
101 const std::string& driver,
102 const std::vector<Core::FMToutput>& outputs,
103 const std::vector<Models::FMTmodel*>& allmodels,
104 std::vector<std::string>layersoptions = std::vector<std::string>(),
105 double minimaldrift = 0.5,
107 // DocString: FMTparallelwriter::FMTparallelwriter(const std::string&,const std::string&,std::vector<std::string>,Core::FMToutputlevel)
111 FMTparallelwriter(const std::string& location,
112 const std::string& driver,
114 std::vector<std::string>layersoptions = std::vector<std::string>(),
115 int firstperiod=1,
116 int lastperiod=1,
117 std::string primaryfilelocation = std::string());
118 // DocString: FMTparallelwriter::setlayer
122 void setlayer(const Models::FMTmodel* model);
123 // DocString: FMTparallelwriter::write()
127 void write(const std::string& modelname,
128 const std::map<std::string, std::vector<std::vector<double>>>& results,
129 const int& firstperiod, const int& lastperiod, const int& iteration) const;
130 // DocString: FMTparallelwriter::getresults()
134 std::map<std::string, std::vector<std::vector<double>>> getresults(const std::unique_ptr<Models::FMTmodel>& modelptr, const int& firstperiod, const int& lastperiod) const;
135 // DocString: FMTparallelwriter::setdriftprobability()
139 void setdriftprobability(const std::string& globalmodel, const std::string& localmodel) const;
140 // DocString: FMTparallelwriter::getandwrite()
144 void getandwrite(const std::unique_ptr<Models::FMTmodel>& modelptr, const std::vector<Core::FMToutput>& loutputs);
145 // DocString: FMTparallelwriter::close()
149 void close() noexcept;
150 };
151}
152#endif
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTmodel.hpp:60
Definition: FMTparallelwriter.hpp:27
FMTparallelwriter(const std::string &location, const std::string &driver, Core::FMToutputlevel outputlevel=Core::FMToutputlevel::totalonly, std::vector< std::string >layersoptions=std::vector< std::string >(), int firstperiod=1, int lastperiod=1, std::string primaryfilelocation=std::string())
void getandwrite(const std::unique_ptr< Models::FMTmodel > &modelptr, const std::vector< Core::FMToutput > &loutputs)
FMTparallelwriter(const FMTparallelwriter &rhs)=default
void setlayer(const Models::FMTmodel *model)
FMTparallelwriter(const std::string &location, const std::string &driver, const std::vector< Core::FMToutput > &outputs, const std::vector< Models::FMTmodel * > &allmodels, std::vector< std::string >layersoptions=std::vector< std::string >(), double minimaldrift=0.5, Core::FMToutputlevel outputlevel=Core::FMToutputlevel::totalonly)
const std::map< std::string, std::map< double, std::vector< double > > > getdriftprobability(const std::map< std::string, std::vector< std::vector< double > > > &globalvalues, const std::map< std::string, std::vector< std::vector< double > > > &localvalues, const bool lower=true) const
std::map< std::string, std::vector< std::vector< double > > > getresults(const std::unique_ptr< Models::FMTmodel > &modelptr, const int &firstperiod, const int &lastperiod) const
void write(const std::string &modelname, const std::map< std::string, std::vector< std::vector< double > > > &results, const int &firstperiod, const int &lastperiod, const int &iteration) const
void setdriftprobability(const std::string &globalmodel, const std::string &localmodel) const
Definition: FMTmodelparser.hpp:51
FMToutputlevel
Definition: FMTutility.hpp:17
@ totalonly
Definition: FMTutility.hpp:19
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTareaparser.hpp:50
Namespace for parallel tasking may include multithreading / multiprocessing.
Definition: FMTopareaschedulertask.hpp:40