reaction_rule_vector const& query_reaction_rule( species_id_type const& r1, species_id_type const& r2) const { typename second_order_reaction_rule_vector_map::const_iterator i(second_order_cache_.find(std::make_pair(r1, r2))); if (i == second_order_cache_.end()) { const ecell4::Species sp1(r1), sp2(r2); ecell4::Model::reaction_rule_container_type reaction_rules_at_ecell4( model_->query_reaction_rules(sp1, sp2)); if (reaction_rules_at_ecell4.size() == 0) { reaction_rules_at_ecell4.push_back( create_repulsive_reaction_rule(sp1, sp2)); } std::pair<typename second_order_reaction_rule_vector_map::iterator, bool> x(second_order_cache_.insert( std::make_pair(std::make_pair(r1, r2), reaction_rule_vector()))); for (std::vector<ecell4::ReactionRule>::const_iterator it(reaction_rules_at_ecell4.begin()); it != reaction_rules_at_ecell4.end(); it++) { x.first->second.push_back(convert_reaction_rule_type(*it)); } return x.first->second; } return i->second; }
EGFRDSimulatorWrapper( boost::shared_ptr<NetworkModel> model, boost::shared_ptr<EGFRDWorld> world, Integer dissociation_retry_moves = 3) : model_(model), world_(world) { // set the log level for epdp as L_WARNING. ::LoggerManager::register_logger_manager( "ecell.EGFRDSimulator", boost::shared_ptr< ::LoggerManager>( new ::LoggerManager("dummy", ::Logger::L_WARNING))); const std::vector<Species> species((*model_).list_species()); for (std::vector<Species>::const_iterator i(species.begin()); i != species.end(); ++i) { if (!(*world_).has_species(*i)) { (*world_).add_species(*i); } } for (NetworkModel::species_container_type::const_iterator i(species.begin()); i != species.end(); ++i) { for (NetworkModel::species_container_type::const_iterator j(i); j != species.end(); ++j) { if ((*model_).query_reaction_rules(*i, *j).size() == 0) { (*world_).add_reaction_rule( create_repulsive_reaction_rule(*i, *j)); } } } const NetworkModel::reaction_rule_container_type& reaction_rules((*model_).reaction_rules()); for (NetworkModel::reaction_rule_container_type::const_iterator i(reaction_rules.begin()); i != reaction_rules.end(); ++i) { (*world_).add_reaction_rule(*i); } sim_ = boost::shared_ptr<simulator_type>( (*world_).create_simulator(dissociation_retry_moves)); initialize(); }