Ignore:
Timestamp:
12/17/20 13:18:57 (4 years ago)
Author:
ymipsl
Message:

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

YM

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

Legend:

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

    r1988 r1998  
    4444 
    4545CAxisAlgorithmDuplicateScalar::CAxisAlgorithmDuplicateScalar(bool isSource, CAxis* axisDestination, CScalar* scalarSource, CDuplicateScalarToAxis* algo) 
    46  : CAxisAlgorithmTransformation(isSource, axisDestination, scalarSource) 
     46 : CAlgorithmTransformationTransfer(isSource) 
    4747{ 
     48   
     49  CArray<int,1>& axisDstIndex = axisDest_->index; 
    4850 
     51  int nbAxisIdx = axisDstIndex.numElements(); 
     52  for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis) 
     53  { 
     54    int globalAxisIdx = axisDstIndex(idxAxis); 
     55    this->transformationMapping_[globalAxisIdx] = 0 ; 
     56  } 
     57 
     58  axisDestination->checkAttributes() ; 
     59  this->computeAlgorithm(scalarSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; 
    4960} 
    5061 
     
    5465} 
    5566 
    56 void CAxisAlgorithmDuplicateScalar::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    57 TRY 
    58 { 
    59   this->transformationMapping_.resize(1); 
    60   this->transformationWeight_.resize(1); 
    61  
    62   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    63   TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
    64  
    65   CArray<int,1>& axisDstIndex = axisDest_->index; 
    66  
    67   int nbAxisIdx = axisDstIndex.numElements(); 
    68   for (int idxAxis = 0; idxAxis < nbAxisIdx; ++idxAxis) 
    69   { 
    70     int globalAxisIdx = axisDstIndex(idxAxis); 
    71     transMap[globalAxisIdx].resize(1); 
    72     transWeight[globalAxisIdx].resize(1); 
    73     transMap[globalAxisIdx][0] = 0 ; 
    74     transWeight[globalAxisIdx][0] = 1.0 ; 
    75   } 
    7667} 
    77 CATCH 
    78 } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_duplicate_scalar.hpp

    r1988 r1998  
    1010#define __XIOS_AXIS_ALGORITHM_DUPLICATE_SCALAR_HPP__ 
    1111 
    12 #include "axis_algorithm_transformation.hpp" 
     12#include "algorithm_transformation_transfer.hpp" 
    1313#include "transformation.hpp" 
    1414 
     
    2424  Duplicate scalar into axis destination 
    2525*/ 
    26 class CAxisAlgorithmDuplicateScalar : public CAxisAlgorithmTransformation 
     26class CAxisAlgorithmDuplicateScalar : public CAlgorithmTransformationTransfer 
    2727{ 
    2828public: 
     
    3333  static bool registerTrans(); 
    3434 
    35 protected: 
    36   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
    3735 
    3836private: 
     37 
     38  CAxis* axisSrc_; 
     39  CAxis* axisDest_; 
     40 
    3941  static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 
    4042                                                CTransformation<CAxis>* transformation, 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_extract.cpp

    r1988 r1998  
    4141 
    4242CAxisAlgorithmExtract::CAxisAlgorithmExtract(bool isSource, CAxis* axisDestination, CAxis* axisSource, CExtractAxis* extractAxis) 
    43 : CAxisAlgorithmTransformation(isSource, axisDestination, axisSource) 
     43: CAlgorithmTransformationTransfer(isSource), axisDest_(axisDestination), axisSrc_(axisSource) 
    4444TRY 
    4545{ 
     
    8383  if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest); 
    8484 
    85   this->transformationMapping_.resize(1); 
    86   this->transformationWeight_.resize(1); 
    87   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    88   TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
     85  auto& transMap = this->transformationMapping_; 
    8986 
    9087  for (int iDest = 0; iDest < nDest; iDest++) 
     
    106103    indGloDest = axisDest_->index(iDest); 
    107104    indGloSrc = axisSrc_->index(iSrc); 
    108     transMap[indGloDest].push_back(indGloSrc); 
    109     transWeight[indGloDest].push_back(1.0); 
     105     
     106    transMap[indGloDest]=indGloSrc; 
    110107 
    111108  } 
     109 
     110  axisDestination->checkAttributes() ; 
     111 
     112  this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; 
    112113} 
    113114CATCH 
    114115 
    115 /*! 
    116   Compute the index mapping between domain on grid source and one on grid destination 
    117 */ 
    118 void CAxisAlgorithmExtract::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    119 { 
    120 } 
     116 
    121117 
    122118} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_extract.hpp

    r1988 r1998  
    66#define __XIOS_AXIS_ALGORITHM_EXTRACT_HPP__ 
    77 
    8 #include "axis_algorithm_transformation.hpp" 
     8#include "algorithm_transformation_transfer.hpp" 
    99#include "transformation.hpp" 
    1010 
     
    1919  Only this extracted region is extracted to write on Netcdf. 
    2020*/ 
    21 class CAxisAlgorithmExtract : public CAxisAlgorithmTransformation 
     21class CAxisAlgorithmExtract : public CAlgorithmTransformationTransfer 
    2222{ 
    2323public: 
     
    2727 
    2828  static bool registerTrans(); 
    29 protected: 
    30   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
    3129 
    3230private: 
     
    4543 
    4644private: 
    47  
     45  CAxis* axisSrc_; 
     46  CAxis* axisDest_; 
    4847  static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 
    4948                                                CTransformation<CAxis>* transformation, 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_zoom.cpp

    r1988 r1998  
    4141 
    4242CAxisAlgorithmZoom::CAxisAlgorithmZoom(bool isSource, CAxis* axisDestination, CAxis* axisSource, CZoomAxis* zoomAxis) 
    43 : CAxisAlgorithmTransformation(isSource, axisDestination, axisSource) 
     43: CAlgorithmTransformationTransfer(isSource), axisDest_(axisDestination), axisSrc_(axisSource) 
    4444TRY 
    4545{ 
     
    8383  if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest); 
    8484 
    85   this->transformationMapping_.resize(1); 
    86   this->transformationWeight_.resize(1); 
    87   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    88   TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
     85  auto& transMap = this->transformationMapping_; 
    8986 
    9087  for (int iDest = 0; iDest < nDest; iDest++) 
     
    106103    indGloDest = axisDest_->index(iDest); 
    107104    indGloSrc = axisSrc_->index(iSrc); 
    108     transMap[indGloDest].push_back(indGloSrc); 
    109     transWeight[indGloDest].push_back(1.0); 
     105    transMap[indGloDest]=indGloSrc; 
    110106 
    111107  } 
     108 
     109  axisDestination->checkAttributes() ; 
     110 
     111  this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; 
    112112} 
    113113CATCH 
    114114 
    115 /*! 
    116   Compute the index mapping between domain on grid source and one on grid destination 
    117 */ 
    118 void CAxisAlgorithmZoom::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    119 { 
    120 } 
    121115 
    122116} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_zoom.hpp

    r1988 r1998  
    66#define __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ 
    77 
    8 #include "axis_algorithm_transformation.hpp" 
     8#include "algorithm_transformation_transfer.hpp" 
    99#include "transformation.hpp" 
    1010 
     
    1919  Only this zoomed region is zoomed to write on Netcdf. 
    2020*/ 
    21 class CAxisAlgorithmZoom : public CAxisAlgorithmTransformation 
     21class CAxisAlgorithmZoom : public CAlgorithmTransformationTransfer 
    2222{ 
    2323public: 
     
    2727 
    2828  static bool registerTrans(); 
    29 protected: 
    30   void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
    3129 
    3230private: 
     
    4543 
    4644private: 
     45   
     46  CAxis* axisSrc_; 
     47  CAxis* axisDest_; 
    4748 
    4849  static CGenericAlgorithmTransformation* create(bool isSource, CGrid* gridDst, CGrid* gridSrc, 
Note: See TracChangeset for help on using the changeset viewer.