source: XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_transfer.cpp @ 2118

Last change on this file since 2118 was 2004, checked in by ymipsl, 3 years ago

fix typo.
YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#include "algorithm_transformation_transfer.hpp"
2#include "array_new.hpp"
3#include "local_view.hpp"
4#include "transform_connector.hpp"
5#include "context.hpp"
6
7namespace xios
8{
9 
10  void CAlgorithmTransformationTransfer::computeAlgorithm(CLocalView* srcView, CLocalView* dstView)
11  {
12   this->computeRecvElement(srcView, dstView) ;
13   transferTransformConnector_ = new  CTransferTransformConnector( recvElement_->getView(CElementView::FULL), dstView, transformationMapping_) ; 
14  }
15 
16
17  void CAlgorithmTransformationTransfer::apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut)
18  {
19    transferTransformConnector_ -> transfer(dimBefore, dimAfter, dataIn, dataOut) ; 
20  }
21 
22  void CAlgorithmTransformationTransfer::computeRecvElement(CLocalView* srcView, CLocalView* dstView)
23  {
24    set<size_t> srcIndex ;
25    for(auto& it : transformationMapping_) srcIndex.insert(it.second) ;
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
34}
Note: See TracBrowser for help on using the repository browser.