Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[codegen/simcode] Improve code generation for assignment of records i…
…n simulation context. (#546) - We now split up the record memebers and then create assignments for each member. We used to textually generate '=' assignments for the memebers. This does not work if the member is a record or an array. Instead we now actually create assignment expressions and then send them back to the template functions. Fix generation of auxiliary, residual and algebraicstate vars for daeMode - setVariableIndexHelper does not update the index so it is not the one that should be used. It also seems uneccsary to add the algebraicstateVars to the hastable manually. They are already there. - disable the creation of a new hastable after we had added the auxiliary vars to the old one. Otherwise we will discard them. - Since it was discarding some of the variables added to the hastable daemode used #defines to access these vars instead of actaully fixing the problem. The defines are disabled now. Fix creation of an array expression from a list of crefs. - Expanded crefs can be multidimensional. Therefore we should create multidimensional ARRAY expression in such cases. - Sometimes we get unevaluated dimensions in a simulation variable cref. In this case we might not be able to correctly exapnd the cref to an ARRAY exp if it is multidimensional. Since we do not know where to break up the list of exps. However there is now a workaround to let this happen if the cref was a one dimensional array. We jsut create an array with the unevaluated dim exp and hope it is correct. The proper way to fix this is to fix the FrontEnd to use evaluated dims for all crefs. But I am not going to try and do that now.
- Loading branch information
Showing
6 changed files
with
295 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.