Sam Yates
authored
Incorporate symbolic GE code from prototype (with some simplifications) in msparse.hpp, symge.hpp and symge.cpp, together with unit tests. Add two kinetic scheme test cases for validation: test_kin1 (simple exponential scheme) and test_kinlva (combination of exponential gate and a three-species kinetic scheme, modelling a low voltage-activated Calcium channel from Wang, X. J. et al., J. Neurophys. 1991). Adapt numeric HH validation data generation to LVA Ca channel, with explicit stopping at stimulus discontinuities. Add two new validation tests based on above: kinetic.kin1_numeric_ref and kinetic.kinlva_numeric_ref (multicore backend only). Introduce a BlockRewriterBase visitor base class, as an aid for visitors that transform/rewrite procedure bodies; refactor KineticRewriter over this class. Introduce common error_stack mixin class for common functionality across Module and the various procedure rewriters. Implement visitors and public-facing convenience wrappers in symdiff.hpp and symdiff.cpp: involves_identifer for testing if an expression contains given identifiers. constant_simplify for constant folding with removal of trivial terms arising from a NumberExpression of zero or one. expr_value to extract the numerical value of a NumberExpression, or NaN othereise. is_zero to test if an expression is numerically zero. symbolic_pdiff to perform symbolic partial differentiation; this adds a new (not parseable) expression subclass to represent opaque partial differential terms. substitute to substitute identifiers for other expressions within an expression. linear_test for linearity, diagonality and homogeneity testing (this is probably redundant, given ExpressionClassifier already exists). Simplify unnecessary uses of make_unique with Vistor subclasses. Make SOLVE statement rewriting more generic, through the use of solve-rewriter visitors CnexpSolverVisitor, SparseSolverVisitor, and DirectSolverVisitor; implementations in solvers.hpp and solvers.cpp. Supports multiple SOLVE statements for independent subsets of state variables with the BREAKPOINT block. Add block rewriter for the removal of unused local variables, with convenience wrapper remove_unused_locals. Generalize is_in utility in modccutil.hpp. Simplify expression comparison in modcc unit tests with EXPECT_EXPR_EQ macro added to tests/modcc/test.hpp, that operates by comparing expression text representations. Simplify and consolidate verbose printing in modcc unit tests with verbose_print function that tests the global verbose flag and handles expression_ptr and similar which have to_string methods.