Ignore:
Timestamp:
12/11/14 16:07:42 (9 years ago)
Author:
rlacroix
Message:

Convert more attributes to use the new duration type:

  • field: freq_op and freq_offset
  • file: output_freq, sync_freq and split_freq.

Remember that you now have to use the "xios_duration" type instead of strings to get/set those attributes through the Fortran interface.

File:
1 edited

Legend:

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

    r532 r538  
    180180   
    181181   
    182   void cxios_set_field_freq_offset(field_Ptr field_hdl, const char * freq_offset, int freq_offset_size) 
    183   { 
    184     std::string freq_offset_str; 
    185     if(!cstr2string(freq_offset, freq_offset_size, freq_offset_str)) return; 
    186      CTimer::get("XIOS").resume(); 
    187     field_hdl->freq_offset.setValue(freq_offset_str); 
    188      CTimer::get("XIOS").suspend(); 
    189   } 
    190    
    191   void cxios_get_field_freq_offset(field_Ptr field_hdl, char * freq_offset, int freq_offset_size) 
    192   { 
    193      CTimer::get("XIOS").resume(); 
    194     if(!string_copy(field_hdl->freq_offset.getInheritedValue(),freq_offset , freq_offset_size)) 
    195       ERROR("void cxios_get_field_freq_offset(field_Ptr field_hdl, char * freq_offset, int freq_offset_size)", <<"Input string is to short"); 
    196      CTimer::get("XIOS").suspend(); 
     182  void cxios_set_field_freq_offset(field_Ptr field_hdl, cxios_duration freq_offset_c) 
     183  { 
     184    CTimer::get("XIOS").resume(); 
     185    field_hdl->freq_offset.allocate(); 
     186    CDuration& freq_offset = field_hdl->freq_offset.get(); 
     187    freq_offset.year = freq_offset_c.year; 
     188    freq_offset.month = freq_offset_c.month; 
     189    freq_offset.day = freq_offset_c.day; 
     190    freq_offset.hour = freq_offset_c.hour; 
     191    freq_offset.minute = freq_offset_c.minute; 
     192    freq_offset.second = freq_offset_c.second; 
     193    freq_offset.timestep = freq_offset_c.timestep; 
     194    CTimer::get("XIOS").suspend(); 
     195  } 
     196   
     197  void cxios_get_field_freq_offset(field_Ptr field_hdl, cxios_duration* freq_offset_c) 
     198  { 
     199    CTimer::get("XIOS").resume(); 
     200    CDuration freq_offset = field_hdl->freq_offset.getInheritedValue(); 
     201    freq_offset_c->year = freq_offset.year; 
     202    freq_offset_c->month = freq_offset.month; 
     203    freq_offset_c->day = freq_offset.day; 
     204    freq_offset_c->hour = freq_offset.hour; 
     205    freq_offset_c->minute = freq_offset.minute; 
     206    freq_offset_c->second = freq_offset.second; 
     207    freq_offset_c->timestep = freq_offset.timestep; 
     208    CTimer::get("XIOS").suspend(); 
    197209  } 
    198210   
     
    206218   
    207219   
    208   void cxios_set_field_freq_op(field_Ptr field_hdl, const char * freq_op, int freq_op_size) 
    209   { 
    210     std::string freq_op_str; 
    211     if(!cstr2string(freq_op, freq_op_size, freq_op_str)) return; 
    212      CTimer::get("XIOS").resume(); 
    213     field_hdl->freq_op.setValue(freq_op_str); 
    214      CTimer::get("XIOS").suspend(); 
    215   } 
    216    
    217   void cxios_get_field_freq_op(field_Ptr field_hdl, char * freq_op, int freq_op_size) 
    218   { 
    219      CTimer::get("XIOS").resume(); 
    220     if(!string_copy(field_hdl->freq_op.getInheritedValue(),freq_op , freq_op_size)) 
    221       ERROR("void cxios_get_field_freq_op(field_Ptr field_hdl, char * freq_op, int freq_op_size)", <<"Input string is to short"); 
    222      CTimer::get("XIOS").suspend(); 
     220  void cxios_set_field_freq_op(field_Ptr field_hdl, cxios_duration freq_op_c) 
     221  { 
     222    CTimer::get("XIOS").resume(); 
     223    field_hdl->freq_op.allocate(); 
     224    CDuration& freq_op = field_hdl->freq_op.get(); 
     225    freq_op.year = freq_op_c.year; 
     226    freq_op.month = freq_op_c.month; 
     227    freq_op.day = freq_op_c.day; 
     228    freq_op.hour = freq_op_c.hour; 
     229    freq_op.minute = freq_op_c.minute; 
     230    freq_op.second = freq_op_c.second; 
     231    freq_op.timestep = freq_op_c.timestep; 
     232    CTimer::get("XIOS").suspend(); 
     233  } 
     234   
     235  void cxios_get_field_freq_op(field_Ptr field_hdl, cxios_duration* freq_op_c) 
     236  { 
     237    CTimer::get("XIOS").resume(); 
     238    CDuration freq_op = field_hdl->freq_op.getInheritedValue(); 
     239    freq_op_c->year = freq_op.year; 
     240    freq_op_c->month = freq_op.month; 
     241    freq_op_c->day = freq_op.day; 
     242    freq_op_c->hour = freq_op.hour; 
     243    freq_op_c->minute = freq_op.minute; 
     244    freq_op_c->second = freq_op.second; 
     245    freq_op_c->timestep = freq_op.timestep; 
     246    CTimer::get("XIOS").suspend(); 
    223247  } 
    224248   
Note: See TracChangeset for help on using the changeset viewer.