FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTplanningtask.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 FMTplanningtask_H_INCLUDED
9#define FMTplanningtask_H_INCLUDED
10
11#include "FMTtask.hpp"
12#include <list>
13#include <memory>
14#include "FMTutility.hpp"
15
16
17namespace Models
18{
19 class FMTmodel;
20}
21
22namespace Core
23{
24 class FMToutput;
25 class FMTschedule;
26}
27
28
29
31namespace Parallel
32{
33 class FMTparallelwriter;
34 // DocString: FMTplanningtask
39 {
40 // DocString: FMTplanningtask::resultswriter
42 std::shared_ptr<FMTparallelwriter>resultswriter;
43 // DocString: FMTplanningtask::models
45 std::list<std::unique_ptr<Models::FMTmodel>>models;
46 // DocString: FMTplanningtask::schedules
48 std::list<std::vector<Core::FMTschedule>>allschedules;
49 // DocString: FMTplanningtask::outputs
51 std::list<std::vector<Core::FMToutput>>outputs;
52 // DocString: FMTplanningtask::keepmodels
54 bool keepmodels;
55 // DocString: FMTplanningtask::copymodels
59 std::list<std::unique_ptr<Models::FMTmodel>>copymodels(const std::list<std::unique_ptr<Models::FMTmodel>>& tocopy) const;
60 public:
61 // DocString: FMTplanningtask::FMTreplanningtask()
65 FMTplanningtask() = default;
66 // DocString: FMTplanningtask::FMTplanningtask(const FMTplanningtask&)
71 // DocString: FMTplanningtask::operator=(const FMTplanningtask&)
75 FMTplanningtask& operator = (const FMTplanningtask& rhs);
76 // DocString: FMTplanningtask::~FMTplanningtask()
80 virtual ~FMTplanningtask()=default;
81 // DocString: FMTplanningtask::clone
85 std::unique_ptr<FMTtask>clone() const;
86 // DocString: FMTplanningtask::setkeepmodels
91 // DocString: FMTplanningtask::push_back
96 void push_back(const Models::FMTmodel& model,
97 std::vector<Core::FMTschedule>schedules = std::vector<Core::FMTschedule>(),
98 std::vector<Core::FMToutput>louputs = std::vector<Core::FMToutput>());
99 // DocString: FMTplanningtask::FMTplanningtask(...)
103 FMTplanningtask(const int& minoutputperiod,
104 const int& maxoutputperiod,
105 const std::string& outputlocation,
106 std::string gdaldriver = "CSV",
107 std::vector<std::string>creationoptions= std::vector<std::string>(),
109 std::string primaryfilelocatiron = std::string());
110 // DocString: FMTplanningtask::split
114 virtual std::vector<std::unique_ptr<FMTtask>>split(const unsigned int& numberoftasks) const;
115 // DocString: FMTplanningtask::spawn
119 virtual std::unique_ptr<FMTtask>spawn();
120 // DocString: FMTplanningtask::work
124 virtual void work();
125 // DocString: FMTplanningtask::finalize
129 virtual void finalize();
130 // DocString: FMTplanningtask::passinlogger
134 void passinlogger(const std::shared_ptr<Logging::FMTlogger>& logger) override;
135 // DocString: FMTplanningtask::getmodelsfromdynamiccast
139 template<class ptrtype>
140 const std::vector<const ptrtype*> getmodelsfromdynamiccast() const
141 {
142 std::vector<const ptrtype*>castedptr;
143 for (const std::unique_ptr<Models::FMTmodel>& model : models)
144 {
145 castedptr.push_back(dynamic_cast<const ptrtype*>(model.get()));
146 }
147 return castedptr;
148 }
149
150 };
151
152}
153
154
155
156#endif
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTmodel.hpp:60
Definition: FMTplanningtask.hpp:39
virtual ~FMTplanningtask()=default
void passinlogger(const std::shared_ptr< Logging::FMTlogger > &logger) override
std::unique_ptr< FMTtask > clone() const
FMTplanningtask(const int &minoutputperiod, const int &maxoutputperiod, const std::string &outputlocation, std::string gdaldriver="CSV", std::vector< std::string >creationoptions=std::vector< std::string >(), Core::FMToutputlevel outputlevel=Core::FMToutputlevel::standard, std::string primaryfilelocatiron=std::string())
const std::vector< const ptrtype * > getmodelsfromdynamiccast() const
Definition: FMTplanningtask.hpp:140
virtual std::vector< std::unique_ptr< FMTtask > > split(const unsigned int &numberoftasks) const
FMTplanningtask(const FMTplanningtask &rhs)
virtual std::unique_ptr< FMTtask > spawn()
void push_back(const Models::FMTmodel &model, std::vector< Core::FMTschedule >schedules=std::vector< Core::FMTschedule >(), std::vector< Core::FMToutput >louputs=std::vector< Core::FMToutput >())
Definition: FMTtask.hpp:28
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 for parallel tasking may include multithreading / multiprocessing.
Definition: FMTopareaschedulertask.hpp:40