JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
141 stars 26 forks source link

Automatically collect constants used for constraint bounds #1504

Open bmaclach opened 5 years ago

bmaclach commented 5 years ago

NoPCM and SWHS have many quantities with constraints that they are bounded between a minimum and maximum value. These minimum and maximum values are defined as QDefinitions and are constant. They need to be included in the constants field of the SystemInformation so that code generation knows their values.

Drasil should automatically collect such constant QDefinitions used in constraint bounds and automatically add them to the constants field of SystemInformation. All constrained values are already included in the constraints field of SystemInformation, so we could check each constraint to see if it refers to a quantity whose definition is simply a value (i.e. a constant).

More generally, we could do the same for all Exprs present in an example, not just in constraints, making the constants field of SystemInformation fully automated.

smiths commented 5 years ago

This sounds like a great idea towards increased automation and improved code generation.