source: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_weight.cpp @ 2010

Last change on this file since 2010 was 2001, checked in by ymipsl, 3 years ago

Bug fix when introducing gridAlgorithm

YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#include "algorithm_transformation_weight.hpp"
2#include "context.hpp"
3
4namespace xios
5{
6
7
8  void CAlgorithmTransformationWeight::computeAlgorithm(CLocalView* srcView, CLocalView* dstView)
9  {
10    this->computeRecvElement(srcView, dstView) ;
11    weightTransformConnector_ = new  CWeightTransformConnector( recvElement_->getView(CElementView::FULL), dstView, transformationMapping_, transformationWeight_) ; 
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(CLocalView* srcView, 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_ = new CLocalElement(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ;
31    recvElement_->addFullView() ;
32  }
33}
Note: See TracBrowser for help on using the repository browser.