- Timestamp:
- 09/01/17 13:39:53 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/config/grid_attribute.conf
r932 r1250 2 2 DECLARE_ATTRIBUTE(StdString, description) 3 3 4 DECLARE_ARRAY(bool, 1, mask_1d )5 DECLARE_ARRAY(bool, 2, mask_2d )6 DECLARE_ARRAY(bool, 3, mask_3d )7 DECLARE_ARRAY(bool, 4, mask_4d )8 DECLARE_ARRAY(bool, 5, mask_5d )9 DECLARE_ARRAY(bool, 6, mask_6d )10 DECLARE_ARRAY(bool, 7, mask_7d )4 DECLARE_ARRAY(bool, 1, mask_1d, false) 5 DECLARE_ARRAY(bool, 2, mask_2d, false) 6 DECLARE_ARRAY(bool, 3, mask_3d, false) 7 DECLARE_ARRAY(bool, 4, mask_4d, false) 8 DECLARE_ARRAY(bool, 5, mask_5d, false) 9 DECLARE_ARRAY(bool, 6, mask_6d, false) 10 DECLARE_ARRAY(bool, 7, mask_7d, false) 11 11 12 // Meaningless, only server for coherent purpose (for scalar grid) 13 DECLARE_ARRAY(bool, 1, mask_0d, false) 12 14 13 15 // An array contains order of axis and domains composing of the grid -
XIOS/dev/XIOS_DEV_CMIP6/src/distribution_client.cpp
r1158 r1250 478 478 localDataIndex_.resize(indexLocalDataOnClientCount); 479 479 localMaskIndex_.resize(indexSend2ServerCount); 480 localMaskedDataIndex_.resize(indexSend2ServerCount); 480 481 globalDataIndex_.rehash(std::ceil(indexLocalDataOnClientCount/globalDataIndex_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount); 481 482 globalLocalDataSendToServerMap_.rehash(std::ceil(indexSend2ServerCount/globalLocalDataSendToServerMap_.max_load_factor())); //globalLocalDataSendToServerMap_.reserve(indexSend2ServerCount); … … 561 562 globalLocalDataSendToServerMap_[globalIndex] = indexLocalDataOnClientCount; 562 563 localMaskIndex_[indexSend2ServerCount] = gridMaskIndex; 564 localMaskedDataIndex_[indexSend2ServerCount] = indexLocalDataOnClientCount; 563 565 ++indexSend2ServerCount; 564 566 } … … 653 655 } 654 656 657 /*! 658 Return local mask index of client 659 */ 660 const std::vector<int>& CDistributionClient::getLocalMaskedDataIndexOnClient() 661 { 662 if (!isComputed_) createGlobalIndexSendToServer(); 663 return localMaskedDataIndex_; 664 } 665 655 666 } // namespace xios -
XIOS/dev/XIOS_DEV_CMIP6/src/distribution_client.hpp
r1144 r1250 45 45 GlobalLocalDataMap& getGlobalDataIndexOnClient(); 46 46 const std::vector<int>& getLocalMaskIndexOnClient(); 47 const std::vector<int>& getLocalMaskedDataIndexOnClient(); 47 48 48 49 std::vector<int> getNGlob() { return nGlob_; } … … 82 83 std::vector<int> localDataIndex_; 83 84 std::vector<int> localMaskIndex_; 85 std::vector<int> localMaskedDataIndex_; 84 86 85 87 private: -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/source_filter.cpp
r1249 r1250 32 32 packet->status = CDataPacket::NO_ERROR; 33 33 34 packet->data.resize(grid->storeIndex_client.numElements()); 35 grid->inputField(data, packet->data) ; 34 packet->data.resize(grid->storeIndex_client.numElements()); 35 36 if (compression) 37 { 38 packet->data = defaultValue; 39 grid->uncompressField(data, packet->data); 40 } 41 else 42 grid->inputField(data, packet->data); 43 44 45 36 46 // if (compression) grid->inputField(data, packet->data) ; 37 47 // else -
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp
r1248 r1250 950 950 { 951 951 if (!instantDataFilter) 952 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false));952 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true)); 953 953 954 954 // If the field data is to be read by the client or/and written to a file … … 965 965 { 966 966 if (!instantDataFilter) 967 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false));967 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true)); 968 968 969 969 // If the field data is to be read by the client or/and written to a file … … 1016 1016 { 1017 1017 if (check_if_active.isEmpty()) check_if_active = false; 1018 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, NoneDu, false,1018 instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 1019 1019 detectMissingValues, defaultValue)); 1020 1020 } -
XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.cpp
r1239 r1250 89 89 { 90 90 std::vector<int> dataNindex = clientDistribution_->getDataNIndex(); 91 for (int i = 0; i < dataNindex.size(); ++i) retvalue *= dataNindex[i]; 91 for (int i = 0; i < dataNindex.size(); ++i) retvalue *= dataNindex[i]; 92 92 } 93 93 return retvalue; … … 339 339 340 340 // TODO: Transfer grid attributes 341 if (!context->hasClient && context->hasServer) this->createMask();341 //if (!context->hasClient && context->hasServer) this->createMask(); 342 342 this->computeIndex(); 343 343 … … 447 447 448 448 switch (dim) { 449 case 0: 450 modifyGridMask(mask_0d, indexToModify, modifyValue); 451 break; 449 452 case 1: 450 453 modifyGridMask(mask_1d, indexToModify, modifyValue); … … 485 488 486 489 switch (dim) { 490 case 0: 491 modifyGridMaskSize(mask_0d, newDimensionSize, newValue); 492 break; 487 493 case 1: 488 494 modifyGridMaskSize(mask_1d, newDimensionSize, newValue); … … 1253 1259 } 1254 1260 1261 void CGrid::uncompressField_arr(const double* const data, CArray<double, 1>& out) const 1262 { 1263 const std::vector<int>& localMaskedDataIndex = clientDistribution_->getLocalMaskedDataIndexOnClient(); 1264 const int size = localMaskedDataIndex.size(); 1265 1266 for(int i = 0; i < size; ++i) out(localMaskedDataIndex[i]) = data[i]; 1267 } 1268 1255 1269 void CGrid::computeClientIndexScalarGrid() 1256 1270 { … … 1261 1275 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 1262 1276 : context->client; 1277 1278 int rank = client->clientRank; 1279 1280 clientDistribution_ = new CDistributionClient(rank, this); 1263 1281 1264 1282 storeIndex_client.resize(1); … … 1688 1706 } 1689 1707 else // scalar 1690 { 1708 { 1691 1709 } 1692 1710 } 1693 1711 1694 modifyMaskSize(nSize, true); 1712 if (nSize.empty()) // Scalar grid 1713 { 1714 nBegin.push_back(0); 1715 nSize.push_back(1); 1716 nBeginGlobal.push_back(0); 1717 nGlob.push_back(1); 1718 } 1719 1720 modifyMaskSize(nSize, false); 1721 1695 1722 // These below codes are reserved for future 1696 //CDistributionServer srvDist(server->intraCommRank, nBegin, nSize, nBeginGlobal, nGlob);1697 //map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(),1698 //ite = outGlobalIndexFromClient.end(), it;1699 //const CDistributionServer::GlobalLocalMap& globalLocalMask = srvDist.getGlobalLocalIndex();1700 //CDistributionServer::GlobalLocalMap::const_iterator itSrv;1701 //size_t nb = 0;1702 //for (it = itb; it != ite; ++it)1703 //{1704 //CArray<size_t,1>& globalInd = it->second;1705 //for (size_t idx = 0; idx < globalInd.numElements(); ++idx)1706 //{1707 //if (globalLocalMask.end() != globalLocalMask.find(globalInd(idx))) ++nb;1708 //}1709 //}1723 CDistributionServer srvDist(server->intraCommRank, nBegin, nSize, nBeginGlobal, nGlob); 1724 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(), 1725 ite = outGlobalIndexFromClient.end(), it; 1726 const CDistributionServer::GlobalLocalMap& globalLocalMask = srvDist.getGlobalLocalIndex(); 1727 CDistributionServer::GlobalLocalMap::const_iterator itSrv; 1728 size_t nb = 0; 1729 for (it = itb; it != ite; ++it) 1730 { 1731 CArray<size_t,1>& globalInd = it->second; 1732 for (size_t idx = 0; idx < globalInd.numElements(); ++idx) 1733 { 1734 if (globalLocalMask.end() != globalLocalMask.find(globalInd(idx))) ++nb; 1735 } 1736 } 1710 1737 1711 //CArray<int,1> indexToModify(nb);1712 //nb = 0;1713 //for (it = itb; it != ite; ++it)1714 //{1715 //CArray<size_t,1>& globalInd = it->second;1716 //for (size_t idx = 0; idx < globalInd.numElements(); ++idx)1717 //{1718 //itSrv = globalLocalMask.find(globalInd(idx));1719 //if (globalLocalMask.end() != itSrv)1720 //{1721 //indexToModify(nb) = itSrv->second;1722 //++nb;1723 //}1724 //}1725 //}1726 1727 //modifyMask(indexToModify, true);1738 CArray<int,1> indexToModify(nb); 1739 nb = 0; 1740 for (it = itb; it != ite; ++it) 1741 { 1742 CArray<size_t,1>& globalInd = it->second; 1743 for (size_t idx = 0; idx < globalInd.numElements(); ++idx) 1744 { 1745 itSrv = globalLocalMask.find(globalInd(idx)); 1746 if (globalLocalMask.end() != itSrv) 1747 { 1748 indexToModify(nb) = itSrv->second; 1749 ++nb; 1750 } 1751 } 1752 } 1753 1754 modifyMask(indexToModify, true); 1728 1755 } 1729 1756 -
XIOS/dev/XIOS_DEV_CMIP6/src/node/grid.hpp
r1243 r1250 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; 97 void outputField(const CArray<double,1>& stored, CArray<double,n>& field) const; 98 template <int n> 99 void uncompressField(const CArray<double,n>& data, CArray<double,1>& outData) const; 98 100 99 101 virtual void parse(xml::CXMLNode& node); … … 252 254 void storeField_arr(const double* const data, CArray<double, 1>& stored) const; 253 255 void restoreField_arr(const CArray<double, 1>& stored, double* const data) const; 256 void uncompressField_arr(const double* const data, CArray<double, 1>& outData) const; 254 257 255 258 void setVirtualDomainGroup(CDomainGroup* newVDomainGroup); … … 353 356 << "Grid = " << this->GetName()) 354 357 this->restoreField_arr(stored, field.dataFirst()); 358 } 359 360 /*! 361 This function removes the effect of mask on received data on the server. 362 This function only serve for the checking purpose. TODO: Something must be done to seperate mask and data_index from each other in received data 363 \data data received data with masking effect on the server 364 \outData data without masking effect 365 */ 366 template <int N> 367 void CGrid::uncompressField(const CArray<double,N>& data, CArray<double,1>& outData) const 368 { 369 uncompressField_arr(data.dataFirst(), outData); 355 370 } 356 371
Note: See TracChangeset
for help on using the changeset viewer.