Fix bytecode for block+mfs>0 in static model

Variable indices would be incorrect in the evaluated Jacobian if recursive
variables were present. This would lead to incorrect results and/or crashes in
bytecode MEX. This bug has been exposed by commit
f45a99fc68, which actually enabled mfs>0 for
static models.
master
Sébastien Villemot 2023-03-03 17:21:53 +01:00
parent 7acf278370
commit 715ec9e4bc
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 2 additions and 1 deletions

View File

@ -87,7 +87,8 @@ private:
int
getBlockJacobianEndoCol([[maybe_unused]] int blk, int var, [[maybe_unused]] int lag) const override
{
return var;
assert(var >= blocks[blk].getRecursiveSize());
return var - blocks[blk].getRecursiveSize();
}
// Write the block structure of the model in the driver file