Ignore:
Timestamp:
09/15/15 17:31:06 (9 years ago)
Author:
mhnguyen
Message:

Integrating remap library into XIOS

+) Change name of some files of remap library to be compatible with XIOS
+) Implement function to fill in automatically boundary longitude and latitude

Test
+) On Curie
+) test_remap correct

File:
1 edited

Legend:

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

    r687 r688  
    215215        else 
    216216        { 
     217          float njGlo = nj_glo.getValue(); 
     218          float niGlo = ni_glo.getValue(); 
     219          int nbProcOnX, nbProcOnY, range; 
     220 
    217221          // Compute (approximately) number of segment on x and y axis 
    218           float yOverXRatio = (nj_glo.getValue())/(ni_glo.getValue()); 
    219           int nbProcOnX, nbProcOnY, range; 
     222          float yOverXRatio = njGlo/niGlo; 
     223 
    220224          nbProcOnX = std::ceil(std::sqrt(nbLocalDomain/yOverXRatio)); 
    221225          nbProcOnY = std::ceil(((float)nbLocalDomain)/nbProcOnX); 
     
    266270        // Now fill other attributes 
    267271        fillInRectilinearLonLat(); 
     272//        fillInRectilinearBoundLonLat(); 
    268273     } 
    269274   } 
     
    280285     lonvalue_1d.resize(ni); 
    281286     latvalue_1d.resize(nj); 
     287 
    282288     double lonStep = double(360/ni_glo.getValue()); 
    283289     double latStep = double(180/nj_glo.getValue()); 
     
    286292     for (int i = 0; i < ni; ++i) 
    287293     { 
    288        lonvalue_1d(i) = static_cast<double>(ibegin + i) * lonStep; 
     294       lonvalue_1d(i) = static_cast<double>(ibegin + i) * lonStep -180 + lonStep/2; 
    289295     } 
    290296 
    291297     for (int j = 0; j < nj; ++j) 
    292298     { 
    293        latvalue_1d(j) = static_cast<double>(jbegin + j) * latStep - 90; 
    294      } 
     299       latvalue_1d(j) = static_cast<double>(jbegin + j) * latStep - 90 + latStep/2; 
     300     } 
     301   } 
     302 
     303   void CDomain::fillInRectilinearBoundLonLat(CArray<double,2>& boundsLon, CArray<double,2>& boundsLat) 
     304   { 
     305     int i,j,k; 
     306     const int nvertexValue = 4; 
     307 
     308     boundsLon.resize(nvertexValue,ni*nj); 
     309     boundsLat.resize(nvertexValue,nj*ni); 
     310 
     311     double lonStep = double(360/ni_glo.getValue()); 
     312     double latStep = double(180/nj_glo.getValue()); 
     313 
     314     for(j=0;j<nj;++j) 
     315       for(i=0;i<ni;++i) 
     316       { 
     317         k=j*ni+i; 
     318         boundsLon(0,k) = boundsLon(1,k) = (0 != (ibegin + i)) ? (ibegin + i) * lonStep -180 
     319                                                               : -180; 
     320         boundsLon(2,k) = boundsLon(3,k) = ((ibegin + i + 1) != ni_glo) ? (ibegin + i +1) * lonStep -180 
     321                                                                        : 180; 
     322 
     323         boundsLat(1,k) = boundsLat(2,k) = (0 != (jbegin + j)) ? (jbegin + j) * latStep - 90 
     324                                                               : -90; 
     325         boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) != nj_glo) ? (jbegin + j +1) * latStep - 90 
     326                                                               : +90; 
     327       } 
    295328   } 
    296329 
     
    625658            } 
    626659          } 
     660        lonvalue_1d.free(); 
    627661     } 
    628662 
     
    666700         } 
    667701       } 
     702       lonvalue_2d.free(); 
    668703     } 
    669704 
Note: See TracChangeset for help on using the changeset viewer.