Changeset 1482 for XIOS/dev/branch_openmp/src/transformation
- Timestamp:
- 04/13/18 16:25:46 (6 years ago)
- 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 47 47 currentlocalIndex = localIndex[idx].first; 48 48 currentWeight = localIndex[idx].second; 49 if (!NumTraits<double>::is nan(*(dataInput + idx)))49 if (!NumTraits<double>::isNan(*(dataInput + idx))) 50 50 { 51 51 if (flagInitial[currentlocalIndex]) -
XIOS/dev/branch_openmp/src/transformation/Functions/max_reduction.cpp
r1328 r1482 41 41 { 42 42 currentlocalIndex = localIndex[idx].first; 43 if (!NumTraits<double>::is nan(*(dataInput + idx)))43 if (!NumTraits<double>::isNan(*(dataInput + idx))) 44 44 { 45 45 if (flagInitial[currentlocalIndex]) -
XIOS/dev/branch_openmp/src/transformation/Functions/min_reduction.cpp
r1328 r1482 41 41 { 42 42 currentlocalIndex = localIndex[idx].first; 43 if (!NumTraits<double>::is nan(*(dataInput + idx)))43 if (!NumTraits<double>::isNan(*(dataInput + idx))) 44 44 { 45 45 if (flagInitial[currentlocalIndex]) -
XIOS/dev/branch_openmp/src/transformation/Functions/sum_reduction.cpp
r1328 r1482 43 43 { 44 44 currentlocalIndex = localIndex[idx].first; 45 if (!NumTraits<double>::is nan(*(dataInput + idx)))45 if (!NumTraits<double>::isNan(*(dataInput + idx))) 46 46 { 47 47 if (flagInitial[currentlocalIndex]) -
XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp
r1460 r1482 916 916 renormalizationFactor=1 ; 917 917 } 918 919 if (firstPass) 920 { 921 allMissing.resize(dataOut.numElements()) ; 922 allMissing=true ; 923 } 918 924 919 925 for (int idx = 0; idx < nbLocalIndex; ++idx) 920 926 { 921 if (NumTraits<double>::is nan(*(dataInput + idx)))927 if (NumTraits<double>::isNan(*(dataInput + idx))) 922 928 { 923 flagInitial[localIndex[idx].first] = false;929 allMissing(localIndex[idx].first) = allMissing(localIndex[idx].first) && true; 924 930 if (renormalize) renormalizationFactor(localIndex[idx].first)-=localIndex[idx].second ; 925 931 } 926 932 else 927 933 { 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; 930 935 } 931 936 } 932 937 933 // If all data source are nan then data destination must be nan 938 } 939 else 940 { 934 941 for (int idx = 0; idx < nbLocalIndex; ++idx) 935 942 { 936 if (!flagInitial[localIndex[idx].first])937 dataOut(localIndex[idx].first) = defaultValue;938 }939 }940 else941 {942 for (int idx = 0; idx < nbLocalIndex; ++idx)943 {944 943 dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 945 944 } … … 949 948 void CDomainAlgorithmInterpolate::updateData(CArray<double,1>& dataOut) 950 949 { 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 55 55 private: 56 56 CArray<double,1> renormalizationFactor ; 57 CArray<bool,1> allMissing ; 57 58 bool detectMissingValue ; 58 59 bool renormalize ; -
XIOS/dev/branch_openmp/src/transformation/generic_algorithm_transformation.cpp
r1460 r1482 37 37 int nbLocalIndex = localIndex.size(); 38 38 double defaultValue = std::numeric_limits<double>::quiet_NaN(); 39 39 40 if (ignoreMissingValue) 40 41 { 42 if (firstPass) dataOut=defaultValue ; 43 41 44 for (int idx = 0; idx < nbLocalIndex; ++idx) 42 45 { 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 } 59 52 } 60 53 }
Note: See TracChangeset
for help on using the changeset viewer.