Changeset 1078 for XIOS/trunk/src/node


Ignore:
Timestamp:
03/17/17 16:02:40 (7 years ago)
Author:
mhnguyen
Message:

Adding rectilinear and curvilinear domain for expand_domain transformation
-) Rectilinear/curvilinear is expanded not only locally but also globally, its global size ni_glo, nj_glo become ni_glo+2 and nj_glo+2
-) Two attributes i_periodic, j_periodic are only used for rectilinear/curvilinear to process priodic condition

+) Do some minor modification

Test
+) Add test_connectivity_expand
+) On Curie
+) Work (but need more real tests)

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

Legend:

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

    r1064 r1078  
    3131      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    3232      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 
    33       , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isCompressible_(false), isUnstructed_(false) 
     33      , hasBounds(false), hasArea(false), isDistributed_(false), isCompressible_(false), isUnstructed_(false) 
    3434      , isClientAfterTransformationChecked(false), hasLonLat(false) 
    3535      , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client() 
     
    4141      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    4242      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 
    43       , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isCompressible_(false), isUnstructed_(false) 
     43      , hasBounds(false), hasArea(false), isDistributed_(false), isCompressible_(false), isUnstructed_(false) 
    4444      , isClientAfterTransformationChecked(false), hasLonLat(false) 
    4545      , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client() 
     
    844844         for (int i = 0; i < ni; ++i) j_index(i+j*ni) = j+jbegin; 
    845845     } 
    846      computeNGlobDomain(); 
     846      
    847847     checkZoom(); 
    848848      
     
    15501550    int nbServer = client->serverSize; 
    15511551 
    1552     CServerDistributionDescription serverDescription(nGlobDomain_, nbServer); 
     1552    CServerDistributionDescription serverDescription(getNbGlob(), nbServer); 
    15531553    if (isUnstructed_) serverDescription.computeServerDistribution(false, 0); 
    15541554    else serverDescription.computeServerDistribution(false, 1); 
     
    15871587  } 
    15881588 
    1589   void CDomain::computeNGlobDomain() 
    1590   { 
    1591     nGlobDomain_.resize(2); 
    1592     nGlobDomain_[0] = ni_glo.getValue(); 
    1593     nGlobDomain_[1] = nj_glo.getValue(); 
     1589  std::vector<int> CDomain::getNbGlob() 
     1590  { 
     1591     std::vector<int> nbGlob(2); 
     1592     nbGlob[0] = ni_glo.getValue(); 
     1593     nbGlob[1] = nj_glo.getValue(); 
     1594 
     1595     return nbGlob; 
    15941596  } 
    15951597 
     
    16851687    size_t globalSizeIndex = 1, indexBegin, indexEnd; 
    16861688    int range, clientSize = client->clientSize; 
    1687     for (int i = 0; i < nGlobDomain_.size(); ++i) globalSizeIndex *= nGlobDomain_[i]; 
     1689    for (int i = 0; i < getNbGlob().size(); ++i) globalSizeIndex *= getNbGlob()[i]; 
    16881690    indexBegin = 0; 
    16891691    if (globalSizeIndex <= clientSize) 
     
    17041706    } 
    17051707 
    1706     CServerDistributionDescription serverDescription(nGlobDomain_, nbServer); 
     1708    CServerDistributionDescription serverDescription(getNbGlob(), nbServer); 
    17071709    if (isUnstructed_) serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 0); 
    17081710    else serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 1); 
  • XIOS/trunk/src/node/domain.hpp

    r1064 r1078  
    123123        vector< vector<int> > j_indSrv ; // for each server, j global index to send 
    124124 
     125         std::vector<int> getNbGlob(); 
    125126      public: 
    126127         /// Mutateur /// 
     
    210211         bool isCompressible_; 
    211212         bool isRedistributed_; 
    212          TransMapTypes transformationMap_; 
    213          std::vector<int> nGlobDomain_; 
     213         TransMapTypes transformationMap_;          
    214214         bool isUnstructed_; 
    215215        
  • XIOS/trunk/src/node/expand_domain.cpp

    r941 r1078  
    3838  void CExpandDomain::checkValid(CDomain* domainDst) 
    3939  { 
    40     if (CDomain::type_attr::unstructured != domainDst->type) 
    41     { 
    42       ERROR("CExpandDomain::checkValid(CDomain* domainDst)", 
    43             << "Domain extension is only supported for unstructured" << std::endl 
    44             << "Check type of domain destination, id = " << domainDst->getId()); 
    45     } 
     40    // if (CDomain::type_attr::unstructured != domainDst->type) 
     41    // { 
     42    //   ERROR("CExpandDomain::checkValid(CDomain* domainDst)", 
     43    //         << "Domain extension is only supported for unstructured" << std::endl 
     44    //         << "Check type of domain destination, id = " << domainDst->getId()); 
     45    // } 
    4646 
    4747    if (this->type.isEmpty()) this->type.setValue(CExpandDomain::type_attr::edge); 
  • XIOS/trunk/src/node/grid.cpp

    r1008 r1078  
    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   { 
     
    4949      , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 
    5050      , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    51       , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
     51      , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
    5252      , transformations_(0), isTransformed_(false) 
    53       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
     53      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    5454      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 
    5555   { 
     
    7474 
    7575 
    76    StdSize CGrid::getDimension(void) const 
    77    { 
    78       return globalDim_.size(); 
     76   StdSize CGrid::getDimension(void) 
     77   { 
     78      return getGlobalDimension().size(); 
    7979   } 
    8080 
     
    185185        for (int i = 0; i < axisListP.size(); ++i) 
    186186        { 
    187           axisListP[i]->checkAttributesOnClientAfterTransformation(globalDim_,axisPositionInGrid_[i]); 
     187          axisListP[i]->checkAttributesOnClientAfterTransformation(getGlobalDimension(),axisPositionInGrid_[i]); 
    188188        } 
    189189      } 
     
    232232     this->solveScalarRef(areAttributesChecked); 
    233233     this->solveAxisRef(areAttributesChecked); 
    234      this->solveDomainRef(areAttributesChecked); 
    235      computeGridGlobalDimension(getDomains(), getAxis(), getScalars(), axis_domain_order); 
     234     this->solveDomainRef(areAttributesChecked);      
    236235     this->isDomainAxisChecked = areAttributesChecked; 
    237236   } 
     
    463462        { 
    464463          if (sendAtt) 
    465             axisListP[i]->sendCheckedAttributes(globalDim_,axisPositionInGrid_[i]); 
     464            axisListP[i]->sendCheckedAttributes(getGlobalDimension(),axisPositionInGrid_[i]); 
    466465          else 
    467466            axisListP[i]->checkAttributesOnClient(); 
     
    533532     // Compute mapping between client and server 
    534533     std::vector<boost::unordered_map<size_t,std::vector<int> > > indexServerOnElement; 
    535      CServerDistributionDescription serverDistributionDescription(globalDim_, client->serverSize); 
     534     CServerDistributionDescription serverDistributionDescription(getGlobalDimension(), client->serverSize); 
    536535     serverDistributionDescription.computeServerGlobalByElement(indexServerOnElement, 
    537536                                                                client->clientRank, 
    538537                                                                client->clientSize, 
    539538                                                                axis_domain_order, 
    540                                                                 positionDimensionDistributed_); 
     539                                                                getDistributedDimension()); 
    541540     computeIndexByElement(indexServerOnElement, globalIndexOnServer_); 
    542541 
     
    13231322  } 
    13241323 
    1325   void CGrid::computeGridGlobalDimension(const std::vector<CDomain*>& domains, 
    1326                                          const std::vector<CAxis*>& axis, 
    1327                                          const std::vector<CScalar*>& scalars, 
    1328                                          const CArray<int,1>& axisDomainOrder) 
    1329   { 
    1330     globalDim_.resize(domains.size()*2+axis.size()+scalars.size()); 
     1324  /* 
     1325     Compute on the fly the global dimension of a grid with its elements 
     1326     \param[in/out] globalDim global dimension of grid 
     1327     \param[in] domains list of its domains 
     1328     \param[in] axiss list of its axis 
     1329     \param[in] scalars list of its scalars 
     1330     \param[in] axisDomainOrder the order of element in a grid (e.g: scalar then axis) 
     1331     \return The dimension of which we do distribution (often for server) 
     1332  */ 
     1333  int CGrid::computeGridGlobalDimension(std::vector<int>& globalDim, 
     1334                                        const std::vector<CDomain*> domains, 
     1335                                        const std::vector<CAxis*> axis, 
     1336                                        const std::vector<CScalar*> scalars, 
     1337                                        const CArray<int,1>& axisDomainOrder) 
     1338  { 
     1339    globalDim.resize(domains.size()*2+axis.size()+scalars.size()); 
     1340    int positionDimensionDistributed = 1; 
    13311341    int idx = 0, idxDomain = 0, idxAxis = 0, idxScalar = 0; 
    13321342    for (int i = 0; i < axisDomainOrder.numElements(); ++i) 
     
    13361346        if (!(domains[idxDomain]->type.isEmpty()) && (domains[idxDomain]->type==CDomain::type_attr::unstructured)) 
    13371347        { 
    1338           positionDimensionDistributed_ = idx; 
     1348          positionDimensionDistributed = idx; 
    13391349        } 
    13401350        else 
    13411351        { 
    1342           positionDimensionDistributed_ = idx +1; 
    1343         } 
    1344  
    1345         globalDim_[idx]   = domains[idxDomain]->ni_glo.getValue(); 
    1346         globalDim_[idx+1] = domains[idxDomain]->nj_glo.getValue(); 
     1352          positionDimensionDistributed = idx +1; 
     1353        } 
     1354 
     1355        globalDim[idx]   = domains[idxDomain]->ni_glo.getValue(); 
     1356        globalDim[idx+1] = domains[idxDomain]->nj_glo.getValue(); 
    13471357 
    13481358        ++idxDomain; 
     
    13511361      else if (1 == axisDomainOrder(i)) 
    13521362      { 
    1353         globalDim_[idx] = axis[idxAxis]->n_glo.getValue(); 
     1363        globalDim[idx] = axis[idxAxis]->n_glo.getValue(); 
    13541364        ++idxAxis; 
    13551365        ++idx; 
     
    13571367      else 
    13581368      { 
    1359         globalDim_[idx] = 1; 
     1369        globalDim[idx] = 1; 
    13601370        ++idxScalar; 
    13611371        ++idx; 
    13621372      } 
    13631373    } 
    1364   } 
    1365  
     1374 
     1375    return positionDimensionDistributed; 
     1376  } 
     1377 
     1378  // Retrieve the global dimension of grid 
    13661379  std::vector<int> CGrid::getGlobalDimension() 
    13671380  { 
    1368     return globalDim_; 
     1381    std::vector<int> globalDim; 
     1382    computeGridGlobalDimension(globalDim, getDomains(), getAxis(), getScalars(), axis_domain_order); 
     1383 
     1384    return globalDim; 
     1385  } 
     1386 
     1387  // Retrieve dimension on which we do distribution (Very often, it should be 2nd dimension) 
     1388  int CGrid::getDistributedDimension() 
     1389  { 
     1390    std::vector<int> globalDim; 
     1391    return computeGridGlobalDimension(globalDim, getDomains(), getAxis(), getScalars(), axis_domain_order);     
    13691392  } 
    13701393 
  • XIOS/trunk/src/node/grid.hpp

    r988 r1078  
    8787 
    8888         /// Accesseurs /// 
    89          StdSize getDimension(void) const; 
     89         StdSize getDimension(void); 
    9090 
    9191         StdSize  getDataSize(void) const; 
     
    229229         void modifyMask(const CArray<int,1>& indexToModify); 
    230230 
    231          void computeGridGlobalDimension(const std::vector<CDomain*>& domains, 
    232                                          const std::vector<CAxis*>& axis, 
    233                                          const std::vector<CScalar*>& scalars, 
    234                                          const CArray<int,1>& axisDomainOrder); 
    235  
    236231      private: 
    237232       template<int N> 
     
    261256                                   CClientServerMapping::GlobalIndexMap& globalIndexOnServer); 
    262257 
     258        int computeGridGlobalDimension(std::vector<int>& globalDim, 
     259                                       const std::vector<CDomain*> domains, 
     260                                       const std::vector<CAxis*> axis, 
     261                                       const std::vector<CScalar*> scalars, 
     262                                       const CArray<int,1>& axisDomainOrder); 
     263 
     264        int getDistributedDimension(); 
    263265      private: 
    264266        CDomainGroup* vDomainGroup_; 
     
    276278        std::vector<int> connectedServerRank_; 
    277279        bool isDataDistributed_; 
    278         int positionDimensionDistributed_; 
     280         
    279281         //! True if and only if the data defined on the grid can be outputted in a compressed way 
    280282        bool isCompressible_; 
     
    285287        std::vector<int> axisPositionInGrid_; 
    286288        CGridTransformation* transformations_; 
    287         bool hasDomainAxisBaseRef_; 
    288         std::vector<int> globalDim_; 
     289        bool hasDomainAxisBaseRef_;         
    289290        std::map<CGrid*, std::pair<bool,StdString> > gridSrc_; 
    290291        bool hasTransform_; 
Note: See TracChangeset for help on using the changeset viewer.