Opened 13 years ago
Closed 11 years ago
#1949 closed enhancement (fixed)
Support partial function evaluation
| Reported by: | Jens Frenkel | Owned by: | Martin Sjölund | 
|---|---|---|---|
| Priority: | high | Milestone: | 1.9.1 | 
| Component: | Code Generation | Version: | trunk | 
| Keywords: | function | Cc: | Jens Frenkel | 
Description
The model Modelica.Math.Nonlinear.Examples.quadratureLobatto3 of the MSL3.2.1 failes because code generation does not handle constant funktion arguments. 
The function call 
Modelica.Math.Nonlinear.quadratureLobatto(function Modelica.Math.Nonlinear.Examples.UtilityFunctions.fun7(A, ws), 0.0, 1.0, 1e-13)
result in the unkown c code arguments
modelica_real _Modelica.Math.Nonlinear.Examples.UtilityFunctions.fun7_A modelica_real _Modelica.Math.Nonlinear.Examples.UtilityFunctions.fun7_w
for the function 
ModelicaMathNonlinearquadratureLobattoModelicaMathNonlinearExamplesUtilityFunctionsfun7
Change History (4)
comment:1 by , 13 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → accepted | 
comment:2 by , 12 years ago
| Milestone: | 1.9.0 → 2.0.0 | 
|---|---|
| Summary: | not supported constant funktion arguments → Support partial function evaluation | 
| Type: | defect → enhancement | 
comment:3 by , 11 years ago
| Milestone: | 2.0.0 → 1.9.1 | 
|---|---|
| Owner: | changed from to | 
| Status: | accepted → assigned | 
My local changes now handles this, by introducing closures instead of re-writing the functions in PartFn.mo. Function pointers are now passed as tuple<function,closure>, where a NULL closure calls the function directly. And a non-NULL closure calls an intermediate function that calls the function with the variables bound. 

Hm, these look like partially evaluated functions.
I don't know if we fully support these.
I'll have a look.