Ignore:
Timestamp:
01/03/21 18:00:43 (4 years ago)
Author:
ymipsl
Message:

Adapt transformation algorithm to new infrastructure (on going...)

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_inverse.cpp

    r1988 r1999  
    4949 
    5050CAxisAlgorithmInverse::CAxisAlgorithmInverse(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInverseAxis* inverseAxis) 
    51  : CAxisAlgorithmTransformation(isSource, axisDestination, axisSource) 
     51 : CAlgorithmTransformationTransfer(isSource), axisDest_(axisDestination), axisSrc_(axisSource) 
    5252TRY 
    5353{ 
     
    5959           << "Size of axis destination " <<axisDestination->getId() << " is " << axisDestination->n_glo.getValue()); 
    6060  } 
    61 } 
    62 CATCH 
    63  
    64 void CAxisAlgorithmInverse::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    65 TRY 
    66 { 
    67   this->transformationMapping_.resize(1); 
    68   this->transformationWeight_.resize(1); 
    69  
    70   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    71   TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
    72  
    73   int globalIndexSize = axisDestGlobalIndex_.size(); 
     61 
     62  auto& transMap = this->transformationMapping_; 
     63 
     64  int globalIndexSize = axisDestination->index.size(); 
    7465  for (int idx = 0; idx < globalIndexSize; ++idx) 
    7566  { 
    76     transMap[axisDestGlobalIndex_[idx]].push_back(axisDestGlobalSize_-axisDestGlobalIndex_[idx]-1); 
    77     transWeight[axisDestGlobalIndex_[idx]].push_back(1.0); 
     67    transMap[axisDestination->index(idx)] = globalIndexSize-axisDestination->index(idx)-1; 
    7868  } 
    7969 
     
    8878    } 
    8979  } 
    90 } 
    91 CATCH 
     80 
     81  axisDestination->checkAttributes() ; 
     82  this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; 
     83 
     84} 
     85CATCH 
     86 
    9287 
    9388/*! 
     
    118113  typedef std::unordered_map<size_t, std::vector<double> > GlobalIndexMapFromSrcToDest; 
    119114  GlobalIndexMapFromSrcToDest globalIndexMapFromSrcToDest; 
    120   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    121   TransformationIndexMap::const_iterator itb = transMap.begin(), ite = transMap.end(), it; 
     115  auto& transMap = this->transformationMapping_; 
    122116  CArray<size_t,1> globalSrcIndex(transMap.size()); 
    123117  int localIndex = 0; 
    124   for (it = itb; it != ite; ++it) 
    125   { 
    126     size_t srcIndex = it->second[0]; 
     118  for (auto it = transMap.begin(); it != transMap.end(); ++it) 
     119  { 
     120    size_t srcIndex = it->second; 
    127121    globalIndexMapFromSrcToDest[srcIndex].resize(1); 
    128122    globalIndexMapFromSrcToDest[srcIndex][0] = it->first; 
Note: See TracChangeset for help on using the changeset viewer.