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

Last change on this file since 2291 was 2267, checked in by ymipsl, 3 years ago

tracking memory leak
Elements, views, and connectors are now managed with shared pointer.
YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.3 KB
RevLine 
[1997]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 
[2267]10  void CAlgorithmTransformationTransfer::computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView)
[2001]11  {
12   this->computeRecvElement(srcView, dstView) ;
[2267]13   transferTransformConnector_ = make_shared<CTransferTransformConnector>( recvElement_->getView(CElementView::FULL), dstView, transformationMapping_) ; 
[1997]14  }
15 
16
17  void CAlgorithmTransformationTransfer::apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut)
18  {
[2003]19    transferTransformConnector_ -> transfer(dimBefore, dimAfter, dataIn, dataOut) ; 
[1997]20  }
21 
[2267]22  void CAlgorithmTransformationTransfer::computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView)
[1999]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++ ;}
[2267]30    recvElement_ = make_shared<CLocalElement>(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ;
[1999]31    recvElement_->addFullView() ;
32  }
33
[1997]34}
Note: See TracBrowser for help on using the repository browser.