@@ -31,21 +31,33 @@ void init_exago_tcopflow(pybind11::module &m) {
31
31
pybind11::class_<TCOPFLOW_wrapper>(m, " TCOPFLOW" )
32
32
.def (pybind11::init ())
33
33
.def (" set_network_data" ,
34
- [](TCOPFLOW_wrapper &w, std::string filename) {
35
- PetscErrorCode ierr;
36
- ierr = TCOPFLOWSetNetworkData (w.tcopf , filename.c_str ());
37
- ExaGOCheckError (ierr);
38
- .def (" set_solver" , [](TCOPFLOW_wrapper &w, std::string solver) {
39
- PetscErrorCode ierr;
40
- ierr = TCOPFLOWSetSolver (w.tcopf , solver.c_str ());
41
- ExaGO
42
- });
43
-
34
+ [](TCOPFLOW_wrapper &w, std::string filename) {
35
+ PetscErrorCode ierr;
36
+ ierr = TCOPFLOWSetNetworkData (w.tcopf , filename.c_str ());
37
+ ExaGOCheckError (ierr);
38
+ })
39
+ .def (" set_solver" , [](TCOPFLOW_wrapper &w, std::string solver) {
40
+ PetscErrorCode ierr;
41
+ ierr = TCOPFLOWSetSolver (w.tcopf , solver.c_str ());
42
+ ExaGOCheckError (ierr);
43
+ })
44
+ .def (" set_tolerance" ,
45
+ [](TCOPFLOW_wrapper &w, double tol) {
46
+ PetscErrorCode ierr;
47
+ ierr = TCOPFLOWSetTolerance (w.tcopf , tol);
48
+ ExaGOCheckError (ierr);
49
+ })
44
50
.def (" setup" , [](TCOPFLOW_wrapper &w) {
45
51
PetscErrorCode ierr;
46
52
ierr = TCOPFLOWSetUp (w.tcopf );
47
53
ExaGOCheckError (ierr);
48
- });
54
+ })
55
+ .def (" solve" ,
56
+ [](TCOPFLOW_wrapper &w) {
57
+ PetscErrorCode ierr;
58
+ ierr = TCOPFLOWSolve (w.tcopf );
59
+ ExaGOCheckError (ierr);
60
+ })
49
61
50
62
.def (" get_convergence_status" ,
51
63
[](TCOPFLOW_wrapper &w) -> bool {
@@ -64,24 +76,24 @@ void init_exago_tcopflow(pybind11::module &m) {
64
76
return obj;
65
77
})
66
78
.def (" get_num_iterations" ,
67
- [](TCCOPFLOW_wrapper &w) -> int {
79
+ [](TCOPFLOW_wrapper &w) -> int {
68
80
PetscErrorCode ierr;
69
81
PetscInt n;
70
82
ierr = TCOPFLOWGetNumIterations (w.tcopf , &n);
71
83
ExaGOCheckError (ierr);
72
84
return n;
73
- })
74
- .def (" save_solution" ,
85
+ });
86
+ /* .def("save_solution",
75
87
[](TCOPFLOW_wrapper &w, OutputFormat fmt, std::string outfile) {
76
88
PetscErrorCode ierr;
77
89
ierr = TCOPFLOWSaveSolution(w.tcopf, fmt, outfile.c_str());
78
90
ExaGOCheckError(ierr);
79
- });
91
+ })
80
92
.def("save_solution_all",
81
- [](TCCOPFLOW_wrapper &w, OutputFormat fmt, std::string outdir) {
93
+ [](TCOPFLOW_wrapper &w, OutputFormat fmt, std::string outdir) {
82
94
PetscErrorCode ierr;
83
95
ierr = TCCOPFLOWSaveSolutionAll(w.tcopf, fmt, outdir.c_str());
84
96
ExaGOCheckError(ierr);
85
- });
97
+ })*/
86
98
87
99
}
0 commit comments