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/src/transformation
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • 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  } 
Note: See TracChangeset for help on using the changeset viewer.