Template:CMI Example CMI run C: Difference between revisions
From CSDMS
Automated import of articles |
Automated import of articles *** existing text overwritten *** |
||
Line 56: | Line 56: | ||
fprintf (stderr, "%s: Updating ports until %f. | fprintf (stderr, "%s: Updating ports until %f. | ||
", CMI_COMPONENT_NAME, now); | ", CMI_COMPONENT_NAME, now); | ||
edu_csdms_tools_IRFPortQueue_run_ports (this->ports, now, _ex); | |||
#if CMI_TURN_OFF_MAPPING | #if CMI_TURN_OFF_MAPPING | ||
fprintf (stderr, "%s: Forgetting mappers. | fprintf (stderr, "%s: Forgetting mappers. | ||
Line 63: | Line 63: | ||
fprintf (stderr, "%s: Run mappers. | fprintf (stderr, "%s: Run mappers. | ||
", CMI_COMPONENT_NAME); | ", CMI_COMPONENT_NAME); | ||
edu_csdms_tools_IRFPortQueue_run_mappers (this->ports, _ex); | |||
#endif | #endif | ||
Line 79: | Line 79: | ||
fprintf (stderr, "%s: Updating ports until %f. | fprintf (stderr, "%s: Updating ports until %f. | ||
", CMI_COMPONENT_NAME, now); | ", CMI_COMPONENT_NAME, now); | ||
edu_csdms_tools_IRFPortQueue_run_ports (this->ports, now, _ex); | |||
#if CMI_TURN_OFF_MAPPING | #if CMI_TURN_OFF_MAPPING | ||
Line 87: | Line 87: | ||
fprintf (stderr, "%s: Run mappers. | fprintf (stderr, "%s: Run mappers. | ||
", CMI_COMPONENT_NAME); | ", CMI_COMPONENT_NAME); | ||
edu_csdms_tools_IRFPortQueue_run_mappers (this->ports, _ex); | |||
#endif | #endif | ||
Revision as of 17:04, 1 February 2012
struct edu_csdms_models_Sedflux3D__data *this =
edu_csdms_models_Sedflux3D__get_data (self);
fprintf (stderr, "%s: Status is %s.
", CMI_COMPONENT_NAME,
edu_csdms_models_Sedflux3D_CMI_get_status (self, _ex));
if (this->status == CMI_STATUS_UPDATING)
return TRUE;
else
this->status = CMI_STATUS_UPDATING;
if (time_interval<0)
time_interval = BMI_Get_end_time (this->state);
//if (time_interval>BMI_Get_end_time (this->state))
// time_interval = BMI_Get_end_time (this->state);
fprintf (stderr, "%s: Updating until %f.
", CMI_COMPONENT_NAME, time_interval);
{
double print_time = edu_csdms_tools_PrintQueue_next_print_time (
this->print_queue, _ex);
//double stop_time = time_interval;
fprintf (stderr, "%s: Next print time is %f.
", CMI_COMPONENT_NAME, print_time);
while (print_time>0 && print_time<time_interval)
{
this->status = CMI_STATUS_UPDATED;
fprintf (stderr, "%s: Running until print time %f.
", CMI_COMPONENT_NAME, print_time);
edu_csdms_models_Sedflux3D_CMI_run (self, print_time, _ex);
edu_csdms_tools_PrintQueue_print_all (this->print_queue, print_time, _ex);
print_time = edu_csdms_tools_PrintQueue_next_print_time (
this->print_queue, _ex);
fprintf (stderr, "%s: Print time is now %f.
", CMI_COMPONENT_NAME, print_time);
}
}
{
double now = BMI_Get_current_time (this->state);
const double port_queue_dt = CMI_PORT_QUEUE_DT;
double t = now + port_queue_dt;
fprintf (stderr, "%s: Updating ports until %f.
", CMI_COMPONENT_NAME, time_interval);
for (; t<time_interval; t+=port_queue_dt)
{
//edu_csdms_tools_PrintQueue_print_all (this->print_queue,
// BMI_Get_current_time (this->state), _ex);
//fprintf (stderr, "%s: Forgetting ports for now.
", CMI_COMPONENT_NAME);
fprintf (stderr, "%s: Updating ports until %f.
", CMI_COMPONENT_NAME, now);
edu_csdms_tools_IRFPortQueue_run_ports (this->ports, now, _ex);
#if CMI_TURN_OFF_MAPPING
fprintf (stderr, "%s: Forgetting mappers.
", CMI_COMPONENT_NAME);
#else
fprintf (stderr, "%s: Run mappers.
", CMI_COMPONENT_NAME);
edu_csdms_tools_IRFPortQueue_run_mappers (this->ports, _ex);
#endif
fprintf (stderr, "%s: Updating myself until %f.
", CMI_COMPONENT_NAME, t);
BMI_Update_until (this->state, t);
now = BMI_Get_current_time (this->state);
}
if (t>time_interval)
{
//edu_csdms_tools_PrintQueue_print_all (this->print_queue,
// BMI_Get_current_time (this->state), _ex);
fprintf (stderr, "%s: Updating ports until %f.
", CMI_COMPONENT_NAME, now);
edu_csdms_tools_IRFPortQueue_run_ports (this->ports, now, _ex);
#if CMI_TURN_OFF_MAPPING
fprintf (stderr, "%s: Forgetting mappers.
", CMI_COMPONENT_NAME);
#else
fprintf (stderr, "%s: Run mappers.
", CMI_COMPONENT_NAME);
edu_csdms_tools_IRFPortQueue_run_mappers (this->ports, _ex);
#endif
BMI_Update_until (this->state, time_interval);
}
}
fprintf (stderr, "%s: Updated.
", CMI_COMPONENT_NAME);
this->status = CMI_STATUS_UPDATED;
return TRUE;