Changeset 1482


Ignore:
Timestamp:
04/13/18 16:25:46 (6 years ago)
Author:
yushan
Message:

Branch EP merged with Dev_cmip6 @r1481

Location:
XIOS/dev/branch_openmp
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/arch/arch-X64_CURIE_GCC.env

    r574 r1482  
    11module unload netcdf 
    22module unload hdf5 
     3module unload boost 
     4module unload blitz 
    35module load netcdf/4.3.3.1_hdf5_parallel 
    46module load gnu/4.9.1 
     7module load boost 
     8module load blitz 
    59export OMPI_CC=gcc 
    610export OMPI_CXX=g++ 
  • XIOS/dev/branch_openmp/arch/arch-X64_CURIE_GCC.path

    r574 r1482  
    1111HDF5_LIB="" 
    1212 
     13BOOST_INCDIR="-I $BOOST_INCDIR" 
     14BOOST_LIBDIR="-L $BOOST_LIBDIR" 
     15BOOST_LIB="" 
     16 
     17BLITZ_INCDIR="-I $BLITZ_INCDIR" 
     18BLITZ_LIBDIR="-L $BLITZ_LIBDIR" 
     19BLITZ_LIB="" 
     20 
    1321OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" 
    1422OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" 
  • XIOS/dev/branch_openmp/arch/arch-X64_CURIE_PGI.env

    r574 r1482  
    1 module unload netcdf 
    2 module unload hdf5 
    31module load netcdf/4.3.3.1_hdf5_parallel 
    42#module unload intel 
    53module unload pgi 
    64module unload gnu 
     5module unload boost 
     6module unload blitz 
    77module load pgi/14.10 
     8module load boost 
     9module load blitz 
     10 
     11 
    812 
    913export OMPI_CC=pgcc 
  • XIOS/dev/branch_openmp/arch/arch-X64_CURIE_PGI.path

    r574 r1482  
    1111HDF5_LIB="" 
    1212 
     13BOOST_INCDIR="-I $BOOST_INCDIR" 
     14BOOST_LIBDIR="-L $BOOST_LIBDIR" 
     15BOOST_LIB="" 
     16 
     17BLITZ_INCDIR="-I $BLITZ_INCDIR" 
     18BLITZ_LIBDIR="-L $BLITZ_LIBDIR" 
     19BLITZ_LIB="" 
     20 
    1321OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" 
    1422OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" 
  • XIOS/dev/branch_openmp/bld.cfg

    r1468 r1482  
    3333bld::target libxios.a  
    3434#bld::target generate_fortran_interface.exe  
    35 #bld::target xios_server.exe  
     35bld::target xios_server.exe  
    3636#bld::target test_regular.exe 
    3737#bld::target test_expand_domain.exe 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_type.hpp

    r1388 r1482  
    184184  struct BUFFER 
    185185  { 
    186     void * void_buffer[12]; 
     186    void * void_buffer[16]; 
    187187  }; 
    188188 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_declaration.cpp

    r1460 r1482  
    2525::MPI_Datatype MPI_UNSIGNED_CHAR_STD = MPI_UNSIGNED_CHAR; 
    2626::MPI_Datatype MPI_UINT64_T_STD = MPI_UINT64_T; 
     27::MPI_Datatype MPI_LONG_LONG_INT_STD = MPI_LONG_LONG_INT; 
    2728 
    2829#undef MPI_INT 
     
    3435#undef MPI_UNSIGNED_CHAR 
    3536#undef MPI_UINT64_T 
     37#undef MPI_LONG_LONG_INT 
    3638 
    3739 
     
    5759extern ::MPI_Datatype MPI_UNSIGNED_CHAR_STD; 
    5860extern ::MPI_Datatype MPI_UINT64_T_STD; 
     61extern ::MPI_Datatype MPI_LONG_LONG_INT_STD; 
    5962 
    6063 
     
    7982ep_lib::MPI_Datatype MPI_UNSIGNED_CHAR = &MPI_UNSIGNED_CHAR_STD; 
    8083ep_lib::MPI_Datatype MPI_UINT64_T = &MPI_UINT64_T_STD; 
     84ep_lib::MPI_Datatype MPI_LONG_LONG_INT = &MPI_LONG_LONG_INT_STD; 
    8185 
    8286 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_declaration.hpp

    r1460 r1482  
    1010#undef MPI_UNSIGNED_CHAR 
    1111#undef MPI_UINT64_T 
     12#undef MPI_LONG_LONG_INT 
    1213 
    1314#undef MPI_SUM 
     
    3132extern ep_lib::MPI_Datatype MPI_UNSIGNED_CHAR; 
    3233extern ep_lib::MPI_Datatype MPI_UINT64_T; 
     34extern ep_lib::MPI_Datatype MPI_LONG_LONG_INT; 
    3335 
    3436extern ep_lib::MPI_Op MPI_SUM; 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp

    r1461 r1482  
    130130            reduce_max<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count); 
    131131        } 
     132         
     133        else if(datatype == MPI_LONG_LONG_INT) 
     134        { 
     135          assert(datasize == sizeof(long long)); 
     136          for(int i=1; i<num_ep; i++) 
     137            reduce_max<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count); 
     138        } 
    132139 
    133140        else printf("datatype Error\n"); 
     
    185192            reduce_min<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count); 
    186193        } 
     194         
     195        else if(datatype == MPI_LONG_LONG_INT) 
     196        { 
     197          assert(datasize == sizeof(long long)); 
     198          for(int i=1; i<num_ep; i++) 
     199            reduce_min<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count); 
     200        } 
    187201 
    188202        else printf("datatype Error\n"); 
     
    240254          for(int i=1; i<num_ep; i++) 
    241255            reduce_sum<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count); 
     256        } 
     257         
     258        else if(datatype ==MPI_LONG_LONG_INT) 
     259        { 
     260          assert(datasize == sizeof(long long)); 
     261          for(int i=1; i<num_ep; i++) 
     262            reduce_sum<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count); 
    242263        } 
    243264 
  • XIOS/dev/branch_openmp/src/attribute_template.hpp

    r1460 r1482  
    5252            void set(const CAttributeTemplate& attr) ; 
    5353            void reset(void) ; 
     54            void checkEmpty(void) const; 
    5455 
    5556            void setInheritedValue(const CAttributeTemplate& attr ); 
  • XIOS/dev/branch_openmp/src/attribute_template_impl.hpp

    r1117 r1482  
    6969 
    7070      template <class T> 
    71          T CAttributeTemplate<T>::getValue(void) const 
     71      void CAttributeTemplate<T>::checkEmpty(void) const 
     72      { 
     73        if (CType<T>::empty) 
     74        { 
     75          StdString msg("On checking attribute with id="); 
     76          msg.append(this->getId()); 
     77          msg.append(" : "); 
     78          msg.append("data is not initialized\n"); 
     79          ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << msg); 
     80        } 
     81      } 
     82       
     83      template <class T> 
     84      T CAttributeTemplate<T>::getValue(void) const 
    7285      { 
    7386        return CType<T>::get() ; 
    74 /* 
    75         if (SuperClass::isEmpty()) 
    76         { 
    77            ERROR("T CAttributeTemplate<T>::getValue(void) const", 
    78                  << "[ id = " << this->getId() << "]" 
    79                  << " L'attribut est requis mais n'est pas défini !"); 
    80          } 
    81         return (SuperClass::getValue<T>()); 
    82 */ 
    83       } 
    84  
    85 /* 
    86       template <class T> 
    87          T* CAttributeTemplate<T>::getRef(void) 
    88       { 
    89          if (SuperClass::isEmpty()) 
    90          { 
    91             ERROR("T CAttributeTemplate<T>::getValue(void) const", 
    92                   << "[ id = " << this->getId() << "]" 
    93                   << " L'attribut est requis mais n'est pas défini !"); 
    94           } 
    95          return (SuperClass::getRef<T>()); 
    96       } 
    97 */ 
    98  
    99       template <class T> 
    100          void CAttributeTemplate<T>::setValue(const T & value) 
     87      } 
     88 
     89 
     90 
     91      template <class T> 
     92      void CAttributeTemplate<T>::setValue(const T & value) 
    10193      { 
    10294         CType<T>::set(value) ; 
  • XIOS/dev/branch_openmp/src/calendar_util.cpp

    r643 r1482  
    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() ); 
     134 
    135135      return (dur.resolve(dt0.getRelCalendar())); 
    136136    } 
  • XIOS/dev/branch_openmp/src/context_client.cpp

    r1460 r1482  
    107107        typeId_in=event.getTypeId() ; 
    108108        classId_in=event.getClassId() ; 
    109         MPI_Allreduce(&timeLine,&timeLine_out, 1, MPI_UINT64_T, MPI_SUM, intraComm) ; 
     109        //MPI_Allreduce(&timeLine,&timeLine_out, 1, MPI_UINT64_T, MPI_SUM, intraComm) ; 
     110        MPI_Allreduce(&timeLine,&timeLine_out, 1, MPI_LONG_LONG_INT, MPI_SUM, intraComm) ; 
    110111        MPI_Allreduce(&typeId_in,&typeId, 1, MPI_INT, MPI_SUM, intraComm) ; 
    111112        MPI_Allreduce(&classId_in,&classId, 1, MPI_INT, MPI_SUM, intraComm) ; 
     
    343344     for (std::map<int,StdSize>::const_iterator it = mapSize.begin(), ite = mapSize.end(); it != ite; ++it) 
    344345     { 
    345        double ratio = double(it->second) / maxEventSize.at(it->first); 
     346       double ratio = double(it->second) / maxEventSizes[it->first]; 
    346347       if (ratio < minBufferSizeEventSizeRatio) minBufferSizeEventSizeRatio = ratio; 
    347348     } 
  • XIOS/dev/branch_openmp/src/duration.cpp

    r1105 r1482  
    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 ); 
    1819 
    1920      ///--------------------------------------------------------------- 
     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      } 
     26 
    2027 
    2128      CDuration& CDuration::operator=(const CDuration& duration) 
  • XIOS/dev/branch_openmp/src/duration.hpp

    r1105 r1482  
    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/branch_openmp/src/filter/file_writer_filter.cpp

    r1460 r1482  
    2929      for (size_t idx = 0; idx < nbData; ++idx) 
    3030      { 
    31         if (NumTraits<double>::isnan(dataArray(idx))) 
     31        if (NumTraits<double>::isNan(dataArray(idx))) 
    3232          dataArray(idx) = missingValue; 
    3333      } 
  • XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.cpp

    r1460 r1482  
    204204    bool ignoreMissingValue = false;  
    205205    double defaultValue = std::numeric_limits<double>::quiet_NaN(); 
    206     if (0 != dataDest.numElements()) ignoreMissingValue = NumTraits<double>::isnan(dataDest(0)); 
     206    if (0 != dataDest.numElements()) ignoreMissingValue = NumTraits<double>::isNan(dataDest(0)); 
    207207 
    208208    const std::list<CGridTransformation::SendingIndexGridSourceMap>& listLocalIndexSend = gridTransformation->getLocalIndexToSendFromGridSource(); 
  • XIOS/dev/branch_openmp/src/filter/store_filter.cpp

    r1460 r1482  
    9393      for (size_t idx = 0; idx < nbData; ++idx) 
    9494      { 
    95         if (NumTraits<double>::isnan(packet->data(idx))) 
     95        if (NumTraits<double>::isNan(packet->data(idx))) 
    9696          packet->data(idx) = missingValue; 
    9797      } 
  • XIOS/dev/branch_openmp/src/filter/temporal_filter.cpp

    r1460 r1482  
    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())) 
    2525    , nbOperationDates(1) 
     26    , nbSamplingDates(0) 
    2627//    , nextOperationDate(initDate + opFreq + this->samplingOffset) 
    2728    , isFirstOperation(true) 
     
    4849      if (usePacket) 
    4950      { 
     51        nbSamplingDates ++; 
    5052        if (!copyLess) 
    5153        { 
     
    5658        } 
    5759 
    58         nextSamplingDate = nextSamplingDate + samplingFreq; 
     60        nextSamplingDate = ((initDate + offsetMonth) + nbSamplingDates * samplingFreq) + offsetAllButMonth + initDate.getRelCalendar().getTimeStep(); 
    5961      } 
    6062 
  • XIOS/dev/branch_openmp/src/filter/temporal_filter.hpp

    r1460 r1482  
    6767      CDate nextSamplingDate; //!< The date of the next sampling 
    6868      int nbOperationDates; //!< The number of times an operation is performed 
     69      int nbSamplingDates; 
    6970//      CDate nextOperationDate; //!< The date of the next operation 
    7071      bool isFirstOperation; //!< True before the first operation was been computed 
  • XIOS/dev/branch_openmp/src/functor/accumulate.cpp

    r1018 r1482  
    3434            double* out=_doutput.dataFirst(); 
    3535            for (i=0; i<n; ++i,++in,++out)  
    36               if (!NumTraits<double>::isnan(*in)) 
     36              if (!NumTraits<double>::isNan(*in)) 
    3737              { 
    38                 if(!NumTraits<double>::isnan(*out)) *out  += *in; 
     38                if(!NumTraits<double>::isNan(*out)) *out  += *in; 
    3939                else *out=*in ; 
    4040              } 
  • XIOS/dev/branch_openmp/src/functor/average.cpp

    r1018 r1482  
    4343            int* nc=nbcalls.dataFirst() ; 
    4444            for (i=0; i<n; ++i,++nc,++in)  
    45               if (!NumTraits<double>::isnan(*in)) (*nc) ++; 
     45              if (!NumTraits<double>::isNan(*in)) (*nc) ++; 
    4646          } 
    4747        } 
     
    5555            int* nc=nbcalls.dataFirst() ; 
    5656            for (i=0; i<n; ++i,++in,++out,++nc)  
    57               if (!NumTraits<double>::isnan(*in))  
     57              if (!NumTraits<double>::isNan(*in))  
    5858              { 
    5959                if (*nc != 0) (*out)  += *in; 
  • XIOS/dev/branch_openmp/src/functor/maximum.cpp

    r1018 r1482  
    3434           {  
    3535             for (; it1 != end1; it1++, it++)  
    36                if (!NumTraits<double>::isnan(*it1)) 
     36               if (!NumTraits<double>::isNan(*it1)) 
    3737               { 
    38                  if (!NumTraits<double>::isnan(*it)) *it = std::max(*it1, *it); 
     38                 if (!NumTraits<double>::isNan(*it)) *it = std::max(*it1, *it); 
    3939                 else *it=*it1 ;   
    4040               } 
  • XIOS/dev/branch_openmp/src/functor/minimum.cpp

    r1018 r1482  
    3636          {  
    3737            for (; it1 != end1; it1++, it++)  
    38               if (!NumTraits<double>::isnan(*it1)) 
     38              if (!NumTraits<double>::isNan(*it1)) 
    3939              { 
    40                 if (!NumTraits<double>::isnan(*it)) *it = std::min(*it1, *it); 
     40                if (!NumTraits<double>::isNan(*it)) *it = std::min(*it1, *it); 
    4141                else *it=*it1 ; 
    4242              } 
  • XIOS/dev/branch_openmp/src/interface/c/icdate.cpp

    r801 r1482  
    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 
     73    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    7574    xios::CDate res = date + dur; 
    7675    return { res.getYear(), res.getMonth(), res.getDay(), res.getHour(), res.getMinute(), res.getSecond() }; 
     
    8281                                   date_c.year, date_c.month, date_c.day, 
    8382                                   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 }; 
     83    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    8784    xios::CDate res = date - dur; 
    8885    return { res.getYear(), res.getMonth(), res.getDay(), res.getHour(), res.getMinute(), res.getSecond() }; 
  • XIOS/dev/branch_openmp/src/interface/c/icduration.cpp

    r801 r1482  
    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 }; 
    12  
     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 ); 
    1310    if (!string_copy(dur.toString(), str, str_size)) 
    1411      ERROR("void cxios_duration_convert_to_string(cxios_duration dur_c, char* str, int str_size)", << "Input string is too short"); 
     
    2825  cxios_duration cxios_duration_add(cxios_duration dur1_c, cxios_duration dur2_c) 
    2926  { 
    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 }; 
     27    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     28    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
    3629    xios::CDuration res = dur1 + dur2; 
    3730    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    4033  cxios_duration cxios_duration_sub(cxios_duration dur1_c, cxios_duration dur2_c) 
    4134  { 
    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 }; 
     35    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     36    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
    4837    xios::CDuration res = dur1 - dur2; 
    4938    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    5241  cxios_duration cxios_duration_mult(double val, cxios_duration dur_c) 
    5342  { 
    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 }; 
     43    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    5744    xios::CDuration res = val * dur; 
    5845    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    6148  cxios_duration cxios_duration_neg(cxios_duration dur_c) 
    6249  { 
    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 }; 
     50    xios::CDuration dur( dur_c.year, dur_c.month, dur_c.day, dur_c.hour, dur_c.minute, dur_c.second, dur_c.timestep ); 
    6651    xios::CDuration res = -dur; 
    6752    return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 
     
    7055  bool cxios_duration_eq(cxios_duration dur1_c, cxios_duration dur2_c) 
    7156  { 
    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 }; 
     57    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     58    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
    7859    return (dur1 == dur2); 
    7960  } 
     
    8162  bool cxios_duration_neq(cxios_duration dur1_c, cxios_duration dur2_c) 
    8263  { 
    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 }; 
     64    xios::CDuration dur1( dur1_c.year, dur1_c.month, dur1_c.day, dur1_c.hour, dur1_c.minute, dur1_c.second, dur1_c.timestep ); 
     65    xios::CDuration dur2( dur2_c.year, dur2_c.month, dur2_c.day, dur2_c.hour, dur2_c.minute, dur2_c.second, dur2_c.timestep ); 
    8966    return (dur1 != dur2); 
    9067  } 
  • XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp

    r1460 r1482  
    189189*/ 
    190190 
    191     if (!SuperClassWriter::isRectilinear(fieldId)) 
     191    //if (!SuperClassWriter::isRectilinear(fieldId)) 
     192    if (true) 
    192193    { 
    193194      for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it) 
     
    471472    itMapNj = itMapNi; ++itMapNj; 
    472473 
    473     if (this->isRectilinear(fieldId) || this->isCurvilinear(fieldId)) 
     474    if (CDomain::type_attr::rectilinear == domain->type || CDomain::type_attr::curvilinear == domain->type || 
     475        this->isRectilinear(fieldId) || this->isCurvilinear(fieldId)) 
    474476    { 
    475477      if (!domain->nj_glo.isEmpty() && (domain->nj_glo != itMapNj->second)) 
     
    495497      domain->ni_glo.setValue(itMapNi->second); 
    496498    } 
    497     else if (this->isUnstructured(fieldId)) 
     499    else if (CDomain::type_attr::unstructured == domain->type|| this->isUnstructured(fieldId)) 
    498500    { 
    499501      domain->nj_glo.setValue(1); 
  • XIOS/dev/branch_openmp/src/node/field.cpp

    r1460 r1482  
    224224    CArray<double,1> recv_data_tmp(recvDataSrv.numElements());     
    225225    const CDate& currDate = context->getCalendar()->getCurrentDate(); 
    226     const CDate opeDate   = (last_operation_srv + context->getCalendar()->getTimeStep()) +freq_op + freq_operation_srv - freq_op - context->getCalendar()->getTimeStep(); 
     226    CDuration offsetAllButMonth (freq_offset.getValue().year, 0 , freq_offset.getValue().day, 
     227                                   freq_offset.getValue().hour, freq_offset.getValue().minute, 
     228                                   freq_offset.getValue().second, freq_offset.getValue().timestep); 
     229    const CDate opeDate   = (last_operation_srv - offsetAllButMonth + context->getCalendar()->getTimeStep()) 
     230                              + freq_op + freq_operation_srv - freq_op - context->getCalendar()->getTimeStep() + offsetAllButMonth; 
    227231 
    228232    if (opeDate <= currDate) 
     
    251255 
    252256    const CDate& currDate = context->getCalendar()->getCurrentDate(); 
    253     const CDate opeDate = (last_operation_srv + context->getCalendar()->getTimeStep()) + freq_op + freq_operation_srv - freq_op - context->getCalendar()->getTimeStep(); 
     257    CDuration offsetAllButMonth (freq_offset.getValue().year, 0 , freq_offset.getValue().day, 
     258                                   freq_offset.getValue().hour, freq_offset.getValue().minute, 
     259                                   freq_offset.getValue().second, freq_offset.getValue().timestep); 
     260    const CDate opeDate   = (last_operation_srv - offsetAllButMonth + context->getCalendar()->getTimeStep()) 
     261                              + freq_op + freq_operation_srv - freq_op - context->getCalendar()->getTimeStep() + offsetAllButMonth; 
    254262    const CDate writeDate = last_Write_srv + freq_write_srv; 
    255263 
  • XIOS/dev/branch_openmp/src/parse_expr/operator_expr.hpp

    r1038 r1482  
    77#include "exception.hpp" 
    88#include "array_new.hpp" 
     9#include "utils.hpp" 
    910 
    1011using namespace std; 
     
    253254    static inline double div_ss(double x, double y)   { return x / y; } 
    254255    static inline double pow_ss(double x, double y)   { return std::pow(x,y); } 
    255     static inline double eq_ss(double x, double y)    { return x == y; } 
     256    static inline double eq_ss(double x, double y) // specific check for NaN 
     257    { 
     258       bool xNan=NumTraits<double>::isNan(x) ; 
     259       bool yNan=NumTraits<double>::isNan(y) ; 
     260       if (xNan && yNan) return true ; 
     261       else if (xNan) return false ; 
     262       else if (yNan) return false ; 
     263       else return x == y; 
     264    } 
     265 
    256266    static inline double lt_ss(double x, double y)    { return x < y; } 
    257267    static inline double gt_ss(double x, double y)    { return x > y; } 
    258268    static inline double le_ss(double x, double y)    { return x <= y; } 
    259269    static inline double ge_ss(double x, double y)    { return x >= y; } 
    260     static inline double ne_ss(double x, double y)    { return x != y; } 
     270    static inline double ne_ss(double x, double y) // specific check for NaN 
     271    { 
     272       bool xNan=NumTraits<double>::isNan(x) ; 
     273       bool yNan=NumTraits<double>::isNan(y) ; 
     274       if (xNan && yNan) return false ; 
     275       else if (xNan) return true ; 
     276       else if (yNan) return true ;       
     277       else return x != y; 
     278    } 
    261279 
    262280    static inline CArray<double,1> neg_f(const CArray<double,1>& x)   { return Array<double,1>(-x); } 
     
    286304    static inline CArray<double,1> div_fs(const CArray<double,1>& x, double y)   { return Array<double,1>(x / y); } 
    287305    static inline CArray<double,1> pow_fs(const CArray<double,1>& x, double y)   { return Array<double,1>(pow(x,y)); } 
    288     static inline CArray<double,1> eq_fs(const CArray<double,1>& x, double y)    { return Array<double,1>(x == y); } 
     306    static inline CArray<double,1> eq_fs(const CArray<double,1>& x, double y) // specific check for NaN 
     307    { 
     308      if (NumTraits<double>::isNan(y)) 
     309      { 
     310        CArray<double,1> ret(x.numElements()) ; 
     311        Array<double,1>::const_iterator itx=x.begin(),itxe=x.end(); 
     312        Array<double,1>::iterator itret=ret.begin() ; 
     313        for(;itx!=itxe;++itx,++itret) *itret=NumTraits<double>::isNan(*itx) ; 
     314        return ret ; 
     315      } 
     316      else return Array<double,1>(x == y);  
     317    } 
     318 
    289319    static inline CArray<double,1> lt_fs(const CArray<double,1>& x, double y)    { return Array<double,1>(x < y); } 
    290320    static inline CArray<double,1> gt_fs(const CArray<double,1>& x, double y)    { return Array<double,1>(x > y); } 
    291321    static inline CArray<double,1> le_fs(const CArray<double,1>& x, double y)    { return Array<double,1>(x <= y); } 
    292322    static inline CArray<double,1> ge_fs(const CArray<double,1>& x, double y)    { return Array<double,1>(x >= y); } 
    293     static inline CArray<double,1> ne_fs(const CArray<double,1>& x, double y)    { return Array<double,1>(x != y); } 
     323    static  inline CArray<double,1> ne_fs(const CArray<double,1>& x, double y) // specific check for NaN 
     324    { 
     325      if (NumTraits<double>::isNan(y)) 
     326      { 
     327        CArray<double,1> ret(x.numElements()) ; 
     328        Array<double,1>::const_iterator itx=x.begin(),itxe=x.end(); 
     329        Array<double,1>::iterator itret=ret.begin() ; 
     330        for(;itx!=itxe;++itx,++itret) *itret = !NumTraits<double>::isNan(*itx) ; 
     331        return ret ; 
     332      } 
     333      else return Array<double,1>(x != y);  
     334    } 
    294335 
    295336    static inline CArray<double,1> add_sf(double x, const CArray<double,1>& y)   { return Array<double,1>(x + y); } 
     
    297338    static inline CArray<double,1> mult_sf(double x, const CArray<double,1>& y)  { return Array<double,1>(x * y); } 
    298339    static inline CArray<double,1> div_sf(double x, const CArray<double,1>& y)   { return Array<double,1>(x / y); } 
    299     static inline CArray<double,1> eq_sf(double x, const CArray<double,1>& y)    { return Array<double,1>(x == y); } 
     340    static inline CArray<double,1> eq_sf(double x, const CArray<double,1>& y) // specific check for NaN 
     341    { 
     342      if (NumTraits<double>::isNan(x)) 
     343      { 
     344        CArray<double,1> ret(y.numElements()) ; 
     345        Array<double,1>::const_iterator ity=y.begin(),itye=y.end(); 
     346        Array<double,1>::iterator itret=ret.begin() ; 
     347        for(;ity!=itye;++ity,++itret) *itret=NumTraits<double>::isNan(*ity) ; 
     348        return ret ; 
     349      } 
     350      else return Array<double,1>(x == y);  
     351    } 
     352 
    300353    static inline CArray<double,1> lt_sf(double x, const CArray<double,1>& y)    { return Array<double,1>(x < y); } 
    301354    static inline CArray<double,1> gt_sf(double x, const CArray<double,1>& y)    { return Array<double,1>(x > y); } 
    302355    static inline CArray<double,1> le_sf(double x, const CArray<double,1>& y)    { return Array<double,1>(x <= y); } 
    303356    static inline CArray<double,1> ge_sf(double x, const CArray<double,1>& y)    { return Array<double,1>(x >= y); } 
    304     static inline CArray<double,1> ne_sf(double x, const CArray<double,1>& y)    { return Array<double,1>(x != y); } 
     357    static inline CArray<double,1> ne_sf(double x, const CArray<double,1>& y) // specific check for NaN 
     358    { 
     359      if (NumTraits<double>::isNan(x)) 
     360      { 
     361        CArray<double,1> ret(y.numElements()) ; 
     362        Array<double,1>::const_iterator ity=y.begin(),itye=y.end(); 
     363        Array<double,1>::iterator itret=ret.begin() ; 
     364        for(;ity!=itye;++ity,++itret) *itret=!NumTraits<double>::isNan(*ity) ; 
     365        return ret ; 
     366      } 
     367      else return Array<double,1>(x != y); 
     368    } 
     369 
    305370 
    306371 
  • XIOS/dev/branch_openmp/src/transformation/Functions/average_reduction.cpp

    r1328 r1482  
    4747      currentlocalIndex = localIndex[idx].first; 
    4848      currentWeight     = localIndex[idx].second; 
    49       if (!NumTraits<double>::isnan(*(dataInput + idx))) 
     49      if (!NumTraits<double>::isNan(*(dataInput + idx))) 
    5050      { 
    5151        if (flagInitial[currentlocalIndex]) 
  • XIOS/dev/branch_openmp/src/transformation/Functions/max_reduction.cpp

    r1328 r1482  
    4141    { 
    4242      currentlocalIndex = localIndex[idx].first;       
    43       if (!NumTraits<double>::isnan(*(dataInput + idx))) 
     43      if (!NumTraits<double>::isNan(*(dataInput + idx))) 
    4444      { 
    4545        if (flagInitial[currentlocalIndex]) 
  • XIOS/dev/branch_openmp/src/transformation/Functions/min_reduction.cpp

    r1328 r1482  
    4141    { 
    4242      currentlocalIndex = localIndex[idx].first; 
    43       if (!NumTraits<double>::isnan(*(dataInput + idx))) 
     43      if (!NumTraits<double>::isNan(*(dataInput + idx))) 
    4444      { 
    4545        if (flagInitial[currentlocalIndex]) 
  • XIOS/dev/branch_openmp/src/transformation/Functions/sum_reduction.cpp

    r1328 r1482  
    4343    { 
    4444      currentlocalIndex = localIndex[idx].first;    
    45       if (!NumTraits<double>::isnan(*(dataInput + idx))) 
     45      if (!NumTraits<double>::isNan(*(dataInput + idx))) 
    4646      {    
    4747        if (flagInitial[currentlocalIndex]) 
  • XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp

    r1460 r1482  
    916916       renormalizationFactor=1 ; 
    917917     } 
     918      
     919    if (firstPass) 
     920    { 
     921      allMissing.resize(dataOut.numElements()) ; 
     922      allMissing=true ; 
     923    } 
    918924 
    919925    for (int idx = 0; idx < nbLocalIndex; ++idx) 
    920926    { 
    921       if (NumTraits<double>::isnan(*(dataInput + idx))) 
     927      if (NumTraits<double>::isNan(*(dataInput + idx))) 
    922928      { 
    923         flagInitial[localIndex[idx].first] = false; 
     929        allMissing(localIndex[idx].first) = allMissing(localIndex[idx].first) && true; 
    924930        if (renormalize) renormalizationFactor(localIndex[idx].first)-=localIndex[idx].second ; 
    925931      } 
    926932      else 
    927933      { 
    928         dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 
    929         flagInitial[localIndex[idx].first] = true; // Reset flag to indicate not all data source are nan 
     934        dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second;    
    930935      } 
    931936    } 
    932937 
    933     // If all data source are nan then data destination must be nan 
     938  } 
     939  else 
     940  { 
    934941    for (int idx = 0; idx < nbLocalIndex; ++idx) 
    935942    { 
    936       if (!flagInitial[localIndex[idx].first]) 
    937         dataOut(localIndex[idx].first) = defaultValue; 
    938     } 
    939   } 
    940   else 
    941   { 
    942     for (int idx = 0; idx < nbLocalIndex; ++idx) 
    943     { 
    944943      dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 
    945944    } 
     
    949948void CDomainAlgorithmInterpolate::updateData(CArray<double,1>& dataOut) 
    950949{ 
    951   if (detectMissingValue && renormalize) 
    952   { 
    953     if (renormalizationFactor.numElements()>0) dataOut/=renormalizationFactor ; // In some case, process doesn't received any data for interpolation (mask) 
    954                                                                                 // so renormalizationFactor is not initialized 
    955   } 
    956 } 
    957  
    958 } 
     950  if (detectMissingValue) 
     951  { 
     952    double defaultValue = std::numeric_limits<double>::quiet_NaN(); 
     953    size_t nbIndex=dataOut.numElements() ;  
     954 
     955    for (int idx = 0; idx < nbIndex; ++idx) 
     956    { 
     957      if (allMissing(idx)) dataOut(idx) = defaultValue; // If all data source are nan then data destination must be nan 
     958    } 
     959     
     960    if (renormalize) 
     961    { 
     962      if (renormalizationFactor.numElements()>0) dataOut/=renormalizationFactor ; // In some case, process doesn't received any data for interpolation (mask) 
     963                                                                                 // so renormalizationFactor is not initialized 
     964    }     
     965  } 
     966} 
     967 
     968} 
  • XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.hpp

    r1460 r1482  
    5555private: 
    5656  CArray<double,1> renormalizationFactor ; 
     57  CArray<bool,1> allMissing ; 
    5758  bool detectMissingValue ; 
    5859  bool renormalize ; 
  • XIOS/dev/branch_openmp/src/transformation/generic_algorithm_transformation.cpp

    r1460 r1482  
    3737  int nbLocalIndex = localIndex.size();    
    3838  double defaultValue = std::numeric_limits<double>::quiet_NaN(); 
     39   
    3940  if (ignoreMissingValue) 
    4041  { 
     42    if (firstPass) dataOut=defaultValue ; 
     43  
    4144    for (int idx = 0; idx < nbLocalIndex; ++idx) 
    4245    { 
    43       if (NumTraits<double>::isnan(*(dataInput + idx))) 
    44       { 
    45         flagInitial[localIndex[idx].first] = false; 
    46       } 
    47       else 
    48       { 
    49         dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 
    50         flagInitial[localIndex[idx].first] = true; // Reset flag to indicate not all data source are nan 
    51       } 
    52     } 
    53  
    54     // If all data source are nan then data destination must be nan 
    55     for (int idx = 0; idx < nbLocalIndex; ++idx) 
    56     { 
    57       if (!flagInitial[localIndex[idx].first]) 
    58         dataOut(localIndex[idx].first) = defaultValue; 
     46      if (! NumTraits<double>::isNan(*(dataInput + idx))) 
     47      { 
     48        if (flagInitial[localIndex[idx].first]) dataOut(localIndex[idx].first) = *(dataInput + idx) * localIndex[idx].second; 
     49        else dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 
     50        flagInitial[localIndex[idx].first] = false; // Reset flag to indicate not all data source are nan 
     51      } 
    5952    } 
    6053  } 
  • XIOS/dev/branch_openmp/src/type/type.hpp

    r1334 r1482  
    4747 
    4848    void allocate(void) ; 
    49     void checkEmpty(void) const; 
     49    virtual void checkEmpty(void) const {return _checkEmpty();}; 
    5050 
    5151    T* ptrValue ; 
     
    6363    void _reset(void) ; 
    6464    bool _isEmpty() const ; 
     65    void _checkEmpty(void) const; 
    6566    size_t _size(void) const ; 
    6667 
  • XIOS/dev/branch_openmp/src/type/type_impl.hpp

    r1105 r1482  
    8787  T& CType<T>::get(void) 
    8888  { 
    89     checkEmpty(); 
    90    return *ptrValue ; 
     89    this->checkEmpty(); 
     90    return *ptrValue ; 
    9191  } 
    9292 
     
    9494  const T& CType<T>::get(void) const 
    9595  { 
    96     checkEmpty(); 
     96    this->checkEmpty(); 
    9797    return *ptrValue ; 
    9898  } 
     
    122122   CType<T>::operator T&() 
    123123   { 
    124     checkEmpty(); 
    125     return *ptrValue ; 
     124     this->checkEmpty(); 
     125     return *ptrValue ; 
    126126   } 
    127127 
     
    129129   CType<T>::operator const T&() const 
    130130   { 
    131     checkEmpty(); 
    132     return *ptrValue ; 
     131     this->checkEmpty(); 
     132     return *ptrValue ; 
    133133   } 
    134134 
     
    136136   CType<T>* CType<T>::_clone(void) const 
    137137   { 
    138      checkEmpty(); 
     138     this->checkEmpty(); 
    139139     return new CType(*this) ; 
    140140   } 
     
    165165  { 
    166166    ostringstream oss; 
    167     checkEmpty(); 
     167    this->checkEmpty(); 
    168168    oss<<*ptrValue ; 
    169169    return oss.str() ; 
     
    173173  bool CType<T>::_toBuffer(CBufferOut& buffer) const 
    174174  { 
    175     checkEmpty(); 
     175    this->checkEmpty(); 
    176176    return buffer.put(*ptrValue) ; 
    177177  } 
     
    206206 
    207207  template <typename T> 
    208   void CType<T>::checkEmpty(void) const 
     208  void CType<T>::_checkEmpty(void) const 
    209209  { 
    210210    if (empty) ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << "Data is not initialized") ; 
  • XIOS/dev/branch_openmp/src/utils.hpp

    r1018 r1482  
    257257    return 1e-12; 
    258258  } 
    259   static inline bool isnan(const Scalar& v) { 
     259  static inline bool isNan(const Scalar& v) { 
    260260    return (v != v); 
    261261  } 
  • XIOS/dev/branch_openmp/src/xios_server.f90

    r1328 r1482  
    44  INCLUDE "mpif.h" 
    55  INTEGER :: ierr 
    6    
     6 
     7     
    78    CALL xios_init_server 
     9     
    810 
    911  END PROGRAM server_main 
Note: See TracChangeset for help on using the changeset viewer.