mrc-ide / individual

R Package for individual based epidemiological models
https://mrc-ide.github.io/individual
Other
30 stars 16 forks source link

Feat/resize int #161

Closed giovannic closed 2 years ago

giovannic commented 2 years ago

~To be reviewed after #159~

This change adds a ResizeableIntegerVariable. There are also a number of refactors to keep validation consistent between the variable types...

On the R side

We now have interfaces which do validation and then call C++ methods:

Variable classes are proxies to as many of these interfaces as they need.

e.g. DoubleVariable uses VariableInterface and DoubleInterface e.g.2. ResizeableIntegerVariable uses VariableInterface, IntegerInterface and ResizeableInterface

I've copied the relevant tests for each proxy class to make sure it works in practice

On the C++ side

ResizeableDoubleVariable is now a template class ResizeableNumericVariable<T>. The same functionality is provided by ResizeableNumericVariable<double>.

ResizeableIntegerVariable provides extra methods to ResizeableNumericVariable<int> for set indexing (get_index_of_set, get_size_of_set...).

For resizeable variable updates, we have moved from object oriented inheritance to type erasure. Let me know what you think of changes like this (maybe you have an opinion on this @richfitz ?). The classes used virtual tables, which cannot combine with templates :/

giovannic commented 2 years ago

Obsolete