Skip to content

Commit

Permalink
Check if any mutates [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Oct 10, 2023
1 parent cd141ae commit 0e1fbf3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/01-seir/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main() {

// Adding a bernoulli graph as step 0
model.agents_from_adjlist(
rgraph_smallworld(500000, 5, .001, false, model)
rgraph_smallworld(1000000, 5, .001, false, model)
);

// Running and checking the results
Expand Down
9 changes: 9 additions & 0 deletions include/epiworld/model-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,15 @@ inline void Model<TSeq>::update_state() {
template<typename TSeq>
inline void Model<TSeq>::mutate_virus() {

// Checking if any virus has mutation
size_t nmutates = 0u;
for (const auto & v: viruses)
if (v->mutation_fun)
nmutates++;

if (nmutates == 0u)
return;

if (use_queuing)
{

Expand Down

0 comments on commit 0e1fbf3

Please sign in to comment.