Changeset 624 for XIOS/trunk/src/transformation/grid_transformation.cpp
- Timestamp:
- 06/22/15 13:36:37 (9 years ago)
- Location:
- XIOS/trunk/src/transformation
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/grid_transformation.cpp
r623 r624 3 3 \author Ha NGUYEN 4 4 \since 14 May 2015 5 \date 09June 20155 \date 18 June 2015 6 6 7 7 \brief Interface for all transformations. … … 62 62 } 63 63 64 /*! 65 Initialize the mapping between the first grid source and the original one 66 In a series of transformation, for each step, there is a need to "create" a new grid that plays a role of "temporary" source. 67 Because at the end of the series, we need to know about the index mapping between the final grid destination and original grid source, 68 for each transformation, we need to make sure that the current "temporary source" maps its global index correctly to the original one. 69 */ 64 70 void CGridTransformation::initializeMappingOfOriginalGridSource() 65 71 { … … 100 106 } 101 107 108 /*! 109 Initialize the algorithms (transformations) 110 */ 102 111 void CGridTransformation::initializeAlgorithms() 103 112 { … … 154 163 } 155 164 165 /*! 166 Select algorithm correspoding to its transformation type and its position in each element 167 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 168 and position of axis is 2 169 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 170 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 171 */ 156 172 void CGridTransformation::selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 157 173 { … … 159 175 } 160 176 177 /*! 178 Select algorithm of an axis correspoding to its transformation type and its position in each element 179 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 180 and position of axis is 2 181 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 182 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 183 */ 161 184 void CGridTransformation::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 162 185 { … … 188 211 } 189 212 213 /*! 214 Select algorithm of a domain correspoding to its transformation type and its position in each element 215 \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 216 and position of axis is 2 217 \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 218 \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 219 */ 190 220 void CGridTransformation::selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 191 221 { 192 193 } 194 222 } 223 224 /*! 225 Assign the current grid destination to the grid source in the new transformation. 226 The current grid destination plays the role of grid source in next transformation (if any). 227 Only element on which the transformation is performed is modified 228 \param [in] elementPositionInGrid position of element in grid 229 \param [in] transType transformation type 230 */ 195 231 void CGridTransformation::setUpGrid(int elementPositionInGrid, ETranformationType transType) 196 232 { … … 211 247 } 212 248 249 /*! 250 Perform all transformations 251 For each transformation, there are some things to do: 252 -) Chose the correct algorithm by transformation type and position of element 253 -) Calculate the mapping of global index between the current grid source and grid destination 254 -) Calculate the mapping of global index between current grid DESTINATION and ORIGINAL grid SOURCE 255 -) Make current grid destination become grid source in the next transformation 256 */ 213 257 void CGridTransformation::computeAll() 214 258 { … … 234 278 const CArray<size_t,1>& globalIndexGridDestSendToServer = distributionClientDest.getGlobalDataIndexSendToServer(); 235 279 236 std::cout << "global index grid dest send to server " << globalIndexGridDestSendToServer << std::endl;237 280 // ComputeTransformation of global index of each element 238 281 std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension(); … … 250 293 } 251 294 252 std::cout << "global index destination 0 final " << *globalIndexOfCurrentGridSource_ << std::endl;253 std::cout << "global index destination 1 final " << *globalIndexOfOriginalGridSource_ << std::endl;254 295 updateFinalGridDestination(); 255 296 computeFinalTransformationMapping(); … … 269 310 CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 270 311 const CArray<int, 1>& localMaskIndexOnClientDest = distributionClientDest.getLocalMaskIndexOnClient(); 271 std::cout << "local mask " << localMaskIndexOnClientDest << std::endl;272 273 312 const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); 274 std::cout << "global index " << globalIndexOnClientDest << std::endl; 313 275 314 CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; 276 315 itbArr = globalIndexOnClientDest.begin(); … … 308 347 } 309 348 310 std::cout << "index to modify " << *maskIndexToModify << std::endl;311 349 gridDestination_->modifyMask(*maskIndexToModify); 312 350 … … 339 377 int sendBuffSize = 0; 340 378 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize += (itSend->second).size(); 341 342 std::cout << "global index destination 0 before" << *globalIndexOfCurrentGridSource_ << std::endl;343 std::cout << "global index destination 1 before" << *globalIndexOfOriginalGridSource_ << std::endl;344 379 345 380 typedef unsigned long Scalar; … … 401 436 if (globalIndexOfCurrentGridSource_->numElements() != nbCurrentGridSource) 402 437 { 403 if ((0 != nbCurrentGridSource) && (0 != globalIndexOfCurrentGridSource_)) 404 { 405 delete globalIndexOfCurrentGridSource_; 406 globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 407 } 438 delete globalIndexOfCurrentGridSource_; 439 globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 408 440 } 409 441 410 442 if (globalIndexOfOriginalGridSource_->numElements() != nbCurrentGridSource) 411 443 { 412 if ((0 != nbCurrentGridSource) && (0 != globalIndexOfOriginalGridSource_)) 413 { 414 delete globalIndexOfOriginalGridSource_; 415 globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 416 } 444 delete globalIndexOfOriginalGridSource_; 445 globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 417 446 } 418 447 … … 434 463 } 435 464 436 std::cout << "global index destination 0 after " << *globalIndexOfCurrentGridSource_ << std::endl;437 std::cout << "global index destination 1 after " << *globalIndexOfOriginalGridSource_ << std::endl;438 465 if (0 != sendBuffSize) delete [] sendBuff; 439 466 if (0 != recvBuffSize) delete [] recvBuff; … … 475 502 const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); //gridDestination_->getDistributionClient()->getGlobalDataIndexSendToServer(); 476 503 477 std::cout << "dest: local index " << localIndexOnClientDest << std::endl;478 std::cout << "dest: global index " << globalIndexOnClientDest << std::endl;479 504 const CArray<int, 1>& localIndexOnClientSrc = distributionClientSrc.getLocalDataIndexOnClient(); //gridSource_->getDistributionClient()->getLocalDataIndexOnClient(); 480 505 const CArray<size_t,1>& globalIndexOnClientSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 481 std::cout << "src: local index " << localIndexOnClientSrc << std::endl; 482 std::cout << "src: global index " << globalIndexOnClientSrc << std::endl; 506 483 507 std::vector<size_t>::const_iterator itbVec, itVec, iteVec; 484 508 CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; … … 506 530 { 507 531 int localIdx = std::distance(itbArr, itArr); 508 (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain)509 //(*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data532 // (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 533 (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 510 534 } 511 535 } 512 536 } 513 // std::cout << "local index to receive from source Rank = " << sourceRank << (*localIndexToReceiveOnGridDest_[sourceRank][i]) << std::endl;514 537 } 515 538 … … 536 559 } 537 560 } 538 std::cout << "local index to send to dest Rank = " << destRank << (*localIndexToSendFromGridSource_[destRank]) << std::endl;539 561 } 540 562 } … … 544 566 \return local index of data 545 567 */ 546 std::map<int, CArray<int,1>* > CGridTransformation::getLocalIndexToSendFromGridSource() 568 const std::map<int, CArray<int,1>* >& CGridTransformation::getLocalIndexToSendFromGridSource() const 547 569 { 548 570 return localIndexToSendFromGridSource_; … … 553 575 \return local index of data 554 576 */ 555 std::map<int, std::vector<CArray<int,1>* > > CGridTransformation::getLocalIndexToReceiveOnGridDest() 577 const std::map<int, std::vector<CArray<int,1>* > >& CGridTransformation::getLocalIndexToReceiveOnGridDest() const 556 578 { 557 579 return localIndexToReceiveOnGridDest_;
Note: See TracChangeset
for help on using the changeset viewer.