FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTspatialnodescache.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
9#include <unordered_map>
10#include <map>
11#include "FMTmask.hpp"
12#include "FMToutputnode.hpp"
13#include "FMTutility.hpp"
14
15
16#ifndef FMTSPATIALNODESCACHE_H
17#define FMTSPATIALNODESCACHE_H
18namespace Graph
19{
20 template<class T1,class T2>
21 class FMToutputnodecache;
22}
23
24namespace Models
25{
26 class FMTmodel;
27}
28
29namespace Spatial
30{
31 class FMTcoordinate;
33 {
34 class FMTEXPORT FMTnodecache
35 {
36 public:
37 std::unordered_map<int, double>periodicvalues;
38 bool worthintersecting;
39 boost::unordered_map<Core::FMTmask, double>patternvalues;
40 Core::FMTmask staticmask;
41 Core::FMTmask dynamicmask;
42 std::unordered_set<int>actions;
43 FMTnodecache() = default;
44 FMTnodecache(const Core::FMToutputnode& node, const Models::FMTmodel& model);
45 ~FMTnodecache() = default;
46 FMTnodecache(const FMTnodecache& rhs) = default;
47 FMTnodecache& operator = (const FMTnodecache& rhs) = default;
48 void setvalue(const int& period, const double& value);
49 void removeperiod(const int& period);
50 void clearperiod();
51 void removevaluefromperiod(const int& period, const double& value);
52 void addvaluefromperiod(const int& period, const double& value);
53 bool gotcachevalue(const int& period) const;
54 double getcachevalue(const int& period) const;
55 };
56 FMTnodecache* actualcache;
58 //boost::unordered_map<Core::FMTmask, FMTnodecache>patterncache;
59 public:
60 typedef std::unordered_map<Core::FMToutputnode, FMTnodecache, Core::FMToutputnodehasher, Core::FMToutputnodevaluecomparator> ucaching;
61 private:
62 ucaching patterncache;
63 public:
66 FMTspatialnodescache(const std::vector<FMTcoordinate>& mapping);
69 const std::vector<FMTcoordinate>& getnode(const Core::FMToutputnode& node, const Models::FMTmodel& model,bool& exactnode);
70 void setnode(const Core::FMToutputnode& node, const std::vector<FMTcoordinate>& coordinates);
71 void removeperiod(const int& period);
72 void set(const Core::FMToutputnode& node);
73 FMTnodecache* getactualnodecache();
74 void setnodecache(ucaching::iterator cashit);
76 void erasenode(const Core::FMToutputnode& node);
77 bool isworthy(const Core::FMToutputnode& node) const;
78 bool empty() const;
79 size_t size() const;
80 void insert(const FMTspatialnodescache& rhs);
81 ucaching::iterator begin();
82 ucaching::iterator end();
83
84 };
85
86}
87
88#endif // FMTLINEGRAPH_H
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTmask.hpp:96
Definition: FMToutputnode.hpp:20
Definition: FMToutputnodecache.hpp:27
Definition: FMTmodel.hpp:60
Definition: FMTspatialnodescache.hpp:33
bool isworthy(const Core::FMToutputnode &node) const
void setnodecache(ucaching::iterator cashit)
const std::vector< FMTcoordinate > & getnode(const Core::FMToutputnode &node, const Models::FMTmodel &model, bool &exactnode)
void setnode(const Core::FMToutputnode &node, const std::vector< FMTcoordinate > &coordinates)
void removeperiod(const int &period)
void set(const Core::FMToutputnode &node)
ucaching::iterator begin()
void insert(const FMTspatialnodescache &rhs)
FMTnodecache * getactualnodecache()
void erasenode(const Core::FMToutputnode &node)
std::unordered_map< Core::FMToutputnode, FMTnodecache, Core::FMToutputnodehasher, Core::FMToutputnodevaluecomparator > ucaching
Definition: FMTspatialnodescache.hpp:60
void swap(FMTspatialnodescache &rhs)
FMTspatialnodescache(const std::vector< FMTcoordinate > &mapping)
ucaching::iterator end()
FMTspatialnodescache(const FMTspatialnodescache &rhs)
Namespace for using/building unidirectional graphs in FMT.
Definition: FMTareaparser.hpp:31
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTareaparser.hpp:50
The spatial namespace provides classes for spatialy explicit simulation/optimization based on raster ...
Definition: FMTareaparser.hpp:36