8#ifndef PYEXPORTSPATIAL_H_INCLUDED
9#define PYEXPORTSPATIAL_H_INCLUDED
17#include "FMTGraph.hpp"
19#include "boost/python.hpp"
23BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getforestperiod_overloads, getForestPeriod, 1, 2)
24BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getconstraintevaluation_overloads,getConstraintEvaluation,2,2)
25BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getobjectivevalue_overloads,getObjectiveValue,2,2)
28 namespace bp = boost::python;
29 bp::object SpatialModule(bp::handle<>(bp::borrowed(PyImport_AddModule(
"FMT.Spatial"))));
30 bp::scope().attr(
"Spatial") = SpatialModule;
31 bp::scope Spatial_scope = SpatialModule;
32 bp::scope().attr(
"__doc__") =
".. module:: Spatial\n"
34 " :platform: Unix, Windows\n"
35 " :synopsis: Spatial module used for Simulation.\n"
38 bp::class_<Spatial::FMTCoordinate>(
"FMTcoordinate",
"@DocString(FMTCoordinate)")
39 .def(bp::init<unsigned int,unsigned int>())
40 .def(
"__lt__",&Spatial::FMTCoordinate::operator <,
41 "@DocString(FMTCoordinate::operator<)")
43 "@DocString(FMTCoordinate::getx)")
45 "@DocString(FMTCoordinate::gety)")
47 "@DocString(FMTCoordinate::getSpatialCoordinate)")
48 .setattr(
"__hash__",&boost::pyHash<Spatial::FMTCoordinate>);
50 define_FMTlayer<Core::FMTDevelopment>();
52 definePyPair<Spatial::FMTCoordinate,Core::FMTDevelopment>();
53 definePyPair<Spatial::FMTCoordinate const,Core::FMTDevelopment>();
54 definePyPair<Spatial::FMTCoordinate,Graph::FMTLineGraph>();
55 definePyPair<Spatial::FMTCoordinate const,Graph::FMTLineGraph>();
59 bp::class_<Spatial::FMTForest, bp::bases<Spatial::FMTLayer<Core::FMTDevelopment>>>(
"FMTforest",
"@DocString(FMTForest)")
60 .def(bp::init<Spatial::FMTForest>())
62 "@DocString(FMTForest::getarea)")
64 "@DocString(FMTForest::grow)")
66 "@DocString(FMTForest::getage)")
68 "@DocString(FMTForest::setperiod)");
71 definePyList<Spatial::FMTForest>();
73 bp::class_<Spatial::FMTEventContainer>(
"FMTeventcontainer",
"@DocString(FMTEventContainer)")
74 .def(bp::init<Spatial::FMTEventContainer>());
76 definePyList<Spatial::FMTEventContainer>();
122 define_FMTlayer<Graph::FMTLineGraph>();
124 bp::class_<Spatial::FMTSpatialSchedule, bp::bases<Spatial::FMTLayer<Graph::FMTLineGraph>>>(
"FMTSpatialSchedule",
"@DocString(FMTSpatialSchedule)")
125 .def(bp::init<Spatial::FMTSpatialSchedule>())
132 definePyList<Spatial::FMTSpatialSchedule>();
134 bp::class_<Spatial::FMTBindingSpatialAction>(
"FMTbindingspatialaction",
"@DocString(FMTBindingSpatialAction)")
139 definePyList<Spatial::FMTBindingSpatialAction>();
const size_t & getMinimalAdjacency() const
Return the minimal adjacency.
Definition: FMTBindingSpatialAction.h:123
const size_t & getMinimalSize() const
Return the minimal size.
Definition: FMTBindingSpatialAction.h:141
const size_t & getMaximalSize() const
Return the maximal size.
Definition: FMTBindingSpatialAction.h:150
const std::vector< double > getSpatialCoordinate(std::vector< double > geoTransform) const
Return the spatial coordinate using a geographic transform.
uint16_t getY() const
Return the y position of the coordinate.
uint16_t getX() const
Return the x position of the coordinate.
void setPeriod(int period)
Set the period of every development of the forest.
std::vector< Core::FMTActualDevelopment > getArea() const
Return the actual developments of the forest, aggregating the area of identical developments by cell ...
FMTLayer< int > getAge() const
Return a layer with the age of each development.
FMTForest grow() const
Grow every development of the forest by one period.
std::vector< Spatial::FMTBindingSpatialAction > getBindingActions(const Models::FMTModel &model, const int &period) const
Get the binding actions based on the model constraints for a period.
double getConstraintEvaluation(const FMTSpatialGraphs &p_Graphs, size_t p_ConstraintId) const
Return the evaluated value of a solution constraint.
std::vector< std::pair< FMTCoordinate, double > > getOutputByCoordinate(const Models::FMTModel &model, const Core::FMTOutput &output, const int &period) const
Return the output value by coordinate for an output, a model and a period.
void operateCoord(const FMTCoordinate &coord, const Core::FMTAction &action, const int &action_id, const FMTBindingSpatialAction &bindingspaction, const Core::FMTTransition &Transition, const Core::FMTYields &ylds, const std::vector< Core::FMTTheme > &themes)
Operate a coordinate and add it to the events.
void grow()
Grow every graph of the schedule by one period.
FMTForest getForestPeriod(const int &period, bool periodStart=false) const
Return the forest corresponding to a period.
Definition: PYdefinitions.h:14
void exportSpatial()
Definition: PYexportSpatial.h:26