web
You’re offline. This is a read only version of the page.
close
Please wait...
×

Error



Posted 14 years ago by mwtoews
Simple question. I'd like to get the current time step integer. I've tried [tt]IfmGetAbsoluteSimulationTime[/tt], however, this is not quite the same (it is a floating-point day, not an integer for the time step). Please help me fill in the blank, or prove me a way to determine the time step.

[code]
static void PostTimeStep (IfmDocument pDoc)
{
double abs_sim_time = IfmGetAbsoluteSimulationTime(pDoc);
        int ts_num = ??????;

IfmInfo(pDoc, "At timestep #%i, with absolute time %g days\n", ts_num, abs_sim_time);
}
[/code]

Thanks!
Posted 14 years ago by mwtoews
My solution is to track this independently, using a module global:

[code]
int ts; // time step integer

static void OnEnterSimulator (IfmDocument pDoc)
{
    // Reset time step
    ts = 0;
...

static void PostTimeStep (IfmDocument pDoc)
{
    ts++;
    IfmInfo(pDoc, "Processing timestep %i\n", ts);
...
[/code]

You must be signed in to post in this forum.