Changeset 1158 for XIOS/dev/dev_olga/src/node/grid.cpp
- Timestamp:
- 06/06/17 17:58:16 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/grid.cpp
r1144 r1158 31 31 , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 32 32 , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 33 , globalDim_(),connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false)33 , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 34 34 , transformations_(0), isTransformed_(false) 35 , axisPositionInGrid_(), positionDimensionDistributed_(1),hasDomainAxisBaseRef_(false)35 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 36 36 , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 37 37 , computedWrittenIndex_(false) … … 50 50 , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 51 51 , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 52 , globalDim_(),connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false)52 , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 53 53 , transformations_(0), isTransformed_(false) 54 , axisPositionInGrid_(), positionDimensionDistributed_(1),hasDomainAxisBaseRef_(false)54 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 55 55 , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 56 56 , computedWrittenIndex_(false) … … 76 76 77 77 78 StdSize CGrid::getDimension(void) const79 { 80 return g lobalDim_.size();78 StdSize CGrid::getDimension(void) 79 { 80 return getGlobalDimension().size(); 81 81 } 82 82 … … 196 196 for (int i = 0; i < axisListP.size(); ++i) 197 197 { 198 axisListP[i]->checkAttributesOnClientAfterTransformation(g lobalDim_,axisPositionInGrid_[i]);198 axisListP[i]->checkAttributesOnClientAfterTransformation(getGlobalDimension(),axisPositionInGrid_[i]); 199 199 } 200 200 } … … 243 243 this->solveScalarRef(areAttributesChecked); 244 244 this->solveAxisRef(areAttributesChecked); 245 this->solveDomainRef(areAttributesChecked); 246 computeGridGlobalDimension(getDomains(), getAxis(), getScalars(), axis_domain_order); 245 this->solveDomainRef(areAttributesChecked); 247 246 this->isDomainAxisChecked = areAttributesChecked; 248 247 } … … 311 310 {sendIndex(); this->isIndexSent = true;} 312 311 } 312 313 // Not sure about this 314 //if (!(this->hasTransform() && !this->isTransformed())) 315 // this->isChecked = true; 316 //return; 313 317 } 314 318 … … 409 413 using namespace std; 410 414 std::vector<CDomain*> domainP = this->getDomains(); 411 std::vector<CAxis*> axisP = this->getAxis(); 415 std::vector<CAxis*> axisP = this->getAxis(); 412 416 int dim = domainP.size() * 2 + axisP.size(); 413 417 … … 512 516 { 513 517 if (sendAtt) 514 axisListP[i]->sendCheckedAttributes(g lobalDim_,axisPositionInGrid_[i]);518 axisListP[i]->sendCheckedAttributes(getGlobalDimension(),axisPositionInGrid_[i]); 515 519 else 516 520 axisListP[i]->checkAttributesOnClient(); … … 534 538 } 535 539 } 540 } 541 std::vector<int> CGrid::getAxisPositionInGrid() const 542 { 543 return axisPositionInGrid_; 536 544 } 537 545 … … 652 660 } 653 661 } 654 655 656 662 } 657 663 } … … 695 701 // Compute mapping between client and server 696 702 std::vector<boost::unordered_map<size_t,std::vector<int> > > indexServerOnElement; 697 CServerDistributionDescription serverDistributionDescription(g lobalDim_, client->serverSize);703 CServerDistributionDescription serverDistributionDescription(getGlobalDimension(), client->serverSize); 698 704 serverDistributionDescription.computeServerGlobalByElement(indexServerOnElement, 699 705 client->clientRank, … … 933 939 } 934 940 } 935 941 } 936 942 } 937 943 //---------------------------------------------------------------- … … 1122 1128 } 1123 1129 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 1124 1163 void CGrid::storeField_arr(const double* const data, CArray<double, 1>& stored) const 1125 1164 { … … 1170 1209 { 1171 1210 CContext* context = CContext::getCurrent(); 1172 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1;1173 1211 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1; 1174 1212 for (int p = 0; p < nbSrvPools; ++p) … … 1538 1576 } 1539 1577 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; 1546 1595 int idx = 0, idxDomain = 0, idxAxis = 0, idxScalar = 0; 1547 1596 for (int i = 0; i < axisDomainOrder.numElements(); ++i) … … 1551 1600 if (!(domains[idxDomain]->type.isEmpty()) && (domains[idxDomain]->type==CDomain::type_attr::unstructured)) 1552 1601 { 1553 positionDimensionDistributed _= idx;1602 positionDimensionDistributed = idx; 1554 1603 } 1555 1604 else 1556 1605 { 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(); 1562 1611 1563 1612 ++idxDomain; … … 1566 1615 else if (1 == axisDomainOrder(i)) 1567 1616 { 1568 globalDim _[idx] = axis[idxAxis]->n_glo.getValue();1617 globalDim[idx] = axis[idxAxis]->n_glo.getValue(); 1569 1618 ++idxAxis; 1570 1619 ++idx; … … 1572 1621 else 1573 1622 { 1574 globalDim _[idx] = 1;1623 globalDim[idx] = 1; 1575 1624 ++idxScalar; 1576 1625 ++idx; 1577 1626 } 1578 1627 } 1579 } 1580 1628 1629 return positionDimensionDistributed; 1630 } 1631 1632 // Retrieve the global dimension of grid 1581 1633 std::vector<int> CGrid::getGlobalDimension() 1582 1634 { 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); 1584 1646 } 1585 1647
Note: See TracChangeset
for help on using the changeset viewer.