FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
PYexportGraph.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 PYEXPORTGRAPH_H_INCLUDED
9#define PYEXPORTGRAPH_H_INCLUDED
10
11#include "Rdefinitions.h"
12#include "FMTGraphStats.h"
13#include "FMTGraph.hpp"
14#include "boost/python.hpp"
15
16namespace Python
17{
19{
20 namespace bp = boost::python;
21 bp::object GraphModule(bp::handle<>(bp::borrowed(PyImport_AddModule("FMT.Graph"))));
22 bp::scope().attr("Graph") = GraphModule;
23 bp::scope GraphModule_scope = GraphModule;
24 bp::scope().attr("__doc__") = ".. module:: Graph\n"
25 "\n"
26 " :platform: Unix, Windows\n"
27 " :synopsis: Module used to generate graph.\n"
28 "\n";
29
30 bp::class_<Graph::FMTGraphStats>("FMTgraphstats", "@DocString(FMTGraphStats)")
31 .def("__str__", &Graph::FMTGraphStats::operator std::string,
32 "@DocString(FMTGraphStats::operator std::string)")
33 .def_readwrite("cols", &Graph::FMTGraphStats::cols,
34 "@DocString(FMTGraphStats::cols)")
35 .def_readwrite("rows", &Graph::FMTGraphStats::rows,
36 "@DocString(FMTGraphStats::rows)")
37 .def_readwrite("vertices", &Graph::FMTGraphStats::vertices,
38 "@DocString(FMTGraphStats::vertices)")
39 .def_readwrite("edges", &Graph::FMTGraphStats::edges,
40 "@DocString(FMTGraphStats::edges)")
41 .def_readwrite("transfer_rows", &Graph::FMTGraphStats::transfer_rows,
42 "@DocString(FMTGraphStats::transfer_rows)")
43 .def_readwrite("output_rows", &Graph::FMTGraphStats::output_rows,
44 "@DocString(FMTGraphStats::output_rows)")
45 .def_readwrite("output_cols", &Graph::FMTGraphStats::output_cols,
46 "@DocString(FMTGraphStats::output_cols)");
47
48 bp::class_<Graph::FMTPredictor>("FMTpredictor", "@DocString(FMTPredictor)")
49 .def("getpredictors", &Graph::FMTPredictor::getPredictors,
50 "@DocString(FMTPredictor::getpredictors)")
51 .def("getpredictornames", &Graph::FMTPredictor::getPredictorNames,
52 "@DocString(FMTPredictor::getpredictornames)");
53
54 definePyList<Graph::FMTPredictor>();
55 definePyDict<int, int>();
56 definePyList<std::vector<Graph::FMTPredictor>>();
57 bp::enum_<Graph::FMTgraphbuild>("FMTsolverinterface")
58 .value("schedulebuild", Graph::FMTgraphbuild::schedulebuild)
59 .value("fullbuild", Graph::FMTgraphbuild::fullbuild)
60 .value("nobuild", Graph::FMTgraphbuild::nobuild);
61
62 //bp::class_<Graph::FMTGraph>("FMTgraph", "@DocString(FMTGraph)")
63 // .def_pickle(FMT_pickle_suite<Graph::FMTGraph>());
64
65 bp::class_<Graph::FMTLineGraph>("FMTlinegraph","@DocString(FMTGraph)")
66 .def("getperiodactionids",&Graph::FMTLineGraph::getPeriodActionIds,"@DocString(FMTGraphStats::getperiodactionids)");
67
68}
69
70}
71
72#endif // PYEXPORTGRAPH_H_INCLUDED
int rows
Number of rows in the matrix of FMTLpSolver.
Definition: FMTGraphStats.h:54
int output_cols
Number of output cols in the FMTLpSolver.
Definition: FMTGraphStats.h:69
int transfer_rows
Number of area transfer rows in the FMTLpSolver.
Definition: FMTGraphStats.h:63
int cols
Number of columns in the matrix of FMTLpSolver.
Definition: FMTGraphStats.h:51
int edges
Number of edges in the FMTGraph.
Definition: FMTGraphStats.h:60
int vertices
Number of vertices in the FMTGraph.
Definition: FMTGraphStats.h:57
int output_rows
Number of output rows in the FMTLpSolver.
Definition: FMTGraphStats.h:66
std::vector< int > getPeriodActionIds(const int &period, bool p_ordered=true) const
Return the action ids of every action done in a period, in order.
std::vector< double > getPredictors() const
Return the predictor values.
std::vector< std::string > getPredictorNames(const std::vector< std::string > &yieldnames) const
Return the names of the predictors.
Definition: PYdefinitions.h:14
void exportGraph()
Definition: PYexportGraph.h:18