Changeset 2232


Ignore:
Timestamp:
09/15/21 14:41:40 (3 months ago)
Author:
jderouillat
Message:

Reconsider the workflow view to identify points to exclude from transformation definition (domain_extract)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_extract.cpp

    r2228 r2232  
    175175  if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); 
    176176 
    177  
    178177  // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) 
    179178  CArray<size_t,1> sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); 
     
    186185  CArray<int,1> sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); 
    187186  int srcWorkflowSize = sourceWorkflowIdx.numElements(); 
    188   for (size_t i = 0; i < srcWorkflowSize ; ++i) 
    189   { 
    190     { 
    191       int iIdxSrc = sourceWorkflowIdx(i)%domainSource->ni-destIBegin; 
    192       int jIdxSrc = sourceWorkflowIdx(i)/domainSource->ni-destJBegin; 
    193       int extractedSrcWFIdx = jIdxSrc * niDest + iIdxSrc; 
    194       if ((extractedSrcWFIdx>=0)&&(extractedSrcWFIdx<niDest*njDest)) 
    195       { 
    196         domainDest_->data_i_index(extractedSrcWFIdx) = extractedSrcWFIdx; 
    197       } 
    198     } 
    199   } 
    200187 
    201188  int iIdxSrcMin = INT_MAX; 
    202189  int jIdxSrcMin = INT_MAX; 
     190  int IdxMin = INT_MAX; 
    203191  for (int countSrc = 0; countSrc < indexSize ; ++countSrc) 
    204192  { 
    205       if ( sourceGlobalIdx(countSrc)%domainSource->ni_glo < iIdxSrcMin ) 
    206           iIdxSrcMin = sourceGlobalIdx(countSrc)%domainSource->ni_glo; 
    207       if ( sourceGlobalIdx(countSrc)/domainSource->ni_glo < jIdxSrcMin ) 
    208           jIdxSrcMin = sourceGlobalIdx(countSrc)/domainSource->ni_glo; 
     193    if ( sourceGlobalIdx(countSrc)%domainSource->ni_glo < iIdxSrcMin ) 
     194      iIdxSrcMin = sourceGlobalIdx(countSrc)%domainSource->ni_glo; 
     195    if ( sourceGlobalIdx(countSrc)/domainSource->ni_glo < jIdxSrcMin ) 
     196      jIdxSrcMin = sourceGlobalIdx(countSrc)/domainSource->ni_glo; 
     197    if ( sourceGlobalIdx(countSrc) < IdxMin ) 
     198      IdxMin = sourceGlobalIdx(countSrc); 
    209199  } 
    210200   
     
    223213 
    224214      // ------------------ define transformation only if in the WF ------------------  
    225       int convert_locally_global_idx = (jIdxSrc-jIdxSrcMin)*domainSource->ni + (iIdxSrc-iIdxSrcMin) ; 
     215      // countSrc+IdxMin is the global position (not index) considering the distributed memory 
     216      //     - can be compared to the workflow view 
     217      int iIdxSrc2 = (countSrc+IdxMin)%domainSource->ni_glo; 
     218      int jIdxSrc2 = (countSrc+IdxMin)/domainSource->ni_glo; 
     219      int convert_locally_global_idx = (jIdxSrc2-jIdxSrcMin)*domainSource->ni + (iIdxSrc2-iIdxSrcMin) ; 
    226220      bool concerned_by_WF(false); 
    227221      for ( int i = 0 ; i<sourceWorkflowIdx.numElements() ; ++i ) 
     
    236230      { 
    237231        transformationMapping_[extractNi_*(jIdxSrc-extractJBegin_)+iIdxSrc-extractIBegin_]=sourceGlobalIdx(countSrc); 
     232        domainDest_->data_i_index( countDest ) = countDest; 
    238233      } 
    239234      // ----------------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.