Ignore:
Timestamp:
10/09/15 14:51:28 (9 years ago)
Author:
mhnguyen
Message:

Add more attributes to generate_rectilinear_domain

+) Longitude and latitude of an auto-generated domain can be specified by its boundaries whose values are determined by range

Test
+) On Curie
+) test_remap passes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/domain.cpp

    r720 r727  
    174174     if (type_attr::rectilinear == type) 
    175175     { 
     176        this->isRedistributed_ = true; 
     177 
    176178        CContext* context = CContext::getCurrent(); 
    177179        CContextClient* client = context->client; 
     
    271273        // Now fill other attributes 
    272274        fillInRectilinearLonLat(); 
    273         this->isRedistributed_ = true; 
    274275     } 
    275276   } 
     
    287288     latvalue_1d.resize(nj); 
    288289 
    289      double lonStep = double(360/ni_glo.getValue()); 
    290      double latStep = double(180/nj_glo.getValue()); 
     290     double lonRange = lon_end - lon_start; 
     291     double latRange = lat_end - lat_start; 
     292 
     293     double lonStep = lonRange/double(ni_glo.getValue()); 
     294     double latStep = latRange/double(nj_glo.getValue()); 
    291295 
    292296     // Assign lon value 
    293297     for (int i = 0; i < ni; ++i) 
    294298     { 
    295        lonvalue_1d(i) = static_cast<double>(ibegin + i) * lonStep -180 + lonStep/2; 
     299       if (0 == (ibegin + i)) 
     300       { 
     301         lonvalue_1d(i) = lon_start; 
     302       } 
     303       else if (ni_glo == (ibegin + i + 1)) 
     304       { 
     305         lonvalue_1d(i) = lon_end; 
     306       } 
     307       else 
     308       { 
     309         lonvalue_1d(i) = (ibegin + i) * lonStep  + lon_start; 
     310       } 
    296311     } 
    297312 
    298313     for (int j = 0; j < nj; ++j) 
    299314     { 
    300        latvalue_1d(j) = static_cast<double>(jbegin + j) * latStep - 90 + latStep/2; 
     315       if (0 == (jbegin + j)) 
     316       { 
     317          latvalue_1d(j) = lat_start; 
     318       } 
     319       else if (nj_glo == (jbegin + j + 1)) 
     320       { 
     321          latvalue_1d(j) = lat_end; 
     322       } 
     323       else 
     324       { 
     325         latvalue_1d(j) =  (jbegin + j) * latStep + lat_start; 
     326       } 
    301327     } 
    302328   } 
     
    307333     const int nvertexValue = 4; 
    308334 
     335     double boundsLonRange = bounds_lon_end - bounds_lon_start; 
     336     double boundsLatRange = bounds_lat_end - bounds_lat_start; 
     337 
    309338     boundsLon.resize(nvertexValue,ni*nj); 
    310339     boundsLat.resize(nvertexValue,nj*ni); 
    311340 
    312      double lonStep = double(360/ni_glo.getValue()); 
    313      double latStep = double(180/nj_glo.getValue()); 
     341     double lonStep = boundsLonRange/double(ni_glo.getValue()); 
     342     double latStep = boundsLatRange/double(nj_glo.getValue()); 
    314343 
    315344     for(j=0;j<nj;++j) 
     
    317346       { 
    318347         k=j*ni+i; 
    319          boundsLon(0,k) = boundsLon(1,k) = (0 != (ibegin + i)) ? (ibegin + i) * lonStep -180 
    320                                                                : -180; 
    321          boundsLon(2,k) = boundsLon(3,k) = ((ibegin + i + 1) != ni_glo) ? (ibegin + i +1) * lonStep -180 
    322                                                                         : 180; 
    323  
    324          boundsLat(1,k) = boundsLat(2,k) = (0 != (jbegin + j)) ? (jbegin + j) * latStep - 90 
    325                                                                : -90; 
    326          boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) != nj_glo) ? (jbegin + j +1) * latStep - 90 
    327                                                                : +90; 
     348         boundsLon(0,k) = boundsLon(1,k) = (0 != (ibegin + i)) ? (ibegin + i) * lonStep + bounds_lon_start 
     349                                                               : bounds_lon_start; 
     350         boundsLon(2,k) = boundsLon(3,k) = ((ibegin + i + 1) != ni_glo) ? (ibegin + i +1) * lonStep + bounds_lon_start 
     351                                                                        : bounds_lon_end; 
     352 
     353         boundsLat(1,k) = boundsLat(2,k) = (0 != (jbegin + j)) ? (jbegin + j) * latStep + bounds_lat_start 
     354                                                               : bounds_lat_start; 
     355         boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) != nj_glo) ? (jbegin + j +1) * latStep + bounds_lat_start 
     356                                                               : bounds_lat_end; 
    328357       } 
    329358   } 
Note: See TracChangeset for help on using the changeset viewer.