Skip to content

Commit

Permalink
new preset loading in python interface
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Maas committed Nov 8, 2024
1 parent 19eea47 commit 2a32b62
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions python/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "mt-kahypar/partition/mapping/target_graph.h"
#include "mt-kahypar/io/hypergraph_factory.h"
#include "mt-kahypar/io/hypergraph_io.h"
#include "mt-kahypar/io/presets.h"
#include "mt-kahypar/utils/cast.h"
#include "mt-kahypar/utils/randomize.h"

Expand Down Expand Up @@ -245,22 +246,11 @@ PYBIND11_MODULE(mtkahypar, m) {
py::class_<Context>(m, "Context", py::module_local())
.def(py::init<>())
.def("loadPreset", [](Context& context, const PresetType preset) {
switch ( preset ) {
case PresetType::deterministic:
context.load_deterministic_preset();
break;
case PresetType::large_k:
context.load_large_k_preset();
break;
case PresetType::default_preset:
context.load_default_preset();
break;
case PresetType::quality:
context.load_quality_preset();
break;
default:
LOG << "Preset type" << preset << "not supported!";
break;
if ( preset != PresetType::UNDEFINED ) {
auto preset_option_list = loadPreset(preset);
presetToContext(context, preset_option_list);
} else {
LOG << "Preset type" << preset << "not supported!";
}
}, "Loads a preset for partitioning (DETERMINISTIC, LARGE_K, DEFAULT or QUALITY)",
py::arg("preset type"))
Expand Down

0 comments on commit 2a32b62

Please sign in to comment.