Changeset 1178 for XIOS/dev/dev_olga/src
- Timestamp:
- 06/21/17 14:47:11 (7 years ago)
- Location:
- XIOS/dev/dev_olga/src/node
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/grid.cpp
r1165 r1178 287 287 nbSrvPools = 1; 288 288 for (int p = 0; p < nbSrvPools; ++p) 289 { 290 if (isScalarGrid()) 291 { 292 if (context->hasClient) 293 if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 294 295 if (this->isChecked) continue; 296 297 if (context->hasClient) 298 { 299 this->computeIndexScalarGrid(); 300 } 301 302 if (!(this->hasTransform() && !this->isTransformed())) 303 this->isChecked = true; 304 continue; 305 } 306 307 if (context->hasClient) 308 { 309 if (this->isChecked && doSendingIndex && !isIndexSent) 310 {sendIndex(); this->isIndexSent = true;} 289 { 290 if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent) 291 { 292 if (isScalarGrid()) 293 sendIndexScalarGrid(); 294 else 295 sendIndex(); 296 this->isIndexSent = true; 311 297 } 312 298 … … 551 537 if (computedWrittenIndex_) return; 552 538 computedWrittenIndex_ = true; 539 540 if (isScalarGrid()) 541 { 542 size_t nbWritten = 1; 543 int writtenIndex = 0; 544 545 localIndexToWriteOnClient.resize(nbWritten); 546 localIndexToWriteOnServer.resize(nbWritten); 547 localIndexToWriteOnServer(0) = writtenIndex; 548 localIndexToWriteOnClient(0) = writtenIndex; 549 550 return; 551 } 553 552 554 553 size_t nbWritten = 0, indGlo; … … 751 750 { 752 751 CContext* context = CContext::getCurrent(); 753 computeClientIndex(); 754 if (context->hasClient) 752 if (isScalarGrid()) 755 753 { 756 computeConnectedClients(); 754 computeClientIndexScalarGrid(); 755 if (context->hasClient) 756 { 757 computeConnectedClientsScalarGrid(); 758 } 759 } 760 else 761 { 762 computeClientIndex(); 763 if (context->hasClient) 764 { 765 computeConnectedClients(); 766 } 757 767 } 758 768 } … … 1176 1186 } 1177 1187 1178 void CGrid::computeIndexScalarGrid() 1188 void CGrid::computeClientIndexScalarGrid() 1189 { 1190 CContext* context = CContext::getCurrent(); 1191 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; // This should be changed soon 1192 for (int p = 0; p < nbSrvPools; ++p) 1193 { 1194 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 1195 : context->client; 1196 1197 storeIndex_client.resize(1); 1198 storeIndex_client(0) = 0; 1199 1200 if (0 != serverDistribution_) 1201 { 1202 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(), 1203 ite = outGlobalIndexFromClient.end(), it; 1204 for (it = itb; it != ite; ++it) 1205 { 1206 int rank = it->first; 1207 CArray<size_t,1>& globalIndex = outGlobalIndexFromClient[rank]; 1208 outLocalIndexStoreOnClient.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 1209 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient[rank]; 1210 if (1 != globalIndex.numElements()) 1211 ERROR("void CGrid::computeClientIndexScalarGrid()", 1212 << "Something wrong happened. " 1213 << "Number of received global index on scalar grid should equal to 1" 1214 << "Number of received global index " << globalIndex.numElements() << "."); 1215 1216 localIndex(0) = globalIndex(0); 1217 } 1218 } 1219 } 1220 } 1221 1222 void CGrid::computeConnectedClientsScalarGrid() 1179 1223 { 1180 1224 CContext* context = CContext::getCurrent(); … … 1186 1230 for (int p = 0; p < nbSrvPools; ++p) 1187 1231 { 1188 CContextClient* client = context->hasServer ? context->clientPrimServer[p] : context->client; 1189 1190 storeIndex_client.resize(1); 1191 storeIndex_client(0) = 0; 1232 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 1233 : context->client; 1192 1234 1193 1235 connectedServerRank_[p].clear(); 1194 1236 1195 if (0 == client->clientRank) 1196 { 1197 for (int rank = 0; rank < client->serverSize; ++rank) 1198 { 1237 if (client->isServerLeader()) 1238 { 1239 const std::list<int>& ranks = client->getRanksServerLeader(); 1240 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1241 { 1242 int rank = *itRank; 1243 int nb = 1; 1199 1244 connectedServerRank_[p].push_back(rank); 1200 connectedDataSize_[p][rank] = 1; 1201 nbSenders[p][rank] = 1; 1202 } 1203 } 1245 connectedDataSize_[p][rank] = nb; 1246 nbSenders[p][rank] = nb; 1247 } 1248 } 1249 else 1250 { 1251 const std::list<int>& ranks = client->getRanksServerNotLeader(); 1252 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1253 { 1254 int rank = *itRank; 1255 int nb = 1; 1256 connectedServerRank_[p].push_back(rank); 1257 connectedDataSize_[p][rank] = nb; 1258 nbSenders[p][rank] = nb; 1259 } 1260 } 1261 1204 1262 isDataDistributed_ = false; 1205 1263 } -
XIOS/dev/dev_olga/src/node/grid.hpp
r1165 r1178 278 278 void computeClientIndex(); 279 279 void computeConnectedClients(); 280 void computeClientIndexScalarGrid(); 281 void computeConnectedClientsScalarGrid(); 280 282 281 283 private:
Note: See TracChangeset
for help on using the changeset viewer.