Steven Hughes
2007-11-05 19:39:03 UTC
Darrel,
I've read through the doc once, and probably need a second reading. So
far I prefer method 3.2. But, here's a few questions I have so far:
1) How does a function manage its LOS in the case that it calls itself, or if it calls a function that in turn calls it back?
In the case of recursion, what about having a list or tree (not sure of the best term here) of LOSs' for each nested/recursive call made to a function. So using your example, if CalculatePropTime was called recursively (not sure why this would happen, just need a simple example), then the LOS may look like this
* Call from MainSequence
o XYPlot: plot
o Variable: startEpoch, endEpoch, j
* Call from CalculatePropTime
o XYPlot: plot
o Variable: startEpoch, endEpoch, j
* Call from CalculatePropTime
o XYPlot: plot
o Variable: startEpoch, endEpoch, j
* Last Call to CalculatePropTime
o XYPlot: plot
o Variable: startEpoch, endEpoch, j
At the last recursive call to CalculatePropTime, you would begin
traversing the tree in reverse. It seems that if we support recursion
or some types of nested functions calls, then something like this is
unavoidable. Is this true, and is there a design issue or conflict with
this approach??
2) I can see eventually using something like an Include command to load
a library of useful GMAT functions. If we create a LOS for every
function,during the build process, this means that a lot of memory and
time could be consumed setting up the LOS for functions that may not be
used. Why can't the LOS for functions be created as the mission sequence
is run and a function is called?
Steve
I've read through the doc once, and probably need a second reading. So
far I prefer method 3.2. But, here's a few questions I have so far:
1) How does a function manage its LOS in the case that it calls itself, or if it calls a function that in turn calls it back?
In the case of recursion, what about having a list or tree (not sure of the best term here) of LOSs' for each nested/recursive call made to a function. So using your example, if CalculatePropTime was called recursively (not sure why this would happen, just need a simple example), then the LOS may look like this
* Call from MainSequence
o XYPlot: plot
o Variable: startEpoch, endEpoch, j
* Call from CalculatePropTime
o XYPlot: plot
o Variable: startEpoch, endEpoch, j
* Call from CalculatePropTime
o XYPlot: plot
o Variable: startEpoch, endEpoch, j
* Last Call to CalculatePropTime
o XYPlot: plot
o Variable: startEpoch, endEpoch, j
At the last recursive call to CalculatePropTime, you would begin
traversing the tree in reverse. It seems that if we support recursion
or some types of nested functions calls, then something like this is
unavoidable. Is this true, and is there a design issue or conflict with
this approach??
2) I can see eventually using something like an Include command to load
a library of useful GMAT functions. If we create a LOS for every
function,during the build process, this means that a lot of memory and
time could be consumed setting up the LOS for functions that may not be
used. Why can't the LOS for functions be created as the mission sequence
is run and a function is called?
Steve
The attached document shows the object map options I'm thinking
through for Functions. I only have one test case in it so far; I'll
add a second and maybe a third tomorrow, and fill out the table at the
end.
Just thought you might want to see the pieces I'm thinking about. The
current example favors the "semilocal" approach, but it's only one
data point, and other examples won't be as generous to that approach,
I think.
(Yeah, it's 10 pages, but mostly faked up scripting and definitions.)
through for Functions. I only have one test case in it so far; I'll
add a second and maybe a third tomorrow, and fill out the table at the
end.
Just thought you might want to see the pieces I'm thinking about. The
current example favors the "semilocal" approach, but it's only one
data point, and other examples won't be as generous to that approach,
I think.
(Yeah, it's 10 pages, but mostly faked up scripting and definitions.)