Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
2d4aec1
add model with Populations with Regions
charlie0614 Apr 11, 2024
9416256
working SIR model without infections during commuting
charlie0614 Apr 24, 2024
12c9c09
add infections during commuting and age groups
charlie0614 Apr 26, 2024
2b883b6
read in mobility data for new model
charlie0614 Apr 26, 2024
d49a048
only add edges if weight is big enough
charlie0614 Apr 26, 2024
56c4dd4
correct age resolution
charlie0614 May 8, 2024
0efa8db
add tests
charlie0614 Jun 10, 2024
05e3717
add seir version of mobility model
charlie0614 Jun 17, 2024
f475e3c
small adjustments sir version
charlie0614 Jun 17, 2024
68632c5
Merge branch 'main' into 1003-implement-model-in-which-the-mobility-i…
charlie0614 Jun 17, 2024
f19bcf6
fixes after merge
charlie0614 Jun 18, 2024
6ace8cf
Renaming
charlie0614 Jul 25, 2024
232f705
Renaming
charlie0614 Jul 25, 2024
6045e1f
Set up examples for comparison
charlie0614 Jul 25, 2024
dfdac2d
changes for plots and corrections
charlie0614 Jul 29, 2024
16a07da
add improved model
charlie0614 Sep 19, 2024
23196bc
changes for comparing simulations
charlie0614 Sep 19, 2024
4193cd6
Merge branch 'main' into 1003-implement-model-in-which-the-mobility-i…
charlie0614 Sep 26, 2024
bfc2562
adjust plot file
charlie0614 Sep 26, 2024
c6b56e9
reformat py file
charlie0614 Sep 26, 2024
5e51d69
py file
charlie0614 Sep 26, 2024
0eff4d1
py file
charlie0614 Sep 26, 2024
3d3b007
change commuting strengths to contact matrix and implement indicator …
charlie0614 Sep 30, 2024
9f0fba7
return to factor 0.5
charlie0614 Oct 7, 2024
8908d01
read in data and time measurement 400 counties
charlie0614 Oct 8, 2024
06950d9
small corrections model
charlie0614 Oct 8, 2024
aad78a9
corrections again
charlie0614 Oct 10, 2024
2bdb791
change integrator in graph model
charlie0614 Oct 10, 2024
3c6f630
fix bug with age groups and discard transmissions during commuting
charlie0614 Nov 7, 2024
aa6b393
adapt structure of old model
charlie0614 Nov 7, 2024
e6e6d70
add computation of basis reproduction number for old model
charlie0614 Nov 8, 2024
649467c
add computation of basis reproduction numbers and changes for countin…
charlie0614 Nov 20, 2024
4239fa7
small cleanup
charlie0614 Nov 28, 2024
2c4de48
read in population data
charlie0614 Dec 1, 2024
ce86fb6
debugging artefacts
charlie0614 Dec 1, 2024
d378118
more cleanup and provide demo population for a number of agegroups di…
charlie0614 Dec 2, 2024
33a2dd5
read in contact matrices, set age resolved parameters, restructure
charlie0614 Dec 2, 2024
c1bd747
add bool for using population from data
charlie0614 Dec 3, 2024
df22f54
read in data for graph model
charlie0614 Dec 3, 2024
7b30779
simulation for nrw, plots and a bug fix
charlie0614 Dec 12, 2024
f49a497
add timing example
charlie0614 Dec 13, 2024
64744ab
cmake changes for timing
charlie0614 Dec 13, 2024
a262104
fix bug for measuring runtimes and graph timing example
charlie0614 Dec 13, 2024
565141c
fix bug for graph timing
charlie0614 Dec 13, 2024
9f36912
fix things for runtime measurements
charlie0614 Dec 16, 2024
ee57c8f
add plotfiles, small correction in the model and maybe optimizations
charlie0614 Dec 18, 2024
d8b321f
mini optimizations and small changes for timing runs
charlie0614 Dec 19, 2024
7dc7e44
add simulations for paper model and comparison of basic reproduction …
charlie0614 Dec 19, 2024
90a8d3e
small changes in plots
charlie0614 Dec 19, 2024
c78c996
fix runtime maybe
charlie0614 Dec 20, 2024
cd056b5
adjust timing examples for single age group
charlie0614 Dec 31, 2024
fba237a
remove prints from simulations
charlie0614 Jan 9, 2025
363bf85
add examples for basic reproduction numbers, and measurements of steps
charlie0614 Jan 9, 2025
fd2bfdd
remove synthetic population for simulation
charlie0614 Jan 9, 2025
33bf7a9
small improvement model c
charlie0614 Jan 9, 2025
24883f3
remove steps from timing example
charlie0614 Jan 9, 2025
4db243d
changes in plots
charlie0614 Jan 9, 2025
8084deb
fix bug in model b
charlie0614 Jan 12, 2025
9b87803
fix bug in computation of basic reproduction number as well
charlie0614 Jan 12, 2025
f7f3eca
add likwid test example
Jan 14, 2025
c74474f
new likwid example
Jan 14, 2025
a4fb5d7
likwid examples
Jan 17, 2025
172998a
optimize model
charlie0614 Jan 23, 2025
87faada
cleanup timing files
charlie0614 Feb 5, 2025
45cad87
cleanup step files
charlie0614 Feb 5, 2025
b0e9827
restructure for thesis submission
charlie0614 Feb 5, 2025
9f8334f
add system flag for boost again
charlie0614 Feb 5, 2025
a4351e3
rename ode_seir_mobility
charlie0614 Feb 5, 2025
f18a2ef
rename namespaces of metapopulation models
charlie0614 Feb 5, 2025
7795832
small corrections
charlie0614 Feb 5, 2025
995f59b
cleanup plot file results
charlie0614 Feb 5, 2025
32c74ad
cleanup plot file runtimes
charlie0614 Feb 5, 2025
629e886
change colors in plots
charlie0614 Feb 5, 2025
c61dac5
add shellscripts for runtimes and steps
charlie0614 Feb 5, 2025
6e56e39
delete redundant plot
charlie0614 Feb 5, 2025
d84d5a3
optimizations ode model
charlie0614 Mar 10, 2025
a5540f9
remove old examples
charlie0614 Mar 27, 2025
137feab
Merge branch 'main' into 1003-implement-model-in-which-the-mobility-i…
charlie0614 Mar 27, 2025
1291acd
format python file
charlie0614 Mar 28, 2025
d4e9341
format more python files
charlie0614 Mar 28, 2025
c48fc83
resolve pyupgrade issue
charlie0614 Mar 31, 2025
6782917
commit likwid examples
charlie0614 Mar 31, 2025
51a28f4
rename mio::Vector in metapop models
charlie0614 Apr 2, 2025
b9d0fbb
adjust to changed data structure
charlie0614 Apr 4, 2025
881cb5b
adjust to changed data structure
charlie0614 Apr 4, 2025
86fdc27
CHG: Adapt paths to new folder structure
kilianvolmer Apr 16, 2025
298636a
adjustments for testing
charlie0614 Apr 24, 2025
d7ba3c5
add tests
charlie0614 Apr 30, 2025
e2f3864
continue working on tests and restructure population after commuting
charlie0614 May 5, 2025
67e6d22
add minimal metapop example
charlie0614 May 12, 2025
04f3033
Merge branch '1003-implement-model-in-which-the-mobility-is-integrate…
charlie0614 May 12, 2025
77f2d97
delete thesis examples and rename model
charlie0614 May 12, 2025
5800934
remove timing artifacts
charlie0614 May 12, 2025
ceea756
renamed model
charlie0614 May 12, 2025
99fe446
renamed model 2
charlie0614 May 12, 2025
22a94f4
remove superfluous include omp
charlie0614 May 12, 2025
fd323b0
correct setting of population after commuting
charlie0614 May 13, 2025
b2d266a
comment in tests
charlie0614 May 13, 2025
baf54e7
correct test and add compare files
charlie0614 May 13, 2025
13ec735
remove debugging artifact
charlie0614 May 13, 2025
fc94b55
add documentation
charlie0614 May 14, 2025
172c674
change error handling to include
charlie0614 May 14, 2025
8b85683
correct docu for contact matrix
charlie0614 Jun 11, 2025
4619fac
use existing region struct
charlie0614 Jul 11, 2025
e7c4def
adjust to new data structure
charlie0614 Jul 11, 2025
f788f7f
Merge branch 'main' into 1003-implement-ode-seir-metapopulation-model
charlie0614 Jul 11, 2025
61cc368
.
HenrZu Nov 11, 2025
06299c5
Merge branch 'main' into 1003-ode-seir-metapop-add-bindings
charlie0614 Apr 29, 2026
c03d747
fix bugs after merging main and expand bindings
charlie0614 Apr 30, 2026
8e3bccd
clean up bindings and add example
charlie0614 May 5, 2026
c147525
correct header guard
charlie0614 May 5, 2026
562e041
add pretty name for Region
charlie0614 May 5, 2026
4300b31
remove artefacts from paper
charlie0614 May 11, 2026
f61a1bd
Merge branch 'main' into 1003-ode-seir-metapop-add-bindings
charlie0614 May 12, 2026
b44f121
remove RK4 binding
charlie0614 May 12, 2026
72fc57f
[ci skip] bind flowsimulation and make PopulationAfterCommuting acces…
HenrZu May 13, 2026
0de72d2
fix index in py/cpp metapop example, some tests
HenrZu May 13, 2026
a30d321
Use module_local for InfectionState
HenrZu May 13, 2026
c846447
[ci skip] Apply suggestions from code review
charlie0614 May 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cpp/examples/ode_seir_metapop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ int main()
for (size_t index = 0; index < (size_t)interpolated_result.get_num_time_points(); index++) {
printf("\n %f", interpolated_result.get_times()[index]);
for (size_t i = 0; i < (size_t)model.parameters.get_num_regions(); i++) {

printf("\t %.5f ",
interpolated_result.get_value(index)[(size_t)model.parameters.get_num_regions() *
((size_t)mio::oseirmetapop::InfectionState::Count - 1) +
i] /
model.populations.get_group_total(mio::regions::Region(i)) * 100);
auto infected_idx = model.populations.get_flat_index(
{mio::regions::Region(i), mio::AgeGroup(0), mio::oseirmetapop::InfectionState::Infected});
printf("\t %.5f ", interpolated_result.get_value(index)[infected_idx] /
model.populations.get_group_total(mio::regions::Region(i)) * 100);
}
}
printf("\n");
Expand Down
10 changes: 6 additions & 4 deletions cpp/memilio/math/stepper_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ struct step_adjuster : public boost::numeric::odeint::default_step_adjuster<Valu
* @brief This is an adaptive IntegratorCore. It creates and manages an instance of a
* boost::numeric::odeint::controlled_runge_kutta integrator, wrapped as mio::IntegratorCore.
*/
template <typename FP, template <class State, class Value, class Deriv, class Time, class Algebra, class Operations,
class Resizer> class ControlledStepper>
template <typename FP,
template <class State, class Value, class Deriv, class Time, class Algebra, class Operations, class Resizer>
class ControlledStepper>
class ControlledStepperWrapper : public mio::OdeIntegratorCore<FP>
{
using Algebra = boost::numeric::odeint::vector_space_algebra;
Expand Down Expand Up @@ -204,8 +205,9 @@ class ControlledStepperWrapper : public mio::OdeIntegratorCore<FP>
* @brief This is a non-adaptive IntegratorCore. It creates and manages an instance of an explicit stepper from
* boost::numeric::odeint, wrapped as mio::IntegratorCore.
*/
template <typename FP, template <class State, class Value, class Deriv, class Time, class Algebra, class Operations,
class Resizer> class ExplicitStepper>
template <typename FP,
template <class State, class Value, class Deriv, class Time, class Algebra, class Operations, class Resizer>
class ExplicitStepper>
class ExplicitStepperWrapper : public mio::OdeIntegratorCore<FP>
{
public:
Expand Down
1 change: 0 additions & 1 deletion cpp/models/ode_seir_metapop/infection_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef SEIRMETAPOP_INFECTIONSTATE_H
#define SEIRMETAPOP_INFECTIONSTATE_H

Expand Down
83 changes: 83 additions & 0 deletions pycode/examples/simulation/ode_seir_metapop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Carlotta Gerstein
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#############################################################################

import numpy as np

import memilio.simulation as mio
import memilio.simulation.oseir_metapop as oseir_metapop
from memilio.simulation import AgeGroup, LogLevel, set_log_level
set_log_level(LogLevel.Off)

t0 = 0
tmax = 10
dt = 0.1

model = oseir_metapop.Model(3, 1)

for i in range(model.parameters.num_regions.get()):
# Set infection state stay times (in days)
model.populations[mio.Region(i), AgeGroup(
0), oseir_metapop.InfectionState.Susceptible] = 10000

model.populations[mio.Region(0), AgeGroup(
0), oseir_metapop.InfectionState.Infected].value += 100
model.populations[mio.Region(0), AgeGroup(
0), oseir_metapop.InfectionState.Susceptible].value -= 100

mobility_data_commuter = np.array(
[[0.4, 0.3, 0.3], [0.2, 0.7, 0.1], [0.4, 0.1, 0.5]])
model.set_commuting_strengths(mobility_data_commuter)

# Set contact frequency
model.parameters.ContactPatterns.cont_freq_mat[0].baseline = np.ones(
(3, 3)) * 2.7

model.parameters.TimeExposed[mio.Region(0), AgeGroup(0)] = 3.
model.parameters.TimeExposed[mio.Region(1), AgeGroup(0)] = 4.
model.parameters.TimeExposed[mio.Region(2), AgeGroup(0)] = 5.
model.parameters.TimeInfected[mio.Region(0), AgeGroup(0)] = 7.
model.parameters.TimeInfected[mio.Region(1), AgeGroup(0)] = 8.
model.parameters.TimeInfected[mio.Region(2), AgeGroup(0)] = 9.
model.parameters.TransmissionProbabilityOnContact[mio.Region(
0), AgeGroup(0)] = 0.07333
model.parameters.TransmissionProbabilityOnContact[mio.Region(
1), AgeGroup(0)] = 0.07333
model.parameters.TransmissionProbabilityOnContact[mio.Region(
2), AgeGroup(0)] = 0.07333

result = oseir_metapop.simulate(t0, tmax, dt, model)
interpolated_result = oseir_metapop.interpolate_simulation_result(result)

print("Infected individuals per Region over time [%]:")
print("".join(f"\t Region {i}" for i in range(
model.parameters.num_regions.get())))

for t_idx in range(interpolated_result.get_num_time_points()):
row = f" {interpolated_result.get_times()[t_idx]:.6f}"
values = interpolated_result.get_value(t_idx)

for i in range(model.parameters.num_regions.get()):
population = model.populations.get_group_total_Region(mio.Region(i))
infected_idx = model.populations.get_flat_index(
(mio.Region(i), AgeGroup(0), oseir_metapop.InfectionState.Infected))
percentage = values[infected_idx] / population * 100
row += f"\t {percentage:.5f} "

print(row)
5 changes: 5 additions & 0 deletions pycode/memilio-simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ add_pymio_module(_simulation_oseir
SOURCES memilio/simulation/bindings/models/oseir.cpp
)

add_pymio_module(_simulation_oseir_metapop
LINKED_LIBRARIES memilio ode_seir_metapop
SOURCES memilio/simulation/bindings/models/oseir_metapop.cpp
)

add_pymio_module(_simulation_oseirdb
LINKED_LIBRARIES memilio ode_seirdb
SOURCES memilio/simulation/bindings/models/oseirdb.cpp
Expand Down
3 changes: 3 additions & 0 deletions pycode/memilio-simulation/memilio/simulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def __getattr__(attr):
elif attr == "oseir":
import memilio.simulation.oseir as oseir
return oseir
elif attr == "oseir_metapop":
import memilio.simulation.oseir_metapop as oseir_metapop
return oseir_metapop
elif attr == "oseirdb":
import memilio.simulation.oseirdb as oseirdb
return oseirdb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "utils/custom_index_array.h"
#include "memilio/utils/custom_index_array.h"
#include "memilio/epidemiology/populations.h"
#include "geography/regions.h"

#include "pybind11/pybind11.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2020-2026 MEmilio
*
* Authors: Carlotta Gerstein
*
* Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PYMIO_REGION_H
#define PYMIO_REGION_H

#include "memilio/geography/regions.h"

#include "pybind11/pybind11.h"

namespace pymio
{

template <>
inline std::string pretty_name<mio::regions::Region>()
{
return "Region";
}

} // namespace pymio

#endif //PYMIO_REGION_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Copyright (C) 2020-2025 MEmilio
*
* Authors: Henrik Zunker
*
* Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Includes from pymio
#include "pybind_util.h"
#include "compartments/simulation.h"
#include "compartments/flow_simulation.h"
#include "compartments/compartmental_model.h"
#include "data/analyze_result.h"
#include "epidemiology/age_group.h"
#include "epidemiology/populations.h"
#include "utils/custom_index_array.h"
#include "utils/parameter_set.h"
#include "utils/index.h"

// Includes from MEmilio
#include "models/ode_seir_metapop/model.h"
#include "models/ode_seir_metapop/infection_state.h"
#include "models/ode_seir_metapop/parameters.h"
#include "memilio/compartments/simulation.h"
#include "memilio/data/analyze_result.h"

#include "pybind11/pybind11.h"
#include "pybind11/eigen.h"

namespace py = pybind11;

namespace pymio
{
// specialization of pretty_name
template <>
inline std::string pretty_name<mio::oseirmetapop::InfectionState>()
{
return "InfectionState";
}

} // namespace pymio

PYBIND11_MODULE(_simulation_oseir_metapop, m)
{
pymio::bind_interpolate_result_methods(m);

pymio::iterable_enum<mio::oseirmetapop::InfectionState>(m, "InfectionState", py::module_local{})
.value("Susceptible", mio::oseirmetapop::InfectionState::Susceptible)
.value("Exposed", mio::oseirmetapop::InfectionState::Exposed)
.value("Infected", mio::oseirmetapop::InfectionState::Infected)
.value("Recovered", mio::oseirmetapop::InfectionState::Recovered);

pymio::bind_ParameterSet<mio::oseirmetapop::ParametersBase<double>, pymio::EnablePickling::Required>(
m, "ParametersBase");

pymio::bind_CustomIndexArray<mio::UncertainValue<double>, mio::oseirmetapop::Region, mio::AgeGroup>(
m, "RegionAgeGroupArray");
using RegionAgeGroupPopulations = mio::Populations<double, mio::oseirmetapop::Region, mio::AgeGroup>;
pymio::bind_Population(m, "RegionAgeGroupPopulations", mio::Tag<RegionAgeGroupPopulations>{});

pymio::bind_class<mio::oseirmetapop::Parameters<double>, pymio::EnablePickling::Never,
mio::oseirmetapop::ParametersBase<double>>(m, "Parameters")
.def(py::init<mio::oseirmetapop::Region, mio::AgeGroup>(), py::arg("num_regions"), py::arg("num_agegroups"))
.def("check_constraints", &mio::oseirmetapop::Parameters<double>::check_constraints)
.def("apply_constraints", &mio::oseirmetapop::Parameters<double>::apply_constraints)
.def_property_readonly("num_regions", &mio::oseirmetapop::Parameters<double>::get_num_regions)
.def_property_readonly("num_agegroups", &mio::oseirmetapop::Parameters<double>::get_num_agegroups);

using Populations =
mio::Populations<double, mio::oseirmetapop::Region, mio::AgeGroup, mio::oseirmetapop::InfectionState>;

pymio::bind_Population(m, "Populations", mio::Tag<mio::oseirmetapop::Model<double>::Populations>{});
pymio::bind_CompartmentalModel<mio::oseirmetapop::InfectionState, Populations,
mio::oseirmetapop::Parameters<double>, pymio::EnablePickling::Never>(m, "ModelBase");

using Model = mio::oseirmetapop::Model<double>;
pymio::bind_class<Model, pymio::EnablePickling::Never,
mio::CompartmentalModel<double, mio::oseirmetapop::InfectionState, Populations,
mio::oseirmetapop::Parameters<double>>>(m, "Model")
.def(py::init<int, int>(), py::arg("num_regions"), py::arg("num_agegroups"))
.def("set_commuting_strengths", py::overload_cast<const Eigen::MatrixXd&>(&Model::set_commuting_strengths),
py::arg("commuting_strengths"))
.def("set_commuting_strengths_identity", py::overload_cast<>(&Model::set_commuting_strengths));

pymio::bind_Simulation<mio::Simulation<double, Model>>(m, "Simulation");
pymio::bind_Flow_Simulation<mio::FlowSimulation<double, Model>>(m, "FlowSimulation");

m.def("simulate", &mio::simulate<double, Model>, "Simulates an ODE SEIR metapopulation model from t0 to tmax.",
py::arg("t0"), py::arg("tmax"), py::arg("dt"), py::arg("model"), py::arg("integrator") = py::none());
m.def("simulate_flows", &mio::simulate_flows<double, Model>,
"Simulates an ODE SEIR metapopulation model with flows from t0 to tmax.", py::arg("t0"), py::arg("tmax"),
py::arg("dt"), py::arg("model"), py::arg("integrator") = py::none());

m.attr("__version__") = "dev";
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ auto bind_Range(pybind11::module_& m, const std::string& class_name)
.def(
"__iter__",
[](Range& self) {
return self;
return Iterator{{self.begin(), self.end()}};
},
pybind11::keep_alive<1, 0>{}) //keep alive the Range as long as there is an iterator
.def(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ PYBIND11_MODULE(_simulation, m)
pymio::bind_CustomIndexArray<mio::UncertainValue<double>, mio::AgeGroup>(m, "AgeGroupArray");
pymio::bind_class<mio::AgeGroup, pymio::EnablePickling::Required, mio::Index<mio::AgeGroup>>(m, "AgeGroup")
.def(py::init<size_t>());
pymio::bind_Index<mio::regions::Region>(m, "IndexRegion");
pymio::bind_class<mio::regions::Region, pymio::EnablePickling::Never, mio::Index<mio::regions::Region>>(m, "Region")
.def(py::init<size_t>());

pymio::bind_CustomIndexArray<double, mio::AgeGroup, mio::SimulationDay>(m, "AgeGroupSimulationDayArray");
pymio::bind_class<mio::SimulationDay, pymio::EnablePickling::Never, mio::Index<mio::SimulationDay>>(m,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void bind_Index(pybind11::module_& m, std::string const& name)
c.def(pybind11::init<size_t>(), pybind11::arg("value"));
c.def(pybind11::self == pybind11::self);
c.def(pybind11::self != pybind11::self);
c.def("get", &mio::Index<Tag>::get);

bind_Index_members_if_enum(c);
}
Expand Down
25 changes: 25 additions & 0 deletions pycode/memilio-simulation/memilio/simulation/oseir_metapop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#############################################################################
# Copyright (C) 2020-2025 MEmilio
#
# Authors: Henrik Zunker
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#############################################################################

"""
Python bindings for the MEmilio ODE SEIR metapopulation model.
"""

from memilio.simulation._simulation_oseir_metapop import *
Loading