Changeset 1472


Ignore:
Timestamp:
04/04/18 12:20:26 (2 years ago)
Author:
oabramkina
Message:

Implementing a patch suggested by Rupert Nash in order to bring temporal_filter.cpp in compliance with c++98 norms.

For this, a constructor of CDuration has been added.

Location:
XIOS/dev/XIOS_DEV_CMIP6/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/calendar_util.cpp

    r643 r1472  
    130130    { 
    131131      // TODO :: Vérifier que les deux dates (dt0 et dt1) ont une référence vers le même calendrier. 
    132       CDuration dur = 
    133       { dt0.getYear() - dt1.getYear(), dt0.getMonth()  - dt1.getMonth() , dt0.getDay()   - dt1.getDay(), 
    134         dt0.getHour() - dt1.getHour(), dt0.getMinute() - dt1.getMinute(), dt0.getSecond() - dt1.getSecond() }; 
     132      CDuration dur( dt0.getYear() - dt1.getYear(), dt0.getMonth()  - dt1.getMonth() , dt0.getDay()   - dt1.getDay(), 
     133      dt0.getHour() - dt1.getHour(), dt0.getMinute() - dt1.getMinute(), dt0.getSecond() - dt1.getSecond() ); 
    135134      return (dur.resolve(dt0.getRelCalendar())); 
    136135    } 
  • XIOS/dev/XIOS_DEV_CMIP6/src/duration.cpp

    r1158 r1472  
    77{ 
    88      /// ////////////////////// Définitions ////////////////////// /// 
    9       const CDuration Year     = { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, 
    10                       Month    = { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, 
    11                       Week     = { 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0 }, 
    12                       Day      = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 }, 
    13                       Hour     = { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }, 
    14                       Minute   = { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, 
    15                       Second   = { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 }, 
    16                       TimeStep = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }, 
    17                       NoneDu   = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; 
     9 
     10      const CDuration Year     ( 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ); 
     11      const CDuration Month    ( 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ); 
     12      const CDuration Week     ( 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0 ); 
     13      const CDuration Day      ( 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 ); 
     14      const CDuration Hour     ( 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 ); 
     15      const CDuration Minute   ( 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 ); 
     16      const CDuration Second   ( 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ); 
     17      const CDuration TimeStep ( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 ); 
     18      const CDuration NoneDu   ( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ); 
     19 
     20      ///--------------------------------------------------------------- 
     21 
     22      CDuration::CDuration(double y, double m, double d, double h, double min, double s, double ts) : 
     23      year(y), month(m), day(d), hour(h), minute(min), second(s), timestep(ts) 
     24      { 
     25      } 
    1826 
    1927      ///--------------------------------------------------------------- 
  • XIOS/dev/XIOS_DEV_CMIP6/src/duration.hpp

    r1158 r1472  
    2020 
    2121         public: 
     22            CDuration(double year=0.0, double month=0.0, double day=0.0, double hour=0.0, double minute=0.0, double second=0.0, double timestep=0.0); 
     23 
    2224            /// Opérateurs /// 
    2325            CDuration& operator=(const CDuration& duration); 
  • XIOS/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.cpp

    r1440 r1472  
    1717    , samplingOffset(samplingOffset) 
    1818    , opFreq(opFreq) 
    19     , offsetMonth({0, this->samplingOffset.month, 0, 0, 0, 0, 0}) 
    20     , offsetAllButMonth({this->samplingOffset.year, 0 , this->samplingOffset.day, 
    21                        this->samplingOffset.hour, this->samplingOffset.minute, 
    22                        this->samplingOffset.second, this->samplingOffset.timestep}) 
     19    , offsetMonth(0, this->samplingOffset.month, 0, 0, 0, 0, 0) 
     20    , offsetAllButMonth(this->samplingOffset.year, 0 , this->samplingOffset.day, 
     21                        this->samplingOffset.hour, this->samplingOffset.minute, 
     22                        this->samplingOffset.second, this->samplingOffset.timestep) 
    2323    , initDate(initDate) 
    2424    , nextSamplingDate(initDate + (this->samplingOffset + initDate.getRelCalendar().getTimeStep())) 
  • XIOS/dev/XIOS_DEV_CMIP6/src/interface/c/icdate.cpp

    r801 r1472  
    7070                                   date_c.year, date_c.month, date_c.day, 
    7171                                   date_c.hour, date_c.minute, date_c.second); 
    72     xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 
    73                             dur_c.hour, dur_c.minute, dur_c.second, 
    74                             dur_c.timestep }; 
     72    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    7573    xios::CDate res = date + dur; 
    7674    return { res.getYear(), res.getMonth(), res.getDay(), res.getHour(), res.getMinute(), res.getSecond() }; 
     
    8280                                   date_c.year, date_c.month, date_c.day, 
    8381                                   date_c.hour, date_c.minute, date_c.second); 
    84     xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 
    85                             dur_c.hour, dur_c.minute, dur_c.second, 
    86                             dur_c.timestep }; 
     82    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
     83 
    8784    xios::CDate res = date - dur; 
    8885    return { res.getYear(), res.getMonth(), res.getDay(), res.getHour(), res.getMinute(), res.getSecond() }; 
  • XIOS/dev/XIOS_DEV_CMIP6/src/interface/c/icduration.cpp

    r801 r1472  
    77  void cxios_duration_convert_to_string(cxios_duration dur_c, char* str, int str_size) 
    88  { 
    9     xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 
    10                             dur_c.hour, dur_c.minute, dur_c.second, 
    11                             dur_c.timestep }; 
     9    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    1210 
    1311    if (!string_copy(dur.toString(), str, str_size)) 
     
    2826  cxios_duration cxios_duration_add(cxios_duration dur1_c, cxios_duration dur2_c) 
    2927  { 
    30     xios::CDuration dur1 = { dur1_c.year, dur1_c.month, dur1_c.day, 
    31                              dur1_c.hour, dur1_c.minute, dur1_c.second, 
    32                              dur1_c.timestep }; 
    33     xios::CDuration dur2 = { dur2_c.year, dur2_c.month, dur2_c.day, 
    34                              dur2_c.hour, dur2_c.minute, dur2_c.second, 
    35                              dur2_c.timestep }; 
     28    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     29    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
     30 
    3631    xios::CDuration res = dur1 + dur2; 
    3732    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    4035  cxios_duration cxios_duration_sub(cxios_duration dur1_c, cxios_duration dur2_c) 
    4136  { 
    42     xios::CDuration dur1 = { dur1_c.year, dur1_c.month, dur1_c.day, 
    43                              dur1_c.hour, dur1_c.minute, dur1_c.second, 
    44                              dur1_c.timestep }; 
    45     xios::CDuration dur2 = { dur2_c.year, dur2_c.month, dur2_c.day, 
    46                              dur2_c.hour, dur2_c.minute, dur2_c.second, 
    47                              dur2_c.timestep }; 
     37    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     38    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
     39 
    4840    xios::CDuration res = dur1 - dur2; 
    4941    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    5244  cxios_duration cxios_duration_mult(double val, cxios_duration dur_c) 
    5345  { 
    54     xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 
    55                             dur_c.hour, dur_c.minute, dur_c.second, 
    56                             dur_c.timestep }; 
     46    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    5747    xios::CDuration res = val * dur; 
    5848    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    6151  cxios_duration cxios_duration_neg(cxios_duration dur_c) 
    6252  { 
    63     xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 
    64                             dur_c.hour, dur_c.minute, dur_c.second, 
    65                             dur_c.timestep }; 
     53    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    6654    xios::CDuration res = -dur; 
    6755    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    7058  bool cxios_duration_eq(cxios_duration dur1_c, cxios_duration dur2_c) 
    7159  { 
    72     xios::CDuration dur1 = { dur1_c.year, dur1_c.month, dur1_c.day, 
    73                              dur1_c.hour, dur1_c.minute, dur1_c.second, 
    74                              dur1_c.timestep }; 
    75     xios::CDuration dur2 = { dur2_c.year, dur2_c.month, dur2_c.day, 
    76                              dur2_c.hour, dur2_c.minute, dur2_c.second, 
    77                              dur2_c.timestep }; 
     60    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     61    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
    7862    return (dur1 == dur2); 
    7963  } 
     
    8165  bool cxios_duration_neq(cxios_duration dur1_c, cxios_duration dur2_c) 
    8266  { 
    83     xios::CDuration dur1 = { dur1_c.year, dur1_c.month, dur1_c.day, 
    84                              dur1_c.hour, dur1_c.minute, dur1_c.second, 
    85                              dur1_c.timestep }; 
    86     xios::CDuration dur2 = { dur2_c.year, dur2_c.month, dur2_c.day, 
    87                              dur2_c.hour, dur2_c.minute, dur2_c.second, 
    88                              dur2_c.timestep }; 
     67    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     68    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
    8969    return (dur1 != dur2); 
    9070  } 
Note: See TracChangeset for help on using the changeset viewer.