Ignore:
Timestamp:
01/20/13 23:14:35 (11 years ago)
Author:
ymipsl
Message:

Add grid mask attribute

YM

File:
1 edited

Legend:

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

    r369 r415  
    176176      this->solveDomainRef() ; 
    177177      this->solveAxisRef() ; 
     178         
    178179      if (context->hasClient) 
    179180      { 
    180           
     181         checkMask() ; 
    181182         this->computeIndex() ; 
    182183 
     
    190191   } 
    191192 
     193 
     194   void CGrid::checkMask(void) 
     195   { 
     196      using namespace std; 
     197 
     198      unsigned int niu = domain->ni, nju = domain->nj; 
     199      unsigned int nlu = 1 ; 
     200      if (hasAxis()) nlu=axis->size ; 
     201 
     202      if (!mask.isEmpty()) 
     203      { 
     204         if ((mask.extent(0) != niu) || 
     205             (mask.extent(1) != nju) || 
     206             (mask.extent(2) != nlu)) 
     207             ERROR("CGrid::checkAttributes(void)", 
     208                  <<"Le masque n'a pas la même taille que la grille locale") ; 
     209      } 
     210      else  
     211      { 
     212        mask.resize(niu,nju,nlu) ; 
     213        mask=true  ; 
     214      } 
     215      
     216      CArray<bool,2>& domainMask = domain->mask ; 
     217      for (int l=0; l < nlu ; l++) 
     218        for (int j=0; j < nju ; j++) 
     219          for(int i=0; i<niu ; i++) mask(i,j,l) = mask(i,j,l) && domainMask(i,j) ; 
     220         
     221       
     222   } 
     223    
    192224   //--------------------------------------------------------------- 
    193225 
     
    246278      CArray<int,1> data_i_index = domain->data_i_index ; 
    247279      CArray<int,1> data_j_index = domain->data_j_index ; 
    248        
    249  
    250       CArray<bool,2>& mask = domain->mask ; 
    251       CArray<int,2>& local_mask = domain->local_mask ; 
    252280       
    253281 
     
    268296            if ((l >=lbegin && l<= lend) && 
    269297                (i >= 0 && i < ni) && 
    270                 (j >= 0 && j < nj) && mask(i,j)) 
     298                (j >= 0 && j < nj) && mask(i,j,l)) 
    271299               indexCount++ ; 
    272300         } 
     
    298326            if ((l >= lbegin && l <= lend) && 
    299327                (i >= 0 && i < ni) && 
    300                 (j >= 0 && j < nj) && mask(i,j)) 
     328                (j >= 0 && j < nj) && mask(i,j,l)) 
    301329            { 
    302330               (*storeIndex[0])(indexCount) = count ; 
Note: See TracChangeset for help on using the changeset viewer.