Changeset 1936 for XIOS


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

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

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/distributed_view.cpp

    r1930 r1936  
    2929      for(int i=0 ; i < size ; i++) 
    3030        if (mask(i)) { index(pos) = i ; pos++ ; } 
    31       index.resizeAndPreserve(pos) ; 
     31      if (pos==0) index.resize(pos) ; 
     32      else index.resizeAndPreserve(pos) ; 
    3233      size_[rank] = pos ; 
    3334    } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/distributed_view.hpp

    r1930 r1936  
    4343            } 
    4444          } 
    45           globalIndView.resizeAndPreserve(pos) ; 
     45          if (pos==0) globalIndView.resize(pos) ; 
     46          else globalIndView.resizeAndPreserve(pos) ; 
    4647      } 
    4748    }    
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_view.hpp

    r1930 r1936  
    3434        } 
    3535      } 
    36       globalIndexView.resizeAndPreserve(pos) ; 
     36      if(pos==0) globalIndexView.resize(pos) ; 
     37      else globalIndexView.resizeAndPreserve(pos) ; 
    3738    }     
    3839 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/mesh.cpp

    r1639 r1936  
    539539          } 
    540540        } 
    541         nodeHashList.resizeAndPreserve(nbHash); 
     541        if (nbHash==0) nodeHashList.resize(nbHash); 
     542        else nodeHashList.resizeAndPreserve(nbHash); 
    542543 
    543544        // (2.2) Generating global node indexes 
     
    986987          } 
    987988        } 
    988         edgeHashList.resizeAndPreserve(nEdgeHash); 
     989        if (nEdgeHash==0) edgeHashList.resize(nEdgeHash); 
     990        else edgeHashList.resizeAndPreserve(nEdgeHash); 
    989991 
    990992        // (2.3) Generating global edge indexes 
     
    13271329          } 
    13281330        } 
    1329         nodeIdxList.resizeAndPreserve(nIdx); 
     1331        if (nIdx==0) nodeIdxList.resize(nIdx); 
     1332        else nodeIdxList.resizeAndPreserve(nIdx); 
    13301333        CClientClientDHTSizet dhtNodeIdx(nodeIdx2Idx, comm); 
    13311334        dhtNodeIdx.computeIndexInfoMapping(nodeIdxList); 
     
    13771380          } 
    13781381        } 
    1379         edgeHashList.resizeAndPreserve(nEdgeHash); 
     1382        if (nEdgeHash==0) edgeHashList.resize(nEdgeHash); 
     1383        else edgeHashList.resizeAndPreserve(nEdgeHash); 
    13801384 
    13811385        // (3.4) Generating global edge indexes 
     
    17541758      } 
    17551759    } 
    1756     nghbFaces.resizeAndPreserve(2, nbNghb); 
     1760    if (nbNghb==0) nghbFaces.resize(2, nbNghb); 
     1761    else nghbFaces.resizeAndPreserve(2, nbNghb); 
    17571762  } // getGloNghbFacesNodeType 
    17581763 
     
    18061811      } 
    18071812    } 
    1808     nodeHashList.resizeAndPreserve(iIdx); 
     1813    if (iIdx==0) nodeHashList.resize(iIdx); 
     1814    else nodeHashList.resizeAndPreserve(iIdx); 
    18091815 
    18101816    // (1.2) Generating node indexes 
     
    19341940      } 
    19351941    } 
    1936     nghbFaces.resizeAndPreserve(2, nbNghb); 
     1942    if (nbNghb==0) nghbFaces.resize(2, nbNghb); 
     1943    else nghbFaces.resizeAndPreserve(2, nbNghb); 
    19371944  } // getGloNghbFacesEdgeType 
    19381945 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/test/generic_testcase.f90

    r1934 r1936  
    3434    DOUBLE PRECISION    :: pressure_factor 
    3535    LOGICAL :: domain_mask 
     36    CHARACTER(len_str) :: domain_mask_type="cross" 
    3637    LOGICAL :: axis_mask 
    3738    LOGICAL :: mask3d 
     
    755756    IF (.NOT. xios_getvar(prefix//"domain", params%domain) )             params%domain="lmdz" 
    756757    IF (.NOT. xios_getvar(prefix//"domain_mask", params%domain_mask) )   params%domain_mask=.FALSE. 
     758    IF (.NOT. xios_getvar(prefix//"domain_mask_type", params%domain_mask_type) )   params%domain_mask_type="cross" 
    757759    IF (.NOT. xios_getvar(prefix//"axis", params%axis) )                 params%axis="pressure" 
    758760    IF (.NOT. xios_getvar(prefix//"axis_mask", params%axis_mask) )       params%axis_mask=.FALSE. 
     
    19391941     mask(:)=.TRUE. 
    19401942     IF (params%domain_mask) THEN 
    1941        WHERE (lon(:)-2*lat(:)>-10 .AND. lon(:)-2*lat(:) <10) mask(:)=.FALSE.  
    1942        WHERE (2*lat(:)+lon(:)>-10 .AND. 2*lat(:)+lon(:)<10) mask(:)=.FALSE.  
     1943       IF (params%domain_mask_type=="cross") THEN 
     1944         WHERE (lon(:)-2*lat(:)>-10 .AND. lon(:)-2*lat(:) <10) mask(:)=.FALSE.  
     1945         WHERE (2*lat(:)+lon(:)>-10 .AND. 2*lat(:)+lon(:)<10) mask(:)=.FALSE. 
     1946       ELSE IF (params%domain_mask_type=="latitude_band") THEN 
     1947         WHERE (lat(:)>-30 .AND. lat(:)<30) mask(:)=.FALSE. 
     1948      ENDIF  
    19431949     ENDIF 
    19441950 
  • 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.