Ignore:
Timestamp:
09/15/15 17:30:55 (9 years ago)
Author:
mhnguyen
Message:

Implementing auto-generate rectilinear domain

+) Add a new special transformation to generate (complete) rectilinear domain

Test
+) On Curie
+) test_new_feature passed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r671 r687  
    5858 
    5959  gridSource_ = CGrid::createGrid(domainSrc, axisSrc, gridDestination_->axis_domain_order); 
    60   gridSourceDimensionSize_ = gridSource_->getGlobalDimension(); 
    61   gridDestinationDimensionSize_ = gridDestination_->getGlobalDimension(); 
    6260 
    6361  initializeMappingOfOriginalGridSource(); 
     
    7775 
    7876  CDistributionClient distribution(client->clientRank, originalGridSource_); 
    79   const std::vector<size_t>& globalIndexGridDestSendToServer = distribution.getGlobalDataIndexSendToServer(); 
    80  
    81   weightOfGlobalIndexOfOriginalGridSource_.resize(globalIndexGridDestSendToServer.size()); 
    82   globalIndexOfCurrentGridSource_  = globalIndexGridDestSendToServer; 
    83   globalIndexOfOriginalGridSource_ = globalIndexGridDestSendToServer; 
     77  const std::vector<size_t>& globalIndexGridSrcSendToServer = distribution.getGlobalDataIndexSendToServer(); 
     78 
     79  weightOfGlobalIndexOfOriginalGridSource_.resize(globalIndexGridSrcSendToServer.size()); 
     80  globalIndexOfCurrentGridSource_  = globalIndexGridSrcSendToServer; 
     81  globalIndexOfOriginalGridSource_ = globalIndexGridSrcSendToServer; 
    8482  weightOfGlobalIndexOfOriginalGridSource_ = 1.0; 
    8583} 
     
    346344                               ite = listAlgos_.end(), it; 
    347345  CGenericAlgorithmTransformation* algo = 0; 
    348  
     346  int nbAgloTransformation = 0; // Only count for executed transformation. Generate domain is a special one, not executed in the list 
    349347  for (it = itb; it != ite; ++it) 
    350348  { 
     
    358356    algo = algoTransformation_.back(); 
    359357 
    360     // Recalculate the distribution of grid destination 
    361     CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
    362     const std::vector<size_t>& globalIndexGridDestSendToServer = distributionClientDest.getGlobalDataIndexSendToServer(); 
    363  
    364     // ComputeTransformation of global index of each element 
    365     std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension(); 
    366     std::vector<int> gridSrcDimensionSize = gridSource_->getGlobalDimension(); 
    367     int elementPosition = it->first; 
    368     algo->computeGlobalSourceIndex(elementPosition, 
    369                                    gridDestinationDimensionSize, 
    370                                    gridSrcDimensionSize, 
    371                                    globalIndexGridDestSendToServer, 
    372                                    globaIndexWeightFromDestToSource); 
    373  
    374     // Compute transformation of global indexes among grids 
    375     computeTransformationFromOriginalGridSource(globaIndexWeightFromDestToSource); 
    376  
    377     // Now grid destination becomes grid source in a new transformation 
    378     setUpGrid(elementPositionInGrid, transType); 
    379   } 
    380  
    381   updateFinalGridDestination(); 
    382   computeFinalTransformationMapping(); 
     358    if (0 != algo) // Only registered transformation can be executed 
     359    { 
     360      // Recalculate the distribution of grid destination 
     361      CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
     362      const std::vector<size_t>& globalIndexGridDestSendToServer = distributionClientDest.getGlobalDataIndexSendToServer(); 
     363 
     364      // ComputeTransformation of global index of each element 
     365      std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension(); 
     366      std::vector<int> gridSrcDimensionSize = gridSource_->getGlobalDimension(); 
     367      int elementPosition = it->first; 
     368      algo->computeGlobalSourceIndex(elementPosition, 
     369                                     gridDestinationDimensionSize, 
     370                                     gridSrcDimensionSize, 
     371                                     globalIndexGridDestSendToServer, 
     372                                     globaIndexWeightFromDestToSource); 
     373 
     374      // Compute transformation of global indexes among grids 
     375      computeTransformationFromOriginalGridSource(globaIndexWeightFromDestToSource); 
     376 
     377      // Now grid destination becomes grid source in a new transformation 
     378      setUpGrid(elementPositionInGrid, transType); 
     379      ++nbAgloTransformation; 
     380    } 
     381  } 
     382 
     383  if (0 != nbAgloTransformation) 
     384  { 
     385    updateFinalGridDestination(); 
     386    computeFinalTransformationMapping(); 
     387  } 
    383388} 
    384389 
Note: See TracChangeset for help on using the changeset viewer.