Changeset 2303


Ignore:
Timestamp:
03/03/22 14:11:42 (2 years ago)
Author:
jderouillat
Message:

Compute transformation algorithm using source views to extract scalars from axis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.cpp

    r2270 r2303  
    5151TRY 
    5252{ 
     53  scalarDestination->mask.reset(); 
     54  scalarDestination->value.reset(); 
     55  scalarDestination->n.reset(); 
     56 
    5357  algo->checkValid(scalarDestination, axisSource); 
    5458  pos_ = algo->position; 
    55   this->transformationMapping_[0]=pos_ ; 
    5659 
     60  scalarDestination->mask.setValue( false ); // scalar do not contain data_index, WF view set looking at mask 
     61  scalarDestination->n.setValue( 0 ); 
     62 
     63  // ---------------------------- 
     64  bool scalarOnThisAxisPiece(false); 
     65  CArray<size_t,1> sourceGlobalIdx = axisSource->getLocalElement()->getGlobalIndex(); 
     66  int indexSize = sourceGlobalIdx.numElements(); 
     67  int idxSrc(-1); 
     68  for (int countSrc = 0; countSrc < indexSize ; ++countSrc) 
     69  { 
     70    if ( sourceGlobalIdx(countSrc) == pos_ ) 
     71    { 
     72      scalarOnThisAxisPiece = true; 
     73      idxSrc = countSrc; 
     74    } 
     75  } 
     76    
     77  int idxMin = INT_MAX; 
     78  for (int countSrc = 0; countSrc < indexSize ; ++countSrc) 
     79  { 
     80    if ( sourceGlobalIdx(countSrc) < idxMin ) 
     81      idxMin = sourceGlobalIdx(countSrc); 
     82  } 
     83   
     84  CArray<int,1> sourceWorkflowIdx = axisSource->getLocalView(CElementView::WORKFLOW)->getIndex(); 
     85  int srcWorkflowSize = sourceWorkflowIdx.numElements(); 
     86   
     87 
     88  if (scalarOnThisAxisPiece) 
     89  { 
     90    int iIdxSrc2 = (idxSrc+idxMin)%axisSource->n_glo; 
     91    int convert_locally_global_idx = (iIdxSrc2-idxMin) ; 
     92    bool concerned_by_WF(false); 
     93    for ( int i = 0 ; i<sourceWorkflowIdx.numElements() ; ++i ) 
     94    { 
     95      if (sourceWorkflowIdx(i)==convert_locally_global_idx) 
     96      {       
     97        concerned_by_WF = true; 
     98        break; 
     99      } 
     100    } 
     101 
     102    // Check if in WF 
     103    if (concerned_by_WF) 
     104    { 
     105      this->transformationMapping_[0]=pos_ ; 
     106      scalarDestination->mask.setValue( true ); 
     107      scalarDestination->n.setValue( 1 ); 
     108    } 
     109 
     110    if (axisSource->hasValue) 
     111    { 
     112      scalarDestination->value = axisSource->value(idxSrc); 
     113    } 
     114  } 
     115  // ---------------------------- 
     116   
    57117  scalarDestination->checkAttributes() ; 
    58118  this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; 
Note: See TracChangeset for help on using the changeset viewer.