Ignore:
Timestamp:
09/17/20 18:30:19 (4 years ago)
Author:
ymipsl
Message:

XIOS coupling branch :
Blitz array resizeAndPreserve crash when size=0 => use resize instead

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm_expand.cpp

    r1784 r1936  
    259259  CArray<int,1> data_j_index_dst_full(newNbLocalDst); 
    260260 
    261   domainDestination->lonvalue.resizeAndPreserve(newNbLocalDst); 
    262   domainDestination->latvalue.resizeAndPreserve(newNbLocalDst); 
    263   domainDestination->bounds_lon_1d.resizeAndPreserve(nVertex, newNbLocalDst); 
    264   domainDestination->bounds_lat_1d.resizeAndPreserve(nVertex, newNbLocalDst); 
     261  if (newNbLocalDst==0) 
     262  { 
     263    domainDestination->lonvalue.resize(newNbLocalDst); 
     264    domainDestination->latvalue.resize(newNbLocalDst); 
     265    domainDestination->bounds_lon_1d.resize(nVertex, newNbLocalDst); 
     266    domainDestination->bounds_lat_1d.resize(nVertex, newNbLocalDst); 
     267  } 
     268  else  
     269  { 
     270    domainDestination->lonvalue.resizeAndPreserve(newNbLocalDst); 
     271    domainDestination->latvalue.resizeAndPreserve(newNbLocalDst); 
     272    domainDestination->bounds_lon_1d.resizeAndPreserve(nVertex, newNbLocalDst); 
     273    domainDestination->bounds_lat_1d.resizeAndPreserve(nVertex, newNbLocalDst); 
     274  } 
    265275  CArray<double,1>& lon_dst   = domainDestination->lonvalue; 
    266276  CArray<double,1>& lat_dst   = domainDestination->latvalue; 
     
    532542  int nVertex       = bounds_lon_dst.shape()[0]; 
    533543 
    534   mask_1d_dst.resizeAndPreserve(newNbLocalDst); 
    535   i_index_dst.resizeAndPreserve(newNbLocalDst); 
    536   j_index_dst.resizeAndPreserve(newNbLocalDst); 
    537   lon_dst.resizeAndPreserve(newNbLocalDst); 
    538   lat_dst.resizeAndPreserve(newNbLocalDst); 
    539   bounds_lon_dst.resizeAndPreserve(nVertex, newNbLocalDst); 
    540   bounds_lat_dst.resizeAndPreserve(nVertex, newNbLocalDst); 
     544  if (newNbLocalDst==0) 
     545  { 
     546    mask_1d_dst.resize(newNbLocalDst); 
     547    i_index_dst.resize(newNbLocalDst); 
     548    j_index_dst.resize(newNbLocalDst); 
     549    lon_dst.resize(newNbLocalDst); 
     550    lat_dst.resize(newNbLocalDst); 
     551    bounds_lon_dst.resize(nVertex, newNbLocalDst); 
     552    bounds_lat_dst.resize(nVertex, newNbLocalDst); 
     553  } 
     554  else 
     555  { 
     556    mask_1d_dst.resizeAndPreserve(newNbLocalDst); 
     557    i_index_dst.resizeAndPreserve(newNbLocalDst); 
     558    j_index_dst.resizeAndPreserve(newNbLocalDst); 
     559    lon_dst.resizeAndPreserve(newNbLocalDst); 
     560    lat_dst.resizeAndPreserve(newNbLocalDst); 
     561    bounds_lon_dst.resizeAndPreserve(nVertex, newNbLocalDst); 
     562    bounds_lat_dst.resizeAndPreserve(nVertex, newNbLocalDst); 
     563  } 
    541564  CArray<int,1> data_i_index_dst_full(newNbLocalDst); 
    542565  data_i_index_dst_full(Range(0,oldNbLocal-1)) = data_i_index_src_full; 
Note: See TracChangeset for help on using the changeset viewer.