Ignore:
Timestamp:
01/12/21 23:05:02 (3 years ago)
Author:
ymipsl
Message:
  • bug fix when createing mask on server side when overlapping grid
  • implement axis interpolation on pressure coordinate
  • big cleaning in transformation

YM

File:
1 edited

Legend:

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

    r1988 r2011  
    4444 
    4545CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(bool isSource, CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo) 
    46  : CScalarAlgorithmTransformation(isSource, scalarDestination, scalarSource), reduction_(0) 
     46 : CAlgorithmTransformationReduce(isSource) 
    4747TRY 
    4848{ 
     
    5757  { 
    5858    case CReduceScalarToScalar::operation_attr::sum: 
    59       op = "sum"; 
     59      operator_ = EReduction::sum; 
    6060      break; 
    6161    case CReduceScalarToScalar::operation_attr::min: 
    62       op = "min"; 
     62      operator_ = EReduction::min; 
    6363      break; 
    6464    case CReduceScalarToScalar::operation_attr::max: 
    65       op = "max"; 
     65      operator_ = EReduction::max; 
    6666      break; 
    6767    case CReduceScalarToScalar::operation_attr::average: 
    68       op = "average"; 
     68      operator_ = EReduction::average; 
    6969      break; 
    7070    default: 
     
    7575 
    7676  } 
    77    
    78   if (CReductionAlgorithm::ReductionOperations.end() == CReductionAlgorithm::ReductionOperations.find(op)) 
    79     ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)", 
    80        << "Operation '" << op << "' not found. Please make sure to use a supported one" 
    81        << "Scalar source " <<scalarSource->getId() << std::endl 
    82        << "Scalar destination " << scalarDestination->getId()); 
     77  transformationMapping_[0].push_back(0) ; 
    8378 
    84   reduction_ = CReductionAlgorithm::createOperation(CReductionAlgorithm::ReductionOperations[op]); 
    85 } 
    86 CATCH 
    87  
    88 void CScalarAlgorithmReduceScalar::apply(const std::vector<std::pair<int,double> >& localIndex, const double* dataInput, CArray<double,1>& dataOut, 
    89                                          std::vector<bool>& flagInitial, bool ignoreMissingValue, bool firstPass) 
    90 TRY 
    91 { 
    92   reduction_->apply(localIndex, dataInput, dataOut, flagInitial, ignoreMissingValue, firstPass); 
    93 } 
    94 CATCH 
    95  
    96 void CScalarAlgorithmReduceScalar::updateData(CArray<double,1>& dataOut) 
    97 TRY 
    98 { 
    99   reduction_->updateData(dataOut); 
     79  scalarDestination->checkAttributes() ; 
     80  this->computeAlgorithm(scalarSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ;  
    10081} 
    10182CATCH 
     
    10485TRY 
    10586{ 
    106   if (0 != reduction_) delete reduction_; 
    10787} 
    10888CATCH 
    10989 
    110 void CScalarAlgorithmReduceScalar::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
    111 TRY 
    112 { 
    113   this->transformationMapping_.resize(1); 
    114   this->transformationWeight_.resize(1); 
    115  
    116   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    117   TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
    118  
    119   transMap[0].push_back(0); 
    120   transWeight[0].push_back(1.0); 
    12190 
    12291} 
    123 CATCH 
    124  
    125 } 
Note: See TracChangeset for help on using the changeset viewer.