Changeset 537


Ignore:
Timestamp:
12/11/14 14:32:37 (9 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.

Location:
XIOS/trunk/src
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/attribute_template_decl.cpp

    r532 r537  
    1111  template class CAttributeTemplate<string> ; 
    1212  template class CAttributeTemplate<CDate> ; 
     13  template class CAttributeTemplate<CDuration> ; 
    1314} 
  • XIOS/trunk/src/config/context_attribute.conf

    r532 r537  
    22DECLARE_ATTRIBUTE(CDate, start_date) 
    33DECLARE_ATTRIBUTE(CDate, time_origin) 
    4 DECLARE_ATTRIBUTE(StdString, timestep) 
     4DECLARE_ATTRIBUTE(CDuration, timestep) 
    55DECLARE_ATTRIBUTE(StdString, output_dir) 
    66 
  • XIOS/trunk/src/generate_interface_decl.cpp

    r532 r537  
    2020  macro(double) 
    2121  macro(CDate) 
     22  macro(CDuration) 
    2223} 
  • XIOS/trunk/src/generate_interface_impl.hpp

    r532 r537  
    1717  template<> string CInterface::getStrFortranType<float>(void) {return string("REAL") ;} 
    1818  template<> string CInterface::getStrFortranType<CDate>(void) {return string("TYPE(txios(date))") ;} 
     19  template<> string CInterface::getStrFortranType<CDuration>(void) {return string("TYPE(txios(duration))") ;} 
    1920 
    2021  template<> string CInterface::getStrFortranKind<int>(void) {return string("") ;} 
     
    2324  template<> string CInterface::getStrFortranKind<float>(void) {return string("(KIND=4)") ;} 
    2425  template<> string CInterface::getStrFortranKind<CDate>(void) {return string("") ;} 
     26  template<> string CInterface::getStrFortranKind<CDuration>(void) {return string("") ;} 
    2527 
    2628  template<> string CInterface::getStrFortranKindC<int>(void) {return string("(KIND=C_INT)") ;} 
     
    2931  template<> string CInterface::getStrFortranKindC<float>(void) {return string("(KIND=C_FLOAT)") ;} 
    3032  template<> string CInterface::getStrFortranKindC<CDate>(void) {return string("") ;} 
     33  template<> string CInterface::getStrFortranKindC<CDuration>(void) {return string("") ;} 
    3134 
    3235  template<> bool CInterface::matchingTypeCFortran<int>(void) { return true ; } 
     
    3538  template<> bool CInterface::matchingTypeCFortran<float>(void) { return true; } 
    3639  template<> bool CInterface::matchingTypeCFortran<CDate>(void) { return true; } 
     40  template<> bool CInterface::matchingTypeCFortran<CDuration>(void) { return true; } 
    3741 
    3842 
     
    167171  } 
    168172 
     173  template<> 
     174  void CInterface::AttributeCInterface<CDuration>(ostream& oss, const string& className,const string& name) 
     175  { 
     176    oss << "void cxios_set_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_duration " << name << "_c)" << iendl; 
     177    oss << "{" << iendl; 
     178    oss << "  CTimer::get(\"XIOS\").resume();" << iendl; 
     179    oss << "  " << className << "_hdl->" << name << ".allocate();" << iendl; 
     180    oss << "  CDuration& " << name <<" = " << className << "_hdl->" << name << ".get();" << iendl; 
     181    oss << "  " << name << ".year = " << name << "_c.year;" << iendl; 
     182    oss << "  " << name << ".month = " << name << "_c.month;" << iendl; 
     183    oss << "  " << name << ".day = " << name << "_c.day;" << iendl; 
     184    oss << "  " << name << ".hour = " << name << "_c.hour;" << iendl; 
     185    oss << "  " << name << ".minute = " << name << "_c.minute;" << iendl; 
     186    oss << "  " << name << ".second = " << name << "_c.second;" << iendl; 
     187    oss << "  " << name << ".timestep = " << name << "_c.timestep;" << iendl; 
     188    oss << "  CTimer::get(\"XIOS\").suspend();" << iendl; 
     189    oss << "}" << iendl; 
     190 
     191    oss << iendl; 
     192 
     193    oss << "void cxios_get_" << className << "_" << name << "(" << className << "_Ptr " << className << "_hdl, cxios_duration* " << name << "_c)" << iendl; 
     194    oss << "{" << iendl; 
     195    oss << "  CTimer::get(\"XIOS\").resume();" << iendl; 
     196    oss << "  CDuration " << name <<" = " << className << "_hdl->" << name << ".getInheritedValue();" << iendl; 
     197    oss << "  " << name << "_c->year = " << name << ".year;" << iendl; 
     198    oss << "  " << name << "_c->month = " << name << ".month;" << iendl; 
     199    oss << "  " << name << "_c->day = " << name << ".day;" << iendl; 
     200    oss << "  " << name << "_c->hour = " << name << ".hour;" << iendl; 
     201    oss << "  " << name << "_c->minute = " << name << ".minute;" << iendl; 
     202    oss << "  " << name << "_c->second = " << name << ".second;" << iendl; 
     203    oss << "  " << name << "_c->timestep = " << name << ".timestep;" << iendl; 
     204    oss << "  CTimer::get(\"XIOS\").suspend();" << iendl; 
     205    oss << "}" << iendl; 
     206    oss << iendl; 
     207  } 
     208 
    169209/* 
    170210#define macro(T) \ 
     
    305345    oss << "  USE IDATE" << iendl; 
    306346    oss << "  INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 
    307     oss << "  TYPE(xios_date), VALUE :: " << name << iendl; 
     347    oss << "  TYPE(txios(date)), VALUE :: " << name << iendl; 
    308348    oss << "END SUBROUTINE cxios_set_" << className << "_" << name << iendl; 
    309349    oss << iendl; 
     
    313353    oss << "  INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 
    314354    oss << "  TYPE(txios(date)) :: " << name << iendl; 
     355    oss << "END SUBROUTINE cxios_get_" << className << "_" << name << iendl; 
     356    oss << iendl; 
     357  } 
     358 
     359  template <> 
     360  void CInterface::AttributeFortran2003Interface<CDuration>(ostream& oss, const string& className, const string& name) 
     361  { 
     362    oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; 
     363    oss << "  USE ISO_C_BINDING" << iendl; 
     364    oss << "  USE IDATE" << iendl; 
     365    oss << "  INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 
     366    oss << "  TYPE(txios(duration)), VALUE :: " << name << iendl; 
     367    oss << "END SUBROUTINE cxios_set_" << className << "_" << name << iendl; 
     368    oss << iendl; 
     369    oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; 
     370    oss << "  USE ISO_C_BINDING" << iendl; 
     371    oss << "  USE IDATE" << iendl; 
     372    oss << "  INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 
     373    oss << "  TYPE(txios(duration)) :: " << name << iendl; 
    315374    oss << "END SUBROUTINE cxios_get_" << className << "_" << name << iendl; 
    316375    oss << iendl; 
  • XIOS/trunk/src/interface/c/icdate.cpp

    r509 r537  
    2323// /////////////////////////////// Définitions ////////////////////////////// // 
    2424 
    25    void cxios_set_timestep(double ts_year, double ts_month,  double ts_day, 
    26                           double ts_hour, double ts_minute, double ts_second) 
    27    { 
    28       try 
    29       { 
    30          CTimer::get("XIOS").resume() ; 
    31          CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second, 0}; 
    32          xios::CContext* context = CContext::getCurrent() ; 
    33          context->timestep.setValue(dur.toString()); 
    34          CTimer::get("XIOS").suspend() ; 
    35       } 
    36       catch (xios::CException & exc) 
    37       { 
    38          std::cerr << exc.getMessage() << std::endl; 
    39          exit (EXIT_FAILURE); 
    40       } 
    41    } 
    42  
    4325   void cxios_update_calendar(int step) 
    4426   { 
  • XIOS/trunk/src/interface/c/icdate.hpp

    r533 r537  
    44 
    55  typedef struct { int year, month, day, hour, minute, second; } cxios_date; 
     6  typedef struct { double year, month, day, hour, minute, second, timestep; } cxios_duration; 
    67} // extern "C" 
  • 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   
  • XIOS/trunk/src/interface/fortran/idate.F90

    r532 r537  
    1010   END TYPE txios(date) 
    1111 
    12    TYPE txios(time) 
    13       REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0 
    14    END TYPE txios(time)    
     12   TYPE, BIND(C) :: txios(duration) 
     13      REAL(kind = C_DOUBLE) :: year=0, month=0, day=0, hour=0, minute=0, second=0, timestep=0 
     14   END TYPE txios(duration) 
    1515 
    1616   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 
    17     
    18       SUBROUTINE cxios_set_timestep(ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second) BIND(C) 
    19          IMPORT C_DOUBLE 
    20          REAL (kind = C_DOUBLE), VALUE :: ts_year, ts_month , ts_day   , & 
    21                                           ts_hour, ts_minute, ts_second 
    22       END SUBROUTINE cxios_set_timestep 
    2317 
    2418      SUBROUTINE cxios_update_calendar(step) BIND(C) 
     
    2620         INTEGER (kind = C_INT), VALUE :: step 
    2721      END SUBROUTINE cxios_update_calendar 
    28        
     22 
    2923   END INTERFACE 
    3024    
    3125   CONTAINS ! Fonctions disponibles pour les utilisateurs. 
    3226 
    33  
    34    SUBROUTINE xios(set_timestep)(timestep) 
    35       IMPLICIT NONE 
    36       TYPE(txios(time)), INTENT(IN):: timestep 
    37  
    38       CALL cxios_set_timestep(timestep%year, timestep%month , timestep%day, & 
    39                              timestep%hour, timestep%minute, timestep%second) 
    40  
    41    END SUBROUTINE xios(set_timestep) 
    42  
    43  
    44     
    4527   SUBROUTINE xios(update_calendar)(step) 
    4628     IMPLICIT NONE 
     
    5234      END IF 
    5335      CALL cxios_update_calendar(step) 
    54        
    5536   END SUBROUTINE xios(update_calendar) 
    5637 
    57     
    5838END MODULE IDATE 
  • XIOS/trunk/src/interface/fortran/ixios.F90

    r529 r537  
    1919                  xios(setVar_logic), xios(setVar_char) 
    2020 
    21 USE idate, ONLY : txios(date),txios(time), xios(set_timestep),xios(update_calendar) 
     21USE idate, ONLY : txios(date), txios(duration), xios(update_calendar) 
    2222 
    2323USE idomain, ONLY : txios(domain), txios(domaingroup), xios(get_domain_handle),  & 
     
    158158 PUBLIC :: txios(domain), txios(domaingroup),txios(field), txios(fieldgroup),txios(file), txios(filegroup), & 
    159159          txios(grid), txios(gridgroup), txios(axis), txios(axisgroup),txios(context), txios(date),         & 
    160           txios(time), txios(variable) 
     160          txios(duration), txios(variable) 
    161161 
    162162 PUBLIC :: xios(set_attr), xios(set_domain_attr), xios(set_domaingroup_attr), xios(set_fieldgroup_attr), & 
     
    184184 
    185185 PUBLIC :: xios(set_current_context) 
    186  PUBLIC :: xios(set_timestep),xios(update_calendar) 
     186 PUBLIC :: xios(update_calendar) 
    187187 PUBLIC :: xios(initialize), xios(init_server), xios(finalize), xios(context_initialize),xios(context_is_initialized), & 
    188188           xios(solve_inheritance), xios(close_context_definition), xios(context_finalize), xios(send_field),          & 
  • XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90

    r532 r537  
    5656      USE IDATE 
    5757      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 
    58       TYPE(xios_date), VALUE :: start_date 
     58      TYPE(txios(date)), VALUE :: start_date 
    5959    END SUBROUTINE cxios_set_context_start_date 
    6060     
     
    7777      USE IDATE 
    7878      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 
    79       TYPE(xios_date), VALUE :: time_origin 
     79      TYPE(txios(date)), VALUE :: time_origin 
    8080    END SUBROUTINE cxios_set_context_time_origin 
    8181     
     
    9494     
    9595     
    96     SUBROUTINE cxios_set_context_timestep(context_hdl, timestep, timestep_size) BIND(C) 
     96    SUBROUTINE cxios_set_context_timestep(context_hdl, timestep) BIND(C) 
    9797      USE ISO_C_BINDING 
     98      USE IDATE 
    9899      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 
    99       CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: timestep 
    100       INTEGER  (kind = C_INT)     , VALUE        :: timestep_size 
     100      TYPE(txios(duration)), VALUE :: timestep 
    101101    END SUBROUTINE cxios_set_context_timestep 
    102102     
    103     SUBROUTINE cxios_get_context_timestep(context_hdl, timestep, timestep_size) BIND(C) 
     103    SUBROUTINE cxios_get_context_timestep(context_hdl, timestep) BIND(C) 
    104104      USE ISO_C_BINDING 
     105      USE IDATE 
    105106      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 
    106       CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: timestep 
    107       INTEGER  (kind = C_INT)     , VALUE        :: timestep_size 
     107      TYPE(txios(duration)) :: timestep 
    108108    END SUBROUTINE cxios_get_context_timestep 
    109109     
  • XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90

    r532 r537  
    2121      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date 
    2222      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin 
    23       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep 
     23      TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep 
    2424       
    2525      CALL xios(get_context_handle)(context_id,context_hdl) 
     
    3838      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date 
    3939      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin 
    40       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep 
     40      TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep 
    4141       
    4242      CALL xios(set_context_attr_hdl_)  & 
     
    5454      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date_ 
    5555      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin_ 
    56       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep_ 
     56      TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep_ 
    5757       
    5858      IF (PRESENT(calendar_type_)) THEN 
     
    7373       
    7474      IF (PRESENT(timestep_)) THEN 
    75         CALL cxios_set_context_timestep(context_hdl%daddr, timestep_, len(timestep_)) 
     75        CALL cxios_set_context_timestep(context_hdl%daddr, timestep_) 
    7676      ENDIF 
    7777       
     
    9090      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date 
    9191      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin 
    92       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep 
     92      TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep 
    9393       
    9494      CALL xios(get_context_handle)(context_id,context_hdl) 
     
    107107      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date 
    108108      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin 
    109       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep 
     109      TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep 
    110110       
    111111      CALL xios(get_context_attr_hdl_)  & 
     
    123123      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date_ 
    124124      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin_ 
    125       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep_ 
     125      TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep_ 
    126126       
    127127      IF (PRESENT(calendar_type_)) THEN 
     
    142142       
    143143      IF (PRESENT(timestep_)) THEN 
    144         CALL cxios_get_context_timestep(context_hdl%daddr, timestep_, len(timestep_)) 
     144        CALL cxios_get_context_timestep(context_hdl%daddr, timestep_) 
    145145      ENDIF 
    146146       
  • XIOS/trunk/src/node/context.cpp

    r534 r537  
    111111            "time_origin: Bad format or date not conform to the calendar");        \ 
    112112                                                                                   \ 
    113     this->calendar->setTimeStep                                                    \ 
    114           (CDuration::FromString(this->timestep.getValue()));                      \ 
     113    this->calendar->setTimeStep(this->timestep.getValue());                        \ 
     114                                                                                   \ 
    115115    return;                                                                        \ 
    116116  } 
  • XIOS/trunk/src/test/test_client.f90

    r501 r537  
    1111  CHARACTER(len=*),PARAMETER :: id="client" 
    1212  INTEGER :: comm 
    13   TYPE(xios_time)      :: dtime 
     13  TYPE(xios_duration) :: dtime 
    1414  TYPE(xios_context) :: ctx_hdl 
    1515  INTEGER,PARAMETER :: ni_glo=100 
     
    8888  
    8989    dtime%second=3600 
    90     CALL xios_set_timestep(dtime)  
     90    CALL xios_set_context_attr("test", timestep=dtime) 
    9191     
    9292    ni=0 ; lonvalue(:)=0 
  • XIOS/trunk/src/test/test_complete.f90

    r532 r537  
    1212  INTEGER :: comm 
    1313  TYPE(xios_date)      :: start_date, time_origin 
    14   TYPE(xios_time)      :: dtime 
     14  TYPE(xios_duration)  :: dtime 
    1515  TYPE(xios_context) :: ctx_hdl 
    1616  INTEGER,PARAMETER :: ni_glo=100 
     
    122122 
    123123  dtime%second=3600 
    124   CALL xios_set_timestep(dtime)  
     124  CALL xios_set_context_attr("atmosphere", timestep=dtime) 
    125125     
    126126!!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalité) 
     
    204204 
    205205  dtime%second=1800 
    206   CALL xios_set_timestep(dtime)  
     206  CALL xios_set_context_attr("surface", timestep=dtime) 
    207207     
    208208!!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalité) 
  • XIOS/trunk/src/test/test_cs.f90

    r501 r537  
    3030  INTEGER :: size 
    3131  INTEGER :: comm 
    32   TYPE(xios_time)      :: dtime 
     32  TYPE(xios_duration) :: dtime 
    3333  TYPE(xios_context) :: ctx_hdl 
    3434  INTEGER,PARAMETER :: ni_glo=100  
     
    126126  
    127127    dtime%second=3600 
    128     CALL xios_set_timestep(dtime)  
     128    CALL xios_set_context_attr("test", timestep=dtime) 
    129129     
    130130!    ni=0 ; lonvalue(:)=0 
  • XIOS/trunk/src/test/test_unstruct_complete.f90

    r501 r537  
    1111  CHARACTER(len=*),PARAMETER :: id="client" 
    1212  INTEGER :: comm 
    13   TYPE(xios_time)      :: dtime 
     13  TYPE(xios_duration) :: dtime 
    1414  TYPE(xios_context) :: ctx_hdl 
    1515  INTEGER, PARAMETER :: nlon=60  
     
    209209  
    210210  dtime%second=3600 
    211   CALL xios_set_timestep(dtime)  
     211  CALL xios_set_context_attr("surface", timestep=dtime) 
    212212  CALL xios_close_context_definition() 
    213213     
  • XIOS/trunk/src/test/test_xios_interface.f90

    r532 r537  
    1313  INTEGER :: comm 
    1414  TYPE(xios_date)      :: start_date, time_origin 
    15   TYPE(xios_time)      :: dtime 
     15  TYPE(xios_duration)  :: dtime 
    1616  TYPE(xios_context) :: ctx_hdl 
    1717  INTEGER,PARAMETER :: ni_glo=10 
     
    131131 
    132132  dtime%second=3600 
    133   CALL xios_set_timestep(dtime) 
     133  CALL xios_set_context_attr("atmosphere", timestep=dtime) 
    134134 
    135135!!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalité) 
     
    213213 
    214214  dtime%second=1800 
    215   CALL xios_set_timestep(dtime) 
     215  CALL xios_set_context_attr("surface", timestep=dtime) 
    216216 
    217217!!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalité) 
  • XIOS/trunk/src/type/type_decl.cpp

    r532 r537  
    3030  macro(StdSize) 
    3131  macro(CDate) 
     32  macro(CDuration) 
    3233} 
  • XIOS/trunk/src/type/type_specialisation.hpp

    r533 r537  
    287287      ptrValue->setSecond(sec); 
    288288    } 
     289 
     290    return ret; 
     291  } 
     292 
     293// template specializations for CDuration 
     294 
     295  template <> 
     296  size_t CType<CDuration>::_size() const 
     297  { 
     298    return 7 * sizeof(double); 
     299  } 
     300 
     301  template <> 
     302  size_t CType_ref<CDuration>::_size() const 
     303  { 
     304    return 7 * sizeof(double); 
     305  } 
     306 
     307  template <> 
     308  bool CType<CDuration>::_toBuffer(CBufferOut& buffer) const 
     309  { 
     310    if (buffer.remain() < size()) return false; 
     311    else 
     312    { 
     313      bool ret = true; 
     314      if (ret) ret &= buffer.put(ptrValue->year); 
     315      if (ret) ret &= buffer.put(ptrValue->month); 
     316      if (ret) ret &= buffer.put(ptrValue->day); 
     317      if (ret) ret &= buffer.put(ptrValue->hour); 
     318      if (ret) ret &= buffer.put(ptrValue->minute); 
     319      if (ret) ret &= buffer.put(ptrValue->second); 
     320      if (ret) ret &= buffer.put(ptrValue->timestep); 
     321      return ret; 
     322    } 
     323  } 
     324   
     325  template <> 
     326  bool CType_ref<CDuration>::_toBuffer(CBufferOut& buffer) const 
     327  { 
     328    if (buffer.remain() < size()) return false; 
     329    else 
     330    { 
     331      bool ret = true; 
     332      if (ret) ret &= buffer.put(ptrValue->year); 
     333      if (ret) ret &= buffer.put(ptrValue->month); 
     334      if (ret) ret &= buffer.put(ptrValue->day); 
     335      if (ret) ret &= buffer.put(ptrValue->hour); 
     336      if (ret) ret &= buffer.put(ptrValue->minute); 
     337      if (ret) ret &= buffer.put(ptrValue->second); 
     338      if (ret) ret &= buffer.put(ptrValue->timestep); 
     339      return ret; 
     340    } 
     341  } 
     342 
     343  template <> 
     344  bool CType<CDuration>::_fromBuffer(CBufferIn& buffer) 
     345  { 
     346    allocate(); 
     347    bool ret = true; 
     348 
     349    if (ret) ret &= buffer.get(ptrValue->year); 
     350    if (ret) ret &= buffer.get(ptrValue->month); 
     351    if (ret) ret &= buffer.get(ptrValue->day); 
     352    if (ret) ret &= buffer.get(ptrValue->hour); 
     353    if (ret) ret &= buffer.get(ptrValue->minute); 
     354    if (ret) ret &= buffer.get(ptrValue->second); 
     355    if (ret) ret &= buffer.get(ptrValue->timestep); 
     356 
     357    return ret; 
     358  } 
     359 
     360  template <> 
     361  bool CType_ref<CDuration>::_fromBuffer(CBufferIn& buffer) const 
     362  { 
     363    bool ret = true; 
     364     
     365    if (ret) ret &= buffer.get(ptrValue->year); 
     366    if (ret) ret &= buffer.get(ptrValue->month); 
     367    if (ret) ret &= buffer.get(ptrValue->day); 
     368    if (ret) ret &= buffer.get(ptrValue->hour); 
     369    if (ret) ret &= buffer.get(ptrValue->minute); 
     370    if (ret) ret &= buffer.get(ptrValue->second); 
     371    if (ret) ret &= buffer.get(ptrValue->timestep); 
     372 
     373    return ret; 
     374  } 
     375 
     376  template <> 
     377  bool CType_ref<CDuration>::_fromBuffer(CBufferIn& buffer) 
     378  { 
     379    bool ret = true; 
     380     
     381    if (ret) ret &= buffer.get(ptrValue->year); 
     382    if (ret) ret &= buffer.get(ptrValue->month); 
     383    if (ret) ret &= buffer.get(ptrValue->day); 
     384    if (ret) ret &= buffer.get(ptrValue->hour); 
     385    if (ret) ret &= buffer.get(ptrValue->minute); 
     386    if (ret) ret &= buffer.get(ptrValue->second); 
     387    if (ret) ret &= buffer.get(ptrValue->timestep); 
    289388 
    290389    return ret; 
Note: See TracChangeset for help on using the changeset viewer.