Changeset 731 for XIOS/trunk/src/node/grid.cpp
- Timestamp:
- 10/13/15 15:14:23 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/grid.cpp
r721 r731 84 84 } 85 85 86 std::map<int, StdSize> CGrid::getConnectedServerDataSize() 87 { 88 double secureFactor = 2.5 * sizeof(double) * CXios::bufferSizeFactor; 89 StdSize retVal = 1; 90 std::map<int, StdSize> ret; 91 std::map<int, size_t >::const_iterator itb = connectedDataSize_.begin(), it, itE = connectedDataSize_.end(); 92 93 if (isScalarGrid()) 86 /*! 87 * Compute the minimum buffer size required to send the attributes to the server(s). 88 * 89 * \return A map associating the server rank with its minimum buffer size. 90 */ 91 std::map<int, StdSize> CGrid::getAttributesBufferSize() 92 { 93 std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(); 94 95 // The grid indexes require a similar size as the actual data 96 std::map<int, StdSize> dataSizes = getDataBufferSize(); 97 std::map<int, StdSize>::iterator it, itE = dataSizes.end(); 98 for (it = dataSizes.begin(); it != itE; ++it) 94 99 { 95 for (it = itb; it != itE; ++it) 100 it->second += 2 * sizeof(bool); 101 if (it->second > attributesSizes[it->first]) 102 attributesSizes[it->first] = it->second; 103 } 104 105 // Account for the axis attributes 106 std::vector<CAxis*> axisList = getAxis(); 107 for (size_t i = 0; i < axisList.size(); ++i) 108 { 109 std::map<int, StdSize> axisAttBuffSize = axisList[i]->getAttributesBufferSize(); 110 for (it = axisAttBuffSize.begin(), itE = axisAttBuffSize.end(); it != itE; ++it) 96 111 { 97 retVal *= secureFactor; 98 ret.insert(std::make_pair(it->first, retVal)); 99 } 100 return ret; 101 } 102 103 for (it = itb; it != itE; ++it) 104 { 105 retVal = it->second; 106 retVal *= secureFactor; 107 ret.insert(std::make_pair<int,StdSize>(it->first, retVal)); 108 } 109 110 if (connectedDataSize_.empty()) 111 { 112 for (int i = 0; i < connectedServerRank_.size(); ++i) 113 { 114 retVal = 1; 115 retVal *= secureFactor; 116 ret.insert(std::make_pair<int,StdSize>(connectedServerRank_[i], retVal)); 112 if (it->second > attributesSizes[it->first]) 113 attributesSizes[it->first] = it->second; 117 114 } 118 115 } 119 116 120 // In some cases in which domain is masked, we need to count for connected server for longitude and latitude121 std::vector<CDomain*> domList P = this->getDomains();122 if (!domListP.empty())117 // Account for the domain attributes 118 std::vector<CDomain*> domList = getDomains(); 119 for (size_t i = 0; i < domList.size(); ++i) 123 120 { 124 for (int i = 0; i < domListP.size(); ++i) 121 std::map<int, StdSize> domAttBuffSize = domList[i]->getAttributesBufferSize(); 122 for (it = domAttBuffSize.begin(), itE = domAttBuffSize.end(); it != itE; ++it) 125 123 { 126 const std::map<int, vector<size_t> >& indexDomainServer = domListP[i]->getIndexServer(); 127 std::map<int, vector<size_t> >::const_iterator itDom = indexDomainServer.begin(), iteDom = indexDomainServer.end(); 128 for (; itDom != iteDom; ++itDom) 129 { 130 if (ret.end() == ret.find(itDom->first)) 131 { 132 retVal = (itDom->second).size(); 133 retVal *= secureFactor; 134 ret.insert(std::make_pair<int,StdSize>(itDom->first, retVal)); 135 } 136 } 124 if (it->second > attributesSizes[it->first]) 125 attributesSizes[it->first] = it->second; 137 126 } 138 127 } 139 140 return ret; 128 129 return attributesSizes; 130 } 131 132 /*! 133 * Compute the minimum buffer size required to send the data to the server(s). 134 * 135 * \param id the id used to tag the data 136 * \return A map associating the server rank with its minimum buffer size. 137 */ 138 std::map<int, StdSize> CGrid::getDataBufferSize(const std::string& id /*= ""*/) 139 { 140 std::map<int, StdSize> dataSizes; 141 const size_t extraSize = CEventClient::headerSize + (id.empty() ? getId() : id).size() + sizeof(size_t); 142 143 std::map<int, size_t>::const_iterator itb = connectedDataSize_.begin(), it, itE = connectedDataSize_.end(); 144 for (it = itb; it != itE; ++it) 145 dataSizes.insert(std::make_pair(it->first, extraSize + CArray<double,1>::size(it->second))); 146 147 return dataSizes; 141 148 } 142 149
Note: See TracChangeset
for help on using the changeset viewer.