With the current code, several operations to identify variables describing a type of individuals across all population classes (e.g. infectious individuals) is performed making a grep to the names of the variables, for instance all death individuals will be searched with the regexp ".D$".
This makes the code prone to errors if the names change, for instance I added a compartment called PI and using grep with the above regexp will return both PI and I (because the correct regexp should be "\.PI$".
A possible enhancement is to prestore these indexes and skip the greps, which would also accelerate the code.
With the current code, several operations to identify variables describing a type of individuals across all population classes (e.g. infectious individuals) is performed making a grep to the names of the variables, for instance all death individuals will be searched with the regexp ".D$".
This makes the code prone to errors if the names change, for instance I added a compartment called PI and using grep with the above regexp will return both PI and I (because the correct regexp should be "\.PI$". A possible enhancement is to prestore these indexes and skip the greps, which would also accelerate the code.