Ignore:
Timestamp:
06/06/17 17:58:16 (7 years ago)
Author:
oabramkina
Message:

Two server levels: merging with trunk r1137.
There are bugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/node/grid.cpp

    r1144 r1158  
    3131      , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 
    3232      , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    33       , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
     33      , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
    3434      , transformations_(0), isTransformed_(false) 
    35       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
     35      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    3636      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 
    3737      , computedWrittenIndex_(false) 
     
    5050      , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 
    5151      , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    52       , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
     52      , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
    5353      , transformations_(0), isTransformed_(false) 
    54       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
     54      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    5555      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 
    5656      , computedWrittenIndex_(false) 
     
    7676 
    7777 
    78    StdSize CGrid::getDimension(void) const 
    79    { 
    80       return globalDim_.size(); 
     78   StdSize CGrid::getDimension(void) 
     79   { 
     80      return getGlobalDimension().size(); 
    8181   } 
    8282 
     
    196196        for (int i = 0; i < axisListP.size(); ++i) 
    197197        { 
    198           axisListP[i]->checkAttributesOnClientAfterTransformation(globalDim_,axisPositionInGrid_[i]); 
     198          axisListP[i]->checkAttributesOnClientAfterTransformation(getGlobalDimension(),axisPositionInGrid_[i]); 
    199199        } 
    200200      } 
     
    243243     this->solveScalarRef(areAttributesChecked); 
    244244     this->solveAxisRef(areAttributesChecked); 
    245      this->solveDomainRef(areAttributesChecked); 
    246      computeGridGlobalDimension(getDomains(), getAxis(), getScalars(), axis_domain_order); 
     245     this->solveDomainRef(areAttributesChecked);      
    247246     this->isDomainAxisChecked = areAttributesChecked; 
    248247   } 
     
    311310            {sendIndex(); this->isIndexSent = true;} 
    312311       } 
     312 
     313       // Not sure about this 
     314       //if (!(this->hasTransform() && !this->isTransformed())) 
     315       // this->isChecked = true; 
     316       //return; 
    313317     } 
    314318     
     
    409413      using namespace std; 
    410414      std::vector<CDomain*> domainP = this->getDomains(); 
    411       std::vector<CAxis*> axisP = this->getAxis();       
     415      std::vector<CAxis*> axisP = this->getAxis(); 
    412416      int dim = domainP.size() * 2 + axisP.size(); 
    413417 
     
    512516        { 
    513517          if (sendAtt) 
    514             axisListP[i]->sendCheckedAttributes(globalDim_,axisPositionInGrid_[i]); 
     518            axisListP[i]->sendCheckedAttributes(getGlobalDimension(),axisPositionInGrid_[i]); 
    515519          else 
    516520            axisListP[i]->checkAttributesOnClient(); 
     
    534538        } 
    535539      } 
     540   } 
     541   std::vector<int> CGrid::getAxisPositionInGrid() const 
     542   { 
     543     return axisPositionInGrid_; 
    536544   } 
    537545 
     
    652660              }               
    653661            } 
    654  
    655  
    656662          }           
    657663        } 
     
    695701       // Compute mapping between client and server 
    696702       std::vector<boost::unordered_map<size_t,std::vector<int> > > indexServerOnElement; 
    697        CServerDistributionDescription serverDistributionDescription(globalDim_, client->serverSize); 
     703       CServerDistributionDescription serverDistributionDescription(getGlobalDimension(), client->serverSize); 
    698704       serverDistributionDescription.computeServerGlobalByElement(indexServerOnElement, 
    699705                                                                  client->clientRank, 
     
    933939        } 
    934940      } 
    935      } 
     941    } 
    936942   } 
    937943   //---------------------------------------------------------------- 
     
    11221128   } 
    11231129 
     1130/* 
     1131   void CGrid::outputField(int rank, const CArray<double, 1>& stored, double* field) 
     1132   { 
     1133     const CArray<size_t,1>& out_i = outIndexFromClient[rank]; 
     1134     StdSize numElements = stored.numElements(); 
     1135     for (StdSize n = 0; n < numElements; ++n) 
     1136     { 
     1137       field[out_i(n)] = stored(n); 
     1138     } 
     1139   } 
     1140 
     1141   void CGrid::inputField(int rank, const double* const field, CArray<double,1>& stored) 
     1142   { 
     1143     const CArray<size_t,1>& out_i = outIndexFromClient[rank]; 
     1144     StdSize numElements = stored.numElements(); 
     1145     for (StdSize n = 0; n < numElements; ++n) 
     1146     { 
     1147       stored(n) = field[out_i(n)]; 
     1148     } 
     1149   } 
     1150 
     1151   void CGrid::outputCompressedField(int rank, const CArray<double,1>& stored, double* field) 
     1152   { 
     1153     const CArray<size_t,1>& out_i = compressedOutIndexFromClient[rank]; 
     1154     StdSize numElements = stored.numElements(); 
     1155     for (StdSize n = 0; n < numElements; ++n) 
     1156     { 
     1157       field[out_i(n)] = stored(n); 
     1158     } 
     1159   } 
     1160*/ 
     1161   //---------------------------------------------------------------- 
     1162 
    11241163   void CGrid::storeField_arr(const double* const data, CArray<double, 1>& stored) const 
    11251164   { 
     
    11701209  { 
    11711210    CContext* context = CContext::getCurrent(); 
    1172     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
    11731211    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 
    11741212    for (int p = 0; p < nbSrvPools; ++p) 
     
    15381576  } 
    15391577 
    1540   void CGrid::computeGridGlobalDimension(const std::vector<CDomain*>& domains, 
    1541                                          const std::vector<CAxis*>& axis, 
    1542                                          const std::vector<CScalar*>& scalars, 
    1543                                          const CArray<int,1>& axisDomainOrder) 
    1544   { 
    1545     globalDim_.resize(domains.size()*2+axis.size()+scalars.size()); 
     1578  /* 
     1579     Compute on the fly the global dimension of a grid with its elements 
     1580     \param[in/out] globalDim global dimension of grid 
     1581     \param[in] domains list of its domains 
     1582     \param[in] axiss list of its axis 
     1583     \param[in] scalars list of its scalars 
     1584     \param[in] axisDomainOrder the order of element in a grid (e.g: scalar then axis) 
     1585     \return The dimension of which we do distribution (often for server) 
     1586  */ 
     1587  int CGrid::computeGridGlobalDimension(std::vector<int>& globalDim, 
     1588                                        const std::vector<CDomain*> domains, 
     1589                                        const std::vector<CAxis*> axis, 
     1590                                        const std::vector<CScalar*> scalars, 
     1591                                        const CArray<int,1>& axisDomainOrder) 
     1592  { 
     1593    globalDim.resize(domains.size()*2+axis.size()+scalars.size()); 
     1594    int positionDimensionDistributed = 1; 
    15461595    int idx = 0, idxDomain = 0, idxAxis = 0, idxScalar = 0; 
    15471596    for (int i = 0; i < axisDomainOrder.numElements(); ++i) 
     
    15511600        if (!(domains[idxDomain]->type.isEmpty()) && (domains[idxDomain]->type==CDomain::type_attr::unstructured)) 
    15521601        { 
    1553           positionDimensionDistributed_ = idx; 
     1602          positionDimensionDistributed = idx; 
    15541603        } 
    15551604        else 
    15561605        { 
    1557           positionDimensionDistributed_ = idx +1; 
    1558         } 
    1559  
    1560         globalDim_[idx]   = domains[idxDomain]->ni_glo.getValue(); 
    1561         globalDim_[idx+1] = domains[idxDomain]->nj_glo.getValue(); 
     1606          positionDimensionDistributed = idx +1; 
     1607        } 
     1608 
     1609        globalDim[idx]   = domains[idxDomain]->ni_glo.getValue(); 
     1610        globalDim[idx+1] = domains[idxDomain]->nj_glo.getValue(); 
    15621611 
    15631612        ++idxDomain; 
     
    15661615      else if (1 == axisDomainOrder(i)) 
    15671616      { 
    1568         globalDim_[idx] = axis[idxAxis]->n_glo.getValue(); 
     1617        globalDim[idx] = axis[idxAxis]->n_glo.getValue(); 
    15691618        ++idxAxis; 
    15701619        ++idx; 
     
    15721621      else 
    15731622      { 
    1574         globalDim_[idx] = 1; 
     1623        globalDim[idx] = 1; 
    15751624        ++idxScalar; 
    15761625        ++idx; 
    15771626      } 
    15781627    } 
    1579   } 
    1580  
     1628 
     1629    return positionDimensionDistributed; 
     1630  } 
     1631 
     1632  // Retrieve the global dimension of grid 
    15811633  std::vector<int> CGrid::getGlobalDimension() 
    15821634  { 
    1583     return globalDim_; 
     1635    std::vector<int> globalDim; 
     1636    computeGridGlobalDimension(globalDim, getDomains(), getAxis(), getScalars(), axis_domain_order); 
     1637 
     1638    return globalDim; 
     1639  } 
     1640 
     1641  // Retrieve dimension on which we do distribution (Very often, it should be 2nd dimension) 
     1642  int CGrid::getDistributedDimension() 
     1643  { 
     1644    std::vector<int> globalDim; 
     1645    return computeGridGlobalDimension(globalDim, getDomains(), getAxis(), getScalars(), axis_domain_order);     
    15841646  } 
    15851647 
Note: See TracChangeset for help on using the changeset viewer.