Ignore:
Timestamp:
07/28/15 13:37:07 (9 years ago)
Author:
mhnguyen
Message:

Making changes in domain to make sure unstructed grid work with new method of index distribution

+) Change the way define i_index and j_index of a domain
+) Remove some redundant attributes of domain
+) Adjust the way to calculate index distribution on server side

Test
+) Make some minor change to test_unstruct_complete to work with new XIOS
+) On Curie
+) All test pass and correct

File:
1 edited

Legend:

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

    r656 r657  
    1313#include "context_server.hpp" 
    1414#include "array_new.hpp" 
     15#include "server_distribution_description.hpp" 
    1516#include "client_server_mapping_distributed.hpp" 
    1617 
     
    2324      , isChecked(false), isDomainAxisChecked(false) 
    2425      , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 
    25       , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_() 
     26      , serverDistribution_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_() 
    2627      , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), transformations_(0), isTransformed_(false) 
    27       , axisPositionInGrid_() 
     28      , axisPositionInGrid_(), positionDimensionDistributed_(1) 
    2829   { 
    2930     setVirtualDomainGroup(); 
     
    3536      , isChecked(false), isDomainAxisChecked(false) 
    3637      , vDomainGroup_(), vAxisGroup_(), axisList_(), isAxisListSet(false), isDomListSet(false), clientDistribution_(0), isIndexSent(false) 
    37       , serverDistribution_(0), serverDistributionDescription_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_() 
     38      , serverDistribution_(0), clientServerMap_(0), writtenDataSize_(0), globalDim_() 
    3839      , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), transformations_(0), isTransformed_(false) 
    39       , axisPositionInGrid_() 
     40      , axisPositionInGrid_(), positionDimensionDistributed_(1) 
    4041   { 
    4142     setVirtualDomainGroup(); 
     
    4748    if (0 != clientDistribution_) delete clientDistribution_; 
    4849    if (0 != serverDistribution_) delete serverDistribution_; 
    49     if (0 != serverDistributionDescription_) delete serverDistributionDescription_; 
    5050    if (0 != clientServerMap_) delete clientServerMap_; 
    5151    if (0 != transformations_) delete transformations_; 
     
    5858   ENodeType CGrid::GetType(void)    { return eGrid; } 
    5959 
    60    //--------------------------------------------------------------- 
    6160 
    6261   StdSize CGrid::getDimension(void) const 
     
    112111     } 
    113112 
     113     // In some cases in which domain is masked, we need to count for connected server for longitude and latitude 
     114     std::vector<CDomain*> domListP = this->getDomains(); 
     115     if (!domListP.empty()) 
     116     { 
     117       for (int i = 0; i < domListP.size(); ++i) 
     118       { 
     119         const std::map<int, vector<size_t> >& indexDomainServer = domListP[i]->getIndexServer(); 
     120         std::map<int, vector<size_t> >::const_iterator itDom = indexDomainServer.begin(), iteDom = indexDomainServer.end(); 
     121         for (; itDom != iteDom; ++itDom) 
     122         { 
     123           if (ret.end() == ret.find(itDom->first)) 
     124           { 
     125              retVal = (itDom->second).size(); 
     126              retVal *= secureFactor; 
     127              ret.insert(std::make_pair<int,StdSize>(itDom->first, retVal)); 
     128           } 
     129         } 
     130       } 
     131     } 
     132 
    114133     return ret; 
    115134   } 
    116135 
     136   void CGrid::checkAttributesAfterTransformation() 
     137   { 
     138     setDomainList(); 
     139     std::vector<CDomain*> domListP = this->getDomains(); 
     140     if (!domListP.empty()) 
     141     { 
     142       for (int i = 0; i < domListP.size(); ++i) 
     143       { 
     144         domListP[i]->checkAttributesOnClientAfterTransformation(); 
     145       } 
     146     } 
     147   } 
    117148 
    118149   void CGrid::solveDomainAxisRef(bool areAttributesChecked) 
     
    122153     this->solveAxisRef(areAttributesChecked); 
    123154     this->solveDomainRef(areAttributesChecked); 
    124  
     155     computeGridGlobalDimension(getDomains(), getAxis(), axis_domain_order); 
    125156     this->isDomainAxisChecked = areAttributesChecked; 
    126157   } 
     
    153184     if (context->hasClient) 
    154185     { 
    155         checkMask(); 
     186        this->checkAttributesAfterTransformation(); 
     187        this->checkMask(); 
    156188        this->computeIndex(); 
    157189     } 
     
    229261      if (!domListP.empty()) 
    230262      { 
    231         computeGridGlobalDimension(getDomains(), getAxis(), axis_domain_order); 
    232263        for (int i = 0; i < domListP.size(); ++i) 
    233264        { 
     
    258289        } 
    259290 
    260         computeGridGlobalDimension(getDomains(), getAxis(), axis_domain_order); 
    261291        for (int i = 0; i < axisListP.size(); ++i) 
    262292        { 
     
    267297          ++idx; 
    268298        } 
    269  
    270299      } 
    271300   } 
     
    275304     return axisPositionInGrid_; 
    276305   } 
    277  
    278306 
    279307   //--------------------------------------------------------------- 
     
    317345 
    318346     // Then compute distribution on server side 
    319      serverDistributionDescription_ = new CServerDistributionDescription(clientDistribution_->getNGlob()); 
    320      serverDistributionDescription_->computeServerDistribution(client->serverSize, true); 
    321      serverDistributionDescription_->computeServerGlobalIndexInRange(client->serverSize, 
    322                                                                      std::make_pair<size_t,size_t>(indexBegin, indexEnd)); 
     347     CServerDistributionDescription serverDistributionDescription(globalDim_); 
     348     serverDistributionDescription.computeServerGlobalIndexInRange(client->serverSize, 
     349                                                                   std::make_pair<size_t,size_t>(indexBegin, indexEnd), 
     350                                                                   positionDimensionDistributed_); 
    323351 
    324352     // Finally, compute index mapping between client(s) and server(s) 
    325      clientServerMap_ = new CClientServerMappingDistributed(serverDistributionDescription_->getGlobalIndexRange(), 
     353     clientServerMap_ = new CClientServerMappingDistributed(serverDistributionDescription.getGlobalIndexRange(), 
    326354                                                            client->intraComm, 
    327355                                                            clientDistribution_->isDataDistributed()); 
     
    330358     const std::map<int, std::vector<size_t> >& globalIndexOnServer = clientServerMap_->getGlobalIndexOnServer(); 
    331359     const CArray<size_t,1>& globalIndexSendToServer = clientDistribution_->getGlobalDataIndexSendToServer(); 
    332  
    333360     std::map<int, std::vector<size_t> >::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap; 
    334361     itbGlobalMap = itGlobalMap = globalIndexOnServer.begin(); 
     
    640667      if (axisDomainOrder(i)) 
    641668      { 
     669        if (!(domains[idxDomain]->type.isEmpty()) && (domains[idxDomain]->type==CDomain::type_attr::unstructured)) 
     670        { 
     671          positionDimensionDistributed_ = idx; 
     672        } 
     673        else 
     674        { 
     675          positionDimensionDistributed_ = idx +1; 
     676        } 
     677 
    642678        globalDim_[idx]   = domains[idxDomain]->ni_glo.getValue(); 
    643679        globalDim_[idx+1] = domains[idxDomain]->nj_glo.getValue(); 
     680 
    644681        ++idxDomain; 
    645682        idx += 2; 
Note: See TracChangeset for help on using the changeset viewer.