Changeset 2226


Ignore:
Timestamp:
09/09/21 13:05:36 (3 years ago)
Author:
jderouillat
Message:

Implement a data_i_index computing which only depends on source workflow view

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm
Files:
2 edited

Legend:

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

    r2190 r2226  
    175175  if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); 
    176176 
     177 
    177178  // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) 
    178179  CArray<size_t,1> sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); 
    179180  int indexSize = sourceGlobalIdx.numElements(); 
    180   domainDest_->mask_1d.resize(niDest*njDest); 
     181  domainDest_->data_i_index.resize(niDest*njDest); 
     182  domainDestination->data_i_index = -1;  
     183  domainDest_->data_j_index.resize(niDest*njDest); 
     184  domainDestination->data_j_index = 0;  
     185 
    181186  CArray<int,1> sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); 
    182   CArray<int,1> sourceFullIdx     = domainSource->getLocalView(CElementView::FULL    )->getIndex(); 
     187  int srcWorkflowSize = sourceWorkflowIdx.numElements(); 
     188  for (size_t i = 0; i < srcWorkflowSize ; ++i) 
     189  { 
     190    { 
     191      int iIdxSrc = sourceWorkflowIdx(i)%domainSource->ni_glo-destIBegin; 
     192      int jIdxSrc = sourceWorkflowIdx(i)/domainSource->ni_glo-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  } 
    183200   
    184201  int countDest(0); // increment of the position in destination domain  
    185   int countMasked(0); // countMasked will store the offset index between full and workflow views 
    186202  for (int countSrc = 0; countSrc < indexSize ; ++countSrc) { 
    187203    int iIdxSrc = sourceGlobalIdx(countSrc)%domainSource->ni_glo; 
     
    195211      domainDest_->j_index(countDest) = jIdxSrc-extractJBegin_; 
    196212      transformationMapping_[extractNi_*(jIdxSrc-extractJBegin_)+iIdxSrc-extractIBegin_]=sourceGlobalIdx(countSrc); 
    197       if ( ( (countSrc-countMasked) >= sourceWorkflowIdx.numElements() ) 
    198          || ( sourceFullIdx(countSrc)!=sourceWorkflowIdx(countSrc-countMasked) ) ) 
    199       { 
    200         domainDest_->mask_1d(countDest) = 0; 
    201         // if point masked, manage offset between full and worfklow views of domainSource 
    202         countMasked++; 
    203       } 
    204       else { 
    205         domainDest_->mask_1d(countDest) = 1; 
    206       } 
    207213 
    208214      int iIdxDestLocal = countDest%niDest; 
     
    262268      countDest++; 
    263269    } 
    264     else 
    265       if ( ( (countSrc-countMasked) >= sourceWorkflowIdx.numElements() ) 
    266          || ( sourceFullIdx(countSrc)!=sourceWorkflowIdx(countSrc-countMasked) ) ) 
    267       { 
    268         // manage offset between full and worfklow views of domainSource even if point i is not concerned 
    269         countMasked++; 
    270       } 
    271270 
    272271  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp

    r2190 r2226  
    9494   domainDestination->i_index.resize( indexSize ); 
    9595   domainDestination->j_index.resize( indexSize ); 
    96    for (size_t i = 0; i < indexSize ; ++i) { 
     96   for (size_t i = 0; i < indexSize ; ++i) 
     97   { 
    9798     domainDestination->i_index(i) = sourceGlobalIdx(i)%domainSource->ni_glo; 
    9899     domainDestination->j_index(i) = sourceGlobalIdx(i)/domainSource->ni_glo; 
     
    104105   //   - domainDestination->j_index = 0; 
    105106 
    106    // set mask_1d to enable domainMask computing (in checkMask())  
     107   // set data_i_index to enable localMask computing (in computeLocalMask()), used to compute Workflow View 
    107108   CArray<int,1> sourceWorkflowIdx = domainSource->getLocalView(CElementView::WORKFLOW)->getIndex(); 
    108    CArray<int,1> sourceFullIdx     = domainSource->getLocalView(CElementView::FULL    )->getIndex(); 
    109    domainDestination->mask_1d.resize( indexSize ); 
    110    int countMasked(0); // countMasked will store the offset index between full and workflow views 
    111    for (size_t i = 0; i < indexSize ; ++i) { 
    112        if ( ( (i-countMasked) >= sourceWorkflowIdx.numElements() ) 
    113          || ( sourceFullIdx(i)!=sourceWorkflowIdx(i-countMasked) ) ) { 
    114        domainDestination->mask_1d(i) = 0; 
    115        countMasked++; 
    116      } 
    117      else { 
    118        domainDestination->mask_1d(i) = 1; 
    119      } 
     109   domainDestination->data_i_index.resize( indexSize ); 
     110   domainDestination->data_i_index = -1;  
     111   domainDestination->data_j_index.resize( indexSize ); 
     112   domainDestination->data_j_index = 0;  
     113   int srcWorkflowSize = sourceWorkflowIdx.numElements(); 
     114   for (size_t i = 0; i < srcWorkflowSize ; ++i) 
     115   { 
     116     domainDestination->data_i_index(sourceWorkflowIdx(i)) = sourceWorkflowIdx(i); 
    120117   } 
    121118 
Note: See TracChangeset for help on using the changeset viewer.