Changeset 2190 for XIOS


Ignore:
Timestamp:
07/20/21 16:22:31 (3 years ago)
Author:
jderouillat
Message:

Add bound checking when the workflow view is scaned (highlighted by blitz check in debug mode)

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp

    r2185 r2190  
    11251125            { 
    11261126              ind=j*ni+i ; 
    1127               if (!domainMask(ind)) 
     1127              if ( (ind<0)||(!domainMask(ind)) ) 
    11281128              { 
    11291129                data_i_index(k) = -1; 
     
    11551155              data_i_index(k) = -1; 
    11561156 
    1157             if (!domainMask(i)) data_i_index(k) = -1; 
     1157            if ( (i<0)||(!domainMask(i)) ) data_i_index(k) = -1; 
    11581158          } 
    11591159        } 
     
    11771177            if (i>=0 && i < domainMask.size()) 
    11781178            { 
    1179               if (domainMask(i)) 
     1179              if ( (i<0)||(!domainMask(i)) ) 
     1180                data_i_index(k) = -1; 
     1181              else 
    11801182                data_i_index(k) = k; 
    1181               else 
    1182                 data_i_index(k) = -1; 
    11831183            } 
    11841184            else 
     
    12011201              if (i>=0 && i<ni && j>=0 && j<nj) 
    12021202              { 
    1203                 if (domainMask(ind)) 
     1203                if ( (ind<0)||(!domainMask(ind)) ) 
     1204                { 
     1205                  data_i_index(count) = -1; 
     1206                  data_j_index(count) = -1; 
     1207                } 
     1208                else 
    12041209                { 
    12051210                  data_i_index(count) = ki; 
    12061211                  data_j_index(count) = kj; 
    1207                 } 
    1208                 else 
    1209                 { 
    1210                   data_i_index(count) = -1; 
    1211                   data_j_index(count) = -1; 
    12121212                } 
    12131213              } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_extract.cpp

    r2186 r2190  
    195195      domainDest_->j_index(countDest) = jIdxSrc-extractJBegin_; 
    196196      transformationMapping_[extractNi_*(jIdxSrc-extractJBegin_)+iIdxSrc-extractIBegin_]=sourceGlobalIdx(countSrc); 
    197       if ( sourceFullIdx(countSrc)==sourceWorkflowIdx(countSrc-countMasked) ) 
    198       { 
    199         domainDest_->mask_1d(countDest) = 1; 
    200       } 
    201       else { 
     197      if ( ( (countSrc-countMasked) >= sourceWorkflowIdx.numElements() ) 
     198         || ( sourceFullIdx(countSrc)!=sourceWorkflowIdx(countSrc-countMasked) ) ) 
     199      { 
    202200        domainDest_->mask_1d(countDest) = 0; 
    203201        // if point masked, manage offset between full and worfklow views of domainSource 
    204202        countMasked++; 
     203      } 
     204      else { 
     205        domainDest_->mask_1d(countDest) = 1; 
    205206      } 
    206207 
     
    262263    } 
    263264    else 
    264       if ( sourceFullIdx(countSrc)!=sourceWorkflowIdx(countSrc-countMasked) ) 
     265      if ( ( (countSrc-countMasked) >= sourceWorkflowIdx.numElements() ) 
     266         || ( sourceFullIdx(countSrc)!=sourceWorkflowIdx(countSrc-countMasked) ) ) 
    265267      { 
    266268        // manage offset between full and worfklow views of domainSource even if point i is not concerned 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp

    r2184 r2190  
    110110   int countMasked(0); // countMasked will store the offset index between full and workflow views 
    111111   for (size_t i = 0; i < indexSize ; ++i) { 
    112      if ( sourceFullIdx(i)==sourceWorkflowIdx(i-countMasked) ) { 
    113        domainDestination->mask_1d(i) = 1; 
     112       if ( ( (i-countMasked) >= sourceWorkflowIdx.numElements() ) 
     113         || ( sourceFullIdx(i)!=sourceWorkflowIdx(i-countMasked) ) ) { 
     114       domainDestination->mask_1d(i) = 0; 
     115       countMasked++; 
    114116     } 
    115117     else { 
    116        domainDestination->mask_1d(i) = 0; 
    117        countMasked++; 
     118       domainDestination->mask_1d(i) = 1; 
    118119     } 
    119120   } 
Note: See TracChangeset for help on using the changeset viewer.