Changeset 1144 for XIOS/dev/dev_olga/src
- Timestamp:
- 05/23/17 16:32:26 (7 years ago)
- Location:
- XIOS/dev/dev_olga/src
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/distribution_client.cpp
r1129 r1144 10 10 11 11 namespace xios { 12 13 CDistributionClient::CDistributionClient(int rank, CGrid* grid, const GlobalLocalDataMap& globalLocalIndex)14 : CDistribution(rank, 0)15 , axisDomainOrder_()16 , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_()17 , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_()18 , gridMask_(), indexMap_()19 , isDataDistributed_(true), axisNum_(0), domainNum_(0)20 , localDataIndex_(), localMaskIndex_()21 , globalLocalDataSendToServerMap_(globalLocalIndex)22 , infoIndex_(), isComputed_(false)23 , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_()24 , elementZoomMask_(), elementNLocal_(), elementNGlobal_()25 {26 isComputed_ = true;27 localDataIndex_.resize(globalLocalIndex.size());28 localMaskIndex_.resize(globalLocalIndex.size());29 GlobalLocalDataMap::const_iterator it = globalLocalIndex.begin(), ite = globalLocalIndex.end();30 int idx = 0;31 for (; it!=ite; ++it)32 {33 localMaskIndex_[idx] = localDataIndex_[idx] = it->second;34 ++idx;35 }36 37 std::vector<CDomain*> domList = grid->getDomains();38 std::vector<CAxis*> axisList = grid->getAxis();39 std::vector<CScalar*> scalarList = grid->getScalars();40 CArray<int,1> axisDomainOrder = grid->axis_domain_order;41 42 int numElement = axisDomainOrder.numElements();43 // Because domain and axis can be in any order (axis1, domain1, axis2, axis3, )44 // their position should be specified. In axisDomainOrder, domain == true, axis == false45 int dims = numElement;46 idx = 0;47 std::vector<int> indexMap(numElement);48 for (int i = 0; i < numElement; ++i)49 {50 indexMap[i] = idx;51 if (2 == axisDomainOrder(i))52 {53 ++dims;54 idx += 2;55 }56 else ++idx;57 }58 59 nGlob_.resize(dims);60 61 // Data_n_index of domain or axis (For now, axis uses its size as data_n_index62 dataNIndex_.resize(numElement);63 dataDims_.resize(numElement);64 isDataDistributed_ = false;65 int domIndex = 0, axisIndex = 0, scalarIndex = 0;66 for (idx = 0; idx < numElement; ++idx)67 {68 int eleDim = axisDomainOrder(idx);69 70 // If this is a domain71 if (2 == eleDim)72 {73 // On the j axis74 nGlob_.at(indexMap[idx]+1) = domList[domIndex]->nj_glo.getValue();75 nGlob_.at(indexMap[idx]) = domList[domIndex]->ni_glo.getValue();76 dataNIndex_.at(idx) = domList[domIndex]->data_i_index.numElements();77 dataDims_.at(idx) = domList[domIndex]->data_dim.getValue();78 79 isDataDistributed_ |= domList[domIndex]->isDistributed();80 ++domIndex;81 }82 else if (1 == eleDim)// So it's an axis83 {84 nGlob_.at(indexMap[idx]) = axisList[axisIndex]->n_glo.getValue();85 dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements();86 dataDims_.at(idx) = 1;87 88 isDataDistributed_ |= axisList[axisIndex]->isDistributed();89 ++axisIndex;90 }91 else // scalar92 {93 nGlob_.at(indexMap[idx]) = 1;94 dataNIndex_.at(idx) = 1;95 dataDims_.at(idx) = 1;96 97 isDataDistributed_ |= false;98 ++scalarIndex;99 }100 }101 102 }103 104 CDistributionClient::CDistributionClient(int rank, int dims, const CArray<size_t,1>& globalIndex)105 : CDistribution(rank, dims, globalIndex)106 , axisDomainOrder_()107 , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_()108 , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_()109 , gridMask_(), indexMap_()110 , isDataDistributed_(true), axisNum_(0), domainNum_(0)111 , localDataIndex_(), localMaskIndex_()112 , globalLocalDataSendToServerMap_()113 , infoIndex_(), isComputed_(false)114 , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_()115 , elementZoomMask_(), elementNLocal_(), elementNGlobal_()116 {117 }118 12 119 13 CDistributionClient::CDistributionClient(int rank, CGrid* grid) -
XIOS/dev/dev_olga/src/distribution_client.hpp
r1129 r1144 33 33 34 34 public: 35 /** Default constructor */ 36 CDistributionClient(int rank, CGrid* grid, const GlobalLocalDataMap& globalLocalIndex); 37 CDistributionClient(int rank, int dims, const CArray<size_t,1>& globalIndex = CArray<size_t,1>()); 35 /** Default constructor */ 38 36 CDistributionClient(int rank, CGrid* grid); 39 37 -
XIOS/dev/dev_olga/src/distribution_server.cpp
r1129 r1144 12 12 namespace xios { 13 13 14 CDistributionServer::CDistributionServer(int rank, int dims, const CArray<size_t,1>& globalIndex)15 : CDistribution(rank, dims, globalIndex), nGlobal_(), nZoomSize_(), nZoomBegin_(), globalLocalIndexMap_(),16 globalIndexEachDimension_()17 {18 }19 20 CDistributionServer::CDistributionServer(int rank, const std::vector<int>& nZoomBegin,21 const std::vector<int>& nZoomSize, const std::vector<int>& nGlobal)22 : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nZoomSize_(nZoomSize), nZoomBegin_(nZoomBegin), globalLocalIndexMap_(),23 globalIndexEachDimension_()24 {25 createGlobalIndex();26 }27 28 14 CDistributionServer::CDistributionServer(int rank, const std::vector<int>& nZoomBegin, 29 15 const std::vector<int>& nZoomSize, … … 31 17 const std::vector<int>& nGlobal) 32 18 : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nZoomBeginGlobal_(nZoomBeginGlobal), 33 nZoomSize_(nZoomSize), nZoomBegin_(nZoomBegin), globalLocalIndexMap_(), 34 globalIndexEachDimension_() 19 nZoomSize_(nZoomSize), nZoomBegin_(nZoomBegin), globalLocalIndexMap_() 35 20 { 36 21 createGlobalIndex(); 37 22 } 38 39 // CDistributionServer::CDistributionServer(int rank,40 // const std::vector<CArray<int,1> >& globalIndexEachDimension,41 // const std::vector<int>& nGlobal)42 // : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nZoomBeginGlobal_(),43 // nZoomSize_(), nZoomBegin_(), globalLocalIndexMap_(),44 // globalIndexEachDimension_(globalIndexEachDimension)45 // {46 // createGlobalIndexFromIndex(globalIndexEachDimension, nGlobal);47 // }48 23 49 24 CDistributionServer::~CDistributionServer() … … 99 74 idxLoop[0] += innerLoopSize; 100 75 } 101 }102 103 // void CDistributionServer::createGlobalIndexFromIndex(const std::vector<CArray<int,1> >& globalIndexOnEachDimension,104 // const std::vector<int>& nbGlobal)105 // {106 // size_t idx = 0, ssize = 1;107 // for (int i = 0; i < globalIndexOnEachDimension.size(); ++i) ssize *= globalIndexOnEachDimension[i].numElements();108 109 // this->globalIndex_.resize(ssize);110 // size_t nbDim = nbGlobal.size();111 // std::vector<int> idxLoop(nbDim,0);112 // std::vector<int> currentIndex(nbDim);113 // int innerLoopSize = globalIndexOnEachDimension[0].numElements();114 115 // globalLocalIndexMap_.rehash(std::ceil(ssize/globalLocalIndexMap_.max_load_factor()));116 // while (idx<ssize)117 // {118 // for (int i = 0; i < nbDim-1; ++i)119 // {120 // if (idxLoop[i] == globalIndexOnEachDimension[i].numElements())121 // {122 // idxLoop[i] = 0;123 // ++idxLoop[i+1];124 // }125 // }126 127 // for (int i = 1; i < nbDim; ++i)128 // currentIndex[i] = globalIndexOnEachDimension[i](idxLoop[i]);129 130 // size_t mulDim, globalIndex;131 // for (int i = 0; i < innerLoopSize; ++i)132 // {133 // mulDim = 1;134 // globalIndex = globalIndexOnEachDimension[0](i);135 136 // for (int k = 0; k < nbDim; ++k)137 // {138 // mulDim *= nbGlobal[k];139 // globalIndex += (currentIndex[k])*mulDim;140 // }141 // globalLocalIndexMap_[globalIndex] = idx;142 // this->globalIndex_(idx) = globalIndex;143 144 // ++idx;145 // }146 // idxLoop[0] += innerLoopSize;147 // }148 149 // }150 151 /*!152 Compute local index for writing data on server153 \param [in] globalIndex global index received from client154 \return local index of written data155 */156 CArray<size_t,1> CDistributionServer::computeLocalIndex(const CArray<size_t,1>& globalIndex)157 {158 size_t ssize = globalIndex.numElements();159 size_t localIndexSize = std::min(globalIndex_.numElements(), ssize);160 CArray<size_t,1> localIndex(localIndexSize);161 GlobalLocalMap::const_iterator ite = globalLocalIndexMap_.end(), it;162 for (int idx = 0, i = 0; idx < ssize; ++idx)163 {164 it = globalLocalIndexMap_.find(globalIndex(idx));165 if (ite != it)166 {167 localIndex(idx) = it->second;168 ++i;169 }170 }171 172 return localIndex;173 76 } 174 77 -
XIOS/dev/dev_olga/src/distribution_server.hpp
r1099 r1144 23 23 public: 24 24 /** Default constructor */ 25 CDistributionServer(int rank, int dims, const CArray<size_t,1>& globalIndex = CArray<size_t,1>());26 CDistributionServer(int rank, const std::vector<int>& nZoomBeginServer,27 const std::vector<int>& nZoomSizeServer, const std::vector<int>& nGlobal);28 25 CDistributionServer(int rank, const std::vector<int>& nZoomBeginServer, 29 26 const std::vector<int>& nZoomSizeServer, 30 27 const std::vector<int>& nZoomBeginGlobal, 31 const std::vector<int>& nGlobal);32 CDistributionServer(int rank,33 const std::vector<CArray<int,1> >& globalIndexEachDimension,34 28 const std::vector<int>& nGlobal); 35 29 … … 40 34 const std::vector<int>& getZoomBeginServer() const; 41 35 const std::vector<int>& getZoomSizeServer() const; 42 const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; } 43 const std::vector<CArray<int,1> >& getGlobalIndexEachDimension() const {return globalIndexEachDimension_;} 36 const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; } 44 37 int getGridSize() const; 45 46 virtual CArray<size_t,1> computeLocalIndex(const CArray<size_t,1>& globalIndex); 38 47 39 virtual void computeLocalIndex(CArray<size_t,1>& globalIndex); 48 40 virtual void computeGlobalIndex(CArray<int,1>& indexes) const; … … 62 54 std::vector<int> nZoomSize_; 63 55 std::vector<int> nZoomBegin_; 64 std::vector<CArray<int, 1> > globalIndexEachDimension_;65 66 56 }; 67 57 -
XIOS/dev/dev_olga/src/io/nc4_data_output.cpp
r1143 r1144 1378 1378 if (i != 0) compress << ' '; 1379 1379 } 1380 SuperClassWriter::addAttribute("compress", compress.str(), &varId); 1381 1382 // grid->computeCompressedIndex(); 1380 SuperClassWriter::addAttribute("compress", compress.str(), &varId); 1383 1381 1384 1382 CArray<int, 1> indexes(grid->getNumberWrittenIndexes()); 1385 1383 indexes = grid->localIndexToWriteOnServer; 1386 // std::map<int, CArray<size_t, 1> >::const_iterator it;1387 // for (it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it)1388 // {1389 // const CArray<size_t, 1> compressedIndexes = grid->compressedOutIndexFromClient[it->first];1390 // for (int i = 0; i < it->second.numElements(); i++)1391 // indexes(compressedIndexes(i)) = it->second(i);1392 // }1393 1384 1394 1385 switch (SuperClass::type) … … 1447 1438 } 1448 1439 1449 // const std::vector<int>& indexesToWrite = domain->getIndexesToWrite();1450 // indexes.resize(indexesToWrite.size());1451 // for (int n = 0; n < indexes.numElements(); ++n)1452 // indexes(n) = indexesToWrite[n];1453 1454 1440 indexes.resize(domain->compressedIndexToWriteOnServer.numElements()); 1455 1441 indexes = domain->compressedIndexToWriteOnServer; … … 1478 1464 compress = axisId; 1479 1465 1480 // const std::vector<int>& indexesToWrite = axis->getIndexesToWrite();1481 // indexes.resize(indexesToWrite.size());1482 // for (int n = 0; n < indexes.numElements(); ++n)1483 // indexes(n) = indexesToWrite[n];1484 1485 1466 indexes.resize(axis->compressedIndexToWriteOnServer.numElements()); 1486 1467 indexes = axis->compressedIndexToWriteOnServer; … … 1529 1510 } 1530 1511 } 1531 } 1532 1533 // if (!dims.empty()) 1534 // grid->computeCompressedIndex(); 1512 } 1535 1513 } 1536 1514 -
XIOS/dev/dev_olga/src/node/axis.cpp
r1143 r1144 58 58 59 59 ///--------------------------------------------------------------- 60 61 const std::set<StdString> & CAxis::getRelFiles(void) const62 {63 return (this->relFiles);64 }65 66 60 bool CAxis::IsWritten(const StdString & filename) const 67 61 { … … 101 95 102 96 //---------------------------------------------------------------- 103 104 const std::vector<int>& CAxis::getIndexesToWrite(void) const105 {106 return indexesToWrite;107 }108 97 109 98 /*! … … 207 196 } 208 197 209 void CAxis::fillInValues(const CArray<double,1>& values) 210 { 211 this->value = values; 212 } 213 198 /*! 199 Check common attributes of an axis. 200 This check should be done in the very beginning of work flow 201 */ 214 202 void CAxis::checkAttributes(void) 215 203 { … … 270 258 } 271 259 260 /*! 261 Check the validity of data and fill in values if any. 262 */ 272 263 void CAxis::checkData() 273 264 { … … 292 283 } 293 284 285 /*! 286 Check validity of zoom info and fill in values if any. 287 */ 294 288 void CAxis::checkZoom(void) 295 289 { … … 304 298 } 305 299 300 /*! 301 Check validity of mask info and fill in values if any. 302 */ 306 303 void CAxis::checkMask() 307 304 { … … 325 322 } 326 323 327 void CAxis::checkBounds() 328 { 329 if (!bounds.isEmpty()) 330 { 331 if (bounds.extent(0) != 2 || bounds.extent(1) != n) 332 ERROR("CAxis::checkAttributes(void)", 333 << "The bounds array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension 2 x axis size." << std::endl 334 << "Axis size is " << n.getValue() << "." << std::endl 335 << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1) << "."); 336 hasBounds_ = true; 337 } 338 else hasBounds_ = false; 339 } 340 341 void CAxis::checkEligibilityForCompressedOutput() 342 { 343 // We don't check if the mask is valid here, just if a mask has been defined at this point. 344 isCompressible_ = !mask.isEmpty(); 345 } 346 347 bool CAxis::dispatchEvent(CEventServer& event) 324 /*! 325 Check validity of bounds info and fill in values if any. 326 */ 327 void CAxis::checkBounds() 328 { 329 if (!bounds.isEmpty()) 330 { 331 if (bounds.extent(0) != 2 || bounds.extent(1) != n) 332 ERROR("CAxis::checkAttributes(void)", 333 << "The bounds array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension 2 x axis size." << std::endl 334 << "Axis size is " << n.getValue() << "." << std::endl 335 << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1) << "."); 336 hasBounds_ = true; 337 } 338 else hasBounds_ = false; 339 } 340 341 void CAxis::checkEligibilityForCompressedOutput() 342 { 343 // We don't check if the mask is valid here, just if a mask has been defined at this point. 344 isCompressible_ = !mask.isEmpty(); 345 } 346 347 bool CAxis::dispatchEvent(CEventServer& event) 348 348 { 349 349 if (SuperClass::dispatchEvent(event)) return true; … … 356 356 return true; 357 357 break; 358 // case EVENT_ID_INDEX:359 // recvIndex(event);360 // return true;361 // break;362 358 case EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES: 363 359 recvNonDistributedAttributes(event); … … 376 372 } 377 373 374 /*! 375 Check attributes on client side (This name is still adequate???) 376 */ 378 377 void CAxis::checkAttributesOnClient() 379 378 { … … 385 384 } 386 385 386 /* 387 The (spatial) transformation sometimes can change attributes of an axis. Therefore, we should recheck them. 388 */ 387 389 void CAxis::checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid, 388 390 CServerDistributionDescription::ServerDistributionType distType) … … 413 415 } 414 416 417 /*! 418 Send attributes from one client to other clients 419 \param[in] globalDim global dimension of grid which contains this axis 420 \param[in] order 421 */ 415 422 void CAxis::sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 416 423 CServerDistributionDescription::ServerDistributionType distType) … … 561 568 indSrv_.swap(globalIndexAxisOnServer); 562 569 563 // CClientServerMapping::GlobalIndexMap::const_iterator it = globalIndexAxisOnServer.begin(),564 // ite = globalIndexAxisOnServer.end();565 570 CClientServerMapping::GlobalIndexMap::const_iterator it = indSrv_.begin(), 566 571 ite = indSrv_.end(); 567 // std::vector<size_t>::const_iterator itbVec = (globalAxisZoom).begin(),568 // iteVec = (globalAxisZoom).end();569 // indSrv_.clear();570 // indWrittenSrv_.clear();571 // for (; it != ite; ++it)572 // {573 // int rank = it->first;574 // const std::vector<size_t>& globalIndexTmp = it->second;575 // int nb = globalIndexTmp.size();576 577 // for (int i = 0; i < nb; ++i)578 // {579 // if (std::binary_search(itbVec, iteVec, globalIndexTmp[i]))580 // {581 // indSrv_[rank].push_back(globalIndexTmp[i]);582 // }583 584 // if (writtenInd.count(globalIndexTmp[i]))585 // {586 // indWrittenSrv_[rank].push_back(globalIndexTmp[i]);587 // }588 // }589 // }590 572 591 573 connectedServerRank_.clear(); … … 594 576 } 595 577 596 // if (!indSrv_.empty())597 // {598 // std::map<int, vector<size_t> >::const_iterator itIndSrv = indSrv_.begin(),599 // iteIndSrv = indSrv_.end();600 // connectedServerRank_.clear();601 // for (; itIndSrv != iteIndSrv; ++itIndSrv)602 // connectedServerRank_.push_back(itIndSrv->first);603 // }604 578 nbConnectedClients_ = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 605 579 } … … 750 724 } 751 725 } 752 753 // void CAxis::computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid,754 // CServerDistributionDescription::ServerDistributionType distType)755 // {756 // CContext* context = CContext::getCurrent();757 // CContextClient* client = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client;758 // int nbServer = client->serverSize;759 // int range, clientSize = client->clientSize;760 // int rank = client->clientRank;761 762 // size_t ni = this->n.getValue();763 // size_t ibegin = this->begin.getValue();764 // size_t zoom_end = global_zoom_begin+global_zoom_n-1;765 // size_t nZoomCount = 0;766 // size_t nbIndex = index.numElements();767 // for (size_t idx = 0; idx < nbIndex; ++idx)768 // {769 // size_t globalIndex = index(idx);770 // if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) ++nZoomCount;771 // }772 773 // CArray<size_t,1> globalIndexAxis(nbIndex);774 // std::vector<size_t> globalAxisZoom(nZoomCount);775 // nZoomCount = 0;776 // for (size_t idx = 0; idx < nbIndex; ++idx)777 // {778 // size_t globalIndex = index(idx);779 // globalIndexAxis(idx) = globalIndex;780 // if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end)781 // {782 // globalAxisZoom[nZoomCount] = globalIndex;783 // ++nZoomCount;784 // }785 // }786 787 // std::set<int> writtenInd;788 // if (isCompressible_)789 // {790 // for (int idx = 0; idx < data_index.numElements(); ++idx)791 // {792 // int ind = CDistributionClient::getAxisIndex(data_index(idx), data_begin, ni);793 794 // if (ind >= 0 && ind < ni && mask(ind))795 // {796 // ind += ibegin;797 // if (ind >= global_zoom_begin && ind <= zoom_end)798 // writtenInd.insert(ind);799 // }800 // }801 // }802 803 // CServerDistributionDescription serverDescriptionGlobal(globalDim, nbServer);804 // int distributedDimensionOnServer = serverDescriptionGlobal.getDimensionDistributed();805 // CClientServerMapping::GlobalIndexMap globalIndexAxisOnServer;806 // if (distributedDimensionOnServer == orderPositionInGrid) // So we have distributed axis on client side and also on server side*807 // {808 // std::vector<int> nGlobAxis(1);809 // nGlobAxis[0] = n_glo.getValue();810 811 // size_t globalSizeIndex = 1, indexBegin, indexEnd;812 // for (int i = 0; i < nGlobAxis.size(); ++i) globalSizeIndex *= nGlobAxis[i];813 // indexBegin = 0;814 // if (globalSizeIndex <= clientSize)815 // {816 // indexBegin = rank%globalSizeIndex;817 // indexEnd = indexBegin;818 // }819 // else820 // {821 // for (int i = 0; i < clientSize; ++i)822 // {823 // range = globalSizeIndex / clientSize;824 // if (i < (globalSizeIndex%clientSize)) ++range;825 // if (i == client->clientRank) break;826 // indexBegin += range;827 // }828 // indexEnd = indexBegin + range - 1;829 // }830 831 // CServerDistributionDescription serverDescription(nGlobAxis, nbServer);832 // serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd));833 // CClientServerMapping* clientServerMap = new CClientServerMappingDistributed(serverDescription.getGlobalIndexRange(), client->intraComm);834 // clientServerMap->computeServerIndexMapping(globalIndexAxis);835 // globalIndexAxisOnServer = clientServerMap->getGlobalIndexOnServer();836 // delete clientServerMap;837 // }838 // else839 // {840 // std::vector<size_t> globalIndexServer(n_glo.getValue());841 // for (size_t idx = 0; idx < n_glo.getValue(); ++idx)842 // {843 // globalIndexServer[idx] = idx;844 // }845 846 // for (int idx = 0; idx < nbServer; ++idx)847 // {848 // globalIndexAxisOnServer[idx] = globalIndexServer;849 // }850 // }851 852 // CClientServerMapping::GlobalIndexMap::const_iterator it = globalIndexAxisOnServer.begin(),853 // ite = globalIndexAxisOnServer.end();854 // std::vector<size_t>::const_iterator itbVec = (globalAxisZoom).begin(),855 // iteVec = (globalAxisZoom).end();856 // indSrv_.clear();857 // indWrittenSrv_.clear();858 // for (; it != ite; ++it)859 // {860 // int rank = it->first;861 // const std::vector<size_t>& globalIndexTmp = it->second;862 // int nb = globalIndexTmp.size();863 864 // for (int i = 0; i < nb; ++i)865 // {866 // if (std::binary_search(itbVec, iteVec, globalIndexTmp[i]))867 // {868 // indSrv_[rank].push_back(globalIndexTmp[i]);869 // }870 871 // if (writtenInd.count(globalIndexTmp[i]))872 // {873 // indWrittenSrv_[rank].push_back(globalIndexTmp[i]);874 // }875 // }876 // }877 878 // connectedServerRank_.clear();879 // for (it = globalIndexAxisOnServer.begin(); it != ite; ++it) {880 // connectedServerRank_.push_back(it->first);881 // }882 883 // if (!indSrv_.empty())884 // {885 // std::map<int, vector<size_t> >::const_iterator itIndSrv = indSrv_.begin(),886 // iteIndSrv = indSrv_.end();887 // connectedServerRank_.clear();888 // for (; itIndSrv != iteIndSrv; ++itIndSrv)889 // connectedServerRank_.push_back(itIndSrv->first);890 // }891 // nbConnectedClients_ = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_);892 // }893 726 894 727 void CAxis::sendNonDistributedAttributes() -
XIOS/dev/dev_olga/src/node/axis.hpp
r1143 r1144 45 45 enum EEventId 46 46 { 47 EVENT_ID_DISTRIBUTION_ATTRIBUTE, 48 EVENT_ID_INDEX, 47 EVENT_ID_DISTRIBUTION_ATTRIBUTE, 49 48 EVENT_ID_DISTRIBUTED_VALUE, 50 49 EVENT_ID_NON_DISTRIBUTED_VALUE, … … 69 68 70 69 static CAxis* createAxis(); 71 72 /// Accesseurs /// 73 const std::set<StdString> & getRelFiles(void) const; 74 75 const std::vector<int>& getIndexesToWrite(void) const; 70 76 71 int getNumberWrittenIndexes() const; 77 72 int getTotalNumberWrittenIndexes() const; … … 117 112 bool hasTransformation(); 118 113 void solveInheritanceTransformation(); 119 TransMapTypes getAllTransformations(); 120 void fillInValues(const CArray<double,1>& values); 114 TransMapTypes getAllTransformations(); 121 115 void duplicateTransformation(CAxis*); 122 116 CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id=""); -
XIOS/dev/dev_olga/src/node/context.cpp
r1139 r1144 526 526 void CContext::postProcessingGlobalAttributes() 527 527 { 528 if (allProcessed) return; 528 if (allProcessed) return; 529 529 530 // if (hasClient) 531 // { 532 // After xml is parsed, there are some more works with post processing 533 postProcessing(); 534 535 // Check grid and calculate its distribution 536 checkGridEnabledFields(); 537 538 //} 539 540 530 // After xml is parsed, there are some more works with post processing 531 postProcessing(); 532 533 // Check grid and calculate its distribution 534 checkGridEnabledFields(); 541 535 542 536 setClientServerBuffer(); … … 565 559 // We have a xml tree on the server side and now, it should be also processed 566 560 sendPostProcessing(); 561 567 562 sendGridEnabledFields(); 568 563 } … … 605 600 606 601 void CContext::recvPostProcessingGlobalAttributes(CBufferIn& buffer) 607 { 608 // CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar(); 602 { 609 603 postProcessingGlobalAttributes(); 610 604 } … … 632 626 buildFilterGraphOfFieldsWithReadAccess(); 633 627 } 634 635 // if (hasClient) this->solveAllRefOfEnabledFields(true); 636 checkGridEnabledFields(); 637 // sendGridEnabledFields(); 628 629 checkGridEnabledFields(); 638 630 639 631 if (hasClient) this->sendProcessingGridOfEnabledFields(); … … 666 658 for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) 667 659 (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); 668 }669 670 void CContext::solveAllEnabledFields()671 {672 int size = this->enabledFiles.size();673 for (int i = 0; i < size; ++i)674 {675 this->enabledFiles[i]->solveOnlyRefOfEnabledFields(false);676 }677 678 for (int i = 0; i < size; ++i)679 {680 this->enabledFiles[i]->generateNewTransformationGridDest();681 }682 660 } 683 661 … … 1062 1040 CBufferIn* buffer=event.subEvents.begin()->buffer; 1063 1041 string id; 1064 *buffer>>id; 1065 //get(id)->solveOnlyRefOfEnabledFields(false); 1042 *buffer>>id; 1066 1043 } 1067 1044 … … 1156 1133 1157 1134 // Check if some automatic time series should be generated 1158 // Warning: This must be done after solving the inheritance and before the rest of post-processing 1159 // prepareTimeseries(); 1135 // Warning: This must be done after solving the inheritance and before the rest of post-processing 1160 1136 1161 1137 // The timeseries should only be prepared in client … … 1164 1140 //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 1165 1141 this->findEnabledFiles(); 1166 // this->findEnabledReadModeFiles();1142 1167 1143 // For now, only read files with client and only one level server 1168 1144 if (hasClient && !hasServer) this->findEnabledReadModeFiles(); 1169 1170 1145 1171 1146 // Find all enabled fields of each file … … 1174 1149 if (hasClient && !hasServer) this->findAllEnabledFieldsInReadModeFiles(); 1175 1150 1176 // if (hasClient) 1177 if (hasClient && !hasServer)1178 {1179 // Try to read attributes of fields in file then fill in corresponding grid (or domain, axis)1180 this->readAttributesOfEnabledFieldsInReadModeFiles();1181 }1151 1152 if (hasClient && !hasServer) 1153 { 1154 // Try to read attributes of fields in file then fill in corresponding grid (or domain, axis) 1155 this->readAttributesOfEnabledFieldsInReadModeFiles(); 1156 } 1182 1157 1183 1158 // Only search and rebuild all reference objects of enable fields, don't transform -
XIOS/dev/dev_olga/src/node/context.hpp
r1139 r1144 128 128 129 129 void solveAllRefOfEnabledFieldsAndTransform(bool sendToServer); 130 void solveAllEnabledFields();131 130 void checkGridEnabledFields(); 132 131 void sendGridEnabledFields(); -
XIOS/dev/dev_olga/src/node/domain.cpp
r1143 r1144 79 79 } 80 80 81 const std::set<StdString> & CDomain::getRelFiles(void) const82 {83 return (this->relFiles);84 }85 86 87 const std::vector<int>& CDomain::getIndexesToWrite(void) const88 {89 return indexesToWrite;90 }91 92 81 /*! 93 82 Returns the number of indexes written by each server. … … 115 104 { 116 105 return offsetWrittenIndexes_; 117 }118 119 /*!120 Returns the start of indexes written by each server.121 \return the start of indexes written by each server122 */123 const std::vector<int>& CDomain::getStartWriteIndex() const124 {125 return start_write_index_;126 }127 128 /*!129 Returns the count of indexes written by each server.130 \return the count of indexes written by each server131 */132 const std::vector<int>& CDomain::getCountWriteIndex() const133 {134 return count_write_index_;135 }136 137 /*!138 Returns the local data written by each server.139 */140 const std::vector<int>& CDomain::getLocalWriteSize() const141 {142 return local_write_size_;143 }144 145 /*!146 Returns the global data written by all server.147 */148 const std::vector<int>& CDomain::getGlobalWriteSize() const149 {150 return global_write_size_;151 106 } 152 107 … … 1564 1519 } 1565 1520 1566 1567 // void CDomain::computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid,1568 // CServerDistributionDescription::ServerDistributionType distType)1569 1521 /*! 1570 Compute the connection of a client to other clients to determine which clients to send attributes to 1522 Compute the connection of a client to other clients to determine which clients to send attributes to. 1523 The sending clients are supposed to already know the distribution of receiving clients (In simple cases, it's band) 1524 The connection among clients is calculated by using global index. 1525 A client connects to other clients which holds the same global index as it. 1571 1526 */ 1572 1527 void CDomain::computeConnectedClients() … … 1609 1564 } 1610 1565 1611 // for (i = 0; i < nbIndex; ++i)1612 // {1613 // i_ind=i_index(i);1614 // j_ind=j_index(i);1615 1616 // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend)1617 // {1618 // ++globalIndexCountZoom;1619 // }1620 // }1621 1622 // int globalIndexWrittenCount = 0;1623 // if (isCompressible_)1624 // {1625 // for (i = 0; i < data_i_index.numElements(); ++i)1626 // {1627 // i_ind = CDistributionClient::getDomainIndex(data_i_index(i), data_j_index(i),1628 // data_ibegin, data_jbegin, data_dim, ni,1629 // j_ind);1630 // if (i_ind >= 0 && i_ind < ni && j_ind >= 0 && j_ind < nj && mask_1d(i_ind + j_ind * ni))1631 // {1632 // i_ind += ibegin;1633 // j_ind += jbegin;1634 // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend)1635 // ++globalIndexWrittenCount;1636 // }1637 // }1638 // }1639 1566 1640 1567 // Fill in index 1641 1642 1568 CArray<size_t,1> globalIndexDomainZoom(globalIndexCountZoom); 1643 1569 CArray<size_t,1> localIndexDomainZoom(globalIndexCountZoom); … … 1672 1598 globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 1673 1599 ++globalIndexCountZoom; 1674 // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend)1675 // {1676 // globalIndexDomainZoom(globalIndexCountZoom) = globalIndex;1677 // localIndexDomainZoom(globalIndexCountZoom) = i;1678 // ++globalIndexCountZoom;1679 // }1680 1600 } 1681 1601 } … … 1699 1619 int jend = jbegin + nj -1; 1700 1620 zoom_ibegin = global_zoom_ibegin > ibegin ? global_zoom_ibegin : ibegin; 1701 int zoom_iend 1621 int zoom_iend = global_zoom_iend < iend ? zoom_iend : iend ; 1702 1622 zoom_ni = zoom_iend-zoom_ibegin+1 ; 1703 1623 … … 1707 1627 } 1708 1628 1709 // if (globalLocalIndexZoomMap_.empty())1710 // {1711 // int nbIndexZoom = globalIndexDomainZoom.numElements();1712 // for (i = 0; i < nbIndex; ++i)1713 // globalLocalIndexZoomMap_[globalIndexDomainZoom(i)] = i;1714 // }1715 1716 1717 // CArray<int,1> globalIndexWrittenDomain(globalIndexWrittenCount);1718 // if (isCompressible_)1719 // {1720 // globalIndexWrittenCount = 0;1721 // for (i = 0; i < data_i_index.numElements(); ++i)1722 // {1723 // i_ind = CDistributionClient::getDomainIndex(data_i_index(i), data_j_index(i),1724 // data_ibegin, data_jbegin, data_dim, ni,1725 // j_ind);1726 // if (i_ind >= 0 && i_ind < ni && j_ind >= 0 && j_ind < nj && mask_1d(i_ind + j_ind * ni))1727 // {1728 // i_ind += ibegin;1729 // j_ind += jbegin;1730 // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend)1731 // {1732 // globalIndexWrittenDomain(globalIndexWrittenCount) = i_ind + j_ind * ni_glo;1733 // ++globalIndexWrittenCount;1734 // }1735 // }1736 // }1737 // }1738 1629 1739 1630 size_t globalSizeIndex = 1, indexBegin, indexEnd; … … 1772 1663 CClientServerMapping::GlobalIndexMap::const_iterator it = globalIndexDomainOnServer.begin(), 1773 1664 ite = globalIndexDomainOnServer.end(); 1774 // typedef XIOSBinarySearchWithIndex<size_t> BinarySearch;1775 // std::vector<int>::iterator itVec;1776 1777 // indSrv_.clear();1778 // indWrittenSrv_.clear();1779 // for (; it != ite; ++it)1780 // {1781 // int rank = it->first;1782 // int indexSize = it->second.size();1783 // std::vector<int> permutIndex(indexSize);1784 // XIOSAlgorithms::fillInIndex(indexSize, permutIndex);1785 // XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(it->second, permutIndex);1786 // BinarySearch binSearch(it->second);1787 // int nb = globalIndexDomainZoom.numElements();1788 // for (int i = 0; i < nb; ++i)1789 // {1790 // if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexDomainZoom(i), itVec))1791 // {1792 // indSrv_[rank].push_back(localIndexDomainZoom(i));1793 // }1794 // }1795 // for (int i = 0; i < globalIndexWrittenDomain.numElements(); ++i)1796 // {1797 // if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexWrittenDomain(i), itVec))1798 // {1799 // indWrittenSrv_[rank].push_back(globalIndexWrittenDomain(i));1800 // }1801 // }1802 // }1803 1804 1665 connectedServerRank_.clear(); 1805 1666 for (it = globalIndexDomainOnServer.begin(); it != ite; ++it) { … … 1823 1684 } 1824 1685 1825 const boost::unordered_map<int, vector<size_t> >& CDomain::getIndexServer() const1826 {1827 return indSrv_;1828 }1829 1686 /*! 1687 Compute index to write data. We only write data on the zoomed region, therefore, there should 1688 be a map between the complete grid and the reduced grid where we write data. 1689 By using global index we can easily create this kind of mapping. 1690 */ 1830 1691 void CDomain::computeWrittenIndex() 1831 1692 { … … 1976 1837 list_msgsIndex.back() << list_indGlob.back(); //list_indi.back() << list_indj.back(); 1977 1838 1978 // if (isCompressible_)1979 // {1980 // std::vector<int>& writtenIndSrc = indWrittenSrv_[rank];1981 // list_writtenInd.push_back(CArray<int,1>(writtenIndSrc.size()));1982 // CArray<int,1>& writtenInd = list_writtenInd.back();1983 1984 // for (n = 0; n < writtenInd.numElements(); ++n)1985 // writtenInd(n) = writtenIndSrc[n];1986 1987 // list_msgsIndex.back() << writtenInd;1988 // }1989 1990 1839 eventIndex.push(rank, nbConnectedClients_[rank], list_msgsIndex.back()); 1991 1840 } … … 1997 1846 /*! 1998 1847 Send global index and zoom index from client to connected client(s) 1999 zoom index can be smaller than global index 1848 zoom index can be smaller than global index. 1849 This function can be used in the future??? 2000 1850 */ 2001 1851 void CDomain::sendIndexZoom() … … 2100 1950 2101 1951 /*! 2102 Send mask index from client to connected(s) 1952 Send mask index from client to connected(s) clients 2103 1953 */ 2104 1954 void CDomain::sendMask() … … 2196 2046 /*! 2197 2047 Send longitude and latitude from client to servers 2198 Each client send long and lat information to corresponding connected server(s).2048 Each client send long and lat information to corresponding connected clients(s). 2199 2049 Because longitude and latitude are optional, this function only called if latitude and longitude exist 2200 2050 */ … … 2295 2145 Data index can be compressed however, we always send decompressed data index 2296 2146 and they will be compressed on receiving. 2147 The compressed index are represented with 1 and others are represented with -1 2297 2148 */ 2298 2149 void CDomain::sendDataIndex() … … 2431 2282 } 2432 2283 get(domainId)->recvIndex(rankBuffers); 2433 2434 // if (domain->isCompressible_)2435 // {2436 // std::sort(domain->indexesToWrite.begin(), domain->indexesToWrite.end());2437 2438 // CContextServer* server = CContext::getCurrent()->server;2439 // domain->numberWrittenIndexes_ = domain->indexesToWrite.size();2440 // MPI_Allreduce(&domain->numberWrittenIndexes_, &domain->totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);2441 // MPI_Scan(&domain->numberWrittenIndexes_, &domain->offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);2442 // domain->offsetWrittenIndexes_ -= domain->numberWrittenIndexes_;2443 // }2444 2284 } 2445 2285 2446 2286 /*! 2447 Receive index information from client(s) 2287 Receive index information from client(s). We use the global index for mapping index between 2288 sending clients and receiving clients. 2448 2289 \param[in] rankBuffers rank of sending client and the corresponding receive buffer 2449 2290 */ … … 2484 2325 ++nbIndGlob; 2485 2326 } 2486 } 2487 2488 // { 2489 // CContextServer* server = CContext::getCurrent()->server; 2490 // count_write_index_.resize(2); 2491 // start_write_index_.resize(2); 2492 // local_write_size_.resize(2); 2493 // global_write_size_.resize(2); 2494 // if ((this->type) == CDomain::type_attr::unstructured) 2495 // { 2496 // count_write_index_[0] = zoom_i_index.numElements(); 2497 // count_write_index_[1] = 0; 2498 // } 2499 // else 2500 // { 2501 // int ni_zoom = zoom_i_index.numElements(), idx, nbIZoom = 0, nbJZoom = 0; 2502 // for (idx =0; idx < ni_zoom; ++idx) 2503 // { 2504 // if ((ibegin <= zoom_i_index(idx)) && (zoom_i_index(idx) < ibegin+ni) && (nbIZoom < ni)) 2505 // ++nbIZoom; 2506 // if ((jbegin <= zoom_j_index(idx)) && (zoom_j_index(idx) < jbegin+nj) && (nbJZoom < nj)) 2507 // ++nbJZoom; 2508 // } 2509 // count_write_index_[0] = nbIZoom; 2510 // count_write_index_[1] = nbJZoom; 2511 2512 // // Reoder the zoom_index 2513 // for (int j = 0; j < nbJZoom; ++j) 2514 // for (int i = 0; i < nbIZoom; ++i) 2515 // { 2516 // idx = nbIZoom * j + i; 2517 // if (idx < ni_zoom) 2518 // { 2519 // zoom_i_index(idx) = ibegin + i; 2520 // zoom_j_index(idx) = jbegin + j; 2521 // } 2522 // } 2523 2524 // // Reorder the global index 2525 // for (int j = 0; j < nj; ++j) 2526 // for (int i = 0; i < ni; ++i) 2527 // { 2528 // idx = ni * j + i; 2529 // if (idx < nbIndGlob) 2530 // { 2531 // i_index(idx) = ibegin + i; 2532 // j_index(idx) = jbegin + j; 2533 // } 2534 // } 2535 // } 2536 2537 2538 // MPI_Scan(&count_write_index_[0], &start_write_index_[0], 2, MPI_INT, MPI_SUM, server->intraComm); 2539 // start_write_index_[0] = 0; 2540 // start_write_index_[1] -= count_write_index_[1]; 2541 // local_write_size_[0] = count_write_index_[0]; 2542 // local_write_size_[1] = count_write_index_[1]; 2543 // MPI_Allreduce(&count_write_index_[0], &global_write_size_[0], 2, MPI_INT, MPI_SUM, server->intraComm); 2544 // global_write_size_[0] = count_write_index_[0]; 2545 // global_write_size_[1] = (global_write_size_[1] > nj_glo) ? nj_glo : global_write_size_[1]; 2546 2547 2548 // } 2549 2550 // int type_int; 2551 // buffer >> type_int >> isCurvilinear >> indiSrv[rank] >> indjSrv[rank]; 2552 // type.setValue((type_attr::t_enum)type_int); // probleme des type enum avec les buffers : ToFix 2553 2554 // if (isCompressible_) 2555 // { 2556 // CArray<int, 1> writtenIndexes; 2557 // buffer >> writtenIndexes; 2558 // indexesToWrite.reserve(indexesToWrite.size() + writtenIndexes.numElements()); 2559 // for (int i = 0; i < writtenIndexes.numElements(); ++i) 2560 // indexesToWrite.push_back(writtenIndexes(i)); 2561 // } 2327 } 2562 2328 } 2563 2329 … … 2627 2393 { 2628 2394 } 2629 2630 // globalLocalIndexZoomMap_.rehash(std::ceil(nbZoomInd/globalLocalIndexZoomMap_.max_load_factor()));2631 // nbZoomInd = 0;2632 // for (int j = 0; j < zoom_nj; ++j)2633 // for (int i = 0; i < zoom_ni; ++i)2634 // {2635 // globalLocalIndexZoomMap_[(i + zoom_ibegin) + (j + zoom_jbegin) * ni_glo] = nbZoomInd;2636 // ++nbZoomInd;2637 // }2638 2395 } 2639 2396 … … 3004 2761 } 3005 2762 get(domainId)->recvDataIndex(rankBuffers); 3006 3007 // if (domain->isCompressible_)3008 // {3009 // std::sort(domain->indexesToWrite.begin(), domain->indexesToWrite.end());3010 3011 // CContextServer* server = CContext::getCurrent()->server;3012 // domain->numberWrittenIndexes_ = domain->indexesToWrite.size();3013 // MPI_Allreduce(&domain->numberWrittenIndexes_, &domain->totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);3014 // MPI_Scan(&domain->numberWrittenIndexes_, &domain->offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);3015 // domain->offsetWrittenIndexes_ -= domain->numberWrittenIndexes_;3016 // }3017 2763 } 3018 2764 -
XIOS/dev/dev_olga/src/node/domain.hpp
r1143 r1144 91 91 CTransformation<CDomain>* addTransformation(ETranformationType transType, const StdString& id=""); 92 92 93 public: 94 const std::set<StdString> & getRelFiles(void) const; 93 public: 95 94 bool IsWritten(const StdString & filename) const; 96 95 bool isWrittenCompressed(const StdString& filename) const; 97 98 const std::vector<int>& getIndexesToWrite(void) const; 96 99 97 int getNumberWrittenIndexes() const; 100 98 int getTotalNumberWrittenIndexes() const; 101 99 int getOffsetWrittenIndexes() const; 102 103 const std::vector<int>& getStartWriteIndex() const;104 const std::vector<int>& getCountWriteIndex() const;105 const std::vector<int>& getLocalWriteSize() const;106 const std::vector<int>& getGlobalWriteSize() const;107 100 108 101 std::map<int, StdSize> getAttributesBufferSize(); … … 164 157 static StdString GetName(void); 165 158 static StdString GetDefName(void); 166 167 static ENodeType GetType(void); 168 const boost::unordered_map<int, vector<size_t> >& getIndexServer() const; 159 static ENodeType GetType(void); 160 169 161 CArray<bool, 1> localMask; 170 162 bool isCurvilinear ; … … 199 191 void sendIndexZoom(); 200 192 void sendDataIndex(); 201 202 193 void convertLonLatValue(); 203 194 204 195 private: 205 std::vector<int> start_write_index_;206 std::vector<int> count_write_index_;207 std::vector<int> local_write_size_;208 std::vector<int> global_write_size_;209 210 196 bool doZoomByIndex_; 211 197 bool isChecked, computedWrittenIndex_; -
XIOS/dev/dev_olga/src/node/field.cpp
r1143 r1144 172 172 } 173 173 client->sendEvent(event); 174 } 175 // } 174 } 176 175 177 176 CTimer::get("XIOS Send Data").suspend(); 178 177 } 179 180 // void CField::sendUpdateData(const CArray<double,1>& data, CContextClient* client)181 // {182 // CTimer::get("XIOS Send Data").resume();183 184 // CEventClient event(getType(), EVENT_ID_UPDATE_DATA);185 186 // map<int, CArray<int,1> >::iterator it;187 // list<CMessage> list_msg;188 // list<CArray<double,1> > list_data;189 190 // if (!grid->doGridHaveDataDistributed())191 // {192 // if (client->isServerLeader())193 // {194 // for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++)195 // {196 // int rank = it->first;197 // CArray<int,1>& index = it->second;198 199 // list_msg.push_back(CMessage());200 // list_data.push_back(CArray<double,1>(index.numElements()));201 202 // CArray<double,1>& data_tmp = list_data.back();203 // for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n));204 205 // list_msg.back() << getId() << data_tmp;206 // event.push(rank, 1, list_msg.back());207 // }208 // client->sendEvent(event);209 // }210 // else client->sendEvent(event);211 // }212 // else213 // {214 // for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++)215 // {216 // int rank = it->first;217 // CArray<int,1>& index = it->second;218 219 // list_msg.push_back(CMessage());220 // list_data.push_back(CArray<double,1>(index.numElements()));221 222 // CArray<double,1>& data_tmp = list_data.back();223 // for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n));224 225 // list_msg.back() << getId() << data_tmp;226 // event.push(rank, grid->nbSenders[rank], list_msg.back());227 // }228 // client->sendEvent(event);229 // }230 // CTimer::get("XIOS Send Data").suspend();231 // }232 178 233 179 void CField::recvUpdateData(CEventServer& event) … … 388 334 { 389 335 CContext* context = CContext::getCurrent(); 390 // CContextClient* client = context->client;391 336 CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 392 337 … … 686 631 CContext* context = CContext::getCurrent(); 687 632 if (context->hasClient && !context->hasServer) 688 // if (context->hasClient)689 633 { 690 634 if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) … … 702 646 CContext* context = CContext::getCurrent(); 703 647 if (context->hasClient && !context->hasServer) 704 // if (context->hasClient)705 648 { 706 649 std::map<CGrid*,std::pair<bool,StdString> >& gridSrcMap = grid->getTransGridSource(); … … 840 783 841 784 if (context->hasClient && !context->hasServer) 842 // if (context->hasClient)843 785 { 844 786 solveRefInheritance(true); 845 787 if (hasDirectFieldReference()) getDirectFieldReference()->solveOnlyReferenceEnabledField(false); 846 788 } 847 // else if (context->hasServer) 789 848 790 if (context->hasServer) 849 791 solveServerOperation(); … … 852 794 853 795 if (context->hasClient && !context->hasServer) 854 // if (context->hasClient)855 796 { 856 797 solveGenerateGrid(); … … 868 809 { 869 810 areAllReferenceSolved = true; 870 871 // if (context->hasClient) 811 872 812 if (context->hasClient && !context->hasServer) 873 813 { … … 875 815 if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false); 876 816 } 877 else if (context->hasServer) 878 // if (context->hasServer && !context->hasClient) 817 else if (context->hasServer) 879 818 solveServerOperation(); 880 819 … … 959 898 */ 960 899 void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput) 961 { 962 // if (!areAllReferenceSolved) solveAllReferenceEnabledField(false); 900 { 963 901 if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 964 902 CContext* context = CContext::getCurrent(); … … 1367 1305 void CField::scaleFactorAddOffset(double scaleFactor, double addOffset) 1368 1306 { 1369 // map<int, CArray<double,1> >::iterator it;1370 // for (it = data_srv.begin(); it != data_srv.end(); it++) it->second = (it->second - addOffset) / scaleFactor;1371 1307 recvDataSrv = (recvDataSrv - addOffset) / scaleFactor; 1372 1308 } … … 1374 1310 void CField::invertScaleFactorAddOffset(double scaleFactor, double addOffset) 1375 1311 { 1376 // map<int, CArray<double,1> >::iterator it;1377 // for (it = data_srv.begin(); it != data_srv.end(); it++) it->second = it->second * scaleFactor + addOffset;1378 1312 recvDataSrv = recvDataSrv * scaleFactor + addOffset; 1379 1313 } … … 1402 1336 void CField::outputCompressedField(CArray<double,1>& fieldOut) 1403 1337 { 1404 // map<int, CArray<double,1> >::iterator it;1405 1406 // for (it = data_srv.begin(); it != data_srv.end(); it++)1407 // {1408 // grid->outputCompressedField(it->first, it->second, fieldOut.dataFirst());1409 // }1410 1411 1338 CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 1412 1339 CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer; … … 1480 1407 } 1481 1408 1482 void CField::sendAddAllVariables( )1409 void CField::sendAddAllVariables(CContextClient* client) 1483 1410 { 1484 1411 std::vector<CVariable*> allVar = getAllVariables(); … … 1488 1415 for (; it != itE; ++it) 1489 1416 { 1490 this->sendAddVariable((*it)->getId());1491 (*it)->sendAllAttributesToServer();1492 (*it)->sendValue();1493 }1494 }1495 1496 void CField::sendAddAllVariables(CContextClient* client)1497 {1498 std::vector<CVariable*> allVar = getAllVariables();1499 std::vector<CVariable*>::const_iterator it = allVar.begin();1500 std::vector<CVariable*>::const_iterator itE = allVar.end();1501 1502 for (; it != itE; ++it)1503 {1504 1417 this->sendAddVariable((*it)->getId(), client); 1505 1418 (*it)->sendAllAttributesToServer(client); … … 1508 1421 } 1509 1422 1510 void CField::sendAddVariable(const string& id)1511 {1512 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE);1513 }1514 1515 1423 void CField::sendAddVariable(const string& id, CContextClient* client) 1516 1424 { … … 1518 1426 } 1519 1427 1520 void CField::sendAddVariableGroup(const string& id )1521 { 1522 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP );1428 void CField::sendAddVariableGroup(const string& id, CContextClient* client) 1429 { 1430 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 1523 1431 } 1524 1432 -
XIOS/dev/dev_olga/src/node/field.hpp
r1136 r1144 170 170 171 171 CVariable* addVariable(const string& id = ""); 172 CVariableGroup* addVariableGroup(const string& id = ""); 173 void sendAddVariable(const string& id = ""); 172 CVariableGroup* addVariableGroup(const string& id = ""); 174 173 void sendAddVariable(const string& id, CContextClient* client); 175 void sendAddVariableGroup(const string& id = "");174 void sendAddVariableGroup(const string& id, CContextClient* client); 176 175 static void recvAddVariable(CEventServer& event); 177 176 void recvAddVariable(CBufferIn& buffer); 178 177 static void recvAddVariableGroup(CEventServer& event); 179 void recvAddVariableGroup(CBufferIn& buffer); 180 void sendAddAllVariables(); 178 void recvAddVariableGroup(CBufferIn& buffer); 181 179 void sendAddAllVariables(CContextClient* client); 182 180 void writeUpdateData(const CArray<double,1>& data); 183 184 181 185 182 const std::vector<StdString>& getRefDomainAxisIds(); … … 206 203 map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 207 204 208 map<int, CArray<double,1> > data_srv;205 // map<int, CArray<double,1> > data_srv; 209 206 CArray<double,1> recvDataSrv; 210 207 -
XIOS/dev/dev_olga/src/node/file.cpp
r1136 r1144 616 616 617 617 // Just check file and try to open it 618 CContext* context = CContext::getCurrent();619 // CContextClient* client=context->client;620 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client;621 622 // It would probably be better to call initFile() somehow623 // MPI_Comm_dup(client->intraComm, &fileComm);624 618 if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; 625 619 … … 719 713 { 720 714 this->enabledFields[i]->solveOnlyReferenceEnabledField(sendToServer); 721 // this->enabledFields[i]->solveAllEnabledFields();722 // this->enabledFields[i]->buildGridTransformationGraph();723 715 } 724 716 } … … 763 755 int size = this->enabledFields.size(); 764 756 for (int i = 0; i < size; ++i) 765 { 766 // this->enabledFields[i]->solveAllReferenceEnabledField(sendToServer); 757 { 767 758 this->enabledFields[i]->solveAllEnabledFieldsAndTransform(); 768 759 } … … 886 877 \param[in] id String identity of field that will be created on server 887 878 */ 888 void CFile::sendAddField(const string& id)889 {890 sendAddItem(id, EVENT_ID_ADD_FIELD);891 }892 893 879 void CFile::sendAddField(const string& id, CContextClient* client) 894 880 { 895 881 sendAddItem(id, EVENT_ID_ADD_FIELD, client); 896 }897 898 /*!899 \brief Send a message to create a field group on server side900 \param[in] id String identity of field group that will be created on server901 */902 void CFile::sendAddFieldGroup(const string& id)903 {904 sendAddItem(id, (int)EVENT_ID_ADD_FIELD_GROUP);905 882 } 906 883 … … 968 945 is to duplicate this value on server, too. 969 946 */ 970 void CFile::sendAddAllVariables()971 {972 std::vector<CVariable*> allVar = getAllVariables();973 std::vector<CVariable*>::const_iterator it = allVar.begin();974 std::vector<CVariable*>::const_iterator itE = allVar.end();975 976 for (; it != itE; ++it)977 {978 this->sendAddVariable((*it)->getId());979 (*it)->sendAllAttributesToServer();980 (*it)->sendValue();981 }982 }983 984 947 void CFile::sendAddAllVariables(CContextClient* client) 985 948 { … … 999 962 \brief Send a message to create a variable group on server side 1000 963 \param[in] id String identity of variable group that will be created on server 1001 */1002 void CFile::sendAddVariableGroup(const string& id)1003 {1004 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP);1005 }1006 1007 /*!1008 \brief Send a message to create a variable group on server side1009 \param[in] id String identity of variable group that will be created on server1010 964 \param [in] client client to which we will send this adding action 1011 965 */ … … 1013 967 { 1014 968 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 1015 }1016 1017 /*!1018 \brief Send a message to create a variable on server side1019 A variable always belongs to a variable group1020 \param[in] id String identity of variable that will be created on server1021 */1022 void CFile::sendAddVariable(const string& id)1023 {1024 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE);1025 969 } 1026 970 -
XIOS/dev/dev_olga/src/node/file.hpp
r1136 r1144 123 123 CContextClient* getContextClient(); 124 124 125 // Send info to server 126 void sendEnabledFields(); 127 void sendEnabledFields(CContextClient* client); 128 void sendAddField(const string& id = ""); 129 void sendAddField(const string& id, CContextClient* client); 130 void sendAddFieldGroup(const string& id = ""); 131 void sendAddFieldGroup(const string& id, CContextClient* client); 132 void sendAddAllVariables(); // to be removed (?) 125 // Send info to server 126 void sendEnabledFields(CContextClient* client); 127 void sendAddField(const string& id, CContextClient* client); 128 void sendAddFieldGroup(const string& id, CContextClient* client); 129 void sendAddVariable(const string& id, CContextClient* client); 130 void sendAddVariableGroup(const string& id, CContextClient* client); 133 131 void sendAddAllVariables(CContextClient* client); 134 void sendAddVariable(const string& id = ""); // to be removed (?) 135 void sendAddVariable(const string& id, CContextClient* client); 136 void sendAddVariableGroup(const string& id = ""); 137 void sendAddVariableGroup(const string& id, CContextClient* client); 138 132 139 133 // Receive info from client 140 134 static void recvAddField(CEventServer& event); -
XIOS/dev/dev_olga/src/node/grid.cpp
r1143 r1144 536 536 } 537 537 538 std::vector<int> CGrid::getAxisPositionInGrid() const 539 { 540 return axisPositionInGrid_; 541 } 542 538 /*! 539 Compute the index to for write data into a file 540 */ 543 541 void CGrid::computeWrittenIndex() 544 542 { … … 561 559 localIndexToWriteOnClient.resize(nbWritten); 562 560 localIndexToWriteOnServer.resize(nbWritten); 563 564 // if (isCompressible()) 561 565 562 { 566 563 numberWrittenIndexes_ = nbWritten; … … 607 604 int rank = client->clientRank; 608 605 609 clientDistribution_ = new CDistributionClient(rank, this); 610 // Get local data index on client 611 storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size()); 612 int nbStoreIndex = storeIndex_client.numElements(); 613 for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 614 // } 606 clientDistribution_ = new CDistributionClient(rank, this); 607 // Get local data index on client 608 storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size()); 609 int nbStoreIndex = storeIndex_client.numElements(); 610 for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 615 611 616 612 if (0 == serverDistribution_) isDataDistributed_= clientDistribution_->isDataDistributed(); 617 613 else 618 { 619 614 { 620 615 // Mapping global index received from clients to the storeIndex_client 621 616 CDistributionClient::GlobalLocalDataMap& globalDataIndex = clientDistribution_->getGlobalDataIndexOnClient(); … … 858 853 } 859 854 860 // nbIndexOnServer = 0;861 // for (it = itb; it != ite; ++it)862 // {863 // const std::vector<int>& tmp = it->second;864 // nbIndexOnServerTmp = 0;865 // for (int i = 0; i < tmp.size(); ++i)866 // {867 // if (0 == nbIndexOnServerTmp(tmp[i]))868 // {869 // globalElementIndexOnServer[idx][tmp[i]][nbIndexOnServer(tmp[i])] = it->first;870 // ++nbIndexOnServerTmp(tmp[i]);871 // }872 // }873 // nbIndexOnServer += nbIndexOnServerTmp;874 // }875 // }876 877 855 nbIndexOnServer = 0; 878 856 for (size_t j = 0; j < globalIndexElementOnServerMap.size(); ++j) … … 1144 1122 } 1145 1123 1146 void CGrid::outputField(int rank, const CArray<double, 1>& stored, double* field)1147 {1148 const CArray<size_t,1>& out_i = outIndexFromClient[rank];1149 StdSize numElements = stored.numElements();1150 for (StdSize n = 0; n < numElements; ++n)1151 {1152 field[out_i(n)] = stored(n);1153 }1154 }1155 1156 void CGrid::inputField(int rank, const double* const field, CArray<double,1>& stored)1157 {1158 const CArray<size_t,1>& out_i = outIndexFromClient[rank];1159 StdSize numElements = stored.numElements();1160 for (StdSize n = 0; n < numElements; ++n)1161 {1162 stored(n) = field[out_i(n)];1163 }1164 }1165 1166 void CGrid::outputCompressedField(int rank, const CArray<double,1>& stored, double* field)1167 {1168 const CArray<size_t,1>& out_i = compressedOutIndexFromClient[rank];1169 StdSize numElements = stored.numElements();1170 for (StdSize n = 0; n < numElements; ++n)1171 {1172 field[out_i(n)] = stored(n);1173 }1174 }1175 1176 //----------------------------------------------------------------1177 1178 1124 void CGrid::storeField_arr(const double* const data, CArray<double, 1>& stored) const 1179 1125 { … … 1193 1139 void CGrid::computeIndexScalarGrid() 1194 1140 { 1195 CContext* context = CContext::getCurrent(); 1196 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 1141 CContext* context = CContext::getCurrent(); 1197 1142 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 1198 1143 connectedServerRank_.resize(nbSrvPools); … … 1219 1164 } 1220 1165 isDataDistributed_ = false; 1221 }1222 }1223 1224 void CGrid::computeCompressedIndex()1225 {1226 compressedOutIndexFromClient = outIndexFromClient;1227 1228 std::map<size_t, size_t> indexes;1229 1230 {1231 std::map<int, CArray<size_t,1> >::const_iterator it = compressedOutIndexFromClient.begin();1232 std::map<int, CArray<size_t,1> >::const_iterator itEnd = compressedOutIndexFromClient.end();1233 for (; it != itEnd; ++it)1234 {1235 for (int i = 0; i < it->second.numElements(); ++i)1236 indexes.insert(std::make_pair(it->second(i), 0));1237 }1238 }1239 1240 {1241 std::map<size_t, size_t>::iterator it = indexes.begin();1242 std::map<size_t, size_t>::iterator itEnd = indexes.end();1243 for (size_t i = 0; it != itEnd; ++it, ++i)1244 it->second = i;1245 }1246 1247 {1248 std::map<int, CArray<size_t,1> >::iterator it = compressedOutIndexFromClient.begin();1249 std::map<int, CArray<size_t,1> >::iterator itEnd = compressedOutIndexFromClient.end();1250 for (; it != itEnd; ++it)1251 {1252 for (int i = 0; i < it->second.numElements(); ++i)1253 it->second(i) = indexes[it->second(i)];1254 }1255 1166 } 1256 1167 } … … 1378 1289 else 1379 1290 { 1380 // CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap, itbGlobalMap;1381 // itbGlobalMap = globalIndexOnServer_.begin(), itGlobalMap;1382 // iteGlobalMap = globalIndexOnServer_.end();1383 1384 // std::map<int,int > nbGlobalLocalTmp;1385 // for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap)1386 // {1387 // int serverRank = itGlobalMap->first;1388 // nbGlobalLocalTmp[serverRank] = 0;1389 // const std::vector<size_t>& indexVec = itGlobalMap->second;1390 // int indexSize = indexVec.size();1391 // for (int idx = 0; idx < indexSize; ++idx)1392 // {1393 // itIndex = globalLocalIndexSendToServer.find(indexVec[idx]);1394 // if (iteIndex != itIndex)1395 // {1396 // ++nbGlobalLocalTmp[serverRank];1397 // }1398 // }1399 // }1400 1401 // std::map<int,std::vector<int> >localIndexTmp;1402 // std::map<int,std::vector<size_t> > globalIndexTmp;1403 // for (std::map<int,int>::iterator it = nbGlobalLocalTmp.begin(); it != nbGlobalLocalTmp.end(); ++it)1404 // {1405 // localIndexTmp[it->first].resize(it->second);1406 // globalIndexTmp[it->first].resize(it->second);1407 // it->second = 0;1408 // }1409 1410 // for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap)1411 // {1412 // int serverRank = itGlobalMap->first;1413 // const std::vector<size_t>& indexVec = itGlobalMap->second;1414 // int indexSize = indexVec.size();1415 // int ind = 0;1416 // for (int idx = 0; idx < indexSize; ++idx)1417 // {1418 // itIndex = globalLocalIndexSendToServer.find(indexVec[idx]);1419 // if (iteIndex != itIndex)1420 // {1421 // ind = nbGlobalLocalTmp[serverRank];1422 // globalIndexTmp[serverRank][ind] = itIndex->first;1423 // localIndexTmp[serverRank][ind] = itIndex->second;1424 // ++nbGlobalLocalTmp[serverRank];1425 // }1426 // }1427 // }1428 1429 1291 CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap; 1430 1292 itGlobalMap = globalIndexOnServer_.begin(); … … 1502 1364 1503 1365 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 1504 nbSrvPools = 1; 1505 // connectedServerRank_.resize(nbSrvPools); 1366 nbSrvPools = 1; 1506 1367 nbReadSenders.resize(nbSrvPools); 1507 1368 for (int p = 0; p < nbSrvPools; ++p) … … 1510 1371 CContextClient* client = (!context->hasClient) ? context->client : context->clientPrimServer[p]; 1511 1372 1512 // CContextServer* server = (context->hasServer) ? context->server : context->serverPrimServer[p];1513 // CContextClient* client = (context->hasServer) ? context->client : context->clientPrimServer[p];1514 // numberWrittenIndexes_ = totalNumberWrittenIndexes_ = offsetWrittenIndexes_ = 0;1515 //connectedServerRank_[p] = ranks;1516 1517 1373 int idx = 0, numElement = axis_domain_order.numElements(); 1518 1374 int ssize = numElement; … … 1596 1452 else 1597 1453 { 1598 // dataSize = outIndex.numElements();1599 // for (int i = 0; i < outIndex.numElements(); ++i) outIndex(i) = i;1600 1454 // THE PROBLEM HERE IS THAT DATA CAN BE NONDISTRIBUTED ON CLIENT AND DISTRIBUTED ON SERVER 1601 1455 // BELOW IS THE TEMPORARY FIX only for a single type of element (domain, asix, scalar) 1602 1456 dataSize = serverDistribution_->getGridSize(); 1603 // dataSize = serverDistribution_->getGlobalIndexEachDimension()[0].numElements();1604 // outIndex.resize(dataSize);1605 // outIndex = serverDistribution_->getGlobalIndexEachDimension()[0];1606 1607 1457 } 1608 1458 writtenDataSize_ += dataSize; 1609 1610 // outIndexFromClient.insert(std::make_pair(rank, outIndex));1611 // connectedDataSize_[p][rank] = outIndex.numElements();1612 // numberWrittenIndexes_ += outIndex.numElements();1613 1459 } 1614 1460 … … 1686 1532 } 1687 1533 1688 // if (isScalarGrid()) return; 1689 1690 // if (isDataDistributed_) 1691 // { 1692 // MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 1693 // MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 1694 // offsetWrittenIndexes_ -= numberWrittenIndexes_; 1695 // } 1696 // else 1697 // totalNumberWrittenIndexes_ = numberWrittenIndexes_; 1534 if (isScalarGrid()) return; 1698 1535 1699 1536 nbReadSenders[p] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); … … 1910 1747 { 1911 1748 sendAddItem(id, (int)EVENT_ID_ADD_DOMAIN); 1912 // CContext* context=CContext::getCurrent();1913 1914 // if (! context->hasServer )1915 // {1916 // CContextClient* client=context->client;1917 1918 // CEventClient event(this->getType(),EVENT_ID_ADD_DOMAIN);1919 // if (client->isServerLeader())1920 // {1921 // CMessage msg;1922 // msg<<this->getId();1923 // msg<<id;1924 // const std::list<int>& ranks = client->getRanksServerLeader();1925 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)1926 // event.push(*itRank,1,msg);1927 // client->sendEvent(event);1928 // }1929 // else client->sendEvent(event);1930 // }1931 1749 } 1932 1750 … … 1938 1756 { 1939 1757 sendAddItem(id, (int)EVENT_ID_ADD_AXIS); 1940 // CContext* context=CContext::getCurrent();1941 1942 // if (! context->hasServer )1943 // {1944 // CContextClient* client=context->client;1945 1946 // CEventClient event(this->getType(),EVENT_ID_ADD_AXIS);1947 // if (client->isServerLeader())1948 // {1949 // CMessage msg;1950 // msg<<this->getId();1951 // msg<<id;1952 // const std::list<int>& ranks = client->getRanksServerLeader();1953 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)1954 // event.push(*itRank,1,msg);1955 // client->sendEvent(event);1956 // }1957 // else client->sendEvent(event);1958 // }1959 1758 } 1960 1759 … … 1966 1765 { 1967 1766 sendAddItem(id, (int)EVENT_ID_ADD_SCALAR); 1968 // CContext* context=CContext::getCurrent();1969 1970 // if (! context->hasServer )1971 // {1972 // CContextClient* client=context->client;1973 1974 // CEventClient event(this->getType(),EVENT_ID_ADD_SCALAR);1975 // if (client->isServerLeader())1976 // {1977 // CMessage msg;1978 // msg<<this->getId();1979 // msg<<id;1980 // const std::list<int>& ranks = client->getRanksServerLeader();1981 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)1982 // event.push(*itRank,1,msg);1983 // client->sendEvent(event);1984 // }1985 // else client->sendEvent(event);1986 // }1987 1767 } 1988 1768 … … 2075 1855 { 2076 1856 CDomain* pDom = CDomain::get(*it); 2077 if (context->hasClient && !context->hasServer) 2078 //if (context->hasClient) 1857 if (context->hasClient && !context->hasServer) 2079 1858 { 2080 1859 pDom->solveRefInheritance(apply); … … 2089 1868 CAxis* pAxis = CAxis::get(*it); 2090 1869 if (context->hasClient && !context->hasServer) 2091 // if (context->hasClient)2092 1870 { 2093 1871 pAxis->solveRefInheritance(apply); … … 2102 1880 CScalar* pScalar = CScalar::get(*it); 2103 1881 if (context->hasClient && !context->hasServer) 2104 // if (context->hasClient)2105 1882 { 2106 1883 pScalar->solveRefInheritance(apply); -
XIOS/dev/dev_olga/src/node/grid.hpp
r1136 r1144 91 91 StdSize getDataSize(void) const; 92 92 93 /// Entrées-sorties de champs ///93 /// Entrées-sorties de champs 94 94 template <int n> 95 95 void inputField(const CArray<double,n>& field, CArray<double,1>& stored) const; 96 96 template <int n> 97 void outputField(const CArray<double,1>& stored, CArray<double,n>& field) const; 98 99 void outputField(int rank, const CArray<double,1>& stored, double* field); 100 void inputField(int rank, const double* const field, CArray<double,1>& stored); 101 102 void outputCompressedField(int rank, const CArray<double,1>& stored, double* field); 97 void outputField(const CArray<double,1>& stored, CArray<double,n>& field) const; 103 98 104 99 virtual void parse(xml::CXMLNode& node); … … 129 124 static CGrid* cloneGrid(const StdString& idNewGrid, CGrid* gridSrc); 130 125 131 public: 132 133 /// Entrées-sorties de champs (interne) /// 134 void storeField_arr(const double* const data, CArray<double,1>& stored) const; 135 void restoreField_arr(const CArray<double,1>& stored, double* const data) const; 136 137 /// Traitements protégés /// 126 public: 138 127 void computeIndexServer(void); 139 128 void computeIndex(void); 140 129 void computeIndexScalarGrid(); 141 void computeCompressedIndex();142 130 void computeWrittenIndex(); 143 131 … … 188 176 std::vector<int> getGlobalDimension(); 189 177 bool isScalarGrid() const; 190 std::vector<int> getAxisPositionInGrid() const;191 178 192 179 bool doGridHaveDataToWrite(); … … 261 248 template<int N> 262 249 void modifyGridMaskSize(CArray<bool,N>& gridMask, const std::vector<int>& eachDimSize, bool newValue); 250 251 void storeField_arr(const double* const data, CArray<double, 1>& stored) const; 252 void restoreField_arr(const CArray<double, 1>& stored, double* const data) const; 263 253 264 254 void setVirtualDomainGroup(CDomainGroup* newVDomainGroup); -
XIOS/dev/dev_olga/src/node/scalar.cpp
r976 r1144 86 86 } 87 87 88 /*!89 Check the validity of all transformations applied on scalar90 This functions is called AFTER all inherited attributes are solved91 */92 void CScalar::checkTransformations()93 {94 TransMapTypes::const_iterator itb = transformationMap_.begin(), it,95 ite = transformationMap_.end();96 // for (it = itb; it != ite; ++it)97 // {98 // (it->second)->checkValid(this);99 // }100 }101 102 88 void CScalar::duplicateTransformation(CScalar* src) 103 89 { -
XIOS/dev/dev_olga/src/node/scalar.hpp
r888 r1144 81 81 82 82 private: 83 TransMapTypes transformationMap_; 84 void checkTransformations(); 83 TransMapTypes transformationMap_; 85 84 void setTransformations(const TransMapTypes&); 86 85 -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_zoom.cpp
r1129 r1144 104 104 correct index be extracted 105 105 */ 106 void CAxisAlgorithmZoom::updateAxisDestinationMask()107 {108 StdSize niMask = axisDest_->mask.numElements();109 StdSize iBeginMask = axisDest_->begin.getValue();110 StdSize globalIndexMask = 0;111 TransformationIndexMap& transMap = this->transformationMapping_[0];112 TransformationIndexMap::const_iterator ite = (transMap).end();113 for (StdSize idx = 0; idx < niMask; ++idx)114 {115 globalIndexMask = iBeginMask + idx;116 if (transMap.find(globalIndexMask) == ite)117 (axisDest_->mask)(idx) = false;118 }119 }106 // void CAxisAlgorithmZoom::updateAxisDestinationMask() 107 // { 108 // StdSize niMask = axisDest_->mask.numElements(); 109 // StdSize iBeginMask = axisDest_->begin.getValue(); 110 // StdSize globalIndexMask = 0; 111 // TransformationIndexMap& transMap = this->transformationMapping_[0]; 112 // TransformationIndexMap::const_iterator ite = (transMap).end(); 113 // for (StdSize idx = 0; idx < niMask; ++idx) 114 // { 115 // globalIndexMask = iBeginMask + idx; 116 // if (transMap.find(globalIndexMask) == ite) 117 // (axisDest_->mask)(idx) = false; 118 // } 119 // } 120 120 121 121 } -
XIOS/dev/dev_olga/src/transformation/axis_algorithm_zoom.hpp
r933 r1144 35 35 36 36 private: 37 void updateAxisDestinationMask();37 // void updateAxisDestinationMask(); 38 38 void updateZoom(); 39 39 -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_zoom.cpp
r1129 r1144 132 132 correct index be extracted 133 133 */ 134 void CDomainAlgorithmZoom::updateDomainDestinationMask()135 {136 int niMask = domainDest_->ni.getValue();137 int iBeginMask = domainDest_->ibegin.getValue();138 int njMask = domainDest_->nj.getValue();139 int jBeginMask = domainDest_->jbegin.getValue();140 int niGlob = domainDest_->ni_glo.getValue();141 int globalIndexMask = 0;134 // void CDomainAlgorithmZoom::updateDomainDestinationMask() 135 // { 136 // int niMask = domainDest_->ni.getValue(); 137 // int iBeginMask = domainDest_->ibegin.getValue(); 138 // int njMask = domainDest_->nj.getValue(); 139 // int jBeginMask = domainDest_->jbegin.getValue(); 140 // int niGlob = domainDest_->ni_glo.getValue(); 141 // int globalIndexMask = 0; 142 142 143 TransformationIndexMap& transMap = this->transformationMapping_[0];144 TransformationIndexMap::const_iterator ite = (transMap).end();145 for (int j = 0; j < njMask; ++j)146 {147 for (int i = 0; i < niMask; ++i)148 {149 globalIndexMask = (j+jBeginMask) * niGlob + (i + iBeginMask);150 if (transMap.find(globalIndexMask) == ite)151 (domainDest_->mask_1d)(i+j*niMask) = false;152 }153 }154 }143 // TransformationIndexMap& transMap = this->transformationMapping_[0]; 144 // TransformationIndexMap::const_iterator ite = (transMap).end(); 145 // for (int j = 0; j < njMask; ++j) 146 // { 147 // for (int i = 0; i < niMask; ++i) 148 // { 149 // globalIndexMask = (j+jBeginMask) * niGlob + (i + iBeginMask); 150 // if (transMap.find(globalIndexMask) == ite) 151 // (domainDest_->mask_1d)(i+j*niMask) = false; 152 // } 153 // } 154 // } 155 155 156 156 } -
XIOS/dev/dev_olga/src/transformation/domain_algorithm_zoom.hpp
r933 r1144 36 36 37 37 private: 38 void updateDomainDestinationMask();38 // void updateDomainDestinationMask(); 39 39 void updateZoom(); 40 40
Note: See TracChangeset
for help on using the changeset viewer.