memilio
memilio copied to clipboard
Make models non-virtual to simplify python bindings and SimulationBase
Motivation / Current Behaviour
Currently the python bindings bind a Simulation<CompartmentalModel>, making the user provide InfectionState, Population and Parameters. For that to work, CompartmentalModel::get_derivatives is virtual, and the Simulation(Base) holds a unique_ptr of the model.
Enhancement description
We can simplify this by using the type definitions inside the Model to obtain InfectionState etc. for the bindings. Since these are mostly model specific, this effectively reduces the number of template arguments by 2. Also, we then could drop the virtual from get_derivatives (and get_flows), as well as storing the model directly in the Simulation, removing the need for non-default copy ctor/assignment.
Additional context
- pycode/memilio-simulation/memilio/simulation/bindings/compartments/compartmental_model.h
- cpp/memilio/compartments/simulation_base.h
Checklist
- [x] Attached labels, especially loc:: or model:: labels.
- [x] Linked to project