@@ -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,23 @@ 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>(
78+ m, " LocalInfectionParameters" )
79+ .def (py::init<size_t >());
7880
79- py::class_ <mio::abm::TimeSpan>(m, " TimeSpan" )
81+ pymio::bind_class <mio::abm::TimeSpan, pymio::EnablePickling::Never >(m, " TimeSpan" )
8082 .def (py::init<int >(), py::arg (" seconds" ) = 0 )
8183 .def_property_readonly (" seconds" , &mio::abm::TimeSpan::seconds)
8284 .def_property_readonly (" hours" , &mio::abm::TimeSpan::hours)
@@ -101,7 +103,7 @@ PYBIND11_MODULE(_simulation_abm, m)
101103 m.def (" hours" , &mio::abm::hours);
102104 m.def (" days" , py::overload_cast<int >(&mio::abm::days));
103105
104- py::class_ <mio::abm::TimePoint>(m, " TimePoint" )
106+ pymio::bind_class <mio::abm::TimePoint, pymio::EnablePickling::Never >(m, " TimePoint" )
105107 .def (py::init<int >(), py::arg (" seconds" ) = 0 )
106108 .def_property_readonly (" seconds" , &mio::abm::TimePoint::seconds)
107109 .def_property_readonly (" days" , &mio::abm::TimePoint::days)
@@ -121,7 +123,7 @@ PYBIND11_MODULE(_simulation_abm, m)
121123 .def (py::self - mio::abm::TimeSpan{})
122124 .def (py::self -= mio::abm::TimeSpan{});
123125
124- py::class_ <mio::abm::LocationId>(m, " LocationId" )
126+ pymio::bind_class <mio::abm::LocationId, pymio::EnablePickling::Never >(m, " LocationId" )
125127 .def (py::init ([](uint32_t idx, mio::abm::LocationType type) {
126128 return mio::abm::LocationId{idx, type};
127129 }))
@@ -134,36 +136,38 @@ PYBIND11_MODULE(_simulation_abm, m)
134136 return mio::abm::PersonId{id};
135137 }));
136138
137- py::class_ <mio::abm::Person>(m, " Person" )
139+ pymio::bind_class <mio::abm::Person, pymio::EnablePickling::Never >(m, " Person" )
138140 .def (" set_assigned_location" , py::overload_cast<mio::abm::LocationId>(&mio::abm::Person::set_assigned_location))
139141 .def_property_readonly (" location" , py::overload_cast<>(&mio::abm::Person::get_location, py::const_))
140142 .def_property_readonly (" age" , &mio::abm::Person::get_age)
141143 .def_property_readonly (" is_in_quarantine" , &mio::abm::Person::is_in_quarantine);
142144
143- py::class_ <mio::abm::TestingCriteria>(m, " TestingCriteria" )
145+ pymio::bind_class <mio::abm::TestingCriteria, pymio::EnablePickling::Never >(m, " TestingCriteria" )
144146 .def (py::init<const std::vector<mio::AgeGroup>&, const std::vector<mio::abm::InfectionState>&>(),
145147 py::arg (" age_groups" ), py::arg (" infection_states" ));
146148
147- py::class_<mio::abm::GenericTest>(m, " GenericTest" ).def (py::init<>());
148- py::class_<mio::abm::AntigenTest, mio::abm::GenericTest>(m, " AntigenTest" ).def (py::init<>());
149- py::class_<mio::abm::PCRTest, mio::abm::GenericTest>(m, " PCRTest" ).def (py::init<>());
149+ pymio::bind_class<mio::abm::GenericTest, pymio::EnablePickling::Never>(m, " GenericTest" ).def (py::init<>());
150+ pymio::bind_class<mio::abm::AntigenTest, pymio::EnablePickling::Never, mio::abm::GenericTest>(m, " AntigenTest" )
151+ .def (py::init<>());
152+ pymio::bind_class<mio::abm::PCRTest, pymio::EnablePickling::Never, mio::abm::GenericTest>(m, " PCRTest" )
153+ .def (py::init<>());
150154
151- py::class_ <mio::abm::TestingScheme>(m, " TestingScheme" )
155+ pymio::bind_class <mio::abm::TestingScheme, pymio::EnablePickling::Never >(m, " TestingScheme" )
152156 .def (py::init<const mio::abm::TestingCriteria&, mio::abm::TimeSpan, mio::abm::TimePoint, mio::abm::TimePoint,
153157 const mio::abm::GenericTest&, double >(),
154158 py::arg (" testing_criteria" ), py::arg (" testing_min_time_since_last_test" ), py::arg (" start_date" ),
155159 py::arg (" end_date" ), py::arg (" test_type" ), py::arg (" probability" ))
156160 .def_property_readonly (" active" , &mio::abm::TestingScheme::is_active);
157161
158- py::class_ <mio::abm::Vaccination>(m, " Vaccination" )
162+ pymio::bind_class <mio::abm::Vaccination, pymio::EnablePickling::Never >(m, " Vaccination" )
159163 .def (py::init<mio::abm::ExposureType, mio::abm::TimePoint>(), py::arg (" exposure_type" ), py::arg (" time" ))
160164 .def_readwrite (" exposure_type" , &mio::abm::Vaccination::exposure_type)
161165 .def_readwrite (" time" , &mio::abm::Vaccination::time);
162166
163- py::class_ <mio::abm::TestingStrategy>(m, " TestingStrategy" )
167+ pymio::bind_class <mio::abm::TestingStrategy, pymio::EnablePickling::Never >(m, " TestingStrategy" )
164168 .def (py::init<const std::unordered_map<mio::abm::LocationId, std::vector<mio::abm::TestingScheme>>&>());
165169
166- py::class_ <mio::abm::Location>(m, " Location" )
170+ pymio::bind_class <mio::abm::Location, pymio::EnablePickling::Never >(m, " Location" )
167171 .def_property_readonly (" type" , &mio::abm::Location::get_type)
168172 .def_property_readonly (" index" , &mio::abm::Location::get_index)
169173 .def_property (" infection_parameters" ,
@@ -176,7 +180,7 @@ PYBIND11_MODULE(_simulation_abm, m)
176180 pymio::bind_Range<decltype (std::declval<const mio::abm::World>().get_locations ())>(m, " _WorldLocationsRange" );
177181 pymio::bind_Range<decltype (std::declval<const mio::abm::World>().get_persons ())>(m, " _WorldPersonsRange" );
178182
179- py::class_ <mio::abm::Trip>(m, " Trip" )
183+ pymio::bind_class <mio::abm::Trip, pymio::EnablePickling::Never >(m, " Trip" )
180184 .def (py::init<uint32_t , mio::abm::TimePoint, mio::abm::LocationId, mio::abm::LocationId,
181185 std::vector<uint32_t >>(),
182186 py::arg (" person_id" ), py::arg (" time" ), py::arg (" destination" ), py::arg (" origin" ),
@@ -187,13 +191,13 @@ PYBIND11_MODULE(_simulation_abm, m)
187191 .def_readwrite (" origin" , &mio::abm::Trip::migration_origin)
188192 .def_readwrite (" cells" , &mio::abm::Trip::cells);
189193
190- py::class_ <mio::abm::TripList>(m, " TripList" )
194+ pymio::bind_class <mio::abm::TripList, pymio::EnablePickling::Never >(m, " TripList" )
191195 .def (py::init<>())
192196 .def (" add_trip" , &mio::abm::TripList::add_trip, py::arg (" trip" ), py::arg (" weekend" ) = false )
193197 .def (" next_trip" , &mio::abm::TripList::get_next_trip, py::arg (" weekend" ) = false )
194198 .def (" num_trips" , &mio::abm::TripList::num_trips, py::arg (" weekend" ) = false );
195199
196- py::class_ <mio::abm::World>(m, " World" )
200+ pymio::bind_class <mio::abm::World, pymio::EnablePickling::Never >(m, " World" )
197201 .def (py::init<int32_t >())
198202 .def (" add_location" , &mio::abm::World::add_location, py::arg (" location_type" ), py::arg (" num_cells" ) = 1 )
199203 .def (" add_person" ,
@@ -231,7 +235,7 @@ PYBIND11_MODULE(_simulation_abm, m)
231235 },
232236 py::return_value_policy::reference_internal);
233237
234- py::class_ <mio::abm::Simulation>(m, " Simulation" )
238+ pymio::bind_class <mio::abm::Simulation, pymio::EnablePickling::Never >(m, " Simulation" )
235239 .def (py::init<mio::abm::TimePoint, size_t >())
236240 .def (" advance" ,
237241 static_cast <void (mio::abm::Simulation::*)(mio::abm::TimePoint)>(&mio::abm::Simulation::advance),
0 commit comments