Changeset 653 for XIOS/trunk/src/filter
- Timestamp:
- 07/24/15 16:40:06 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/filter/spatial_transform_filter.cpp
r644 r653 72 72 CContextClient* client = CContext::getCurrent()->client; 73 73 74 const std::map<int, CArray<int,1> *>& localIndexToSend = gridTransformation->getLocalIndexToSendFromGridSource();74 const std::map<int, CArray<int,1> >& localIndexToSend = gridTransformation->getLocalIndexToSendFromGridSource(); 75 75 const std::map<int, std::vector<std::vector<std::pair<int,double> > > >& localIndexToReceive = gridTransformation->getLocalIndexToReceiveOnGridDest(); 76 76 … … 78 78 79 79 // Sending data from field sources to do transformations 80 std::map<int, CArray<int,1> *>::const_iterator itbSend = localIndexToSend.begin(), itSend,81 80 std::map<int, CArray<int,1> >::const_iterator itbSend = localIndexToSend.begin(), itSend, 81 iteSend = localIndexToSend.end(); 82 82 int sendBuffSize = 0; 83 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize = (sendBuffSize < (itSend->second)->numElements())84 ? (itSend->second)->numElements(): sendBuffSize;83 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize = (sendBuffSize < itSend->second.numElements()) 84 ? itSend->second.numElements(): sendBuffSize; 85 85 double* sendBuff; 86 86 if (0 != sendBuffSize) sendBuff = new double[sendBuffSize]; … … 88 88 { 89 89 int destRank = itSend->first; 90 CArray<int,1>*localIndex_p = itSend->second;91 int countSize = localIndex_p ->numElements();90 const CArray<int,1>& localIndex_p = itSend->second; 91 int countSize = localIndex_p.numElements(); 92 92 for (int idx = 0; idx < countSize; ++idx) 93 93 { 94 sendBuff[idx] = dataSrc( (*localIndex_p)(idx));94 sendBuff[idx] = dataSrc(localIndex_p(idx)); 95 95 } 96 96 MPI_Send(sendBuff, countSize, MPI_DOUBLE, destRank, 12, client->intraComm); … … 99 99 // Receiving data on destination fields 100 100 std::map<int,std::vector<std::vector<std::pair<int,double> > > >::const_iterator itbRecv = localIndexToReceive.begin(), itRecv, 101 iteRecv = localIndexToReceive.end();101 iteRecv = localIndexToReceive.end(); 102 102 int recvBuffSize = 0; 103 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) recvBuffSize = (recvBuffSize < (itRecv->second).size())104 ? (itRecv->second).size() : recvBuffSize;103 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) recvBuffSize = (recvBuffSize < itRecv->second.size()) 104 ? itRecv->second.size() : recvBuffSize; 105 105 double* recvBuff; 106 106 if (0 != recvBuffSize) recvBuff = new double[recvBuffSize]; … … 109 109 MPI_Status status; 110 110 int srcRank = itRecv->first; 111 int countSize = (itRecv->second).size();111 int countSize = itRecv->second.size(); 112 112 MPI_Recv(recvBuff, recvBuffSize, MPI_DOUBLE, srcRank, 12, client->intraComm, &status); 113 113 for (int idx = 0; idx < countSize; ++idx) 114 114 { 115 const std::vector<std::pair<int,double> >& localIndex_p = (itRecv->second)[idx];115 const std::vector<std::pair<int,double> >& localIndex_p = itRecv->second[idx]; 116 116 int numIndex = localIndex_p.size(); 117 117 for (int i = 0; i < numIndex; ++i) 118 118 { 119 // if ( (localIndex_p)[i].first >= dataDest.numElements())120 dataDest( (localIndex_p)[i].first) += recvBuff[idx] * ((localIndex_p)[i].second);119 // if (localIndex_p[i].first >= dataDest.numElements()) 120 dataDest(localIndex_p[i].first) += recvBuff[idx] * localIndex_p[i].second; 121 121 } 122 122 }
Note: See TracChangeset
for help on using the changeset viewer.