Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve human readability in C generation #1171

Open
FinbarArgus opened this issue Jun 6, 2023 · 1 comment
Open

Improve human readability in C generation #1171

FinbarArgus opened this issue Jun 6, 2023 · 1 comment
Assignees

Comments

@FinbarArgus
Copy link

FinbarArgus commented Jun 6, 2023

Include Aliases to improve the readability of generated C code.

Currently generated code looks like:

rate[1] = f(variable[1], variable[2])
rate[2] = g(variable[1], variable[2])

It would be nice to have a flag for human readability that changes the generated code to something like this:

name_of_variable_1 = variable[1]
name_of_variable_2 = variable[2]

d_name_of_variable_1 = f(name_of_variable_1, name_of_variable_2)
d_name_of_variable_2 = g(name_of_variable_1, name_of_variable_2)

rate[1] = d_name_of_variable_1
rate[2] = d_name_of_variable_2

Or something similar?

This would make it much easier to collaborate with other groups, i.e. if I want to generate an ANS model to collaborate with a group working on CVS modelling I need to send them the C++ code of the ANS model. If it's not readable it makes things tough. It would also make debugging errors within steps of the solver much easier.

@agarny
Copy link
Contributor

agarny commented Jun 6, 2023

Definitely possible and relatively easy to do. We could make it an option to Generator::implementationCode().

@agarny agarny self-assigned this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants