Commit abfb872d authored by Jason Rhinelander's avatar Jason Rhinelander

Convert t and run_stage to attributes; disable max_threads

max_threads isn't tested and probably doesn't work (to work it would
need mucking around with python's GIL, which is a beast and makes
threading in python sort of suck).  For now just comment it out.
parent daa57a3e
......@@ -63,11 +63,13 @@ void bind_simulation(py::module &m) {
.def("register_dependency", &Simulation::registerDependency, "Records a dependency between simulation members; if the depended-upon member is removed, the depending member will also be removed")
.def("register_weak_dependency", &Simulation::registerWeakDependency, "Records a weak dependency between members: unlike registerDependency, if the depended-upon member is removed, the depending member is notified rather than being removed")
.def("max_threads", (void (Simulation::*)(unsigned long)) &Simulation::maxThreads, "Sets the maximum number of threads for the next call to run()")
.def("max_threads", (unsigned long (Simulation::*)()) &Simulation::maxThreads, "Returns the maximum number of threads for the current/next run() call")
// Disable these for now: C++ threading support needs to worry about the python GIL, which
// isn't currently implemented.
//.def("max_threads", (void (Simulation::*)(unsigned long)) &Simulation::maxThreads, "Sets the maximum number of threads for the next call to run()")
//.def("max_threads", (unsigned long (Simulation::*)()) &Simulation::maxThreads, "Returns the maximum number of threads for the current/next run() call")
.def("run", &Simulation::run, "Runs one period of the simulation")
.def("t", &Simulation::t, "Returns the iteration number, where 1 is the first iteration.")
.def("run_stage", &Simulation::runStage, "Returns the current simulation run stage.")
.def_property_readonly("t", &Simulation::t, "Accesses the simulation period number, where 1 is the first period, and 0 is the initialize stage (before the first call to run()).")
.def_property_readonly("run_stage", &Simulation::runStage, "Accesses the current simulation run stage.")
.def("stage_intra", &Simulation::runStageIntra, "Returns true if the current simulation stage is one of the intra-period stages.")
.def("stage_inter", &Simulation::runStageInter, "Returns true if the current simulation stage is one of the inter-period stages.")
.def("stage_optimize", &Simulation::runStageOptimize, "Returns true if the current simulation is one of the opimization stages, i.e. inter-optimize, intra-optimize, intra-reoptimize, or intra-reset")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment