source: XIOS3/trunk/src/transformation/algorithm_transformation_weight.cpp @ 2391

Last change on this file since 2391 was 2313, checked in by ymipsl, 3 years ago

Take into account detect_missing_value and renormalize attribute for interpolate class transformation.

YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#include "algorithm_transformation_weight.hpp"
2#include "context.hpp"
3
4namespace xios
5{
6
7
8  void CAlgorithmTransformationWeight::computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, bool detectMissingValue, bool renormalize)
9  {
10    this->computeRecvElement(srcView, dstView) ;
11    weightTransformConnector_ = make_shared<CWeightTransformConnector>(recvElement_->getView(CElementView::FULL), dstView, transformationMapping_, transformationWeight_, detectMissingValue, renormalize) ; 
12  }
13 
14
15  void CAlgorithmTransformationWeight::apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut)
16  {
17    weightTransformConnector_ -> transfer(dimBefore, dimAfter, dataIn, dataOut) ;
18  }
19
20  void CAlgorithmTransformationWeight::computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView)
21  {
22    auto& srcMap = transformationMapping_ ;
23    set<size_t> srcIndex ;
24    for(auto& it : srcMap)
25      for(size_t index : it.second) srcIndex.insert(index) ;
26
27    CArray<size_t,1> srcArrayIndex(srcIndex.size()) ;
28    int i=0 ;
29    for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;}
30    recvElement_ = make_shared<CLocalElement>(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ;
31    recvElement_->addFullView() ;
32  }
33}
Note: See TracBrowser for help on using the repository browser.