Changeset 867 for XIOS/trunk/src/transformation/grid_transformation.cpp
- Timestamp:
- 06/09/16 11:33:19 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/transformation/grid_transformation.cpp
- Property svn:executable set to *
r862 r867 15 15 #include "context.hpp" 16 16 #include "context_client.hpp" 17 #include "transformation_mapping.hpp"18 17 #include "axis_algorithm_transformation.hpp" 19 18 #include "distribution_client.hpp" 20 19 #include "mpi_tag.hpp" 20 #include "grid.hpp" 21 21 #include <boost/unordered_map.hpp> 22 22 … … 24 24 CGridTransformation::CGridTransformation(CGrid* destination, CGrid* source) 25 25 : gridSource_(source), gridDestination_(destination), originalGridSource_(source), 26 algoTypes_(), nbAlgos_(0), currentGridIndexToOriginalGridIndex_(),tempGrids_(),26 algoTypes_(), nbAlgos_(0), tempGrids_(), 27 27 auxInputs_(), dynamicalTransformation_(false), timeStamp_() 28 28 … … 45 45 } 46 46 47 initialize MappingOfOriginalGridSource();47 initializeTransformations(); 48 48 } 49 49 … … 54 54 for each transformation, we need to make sure that the current "temporary source" maps its global index correctly to the original one. 55 55 */ 56 void CGridTransformation::initialize MappingOfOriginalGridSource()56 void CGridTransformation::initializeTransformations() 57 57 { 58 58 CContext* context = CContext::getCurrent(); … … 95 95 { 96 96 axisPositionInGrid.push_back(i); 97 // axisPositionInGrid.push_back(idx);98 // ++idx;99 97 } 100 98 else 101 99 { 102 100 domPositionInGrid.push_back(i); 103 // ++idx;104 // domPositionInGrid.push_back(idx);105 // ++idx;106 101 } 107 102 } … … 123 118 { 124 119 initializeAxisAlgorithms(i); 125 // initializeAxisAlgorithms(idx);126 // ++idx;127 120 } 128 121 else 129 122 { 130 123 initializeDomainAlgorithms(i); 131 // ++idx;132 // initializeDomainAlgorithms(idx);133 // ++idx;134 124 } 135 125 } … … 357 347 -) Chose the correct algorithm by transformation type and position of element 358 348 -) Calculate the mapping of global index between the current grid source and grid destination 359 -) Calculate the mapping of global index between current grid DESTINATION and ORIGINALgrid SOURCE349 -) Calculate the mapping of global index between current grid DESTINATION and grid SOURCE 360 350 -) Make current grid destination become grid source in the next transformation 361 351 */ 362 //void CGridTransformation::computeAll(const std::vector<CArray<double,1>* >& dataAuxInputs, Time timeStamp)363 //{364 // if (nbAlgos_ < 1) return;365 // if (!auxInputs_.empty() && !dynamicalTransformation_) { dynamicalTransformation_ = true; return; }366 // if (dynamicalTransformation_)367 // {368 // if (timeStamp_.insert(timeStamp).second)369 // DestinationIndexMap().swap(currentGridIndexToOriginalGridIndex_); // Reset map370 // else371 // return;372 // }373 //374 // CContext* context = CContext::getCurrent();375 // CContextClient* client = context->client;376 //377 // ListAlgoType::const_iterator itb = listAlgos_.begin(),378 // ite = listAlgos_.end(), it;379 //380 // CGenericAlgorithmTransformation* algo = 0;381 // int nbAgloTransformation = 0; // Only count for executed transformation. Generate domain is a special one, not executed in the list382 // for (it = itb; it != ite; ++it)383 // {384 // int elementPositionInGrid = it->first;385 // ETranformationType transType = (it->second).first;386 // int transformationOrder = (it->second).second;387 // DestinationIndexMap globaIndexWeightFromDestToSource;388 //389 // // First of all, select an algorithm390 // if (!dynamicalTransformation_ || (algoTransformation_.size() < listAlgos_.size()))391 // {392 // selectAlgo(elementPositionInGrid, transType, transformationOrder, algoTypes_[std::distance(itb, it)]);393 // algo = algoTransformation_.back();394 // }395 // else396 // algo = algoTransformation_[std::distance(itb, it)];397 //398 // if (0 != algo) // Only registered transformation can be executed399 // {400 // algo->computeIndexSourceMapping(dataAuxInputs);401 //402 // // Recalculate the distribution of grid destination403 // CDistributionClient distributionClientDest(client->clientRank, gridDestination_);404 // const CDistributionClient::GlobalLocalDataMap& globalLocalIndexGridDestSendToServer = distributionClientDest.getGlobalLocalDataSendToServer();405 //406 // // ComputeTransformation of global index of each element407 // std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension();408 // std::vector<int> gridSrcDimensionSize = gridSource_->getGlobalDimension();409 // int elementPosition = it->first;410 // algo->computeGlobalSourceIndex(elementPosition,411 // gridDestinationDimensionSize,412 // gridSrcDimensionSize,413 // globalLocalIndexGridDestSendToServer,414 // globaIndexWeightFromDestToSource);415 //416 // // Compute transformation of global indexes among grids417 // computeTransformationMapping(globaIndexWeightFromDestToSource);418 //419 // // Update number of local index on each transformation420 // nbLocalIndexOnGridDest_.push_back(globalLocalIndexGridDestSendToServer.size());421 //422 // if (1 < nbAlgos_)423 // {424 // // Now grid destination becomes grid source in a new transformation425 // if (nbAgloTransformation != (nbAlgos_-1)) setUpGrid(elementPositionInGrid, transType, nbAgloTransformation);426 // }427 // ++nbAgloTransformation;428 // }429 // }430 //}431 432 352 void CGridTransformation::computeAll(const std::vector<CArray<double,1>* >& dataAuxInputs, Time timeStamp) 433 353 { … … 436 356 if (dynamicalTransformation_) 437 357 { 438 if (timeStamp_.insert(timeStamp).second) 439 { 440 DestinationIndexMap().swap(currentGridIndexToOriginalGridIndex_); // Reset map 441 std::list<size_t>().swap(nbLocalIndexOnGridDest_); 358 if (timeStamp_.insert(timeStamp).second) //Reset map 359 { 442 360 std::list<SendingIndexGridSourceMap>().swap(localIndexToSendFromGridSource_); 443 361 std::list<RecvIndexGridDestinationMap>().swap(localIndexToReceiveOnGridDest_); 444 } 362 std::list<size_t>().swap(nbLocalIndexOnGridDest_); 363 } 445 364 else 446 365 return; … … 555 474 } 556 475 557 558 559 476 // Sending global index of grid source to corresponding process as well as the corresponding mask 560 477 std::vector<MPI_Request> requests; … … 720 637 } 721 638 722 ///*!723 // Compute exchange index between grid source and grid destination724 // \param [in] globalIndexWeightFromDestToSource global index mapping between grid destination and grid source725 //*/726 //void CGridTransformation::computeTransformationMapping(const DestinationIndexMap& globalIndexWeightFromDestToSource)727 //{728 // CContext* context = CContext::getCurrent();729 // CContextClient* client = context->client;730 //731 // CTransformationMapping transformationMap(gridDestination_, gridSource_);732 //733 // transformationMap.computeTransformationMapping(globalIndexWeightFromDestToSource);734 //735 // const CTransformationMapping::ReceivedIndexMap& globalIndexToReceive = transformationMap.getGlobalIndexReceivedOnGridDestMapping();736 // CTransformationMapping::ReceivedIndexMap::const_iterator itbMapRecv, itMapRecv, iteMapRecv;737 // itbMapRecv = globalIndexToReceive.begin();738 // iteMapRecv = globalIndexToReceive.end();739 // localIndexToReceiveOnGridDest_.push_back(RecvIndexGridDestinationMap());740 // RecvIndexGridDestinationMap& recvTmp = localIndexToReceiveOnGridDest_.back();741 // for (itMapRecv = itbMapRecv; itMapRecv != iteMapRecv; ++itMapRecv)742 // {743 // int sourceRank = itMapRecv->first;744 // int numGlobalIndex = (itMapRecv->second).size();745 // recvTmp[sourceRank].resize(numGlobalIndex);746 // for (int i = 0; i < numGlobalIndex; ++i)747 // {748 // recvTmp[sourceRank][i] = make_pair((itMapRecv->second)[i].localIndex,(itMapRecv->second)[i].weight);749 // }750 // }751 //752 // // Find out local index on grid source (to send)753 // const CTransformationMapping::SentIndexMap& globalIndexToSend = transformationMap.getGlobalIndexSendToGridDestMapping();754 // CTransformationMapping::SentIndexMap::const_iterator itbMap, itMap, iteMap;755 // itbMap = globalIndexToSend.begin();756 // iteMap = globalIndexToSend.end();757 // localIndexToSendFromGridSource_.push_back(SendingIndexGridSourceMap());758 // SendingIndexGridSourceMap& tmpSend = localIndexToSendFromGridSource_.back();759 // for (itMap = itbMap; itMap != iteMap; ++itMap)760 // {761 // int destRank = itMap->first;762 // int vecSize = itMap->second.size();763 // tmpSend[destRank].resize(vecSize);764 // for (int idx = 0; idx < vecSize; ++idx)765 // {766 // tmpSend[destRank](idx) = itMap->second[idx].first;767 // }768 // }769 //}770 771 639 bool CGridTransformation::isSpecialTransformation(ETranformationType transType) 772 640 {
Note: See TracChangeset
for help on using the changeset viewer.