Skip to content

Commit 892005c

Browse files
authored
ODESimulator only accepts NetworkModel (#482)
1 parent a1fa0bb commit 892005c

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

ecell4/core/NetworkModel.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class NetworkModel
8383

8484
// NetworkModelTraits
8585

86-
bool is_static() const
86+
bool is_static() const final
8787
{
8888
return true;
8989
}

ecell4/ode/ODESimulator.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,10 @@ class ODESimulator
511511

512512
void initialize()
513513
{
514+
if (!model_->is_static())
515+
{
516+
throw std::runtime_error("Only a NetworkModel is accepted. Use expand");
517+
}
514518
const std::vector<Species> species(model_->list_species());
515519
for(std::vector<Species>::const_iterator it = species.begin();
516520
it != species.end(); it++)

ecell4/python_api/core.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ void define_model(py::module& m)
491491
.def("species_attributes", &Model::species_attributes)
492492
.def("species_attributes_proceed", &Model::species_attributes_proceed)
493493
.def("num_reaction_rules", &Model::num_reaction_rules)
494+
.def("is_static", &Model::is_static)
494495
.def("expand", (std::shared_ptr<Model> (Model::*)(
495496
const std::vector<Species>&, const Integer, const std::map<Species, Integer>&) const) &Model::expand)
496497
.def("expand", (std::shared_ptr<Model> (Model::*)(const std::vector<Species>&, const Integer) const) &Model::expand)
@@ -713,7 +714,6 @@ void define_observers(py::module& m)
713714
.def("dt", &FixedIntervalNumberObserver::dt)
714715
.def("t0", &FixedIntervalNumberObserver::t0)
715716
.def("count", &FixedIntervalNumberObserver::count)
716-
.def("next_time", &FixedIntervalNumberObserver::next_time)
717717
.def("data", &FixedIntervalNumberObserver::data)
718718
.def("targets", &FixedIntervalNumberObserver::targets)
719719
.def("save", &FixedIntervalNumberObserver::save)
@@ -832,7 +832,6 @@ void define_observers(py::module& m)
832832
.def("dt", &FixedIntervalCSVObserver::dt)
833833
.def("t0", &FixedIntervalCSVObserver::t0)
834834
.def("count", &FixedIntervalCSVObserver::count)
835-
.def("next_time", &FixedIntervalCSVObserver::next_time)
836835
.def("set_header", &FixedIntervalCSVObserver::set_header)
837836
.def("set_formatter", &FixedIntervalCSVObserver::set_formatter)
838837
.def(py::pickle(

0 commit comments

Comments
 (0)