Changeset 2009 for XIOS/dev/dev_ym


Ignore:
Timestamp:
01/07/21 23:17:23 (3 years ago)
Author:
ymipsl
Message:

Implement axis interpolation, without pressure coordinate for now.

YM

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

Legend:

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

    r1988 r2009  
    5151 
    5252CAxisAlgorithmInterpolate::CAxisAlgorithmInterpolate(bool isSource, CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis) 
    53 : CAxisAlgorithmTransformation(isSource, axisDestination, axisSource), coordinate_(), transPosition_() 
     53: CAlgorithmTransformationWeight(isSource), coordinate_(), transPosition_(), axisSrc_(axisSource), axisDest_(axisDestination) 
    5454TRY 
    5555{ 
    5656  interpAxis->checkValid(axisSource); 
     57  axisDestination->checkAttributes() ; 
     58 
    5759  order_ = interpAxis->order.getValue(); 
    5860  if (!interpAxis->coordinate.isEmpty()) 
    5961  { 
    6062    coordinate_ = interpAxis->coordinate.getValue(); 
    61     this->idAuxInputs_.resize(1); 
    62     this->idAuxInputs_[0] = coordinate_; 
    63   } 
     63//    this->idAuxInputs_.resize(1); 
     64//    this->idAuxInputs_[0] = coordinate_; 
     65  } 
     66  std::vector<CArray<double,1>* > dataAuxInputs ; 
     67  computeRemap(dataAuxInputs) ; 
     68  this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; 
    6469} 
    6570CATCH 
     
    6873  Compute the index mapping between axis on grid source and one on grid destination 
    6974*/ 
    70 void CAxisAlgorithmInterpolate::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
     75void CAxisAlgorithmInterpolate::computeRemap(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    7176TRY 
    7277{ 
     
    179184TRY 
    180185{ 
    181   TransformationIndexMap& transMap = this->transformationMapping_[transPos]; 
    182   TransformationWeightMap& transWeight = this->transformationWeight_[transPos]; 
     186  TransformationIndexMap& transMap = this->transformationMapping_; 
     187  TransformationWeightMap& transWeight = this->transformationWeight_; 
    183188  std::map<int, std::vector<std::pair<int,double> > >::const_iterator itb = interpolatingIndexValues.begin(), it, 
    184189                                                                      ite = interpolatingIndexValues.end(); 
     
    205210      transMap[globalIndexDest][idx] = index; 
    206211      transWeight[globalIndexDest][idx] = weight; 
     212/* 
    207213      if (!transPosition_.empty()) 
    208214      { 
    209215        (this->transformationPosition_[transPos])[globalIndexDest] = transPosition_[transPos]; 
    210216      } 
    211     } 
    212   } 
     217*/ 
     218    } 
     219  } 
     220/* 
    213221  if (!transPosition_.empty() && this->transformationPosition_[transPos].empty()) 
    214222    (this->transformationPosition_[transPos])[0] = transPosition_[transPos]; 
    215  
     223*/ 
    216224} 
    217225CATCH 
     
    308316    vecAxisValue[0].resize(axisSrc_->value.numElements()); 
    309317    vecAxisValue[0] = axisSrc_->value; 
    310     this->transformationMapping_.resize(1); 
    311     this->transformationWeight_.resize(1); 
     318//    this->transformationMapping_.resize(1); 
     319//    this->transformationWeight_.resize(1); 
    312320  } 
    313321  else 
    314322  { 
     323/* 
    315324    CField* field = CField::get(coordinate_); 
    316325    CGrid* grid = field->getGrid(); 
     
    388397      } 
    389398    } 
    390   } 
    391 } 
    392 CATCH 
    393  
    394 } 
     399  */ 
     400  } 
     401} 
     402CATCH 
     403 
     404} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_interpolate.hpp

    r1988 r2009  
    1010#define __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ 
    1111 
    12 #include "axis_algorithm_transformation.hpp" 
     12#include "algorithm_transformation_weight.hpp" 
    1313#include "transformation.hpp" 
    1414 
     
    2424  The values on axis source are assumed monotonic 
    2525*/ 
    26 class CAxisAlgorithmInterpolate : public CAxisAlgorithmTransformation 
     26class CAxisAlgorithmInterpolate : public CAlgorithmTransformationWeight 
    2727{ 
    2828public: 
     
    3232 
    3333  static bool registerTrans(); 
    34 protected: 
    35   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
    3634 
    3735private: 
     36  void computeRemap(const std::vector<CArray<double,1>* >& dataAuxInputs) ; 
    3837  void retrieveAllAxisValue(const CArray<double,1>& axisValue, const CArray<bool,1>& axisMask, 
    3938                            std::vector<double>& recvBuff, std::vector<int>& indexVec); 
     
    4847  StdString coordinate_; 
    4948  std::vector<std::vector<int> > transPosition_; 
     49  CAxis* axisSrc_=nullptr ; 
     50  CAxis* axisDest_=nullptr; 
     51private: 
    5052 
    51 private: 
    5253  static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 
    5354                                                CTransformation<CAxis>* transformation, 
Note: See TracChangeset for help on using the changeset viewer.