FMT 0.9.8
Forest management tools for forest planning
|
#include <FMTeventcontainer.hpp>
Public Types | |
typedef std::set< FMTevent >::value_type | value_type |
typedef std::set< FMTevent >::iterator | iterator |
typedef std::set< FMTevent >::const_iterator | const_iterator |
typedef std::set< FMTevent >::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
FMTeventcontainer () | |
~FMTeventcontainer ()=default | |
FMTeventcontainer (const FMTeventcontainer &rhs) | |
FMTeventcontainer & | operator= (const FMTeventcontainer &rhs) |
bool | operator== (const FMTeventcontainer &rhs) const |
void | swap (FMTeventcontainer &rhs) |
const_iterator | begin () const |
const_iterator | end () const |
bool | empty () const |
size_t | size () const |
const_iterator | find (const int &period, const FMTcoordinate &coord) const |
const_iterator | find (const FMTevent &event) const |
void | insert (const FMTevent &event) |
void | merge (const FMTeventcontainer &levents) |
void | erase (const FMTevent &event) |
const_iterator | erase (const const_iterator event) |
void | clear () |
int | lastperiod () const |
int | firstperiod () const |
void | erasecoordinate (const FMTcoordinate &coord, const int &periodstart, const std::vector< std::vector< bool > > &actionstarget) |
std::pair< const_iterator, const_iterator > | getbounds (const int &period) const |
void | addaction (const FMTcoordinate &coord, const int &period, const int &actionid, const FMTbindingspatialaction &binding) |
void | addactions (const FMTcoordinate &coord, const int &period, const std::vector< int > &actionids, const std::vector< FMTbindingspatialaction > &bindings) |
std::vector< const_iterator > | getevents (const int &period, const int &action_id) const |
std::vector< const_iterator > | getevents (const int &period, const int &action_id, const FMTcoordinate &minimalcoordinate, const FMTcoordinate &maximalcoordinate) const |
std::vector< std::vector< const_iterator > > | getmultipleevents (const int &period, const std::vector< int > &action_ids, const FMTcoordinate &minimalcoordinate, const FMTcoordinate &maximalcoordinate) const |
std::vector< const_iterator > | getevents (const int &period, const std::vector< int > &actions_id) const |
std::vector< const_iterator > | getevents (const int &period, const std::vector< bool > &actions_used) const |
std::vector< const_iterator > | getevents (const int &period, const std::vector< bool > &actions_used, const FMTcoordinate &minimalcoordinate, const FMTcoordinate &maximalcoordinate) const |
std::vector< const_iterator > | getevents (const int &period, const FMTcoordinate &coord) const |
FMTeventcontainer | geteventstoerase (const int &fromperiod, const std::vector< std::vector< bool > > &actionstarget, const FMTcoordinate &coord, const size_t &buffer, FMTeventcontainer &newevents) const |
FMTeventcontainer | geteventstoadd (const FMTcoordinate &coord, const int &period, const int &actionid, const FMTbindingspatialaction &binding, FMTeventcontainer &newevents) const |
FMTeventcontainer | getcontainer (std::vector< FMTcoordinate > coordinates, const int &minperiod, const int &maxperiod, const size_t &buffer) const |
FMTeventcontainer | addupdate (const FMTeventcontainer &newevents, const FMTeventcontainer &eventstoremove) |
std::vector< const_iterator > | getevents (const int &period, const std::set< FMTcoordinate > &territory) const |
double | minimaldistance (const FMTevent &, const unsigned int &distancel, const int &period, const std::vector< int > &actionsid) const |
double | evaluatedistance (const FMTevent &, const double &lowerdistancetoevent, const double &upperdistancetoevent, const int &period, const std::vector< bool > &actionsused, boost::unordered_set< FMTeventrelation > &relations) const |
Public Member Functions inherited from Core::FMTobject | |
FMTobject () | |
virtual | ~FMTobject () |
FMTobject (const std::shared_ptr< Exception::FMTexceptionhandler > exhandler) | |
FMTobject (const FMTobject &rhs) | |
FMTobject & | operator= (const FMTobject &rhs) |
virtual void | passinlogger (const std::shared_ptr< Logging::FMTlogger > &logger) |
void | passinexceptionhandler (const std::shared_ptr< Exception::FMTexceptionhandler > &exhandler) |
void | redirectlogtofile (const std::string &location) |
virtual void | setdefaultlogger () |
virtual void | setquietlogger () |
virtual void | settasklogger () |
virtual void | setdebuglogger () |
void | setdefaultexceptionhandler () |
void | setquietexceptionhandler () |
void | setdebugexceptionhandler () |
void | setfreeexceptionhandler () |
void | disablenestedexceptions () |
void | enablenestedexceptions () |
void | seterrorstowarnings (const std::vector< Exception::FMTexc > &errors) |
void | setmaxwarningsbeforesilenced (const size_t &maxwarningcount) |
Friends | |
class | boost::serialization::access |
Additional Inherited Members | |
Static Public Member Functions inherited from Core::FMTobject | |
static std::string | getruntimelocation () |
static unsigned long long | getavailablememory () |
Protected Member Functions inherited from Core::FMTobject | |
template<class Archive > | |
void | forcesave (Archive &ar, const unsigned int version) const |
template<class Archive > | |
void | forceload (Archive &ar, const unsigned int version) |
void | checksignals () const |
void | setCPLhandler () |
Static Protected Member Functions inherited from Core::FMTobject | |
static std::chrono::time_point< std::chrono::high_resolution_clock > | getclock () |
template<class chrono > | |
static double | getduration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock) |
static std::string | getdurationinseconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock) |
Static Protected Attributes inherited from Core::FMTobject | |
static std::shared_ptr< Exception::FMTexceptionhandler > | _exhandler |
A shared pointer to the exception handler. | |
static std::shared_ptr< Logging::FMTlogger > | _logger |
A shared pointer to the logger. | |
This class is a container for FMTevent. It's build to handle event comparison or distance calculation in an efficient way by allowing the user to get events by period, action id and/or coordinates. One container can hold all events for a model. They are sorted by period, centroid, action_id and finally by size. You can remove FMTcoordinate and add FMTcoordinate by period and action.
typedef std::set<FMTevent>::const_iterator Spatial::FMTeventcontainer::const_iterator |
typedef std::set<FMTevent>::const_reverse_iterator Spatial::FMTeventcontainer::const_reverse_iterator |
typedef std::set<FMTevent>::iterator Spatial::FMTeventcontainer::iterator |
typedef std::set<FMTevent>::value_type Spatial::FMTeventcontainer::value_type |
Spatial::FMTeventcontainer::FMTeventcontainer | ( | ) |
Default constructor
|
default |
Destructor
Spatial::FMTeventcontainer::FMTeventcontainer | ( | const FMTeventcontainer & | rhs | ) |
Copy constructor
void Spatial::FMTeventcontainer::addaction | ( | const FMTcoordinate & | coord, |
const int & | period, | ||
const int & | actionid, | ||
const FMTbindingspatialaction & | binding | ||
) |
void Spatial::FMTeventcontainer::addactions | ( | const FMTcoordinate & | coord, |
const int & | period, | ||
const std::vector< int > & | actionids, | ||
const std::vector< FMTbindingspatialaction > & | bindings | ||
) |
FMTeventcontainer Spatial::FMTeventcontainer::addupdate | ( | const FMTeventcontainer & | newevents, |
const FMTeventcontainer & | eventstoremove | ||
) |
|
inline |
Return a const iterator to the first FMTevent in events.
|
inline |
Clear content of the container.
|
inline |
Test whether the container is empty.
|
inline |
Return a const iterator to the past-the-end element in events.
const_iterator Spatial::FMTeventcontainer::erase | ( | const const_iterator | event | ) |
Erase an event from the container and return the next iterator.
void Spatial::FMTeventcontainer::erase | ( | const FMTevent & | event | ) |
Erase an event from the container.
void Spatial::FMTeventcontainer::erasecoordinate | ( | const FMTcoordinate & | coord, |
const int & | periodstart, | ||
const std::vector< std::vector< bool > > & | actionstarget | ||
) |
double Spatial::FMTeventcontainer::evaluatedistance | ( | const FMTevent & | , |
const double & | lowerdistancetoevent, | ||
const double & | upperdistancetoevent, | ||
const int & | period, | ||
const std::vector< bool > & | actionsused, | ||
boost::unordered_set< FMTeventrelation > & | relations | ||
) | const |
The function add each distance from the event if the even is within the ditancetoevent for a given period if within = true. If within = false the if the event is not within the distance it will add up the distances.
|
inline |
Get const iterator to the element.
const_iterator Spatial::FMTeventcontainer::find | ( | const int & | period, |
const FMTcoordinate & | coord | ||
) | const |
Get const iterator to the first event found with the coord at the period specified.
int Spatial::FMTeventcontainer::firstperiod | ( | ) | const |
std::pair< const_iterator, const_iterator > Spatial::FMTeventcontainer::getbounds | ( | const int & | period | ) | const |
FMTeventcontainer Spatial::FMTeventcontainer::getcontainer | ( | std::vector< FMTcoordinate > | coordinates, |
const int & | minperiod, | ||
const int & | maxperiod, | ||
const size_t & | buffer | ||
) | const |
std::vector< const_iterator > Spatial::FMTeventcontainer::getevents | ( | const int & | period, |
const FMTcoordinate & | coord | ||
) | const |
std::vector< const_iterator > Spatial::FMTeventcontainer::getevents | ( | const int & | period, |
const int & | action_id | ||
) | const |
std::vector< const_iterator > Spatial::FMTeventcontainer::getevents | ( | const int & | period, |
const int & | action_id, | ||
const FMTcoordinate & | minimalcoordinate, | ||
const FMTcoordinate & | maximalcoordinate | ||
) | const |
std::vector< const_iterator > Spatial::FMTeventcontainer::getevents | ( | const int & | period, |
const std::set< FMTcoordinate > & | territory | ||
) | const |
std::vector< const_iterator > Spatial::FMTeventcontainer::getevents | ( | const int & | period, |
const std::vector< bool > & | actions_used | ||
) | const |
std::vector< const_iterator > Spatial::FMTeventcontainer::getevents | ( | const int & | period, |
const std::vector< bool > & | actions_used, | ||
const FMTcoordinate & | minimalcoordinate, | ||
const FMTcoordinate & | maximalcoordinate | ||
) | const |
std::vector< const_iterator > Spatial::FMTeventcontainer::getevents | ( | const int & | period, |
const std::vector< int > & | actions_id | ||
) | const |
FMTeventcontainer Spatial::FMTeventcontainer::geteventstoadd | ( | const FMTcoordinate & | coord, |
const int & | period, | ||
const int & | actionid, | ||
const FMTbindingspatialaction & | binding, | ||
FMTeventcontainer & | newevents | ||
) | const |
FMTeventcontainer Spatial::FMTeventcontainer::geteventstoerase | ( | const int & | fromperiod, |
const std::vector< std::vector< bool > > & | actionstarget, | ||
const FMTcoordinate & | coord, | ||
const size_t & | buffer, | ||
FMTeventcontainer & | newevents | ||
) | const |
std::vector< std::vector< const_iterator > > Spatial::FMTeventcontainer::getmultipleevents | ( | const int & | period, |
const std::vector< int > & | action_ids, | ||
const FMTcoordinate & | minimalcoordinate, | ||
const FMTcoordinate & | maximalcoordinate | ||
) | const |
|
inline |
Insert an event in the container.
int Spatial::FMTeventcontainer::lastperiod | ( | ) | const |
void Spatial::FMTeventcontainer::merge | ( | const FMTeventcontainer & | levents | ) |
Merge two FMTeventcontainer
double Spatial::FMTeventcontainer::minimaldistance | ( | const FMTevent & | , |
const unsigned int & | distancel, | ||
const int & | period, | ||
const std::vector< int > & | actionsid | ||
) | const |
This function is used when we want to verify if the event is within a certain distance from other events. If it's not, the specified distance distance+1 is return, else the minimal distance is return. It's principally use to calculate penalty for simulated annealing models.
FMTeventcontainer & Spatial::FMTeventcontainer::operator= | ( | const FMTeventcontainer & | rhs | ) |
Copy assignment operator
bool Spatial::FMTeventcontainer::operator== | ( | const FMTeventcontainer & | rhs | ) | const |
Comparison operator equal to
|
inline |
Return container size.
void Spatial::FMTeventcontainer::swap | ( | FMTeventcontainer & | rhs | ) |
Exchange contents of events with the content of rhs.events
|
friend |