FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTPatchRules.h
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 FMTPATCHRULES_m_included
9#define FMTPATCHRULES_m_included
10
11#include <vector>
12#include <set>
13#include "FMTObject.h"
14
15namespace Core {
16 class FMTConstraint;
17 class FMTAction;
18}
19
20
21namespace Spatial
22
23{
24 class FMTEventContainer;
25 class FMTEvent;
26 class FMTSpatialGraphs;
27 // DocString: FMTPatchRules
32 {
33 public:
34 // DocString: FMTPatchRules()
38 FMTPatchRules()=default;
39 // DocString: FMTPatchRules(const FMTPatchRules)
44 FMTPatchRules(const FMTPatchRules& rhs) = default;
45 // DocString: FMTPatchRules::operator=
52 // DocString: FMTPatchRules::getRules
59 static std::vector<FMTPatchRules>
60 getRules(const std::vector<Core::FMTConstraint>& p_constraints,
61 const std::vector<Core::FMTAction>& p_actions);
62 // DocString: FMTPatchRules::evaluate
69 double evaluate(const FMTEventContainer& p_events,
70 const FMTSpatialGraphs& p_SpatialGraphs) const;
71 // DocString: FMTPatchRules::fillTooSmallEvents
78 std::vector<std::set<FMTEvent>::iterator>& p_SmallEvents,
79 FMTEventContainer& p_events) const;
80 // DocString: FMTPatchRules::fillTooBigEvents
86 void fillTooBigEvents(std::vector<std::set<FMTEvent>::iterator>& p_BigEvents,
87 FMTEventContainer& p_events) const;
88 // DocString: FMTPatchRules::fillDispersionEvents
95 void fillDispersionEvents(std::vector<std::set<FMTEvent>::iterator>& p_Dispersion,
96 FMTEventContainer& p_events, const FMTSpatialGraphs& p_SpatialGraphs) const;
97 private:
98 // DocString: FMTPatchRules(const std::vector<Core::FMTConstraint>&,const std::vector<Core::FMTAction>&,int)
105 FMTPatchRules(const std::vector<Core::FMTConstraint>& p_constraints,
106 const std::vector<Core::FMTAction>& p_actions, int p_Id);
107 // DocString: FMTPatchRules::_buildPatchRules
114 void _buildPatchRules(const std::vector<Core::FMTConstraint>& p_constraints,
115 const std::vector<Core::FMTAction>& p_actions, int p_Id);
116 // DocString: FMTPatchRules::_getOrderedRules
123 static std::vector<std::pair<std::vector<int>,
124 std::pair<int,int>>> _getOrderedRules(const std::vector<Core::FMTConstraint>& p_constraints,
125 const std::vector<Core::FMTAction>& p_actions);
126 // DocString: FMTPatchRules::_getBounds
135 template <typename U>
136 static void _getBounds(double p_lower, double p_upper,
137 U& p_NewLower, U& p_NewUpper);
138 // DocString: FMTPatchRules::_tooSmall
145 bool _tooSmall(const FMTEvent& p_event, size_t& p_cost) const;
146 // DocString: FMTPatchRules::_tooBig
153 bool _tooBig(const FMTEvent& p_event, size_t& p_cost) const;
154 // DocString: FMTPatchRules::_isTooClose
162 bool _isTooClose(const FMTEvent& p_event, const FMTEventContainer& p_events, size_t& p_cost) const;
163 // DocString: FMTPatchRules::_isSizeUsed
168 bool _isSizeUsed() const;
169 // DocString: FMTPatchRules::_isAdjacencyUsed
174 bool _isAdjacencyUsed() const;
175 // DocString: FMTPatchRules::_hasMinimalAdjacency
180 bool _hasMinimalAdjacency() const;
181 // DocString: FMTPatchRules::_hasMaximalAdjacency
186 bool _hasMaximalAdjacency() const;
187 // DocString: FMTPatchRules::_isGroupUsed
192 bool _isGroupUsed() const;
193 // DocString: FMTPatchRules::_evaluateSize
199 double _evaluateSize(const FMTEventContainer& p_events) const;
200 // DocString: FMTPatchRules::_evaluateAdjacency
206 double _evaluateAdjacency(const FMTEventContainer& p_events) const;
207 // DocString: FMTPatchRules::_evaluateGroup
214 double _evaluateGroup(const FMTEventContainer& p_events,
215 const FMTSpatialGraphs& p_SpatialGraphs) const;
216
217
218 size_t m_GreenUp;
219 size_t m_MinimalAdjacency;
220 size_t m_MaximalAdjacency;
221 size_t m_MinimalSize;
222 size_t m_MaximalSize;
223 size_t m_NeighborSize;
224 int m_GroupGreenUp;
225 int m_MinimalGroupDistance;
226 int m_MaximalGroupDistance;
227 std::vector<int>m_ActionTargets;
228 int m_GroupTheme;
229 int m_RulesId;
230 int m_MinimalPeriod;
231 int m_MaximalPeriod;
232 };
233
234
235
236}
237#endif
Base class of multiple FMT classes holding a shared exception handler pointer and logger.
Definition: FMTObject.h:49
Container of FMTEvent handling event comparison and distance calculation efficiently,...
Definition: FMTEventContainer.h:32
Base class for a spatial event (FMTsaevent or FMTsesevent): a set of FMTCoordinate corresponding to t...
Definition: FMTEvent.h:28
Spatial patch rules used to evaluate and repair the size, adjacency and grouping of events in a spati...
Definition: FMTPatchRules.h:32
void fillTooSmallEvents(std::vector< std::set< FMTEvent >::iterator > &p_SmallEvents, FMTEventContainer &p_events) const
Fill a vector with the events that are too small.
FMTPatchRules & operator=(const FMTPatchRules &rhs)=default
Copy assignment operator for FMTPatchRules.
void fillDispersionEvents(std::vector< std::set< FMTEvent >::iterator > &p_Dispersion, FMTEventContainer &p_events, const FMTSpatialGraphs &p_SpatialGraphs) const
Fill a vector with the events that break the dispersion (adjacency) rules.
FMTPatchRules()=default
Default constructor for FMTPatchRules.
double evaluate(const FMTEventContainer &p_events, const FMTSpatialGraphs &p_SpatialGraphs) const
Evaluate the cost of the patch rules on a container of events.
FMTPatchRules(const FMTPatchRules &rhs)=default
Copy constructor for FMTPatchRules.
static std::vector< FMTPatchRules > getRules(const std::vector< Core::FMTConstraint > &p_constraints, const std::vector< Core::FMTAction > &p_actions)
Build the patch rules from the spatial constraints and the actions.
void fillTooBigEvents(std::vector< std::set< FMTEvent >::iterator > &p_BigEvents, FMTEventContainer &p_events) const
Fill a vector with the events that are too big.
Container of the line graphs of a spatially explicit model, organized by constraint family,...
Definition: FMTSpatialGraphs.h:52
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
Definition: FMTAreaParser.h:40