Opened 12 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 Adrian Pop, 12 years ago

Owner: changed from Martin Sjölund to Adrian Pop
Status: newaccepted

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

comment:2 by Martin Sjölund, 12 years ago

Milestone: 1.9.02.0.0
Summary: not supported constant funktion argumentsSupport partial function evaluation
Type: defectenhancement

comment:3 by Martin Sjölund, 11 years ago

Milestone: 2.0.01.9.1
Owner: changed from Adrian Pop to Martin Sjölund
Status: acceptedassigned

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.

comment:4 by Martin Sjölund, 11 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r21304.

Note: See TracTickets for help on using tickets.