Ignore:
Timestamp:
09/11/17 17:02:48 (7 years ago)
Author:
ymipsl
Message:

Fix problem of axis distribution. When a grid is composed of a distributed axis and an non distributed axis on client side , on server side the first axis will be non distributed and second axis will be distributed. In this case, attributes (value, bounds, etc) was not sent in correct distribution.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/server_distribution_description.cpp

    r1235 r1258  
    117117{ 
    118118  int nBand  = 0; 
    119   switch (serverType_) { 
     119  switch (serverType_) 
     120  { 
    120121    case BAND_DISTRIBUTION: 
    121122      nBand = computeBandDistribution(nServer_, positionDimensionDistributed); 
    122123      break; 
     124    case ROOT_DISTRIBUTION: 
     125      nBand = computeRootDistribution(nServer_); 
    123126    default: 
    124127      break; 
     
    397400} 
    398401 
     402 
     403/*! 
     404  Compute global index of servers with root distribution : only root server will received data 
     405  \param [in] nServer number of server 
     406*/ 
     407int CServerDistributionDescription::computeRootDistribution(int nServer, int positionDimensionDistributed) 
     408{ 
     409  int dim = nGlobal_.size(); 
     410  positionDimensionDistributed_ = positionDimensionDistributed; 
     411  if (1 == dim) positionDimensionDistributed_ = 0; 
     412  if (positionDimensionDistributed_ > dim) 
     413    ERROR("CServerDistributionDescription::computeBandDistribution(int nServer, int positionDimensionDistributed)", 
     414          << "Position of distributed dimension is invalid" << std::endl 
     415          << "Position of distributed dimension is " << positionDimensionDistributed_ 
     416          << "Dimension " << dim) 
     417 
     418  indexBegin_.resize(nServer); 
     419  dimensionSizes_.resize(nServer); 
     420 
     421  for (int i = 0; i< nServer; ++i) 
     422  { 
     423    indexBegin_[i].resize(dim); 
     424    dimensionSizes_[i].resize(dim); 
     425  } 
     426 
     427  int nGlobTemp = 0; 
     428 
     429  int positionDistributed = (1<dim) ? positionDimensionDistributed_ : 0; 
     430  nGlobTemp = nGlobal_[positionDistributed]; 
     431  int nbBand = 1 ; 
     432 
     433 
     434  for (int i = 0; i < nServer; ++i) 
     435  { 
     436    for (int j = 0; j < dim; ++j) 
     437    { 
     438      if (positionDistributed != j) // bad coding, need to be rewrite 
     439      { 
     440        if (1 == dim) 
     441        { 
     442          if (i==0) 
     443          { 
     444            indexBegin_[i][j] = 0; 
     445            dimensionSizes_[i][j] = nGlobTemp; 
     446          } 
     447          else 
     448          { 
     449            indexBegin_[i][j] = nGlobTemp-1; 
     450            dimensionSizes_[i][j] = 0; 
     451          } 
     452        } 
     453        else 
     454        { 
     455          indexBegin_[i][j] = 0; 
     456          dimensionSizes_[i][j] = nGlobal_[j]; 
     457        } 
     458      } 
     459      else 
     460      { 
     461        if (i==0) 
     462        { 
     463          indexBegin_[i][j] = 0; 
     464          dimensionSizes_[i][j] = nGlobTemp; 
     465        } 
     466        else 
     467        { 
     468          indexBegin_[i][j] = nGlobTemp-1; 
     469          dimensionSizes_[i][j] = 0; 
     470        } 
     471      } 
     472    } 
     473  } 
     474 
     475  return nbBand; 
     476} 
     477 
     478 
     479 
     480 
    399481/*! 
    400482  Get size of each dimension on distributed server 
Note: See TracChangeset for help on using the changeset viewer.