Ignore:
Timestamp:
12/11/14 14:32:37 (10 years ago)
Author:
rlacroix
Message:

Add a new attribute type for durations and use it for the context's timestep.

Note that the "xios_time" type and the "xios_set_timestep" procedure have been removed from the Fortran interface. Instead, the "xios_duration" type and the "xios_get_context_attr"/"xios_set_context_attr" procedures should now be used to get/set the timestep.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp

    r532 r537  
    146146   
    147147   
    148   void cxios_set_context_timestep(context_Ptr context_hdl, const char * timestep, int timestep_size) 
     148  void cxios_set_context_timestep(context_Ptr context_hdl, cxios_duration timestep_c) 
    149149  { 
    150     std::string timestep_str; 
    151     if(!cstr2string(timestep, timestep_size, timestep_str)) return; 
    152      CTimer::get("XIOS").resume(); 
    153     context_hdl->timestep.setValue(timestep_str); 
    154      CTimer::get("XIOS").suspend(); 
     150    CTimer::get("XIOS").resume(); 
     151    context_hdl->timestep.allocate(); 
     152    CDuration& timestep = context_hdl->timestep.get(); 
     153    timestep.year = timestep_c.year; 
     154    timestep.month = timestep_c.month; 
     155    timestep.day = timestep_c.day; 
     156    timestep.hour = timestep_c.hour; 
     157    timestep.minute = timestep_c.minute; 
     158    timestep.second = timestep_c.second; 
     159    timestep.timestep = timestep_c.timestep; 
     160    CTimer::get("XIOS").suspend(); 
    155161  } 
    156162   
    157   void cxios_get_context_timestep(context_Ptr context_hdl, char * timestep, int timestep_size) 
     163  void cxios_get_context_timestep(context_Ptr context_hdl, cxios_duration* timestep_c) 
    158164  { 
    159      CTimer::get("XIOS").resume(); 
    160     if(!string_copy(context_hdl->timestep.getInheritedValue(),timestep , timestep_size)) 
    161       ERROR("void cxios_get_context_timestep(context_Ptr context_hdl, char * timestep, int timestep_size)", <<"Input string is to short"); 
    162      CTimer::get("XIOS").suspend(); 
     165    CTimer::get("XIOS").resume(); 
     166    CDuration timestep = context_hdl->timestep.getInheritedValue(); 
     167    timestep_c->year = timestep.year; 
     168    timestep_c->month = timestep.month; 
     169    timestep_c->day = timestep.day; 
     170    timestep_c->hour = timestep.hour; 
     171    timestep_c->minute = timestep.minute; 
     172    timestep_c->second = timestep.second; 
     173    timestep_c->timestep = timestep.timestep; 
     174    CTimer::get("XIOS").suspend(); 
    163175  } 
    164176   
Note: See TracChangeset for help on using the changeset viewer.