FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTyieldhandler.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 FMTYLDDATA_H_INCLUDED
9#define FMTYLDDATA_H_INCLUDED
10
11#include <string>
12#include <map>
13#include <unordered_map>
14#include <unordered_set>
15#include <algorithm>
16#include <boost/serialization/serialization.hpp>
17#include <boost/serialization/nvp.hpp>
18#include "FMTmask.hpp"
19#include <vector>
20#include "FMTutility.hpp"
21#include "FMTobject.hpp"
22#include "FMTbounds.hpp"
23
24namespace Core
25{
26class FMTyieldrequest;
27class FMTspec;
28class FMTdata;
29
31{
32 friend class boost::serialization::access;
33 template<class Archive>
34 void serialize(Archive& ar, const unsigned int version)
35 {
36 ar & BOOST_SERIALIZATION_NVP(mask);
37 ar & BOOST_SERIALIZATION_NVP(bases);
38 }
39protected:
41 std::vector<int>bases;
42 mutable std::unordered_set<std::string>lookat;
43 bool basepush_data(std::map<std::string, FMTdata>& elements,const std::string& yld, const double& value);
44 bool basepush_data(std::map<std::string, FMTdata>& elements,const std::string& yld, const FMTdata& data);
45 double getchangesfrom(const int& targetage, const int& peakstep) const;
46 int getmaxbase(const FMTyieldrequest& request) const;
47public:
48 virtual size_t getoverrideindex() const;
49 virtual std::vector<size_t> gettabous() const;
50 virtual void setoverrideindex(const size_t& newindex);
51 virtual ~FMTyieldhandler() = default;
52 FMTyieldhandler() = default;
53 FMTyieldhandler(const FMTyieldhandler& rhs) = default;
54 FMTyieldhandler& operator = (const FMTyieldhandler& rhs) = default;
55 FMTyieldhandler(const FMTmask& lmask);
56 double getlinearvalue(const std::vector<double>& dls, const int& agetarget, bool allowoutofrange) const;
57 virtual int getlastbase() const;
58 const std::vector<int>& getbases() const;
60 bool push_base(const int& base);
61 void setbase(const std::vector<int>& allvalues);
62 bool inlookat(const std::string& yld) const;
63 virtual double getlastvalue(const std::string yld) const;
64 virtual double get(const std::string& yld, const FMTyieldrequest& request) const;
65 virtual bool push_data(const std::string& yld, const double& value);
66 virtual bool push_data(const std::string& yld, const FMTdata& data);
67 virtual std::vector<std::string> indexes(const std::vector<std::string>& names) const;
68 virtual operator std::string() const;
69 virtual std::vector<std::string> compare(const std::vector<std::string>& keys) const;
70 virtual std::unique_ptr<FMTyieldhandler>clone() const;
71 virtual bool operator == (const FMTyieldhandler& rhs) const;
72 virtual bool empty() const;
73 virtual size_t size() const;
74 virtual FMTyldtype gettype() const;
75 virtual FMTdata& operator[](const std::string& yldname);
76 virtual const FMTdata& at(const std::string& yldname) const;
77 virtual bool containsyield(const std::string& yldname) const;
78 virtual bool isnullyield(const std::string& yldname) const;
79 virtual std::vector<std::string>getyieldnames() const;
80 virtual void clearcache();
81 virtual std::map<std::string, std::vector<double>>getallyieldsdata(const int& maxbase)const;
82 virtual std::unique_ptr<FMTyieldhandler> presolve(const FMTmaskfilter& filter, const std::vector<FMTtheme>& newthemes) const;
83 virtual std::unique_ptr<FMTyieldhandler> postsolve(const FMTmaskfilter& filter,const std::vector<FMTtheme>& basethemes) const;
84 virtual std::unique_ptr<FMTyieldhandler> getfromfactor(const double& factor,
85 std::vector<std::string>yieldnames = std::vector<std::string>()) const;
86 virtual int getendpoint(const std::string& yld, const int& lowerstep, const double& bound, const double& value) const;
87 virtual double getpeak(const FMTyieldrequest& request,const std::string& yld, const int& targetage) const;
88 virtual int getage(const FMTyieldrequest& request, const FMTspec& spec) const;
89 virtual double getyieldlinearvalue(const std::string&yldname, const FMTyieldrequest& request, bool allowoutofrange=true) const;
90
91
92};
93
94}
95#endif // FMTYLDDATA_H_INCLUDED
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTdata.hpp:32
Definition: FMTmask.hpp:96
Definition: FMTmaskfilter.hpp:27
Definition: FMTobject.hpp:50
Definition: FMTbounds.hpp:342
Definition: FMTyieldhandler.hpp:31
virtual std::vector< std::string > indexes(const std::vector< std::string > &names) const
virtual int getlastbase() const
virtual std::vector< std::string > compare(const std::vector< std::string > &keys) const
virtual bool empty() const
virtual std::unique_ptr< FMTyieldhandler > presolve(const FMTmaskfilter &filter, const std::vector< FMTtheme > &newthemes) const
virtual std::unique_ptr< FMTyieldhandler > postsolve(const FMTmaskfilter &filter, const std::vector< FMTtheme > &basethemes) const
virtual bool push_data(const std::string &yld, const FMTdata &data)
virtual const FMTdata & at(const std::string &yldname) const
virtual std::vector< size_t > gettabous() const
void setbase(const std::vector< int > &allvalues)
virtual size_t getoverrideindex() const
std::unordered_set< std::string > lookat
Definition: FMTyieldhandler.hpp:42
virtual double getlastvalue(const std::string yld) const
virtual double getpeak(const FMTyieldrequest &request, const std::string &yld, const int &targetage) const
const std::vector< int > & getbases() const
bool push_base(const int &base)
virtual size_t size() const
virtual double getyieldlinearvalue(const std::string &yldname, const FMTyieldrequest &request, bool allowoutofrange=true) const
int getmaxbase(const FMTyieldrequest &request) const
virtual FMTdata & operator[](const std::string &yldname)
FMTmask getmask() const
double getchangesfrom(const int &targetage, const int &peakstep) const
virtual bool containsyield(const std::string &yldname) const
virtual bool push_data(const std::string &yld, const double &value)
bool basepush_data(std::map< std::string, FMTdata > &elements, const std::string &yld, const double &value)
virtual FMTyldtype gettype() const
virtual std::vector< std::string > getyieldnames() const
virtual std::unique_ptr< FMTyieldhandler > clone() const
virtual void setoverrideindex(const size_t &newindex)
bool basepush_data(std::map< std::string, FMTdata > &elements, const std::string &yld, const FMTdata &data)
virtual std::map< std::string, std::vector< double > > getallyieldsdata(const int &maxbase) const
FMTyieldhandler(const FMTyieldhandler &rhs)=default
double getlinearvalue(const std::vector< double > &dls, const int &agetarget, bool allowoutofrange) const
bool inlookat(const std::string &yld) const
virtual double get(const std::string &yld, const FMTyieldrequest &request) const
virtual void clearcache()
FMTyieldhandler(const FMTmask &lmask)
virtual ~FMTyieldhandler()=default
virtual bool isnullyield(const std::string &yldname) const
virtual std::unique_ptr< FMTyieldhandler > getfromfactor(const double &factor, std::vector< std::string >yieldnames=std::vector< std::string >()) const
FMTmask mask
Definition: FMTyieldhandler.hpp:40
std::vector< int > bases
Definition: FMTyieldhandler.hpp:41
virtual int getendpoint(const std::string &yld, const int &lowerstep, const double &bound, const double &value) const
virtual int getage(const FMTyieldrequest &request, const FMTspec &spec) const
Definition: FMTyieldrequest.hpp:36
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31
FMTyldtype
Definition: FMTutility.hpp:45