@@ -33,7 +33,7 @@ namespace py = pybind11;
3333
3434PYBIND11_MODULE (_simulation_abm, m)
3535{
36- pymio::iterable_enum<mio::abm::InfectionState>(m, " InfectionState" , py::module_local{} )
36+ pymio::iterable_enum<mio::abm::InfectionState>(m, " InfectionState" )
3737 .value (" Susceptible" , mio::abm::InfectionState::Susceptible)
3838 .value (" Exposed" , mio::abm::InfectionState::Exposed)
3939 .value (" InfectedNoSymptoms" , mio::abm::InfectionState::InfectedNoSymptoms)
@@ -62,21 +62,21 @@ PYBIND11_MODULE(_simulation_abm, m)
6262 .value (" PublicTransport" , mio::abm::LocationType::PublicTransport)
6363 .value (" TransportWithoutContact" , mio::abm::LocationType::TransportWithoutContact);
6464
65- py::class_ <mio::abm::TestParameters>(m, " TestParameters" )
65+ pymio::bind_class <mio::abm::TestParameters, pymio::EnablePickling::Never >(m, " TestParameters" )
6666 .def (py::init<double , double >())
6767 .def_readwrite (" sensitivity" , &mio::abm::TestParameters::sensitivity)
6868 .def_readwrite (" specificity" , &mio::abm::TestParameters::specificity);
6969
7070 pymio::bind_CustomIndexArray<mio::UncertainValue, mio::abm::VirusVariant, mio::AgeGroup>(m, " _AgeParameterArray" );
7171 pymio::bind_Index<mio::abm::ExposureType>(m, " ExposureTypeIndex" );
72- pymio::bind_ParameterSet<mio::abm::ParametersBase>(m, " ParametersBase" );
73- py::class_ <mio::abm::Parameters, mio::abm::ParametersBase>(m, " Parameters" )
72+ pymio::bind_ParameterSet<mio::abm::ParametersBase, pymio::EnablePickling::Never >(m, " ParametersBase" );
73+ pymio::bind_class <mio::abm::Parameters, pymio::EnablePickling::Never , mio::abm::ParametersBase>(m, " Parameters" )
7474 .def (py::init<int >())
7575 .def (" check_constraints" , &mio::abm::Parameters::check_constraints);
7676
77- pymio::bind_ParameterSet<mio::abm::LocalInfectionParameters>(m, " LocalInfectionParameters" ).def (py::init<size_t >());
77+ pymio::bind_ParameterSet<mio::abm::LocalInfectionParameters, pymio::EnablePickling::Never >(m, " LocalInfectionParameters" ).def (py::init<size_t >());
7878
79- py::class_ <mio::abm::TimeSpan>(m, " TimeSpan" )
79+ pymio::bind_class <mio::abm::TimeSpan, pymio::EnablePickling::Never >(m, " TimeSpan" )
8080 .def (py::init<int >(), py::arg (" seconds" ) = 0 )
8181 .def_property_readonly (" seconds" , &mio::abm::TimeSpan::seconds)
8282 .def_property_readonly (" hours" , &mio::abm::TimeSpan::hours)
@@ -101,7 +101,7 @@ PYBIND11_MODULE(_simulation_abm, m)
101101 m.def (" hours" , &mio::abm::hours);
102102 m.def (" days" , py::overload_cast<int >(&mio::abm::days));
103103
104- py::class_ <mio::abm::TimePoint>(m, " TimePoint" )
104+ pymio::bind_class <mio::abm::TimePoint, pymio::EnablePickling::Never >(m, " TimePoint" )
105105 .def (py::init<int >(), py::arg (" seconds" ) = 0 )
106106 .def_property_readonly (" seconds" , &mio::abm::TimePoint::seconds)
107107 .def_property_readonly (" days" , &mio::abm::TimePoint::days)
@@ -121,7 +121,7 @@ PYBIND11_MODULE(_simulation_abm, m)
121121 .def (py::self - mio::abm::TimeSpan{})
122122 .def (py::self -= mio::abm::TimeSpan{});
123123
124- py::class_ <mio::abm::LocationId>(m, " LocationId" )
124+ pymio::bind_class <mio::abm::LocationId, pymio::EnablePickling::Never >(m, " LocationId" )
125125 .def (py::init ([](uint32_t idx, mio::abm::LocationType type) {
126126 return mio::abm::LocationId{idx, type};
127127 }))
@@ -130,36 +130,36 @@ PYBIND11_MODULE(_simulation_abm, m)
130130 .def (py::self == py::self)
131131 .def (py::self != py::self);
132132
133- py::class_ <mio::abm::Person>(m, " Person" )
133+ pymio::bind_class <mio::abm::Person, pymio::EnablePickling::Never >(m, " Person" )
134134 .def (" set_assigned_location" , py::overload_cast<mio::abm::LocationId>(&mio::abm::Person::set_assigned_location))
135135 .def_property_readonly (" location" , py::overload_cast<>(&mio::abm::Person::get_location, py::const_))
136136 .def_property_readonly (" age" , &mio::abm::Person::get_age)
137137 .def_property_readonly (" is_in_quarantine" , &mio::abm::Person::is_in_quarantine);
138138
139- py::class_ <mio::abm::TestingCriteria>(m, " TestingCriteria" )
139+ pymio::bind_class <mio::abm::TestingCriteria, pymio::EnablePickling::Never >(m, " TestingCriteria" )
140140 .def (py::init<const std::vector<mio::AgeGroup>&, const std::vector<mio::abm::InfectionState>&>(),
141141 py::arg (" age_groups" ), py::arg (" infection_states" ));
142+
143+ pymio::bind_class<mio::abm::GenericTest, pymio::EnablePickling::Never>(m, " GenericTest" ).def (py::init<>());
144+ pymio::bind_class<mio::abm::AntigenTest, pymio::EnablePickling::Never, mio::abm::GenericTest>(m, " AntigenTest" ).def (py::init<>());
145+ pymio::bind_class<mio::abm::PCRTest, pymio::EnablePickling::Never, mio::abm::GenericTest>(m, " PCRTest" ).def (py::init<>());
142146
143- py::class_<mio::abm::GenericTest>(m, " GenericTest" ).def (py::init<>());
144- py::class_<mio::abm::AntigenTest, mio::abm::GenericTest>(m, " AntigenTest" ).def (py::init<>());
145- py::class_<mio::abm::PCRTest, mio::abm::GenericTest>(m, " PCRTest" ).def (py::init<>());
146-
147- py::class_<mio::abm::TestingScheme>(m, " TestingScheme" )
147+ pymio::bind_class<mio::abm::TestingScheme, pymio::EnablePickling::Never>(m, " TestingScheme" )
148148 .def (py::init<const mio::abm::TestingCriteria&, mio::abm::TimeSpan, mio::abm::TimePoint, mio::abm::TimePoint,
149149 const mio::abm::GenericTest&, double >(),
150150 py::arg (" testing_criteria" ), py::arg (" testing_min_time_since_last_test" ), py::arg (" start_date" ),
151151 py::arg (" end_date" ), py::arg (" test_type" ), py::arg (" probability" ))
152152 .def_property_readonly (" active" , &mio::abm::TestingScheme::is_active);
153153
154- py::class_ <mio::abm::Vaccination>(m, " Vaccination" )
154+ pymio::bind_class <mio::abm::Vaccination, pymio::EnablePickling::Never >(m, " Vaccination" )
155155 .def (py::init<mio::abm::ExposureType, mio::abm::TimePoint>(), py::arg (" exposure_type" ), py::arg (" time" ))
156156 .def_readwrite (" exposure_type" , &mio::abm::Vaccination::exposure_type)
157157 .def_readwrite (" time" , &mio::abm::Vaccination::time);
158158
159- py::class_ <mio::abm::TestingStrategy>(m, " TestingStrategy" )
159+ pymio::bind_class <mio::abm::TestingStrategy, pymio::EnablePickling::Never >(m, " TestingStrategy" )
160160 .def (py::init<const std::unordered_map<mio::abm::LocationId, std::vector<mio::abm::TestingScheme>>&>());
161161
162- py::class_ <mio::abm::Location>(m, " Location" )
162+ pymio::bind_class <mio::abm::Location, pymio::EnablePickling::Never >(m, " Location" )
163163 .def_property_readonly (" type" , &mio::abm::Location::get_type)
164164 .def_property_readonly (" index" , &mio::abm::Location::get_index)
165165 .def_property (" infection_parameters" ,
@@ -172,7 +172,7 @@ PYBIND11_MODULE(_simulation_abm, m)
172172 pymio::bind_Range<decltype (std::declval<mio::abm::World>().get_locations ())>(m, " _WorldLocationsRange" );
173173 pymio::bind_Range<decltype (std::declval<mio::abm::World>().get_persons ())>(m, " _WorldPersonsRange" );
174174
175- py::class_ <mio::abm::Trip>(m, " Trip" )
175+ pymio::bind_class <mio::abm::Trip, pymio::EnablePickling::Never >(m, " Trip" )
176176 .def (py::init<uint32_t , mio::abm::TimePoint, mio::abm::LocationId, mio::abm::LocationId,
177177 std::vector<uint32_t >>(),
178178 py::arg (" person_id" ), py::arg (" time" ), py::arg (" destination" ), py::arg (" origin" ),
@@ -183,13 +183,13 @@ PYBIND11_MODULE(_simulation_abm, m)
183183 .def_readwrite (" origin" , &mio::abm::Trip::migration_origin)
184184 .def_readwrite (" cells" , &mio::abm::Trip::cells);
185185
186- py::class_ <mio::abm::TripList>(m, " TripList" )
186+ pymio::bind_class <mio::abm::TripList, pymio::EnablePickling::Never >(m, " TripList" )
187187 .def (py::init<>())
188188 .def (" add_trip" , &mio::abm::TripList::add_trip, py::arg (" trip" ), py::arg (" weekend" ) = false )
189189 .def (" next_trip" , &mio::abm::TripList::get_next_trip, py::arg (" weekend" ) = false )
190190 .def (" num_trips" , &mio::abm::TripList::num_trips, py::arg (" weekend" ) = false );
191191
192- py::class_ <mio::abm::World>(m, " World" )
192+ pymio::bind_class <mio::abm::World, pymio::EnablePickling::Never >(m, " World" )
193193 .def (py::init<int32_t >())
194194 .def (" add_location" , &mio::abm::World::add_location, py::arg (" location_type" ), py::arg (" num_cells" ) = 1 )
195195 .def (" add_person" , &mio::abm::World::add_person, py::arg (" location_id" ), py::arg (" age_group" ),
@@ -213,7 +213,7 @@ PYBIND11_MODULE(_simulation_abm, m)
213213 },
214214 py::return_value_policy::reference_internal);
215215
216- py::class_ <mio::abm::Simulation>(m, " Simulation" )
216+ pymio::bind_class <mio::abm::Simulation, pymio::EnablePickling::Never >(m, " Simulation" )
217217 .def (py::init<mio::abm::TimePoint, size_t >())
218218 .def (" advance" ,
219219 static_cast <void (mio::abm::Simulation::*)(mio::abm::TimePoint)>(&mio::abm::Simulation::advance),
0 commit comments