Refactor ion_type and ion_if
Problem to solve with the new feature
Readability and maintainability of the limpet code and ionic model structure
Intended users
Developers
Further details
Leveraging features of C++ can result in easier code to read and maintain for the ionic models. Currently, the way ionic models and plugins are structured, loaded, and executed in the limpet library code is quite hard to read and understand, especially for new contributors.
Proposal
Hi,
As developers of the MLIR code generation for ionic models, we noticed that we were having a lot of trouble figuring out the
way ionic models and plugins are organized (mostly through the ion_type
and ion_if
structs), loaded (apparently, mostly through
generated_functions.cc
) and executed (through function pointers that are assigned by each model / plugin).
The use of auto-generated files (mainly generated_functions.cc
and ION_IF.h
) makes the code more difficult to understand, reason about and
maintain. Moreover, the ion_type
and ion_if
structures are auto-generated, but are written statically and don't seem to depend on anything
in imp_list.txt
or elsewhere.
We also think that some features of C++ could be used to ease reading and reasoning about the code, by rethinking the main ionic model structures (like the one with a bunch of function pointers) with classes for example.
We have a student here in Strasbourg who would work with us to document more precisely, and then implement those changes.
Those changes would not affect functionality, but we argue that they would help in the long term with maintainability and readability. This is also an opportunity to improve documentation in the limpet library of openCARP.
Please let us know if you have remarks, questions, or if the issue board isn't the right place for this discussion. Thank you!
Testing
Since those will be changes in code structure / refactoring, the usual CI tests should suffice to be sure that nothing was modified with respect to functionality.
Links / references
None for now