Changeset 384 for XIOS/trunk/src/node


Ignore:
Timestamp:
10/25/12 10:12:20 (12 years ago)
Author:
ymipsl
Message:

Cartesian/Regular? grid are now working correctly.

YM

Location:
XIOS/trunk/src/node
Files:
2 edited

Legend:

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

    r380 r384  
    412412   void CDomain::completeLonLatClient(void) 
    413413   { 
    414       CArray<double,1> lonvalue_temp ; 
    415       CArray<double,1> latvalue_temp ; 
    416        
     414      int i,j,k ; 
     415      CArray<double,1> lonvalue_temp(ni*nj) ; 
     416      CArray<double,1> latvalue_temp(ni*nj) ; 
     417       
     418      if ( lonvalue.numElements() == ni*nj && latvalue.numElements() == ni*nj ) isCurvilinear=true ; 
     419      else if ( lonvalue.numElements() == ni && latvalue.numElements() == nj ) isCurvilinear=false ; 
     420      else ERROR("void CDomain::completeLonLatClient(void)",<<"the grid is nor curvilinear, nor cartesian, because the size of longitude and latitude array is not coherent with the domain size"<<endl 
     421                                                            <<"lonvalue size = " << lonvalue.numElements() << "different of ni or ni*nj"<<endl 
     422                                                            <<"latvalue size = " << latvalue.numElements() << "different of nj or ni*nj" ) ; 
     423      if (isCurvilinear) 
     424      { 
     425        lonvalue_temp=lonvalue ; 
     426        latvalue_temp=latvalue ; 
     427      } 
     428      else 
     429      { 
     430        for(j=0;j<nj;j++) 
     431          for(i=0;i<ni;i++)  
     432          { 
     433            k=j*ni+i ; 
     434            lonvalue_temp(k)=lonvalue(i) ; 
     435            latvalue_temp(k)=latvalue(j) ; 
     436          } 
     437      } 
     438          
     439         
    417440      const int zoom_ibegin_client  = zoom_ibegin_loc.getValue(), 
    418441                zoom_jbegin_client  = zoom_jbegin_loc.getValue(), 
     
    420443                zoom_nj_client      = zoom_nj_loc.getValue(); 
    421444                 
    422       if (this->data_dim.getValue() == 2) 
    423       { 
    424          StdSize dm = zoom_ni_client * zoom_nj_client; 
    425  
    426          lonvalue_temp.resize(dm); 
    427          latvalue_temp.resize(dm); 
    428           
    429          for (int i = 0; i < zoom_ni_client; i++) 
    430          { 
    431             for (int j = 0; j < zoom_nj_client; j++) 
    432             { 
    433                lonvalue_temp(i + j * zoom_ni_client) = lonvalue( (i + zoom_ibegin_client -1) + (j + zoom_jbegin_client -1)*ni.getValue() );  
    434                latvalue_temp(i + j * zoom_ni_client) = latvalue( (i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue() ); 
    435             } 
    436          } 
    437          lonvalue.reference(lonvalue_temp.copy()) ; 
    438          latvalue.reference(latvalue_temp.copy()) ; 
    439       } 
    440       else 
    441       { 
    442          lonvalue_temp.resize(zoom_ni_client); 
    443          latvalue_temp.resize(zoom_nj_client); 
    444  
    445 // Attention ici à revoir, probablement faux          
    446          for (int i = zoom_ibegin_client - 1; i < (zoom_ni_client - zoom_ibegin_client + 1); i++) 
    447          { 
    448             lonvalue_temp(i) = lonvalue(i);  
    449          } 
    450           
    451          for (int j = zoom_jbegin_client - 1; j < (zoom_nj_client - zoom_jbegin_client + 1); j++) 
    452          { 
    453             latvalue_temp(j) = latvalue(j); 
    454          } 
    455           
    456          lonvalue.reference(lonvalue_temp.copy()) ; 
    457          latvalue.reference(latvalue_temp.copy()) ; 
    458       }   
     445      StdSize dm = zoom_ni_client * zoom_nj_client; 
     446 
     447      lonvalue.resize(dm); 
     448      latvalue.resize(dm); 
     449          
     450      for (int i = 0; i < zoom_ni_client; i++) 
     451      { 
     452        for (int j = 0; j < zoom_nj_client; j++) 
     453        { 
     454          lonvalue(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client -1) + (j + zoom_jbegin_client -1)*ni.getValue() );  
     455          latvalue(i + j * zoom_ni_client) = latvalue_temp( (i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue() ); 
     456        } 
     457      } 
    459458   } 
    460459  
     
    539538          !this->zoom_ibegin.isEmpty() || !this->zoom_jbegin.isEmpty()) 
    540539      { 
    541          if (this->zoom_ni.isEmpty()     && this->zoom_nj.isEmpty() && 
    542              this->zoom_ibegin.isEmpty() && this->zoom_jbegin.isEmpty()) 
     540         if (this->zoom_ni.isEmpty()     || this->zoom_nj.isEmpty() || 
     541             this->zoom_ibegin.isEmpty() || this->zoom_jbegin.isEmpty()) 
    543542         { 
    544543            ERROR("CDomain::checkZoom(void)", 
    545                   <<"Les attributs définissant un zoom doivent tous être définis") ; 
     544                  <<"if one of zoom attributes is defined then all zoom attributes must be defined") ; 
    546545         } 
    547546         else 
     
    870869      list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
    871870 
    872       *list_msg.back()<<this->getId() ; 
     871      *list_msg.back()<<this->getId()<<isCurvilinear ; 
    873872      *list_msg.back()<<*list_indi.back()<<*list_indj.back()<<*list_lon.back()<<*list_lat.back() ; 
    874873      event.push(connectedServer[ns],nbSenders[ns],*list_msg.back()) ; 
     
    961960    CArray<double,1> lat ; 
    962961      
    963     buffer>>indi>>indj>>lon>>lat ; 
     962    buffer>>isCurvilinear>>indi>>indj>>lon>>lat ; 
     963    if (isCurvilinear) cout<<"Grid Curvilinear"<<endl ; 
     964    else cout<<"Grid Cartesian"<<endl ; 
    964965    int i,j,ind_srv ; 
    965966 
  • XIOS/trunk/src/node/domain.hpp

    r369 r384  
    145145 
    146146         CArray<int, 2> local_mask; 
    147  
     147         bool isCurvilinear ; 
    148148       private : 
    149149 
Note: See TracChangeset for help on using the changeset viewer.