From 2bc9c7ff1d949a447f70f6346185fa44fa9d1aa6 Mon Sep 17 00:00:00 2001 From: Jayapreethi Date: Mon, 29 Apr 2024 23:46:27 +0000 Subject: [PATCH] Apply pre-commmit fixes --- interfaces/python/exago_python_tcopflow.cpp | 114 ++++++++++---------- tests/interfaces/python/test_5_tcopflow.py | 2 +- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/interfaces/python/exago_python_tcopflow.cpp b/interfaces/python/exago_python_tcopflow.cpp index f9245b76..7f3000dd 100644 --- a/interfaces/python/exago_python_tcopflow.cpp +++ b/interfaces/python/exago_python_tcopflow.cpp @@ -29,71 +29,71 @@ class TCOPFLOW_wrapper { void init_exago_tcopflow(pybind11::module &m) { pybind11::class_(m, "TCOPFLOW") - .def(pybind11::init()) - .def("set_network_data", - [](TCOPFLOW_wrapper &w, std::string filename) { - PetscErrorCode ierr; - ierr = TCOPFLOWSetNetworkData(w.tcopf, filename.c_str()); - ExaGOCheckError(ierr); - }) - .def("set_solver", [](TCOPFLOW_wrapper &w, std::string solver) { - PetscErrorCode ierr; - ierr = TCOPFLOWSetSolver(w.tcopf, solver.c_str()); - ExaGOCheckError(ierr); - }) - .def("set_tolerance", + .def(pybind11::init()) + .def("set_network_data", + [](TCOPFLOW_wrapper &w, std::string filename) { + PetscErrorCode ierr; + ierr = TCOPFLOWSetNetworkData(w.tcopf, filename.c_str()); + ExaGOCheckError(ierr); + }) + .def("set_solver", + [](TCOPFLOW_wrapper &w, std::string solver) { + PetscErrorCode ierr; + ierr = TCOPFLOWSetSolver(w.tcopf, solver.c_str()); + ExaGOCheckError(ierr); + }) + .def("set_tolerance", [](TCOPFLOW_wrapper &w, double tol) { PetscErrorCode ierr; ierr = TCOPFLOWSetTolerance(w.tcopf, tol); ExaGOCheckError(ierr); }) - .def("setup", [](TCOPFLOW_wrapper &w) { - PetscErrorCode ierr; - ierr = TCOPFLOWSetUp(w.tcopf); - ExaGOCheckError(ierr); - }) - .def("solve", + .def("setup", + [](TCOPFLOW_wrapper &w) { + PetscErrorCode ierr; + ierr = TCOPFLOWSetUp(w.tcopf); + ExaGOCheckError(ierr); + }) + .def("solve", [](TCOPFLOW_wrapper &w) { PetscErrorCode ierr; ierr = TCOPFLOWSolve(w.tcopf); ExaGOCheckError(ierr); }) - .def("get_convergence_status", - [](TCOPFLOW_wrapper &w) -> bool { - PetscErrorCode ierr; - PetscBool flag; - ierr = TCOPFLOWGetConvergenceStatus(w.tcopf, &flag); - ExaGOCheckError(ierr); - return flag; - }) - .def("get_objective", - [](TCOPFLOW_wrapper &w) -> double { - PetscErrorCode ierr; - double obj; - ierr = TCOPFLOWGetObjective(w.tcopf, &obj); - ExaGOCheckError(ierr); - return obj; - }) - .def("get_num_iterations", - [](TCOPFLOW_wrapper &w) -> int { - PetscErrorCode ierr; - PetscInt n; - ierr = TCOPFLOWGetNumIterations(w.tcopf, &n); - ExaGOCheckError(ierr); - return n; - }); - /*.def("save_solution", - [](TCOPFLOW_wrapper &w, OutputFormat fmt, std::string outfile) { - PetscErrorCode ierr; - ierr = TCOPFLOWSaveSolution(w.tcopf, fmt, outfile.c_str()); - ExaGOCheckError(ierr); - }) - .def("save_solution_all", - [](TCOPFLOW_wrapper &w, OutputFormat fmt, std::string outdir) { - PetscErrorCode ierr; - ierr = TCCOPFLOWSaveSolutionAll(w.tcopf, fmt, outdir.c_str()); - ExaGOCheckError(ierr); - })*/ - - } + .def("get_convergence_status", + [](TCOPFLOW_wrapper &w) -> bool { + PetscErrorCode ierr; + PetscBool flag; + ierr = TCOPFLOWGetConvergenceStatus(w.tcopf, &flag); + ExaGOCheckError(ierr); + return flag; + }) + .def("get_objective", + [](TCOPFLOW_wrapper &w) -> double { + PetscErrorCode ierr; + double obj; + ierr = TCOPFLOWGetObjective(w.tcopf, &obj); + ExaGOCheckError(ierr); + return obj; + }) + .def("get_num_iterations", [](TCOPFLOW_wrapper &w) -> int { + PetscErrorCode ierr; + PetscInt n; + ierr = TCOPFLOWGetNumIterations(w.tcopf, &n); + ExaGOCheckError(ierr); + return n; + }); + /*.def("save_solution", + [](TCOPFLOW_wrapper &w, OutputFormat fmt, std::string outfile) { + PetscErrorCode ierr; + ierr = TCOPFLOWSaveSolution(w.tcopf, fmt, outfile.c_str()); + ExaGOCheckError(ierr); + }) +.def("save_solution_all", + [](TCOPFLOW_wrapper &w, OutputFormat fmt, std::string outdir) { + PetscErrorCode ierr; + ierr = TCCOPFLOWSaveSolutionAll(w.tcopf, fmt, outdir.c_str()); + ExaGOCheckError(ierr); + })*/ +} diff --git a/tests/interfaces/python/test_5_tcopflow.py b/tests/interfaces/python/test_5_tcopflow.py index 0366985d..ac1dcec7 100644 --- a/tests/interfaces/python/test_5_tcopflow.py +++ b/tests/interfaces/python/test_5_tcopflow.py @@ -85,4 +85,4 @@ def test_set_model_and_solver(): path = exago.prefix() opf.read_mat_power_data(os.path.join( path, 'share', 'exago', 'datafiles', 'case9', 'case9mod.m')) -''' \ No newline at end of file +'''