Changeset 2267


Ignore:
Timestamp:
12/01/21 16:52:24 (3 years ago)
Author:
ymipsl
Message:

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

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src
Files:
54 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/distributed_view.cpp

    r1936 r2267  
    66{ 
    77 
    8   CDistributedView::CDistributedView(CDistributedElement* parent, CElementView::type, const std::map<int,CArray<int,1>>& indexView)  
     8  CDistributedView::CDistributedView(shared_ptr<CDistributedElement> parent, CElementView::type, const std::map<int,CArray<int,1>>& indexView)  
    99                                    : globalIndex_(parent->globalIndex_), globalSize_(parent->globalSize_), localSize_(parent->localSize_)  
    1010  { 
     
    1616  } 
    1717 
    18   CDistributedView::CDistributedView(CDistributedElement* parent, CElementView::type, const std::map<int,CArray<bool,1>>& maskView)  
     18  CDistributedView::CDistributedView(shared_ptr<CDistributedElement> parent, CElementView::type, const std::map<int,CArray<bool,1>>& maskView)  
    1919                                    : globalIndex_(parent->globalIndex_), globalSize_(parent->globalSize_), localSize_(parent->localSize_)  
    2020  { 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/distributed_view.hpp

    r2180 r2267  
    1414    public: 
    1515 
    16       CDistributedView(CDistributedElement* parent, CElementView::type type, const std::map<int,CArray<int,1>>& indexView) ; 
    17       CDistributedView(CDistributedElement* parent, CElementView::type type, const std::map<int,CArray<bool,1>>& maskView) ; 
     16      CDistributedView(shared_ptr<CDistributedElement> parent, CElementView::type type, const std::map<int,CArray<int,1>>& indexView) ; 
     17      CDistributedView(shared_ptr<CDistributedElement> parent, CElementView::type type, const std::map<int,CArray<bool,1>>& maskView) ; 
    1818       
    1919      std::map<int,CArray<int,1>>&  getIndex(void) { return index_ ;} 
     
    4848    }    
    4949 
    50     void getGlobalIndex(int rank, vector<size_t>& globalIndex, size_t sliceIndex, size_t* sliceSize, CDistributedView** view, int pos) 
     50    void getGlobalIndex(int rank, vector<size_t>& globalIndex, size_t sliceIndex, size_t* sliceSize, shared_ptr<CDistributedView>* view, int pos) 
    5151    { 
    5252      // using map can be expensive, find an otherway later 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/element.cpp

    r1930 r2267  
    2828  void CDistributedElement::addView(CElementView::type type, std::map<int, CArray<int,1>>& indexView) 
    2929  { 
    30     views_[type] = new CDistributedView(this, type, indexView) ; 
     30    views_[type] = make_shared<CDistributedView>(shared_from_this(), type, indexView) ; 
    3131  }  
    3232 
    3333  void CDistributedElement::addView(CElementView::type type, std::map<int, CArray<bool,1>>& maskView) 
    3434  { 
    35     views_[type] = new CDistributedView(this, type, maskView) ; 
     35    views_[type] = make_shared<CDistributedView>(shared_from_this(), type, maskView) ; 
    3636  }  
    3737 
     
    120120  void CLocalElement::addView(CElementView::type type, CArray<int,1>& indexView) 
    121121  { 
    122     views_[type] = new CLocalView(this, type, indexView) ; 
     122    views_[type] = make_shared<CLocalView>(static_pointer_cast<CLocalElement>(shared_from_this()), type, indexView) ; 
    123123  }  
    124124 
    125125  void CLocalElement::addView(CElementView::type type, CArray<bool,1>& maskView) 
    126126  { 
    127     views_[type] = new CLocalView(this, type, maskView) ; 
     127    views_[type] = make_shared<CLocalView>(static_pointer_cast<CLocalElement>(shared_from_this()), type, maskView) ; 
    128128  }  
    129129 
     
    137137  }  
    138138 
    139   CLocalConnector* CLocalElement::getConnector(CElementView::type srcType, CElementView::type dstType)  
     139  shared_ptr<CLocalView> CLocalElement::getView(CElementView::type type)  
     140  {  
     141    if (views_[(size_t)type]==nullptr) { ERROR("CLocalElement::getView(CElementView::type type)",<<"View is not initialized");}  
     142    else return static_pointer_cast<CLocalView>(views_[(size_t)type]) ; 
     143  } 
     144 
     145  shared_ptr<CLocalConnector> CLocalElement::getConnector(CElementView::type srcType, CElementView::type dstType)  
    140146  {  
    141147    auto newPair = pair<CElementView::type,CElementView::type>(srcType,dstType); 
     
    143149    if (it==connectors_.end())  
    144150    { 
    145       auto insertPair=pair<pair<CElementView::type,CElementView::type>, CLocalConnector*>(newPair,new CLocalConnector(getView(srcType),getView(dstType))) ; 
     151      auto insertPair=pair<pair<CElementView::type,CElementView::type>, shared_ptr<CLocalConnector>>(newPair,make_shared<CLocalConnector>(getView(srcType),getView(dstType))) ; 
    146152      it=connectors_.insert(insertPair).first ; 
    147153      it->second->computeConnector() ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/element.hpp

    r1999 r2267  
    1515  class CLocalConnector ; 
    1616 
    17   class CDistributedElement 
     17  class CDistributedElement : public std::enable_shared_from_this<CDistributedElement> 
    1818  { 
    1919 
     
    2222    std::map<int, int> localSize_ ; 
    2323    size_t globalSize_ ; 
    24     std::vector<CDistributedView*> views_= std::vector<CDistributedView*>(CElementView::numViewType_) ; 
     24    std::vector<shared_ptr<CDistributedView>> views_= std::vector<shared_ptr<CDistributedView>>(CElementView::numViewType_) ; 
    2525    CDistributedElement(void) {} ; 
    2626     
     
    3434    std::map<int, CArray<size_t,1>>& getGlobalIndex(void) { return globalIndex_;} 
    3535     
    36     CDistributedView* getView(CElementView::type type)  
     36    shared_ptr<CDistributedView> getView(CElementView::type type)  
    3737    {  
    3838      if (views_[(size_t)type]==nullptr) { ERROR("CDistributedElement::getView(CElementView::type type)",<<"View is not initialized");}  
     
    5151  { 
    5252    // keep local connector inside     
    53       std::map<pair<CElementView::type,CElementView::type>, CLocalConnector*> connectors_  ; 
     53      std::map<pair<CElementView::type,CElementView::type>, shared_ptr<CLocalConnector>> connectors_  ; 
    5454  
    5555    public:  
     
    6161      void addView(CElementView::type type, CArray<bool,1>& maskView) ; 
    6262      void addFullView(void) ; 
    63       CLocalView* getView(CElementView::type type)  
    64       {  
     63       
     64      shared_ptr<CLocalView> getView(CElementView::type type) ; 
     65 /*     {  
    6566        if (views_[(size_t)type]==nullptr) { ERROR("CLocalElement::getView(CElementView::type type)",<<"View is not initialized");}  
    66         else return (CLocalView*) views_[(size_t)type] ;  
     67        else return static_pointer_cast<CLocalView>(views_[(size_t)type]) ; 
    6768      } 
    68        
    69       CLocalConnector* getConnector(CElementView::type srcType, CElementView::type dstType) ; 
     69*/       
     70      shared_ptr<CLocalConnector> getConnector(CElementView::type srcType, CElementView::type dstType) ; 
    7071 
    7172    private : 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.hpp

    r2118 r2267  
    1717  { 
    1818    private: 
    19       CDistributedView* srcView_; 
    20       CLocalView* dstView_; 
     19      shared_ptr<CDistributedView> srcView_; 
     20      shared_ptr<CLocalView> dstView_; 
    2121      map<int, vector<int>> connector_ ; 
    2222      map<int, vector<bool>> mask_ ;  // mask is on src view 
     
    2525 
    2626    public: 
    27       CGathererConnector(CDistributedView* srcView, CLocalView* dstView) : srcView_(srcView), dstView_(dstView) {} ; 
     27      CGathererConnector(shared_ptr<CDistributedView> srcView, shared_ptr<CLocalView> dstView) : srcView_(srcView), dstView_(dstView) {} ; 
    2828      void computeConnector(void) ; 
    2929       
     
    7575 
    7676      template<typename T> 
    77       void transfer(int rank,  CGathererConnector** connectors, int nConnectors, const T* input, T* output) 
     77      void transfer(int rank,  shared_ptr<CGathererConnector>* connectors, int nConnectors, const T* input, T* output) 
    7878      { 
    7979        auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map 
     
    111111 
    112112      // hook for transfering mask in grid connector, maybe find an other way to doing that... 
    113       void transfer_or(int rank,  CGathererConnector** connectors, int nConnectors, const bool* input, bool* output) 
     113      void transfer_or(int rank,  shared_ptr<CGathererConnector>* connectors, int nConnectors, const bool* input, bool* output) 
    114114      { 
    115115        auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map 
     
    210210      } 
    211211 
    212     int getSrcSliceSize(int rank, CGathererConnector** connectors, int nConnectors)  
     212    int getSrcSliceSize(int rank, shared_ptr<CGathererConnector>* connectors, int nConnectors)  
    213213    { if (nConnectors==0) return srcSize_[rank] ; else return srcSize_[rank] * (*(connectors-1))->getSrcSliceSize(rank, connectors-1,nConnectors-1) ; } 
    214214 
    215     int getDstSliceSize(CGathererConnector** connectors, int nConnectors)  
     215    int getDstSliceSize(shared_ptr<CGathererConnector>* connectors, int nConnectors)  
    216216    { if (nConnectors==0) return dstSize_ ; else return dstSize_ * (*(connectors-1))->getDstSliceSize(connectors-1,nConnectors-1) ; } 
    217217   
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_client_server_remote_connector.cpp

    r2236 r2267  
    1010   * \param remoteSize Size of the remote communicator 
    1111   */  
    12   CGridClientServerRemoteConnector::CGridClientServerRemoteConnector(vector<CLocalView*>& srcFullView, vector<CLocalView*>& srcWorkflowView, vector<CDistributedView*>& dstView, MPI_Comm localComm, int remoteSize)  
     12  CGridClientServerRemoteConnector::CGridClientServerRemoteConnector( vector<shared_ptr<CLocalView> >& srcFullView, vector<shared_ptr<CLocalView>>& srcWorkflowView,  
     13                                                                      vector<shared_ptr<CDistributedView>>& dstView, MPI_Comm localComm, int remoteSize)  
    1314                       : CGridRemoteConnector(srcFullView, dstView, localComm, remoteSize) , srcWorkflowView_(srcWorkflowView) 
    1415  {} 
     
    1718  void CGridClientServerRemoteConnector::computeConnector(void) 
    1819  { 
    19     CGridRemoteConnector workflowRemoteConnector(srcWorkflowView_,dstView_,localComm_,remoteSize_) ; 
    20     workflowRemoteConnector.computeConnector() ; 
     20    auto workflowRemoteConnector=make_shared<CGridRemoteConnector>(srcWorkflowView_,dstView_,localComm_,remoteSize_) ; 
     21    workflowRemoteConnector->computeConnector() ; 
    2122    computeViewDistribution() ; 
    2223     
    23     for(int i=0;i<srcView_.size();i++) isSrcViewDistributed_[i] =  isSrcViewDistributed_[i] || workflowRemoteConnector.getIsSrcViewDistributed()[i]  ; 
     24    for(int i=0;i<srcView_.size();i++) isSrcViewDistributed_[i] =  isSrcViewDistributed_[i] || workflowRemoteConnector->getIsSrcViewDistributed()[i]  ; 
    2425    computeConnectorMethods() ; 
    2526    computeRedondantRanks() ; 
    2627 
    2728    for(auto& rank : rankToRemove_) 
    28       if (workflowRemoteConnector.getRankToRemove().count(rank)!=0) 
     29      if (workflowRemoteConnector->getRankToRemove().count(rank)!=0) 
    2930        for(auto& element : elements_) element.erase(rank) ; 
    3031  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_client_server_remote_connector.hpp

    r2236 r2267  
    1212    public: 
    1313 
    14       CGridClientServerRemoteConnector(vector<CLocalView*>& srcView, vector<CLocalView*>& worflowSrcView, vector<CDistributedView*>& dstView, MPI_Comm localComm, int remoteSize) ; 
     14      CGridClientServerRemoteConnector(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CLocalView>>& worflowSrcView, vector<shared_ptr<CDistributedView>>& dstView, MPI_Comm localComm, int remoteSize) ; 
    1515      void computeConnector(void) ; 
    16       vector<CLocalView*> srcWorkflowView_ ;    
     16      vector<shared_ptr<CLocalView>> srcWorkflowView_ ;    
    1717  } ; 
    1818 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_elements.cpp

    r1960 r2267  
    66{ 
    77 
    8   CGridLocalView* CGridLocalElements::getView(CElementView::type type) 
     8  shared_ptr<CGridLocalView> CGridLocalElements::getView(CElementView::type type) 
    99  {  
    10     if (views_[type]==nullptr) views_[type] = new CGridLocalView(this, type) ; 
     10    if (views_[type]==nullptr) views_[type] = make_shared<CGridLocalView>(shared_from_this(), type) ; 
    1111    return views_[type] ; 
    1212  } 
    1313   
    14   CGridLocalConnector* CGridLocalElements::getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask) 
     14  shared_ptr<CGridLocalConnector> CGridLocalElements::getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask) 
    1515  { 
    1616    auto newPair = pair<CElementView::type,CElementView::type>(srcType,dstType); 
     
    1818    if (it==connectors_.end())  
    1919    { 
    20       auto insertPair=pair<pair<CElementView::type,CElementView::type>, CGridLocalConnector*>(newPair,new CGridLocalConnector(this, srcType, dstType, withMask)) ; 
     20      auto insertPair=pair<pair<CElementView::type,CElementView::type>, shared_ptr<CGridLocalConnector>>(newPair, make_shared<CGridLocalConnector>(shared_from_this(), srcType, dstType, withMask)) ; 
    2121      it=connectors_.insert(insertPair).first ; 
    2222    } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_elements.hpp

    r1960 r2267  
    1111  class CGridLocalConnector ; 
    1212 
    13   class CGridLocalElements   
     13  class CGridLocalElements : public std::enable_shared_from_this<CGridLocalElements> 
    1414  { 
    1515    private: 
    16       std::vector<CLocalElement*> elements_ ; 
    17       std::vector<CGridLocalView*> views_= std::vector<CGridLocalView*>(CElementView::numViewType_) ; 
    18       std::map<pair<CElementView::type,CElementView::type>, CGridLocalConnector*> connectors_ ; 
     16      std::vector<shared_ptr<CLocalElement>> elements_ ; 
     17      std::vector<shared_ptr<CGridLocalView>> views_= std::vector<shared_ptr<CGridLocalView>>(CElementView::numViewType_) ; 
     18      std::map<pair<CElementView::type,CElementView::type>, shared_ptr<CGridLocalConnector>> connectors_ ; 
    1919      vector<bool> localMask_ ; 
    2020   
    2121    public: 
    22       CGridLocalElements(vector<CLocalElement*> elements) : elements_(elements) {} 
    23       CGridLocalElements(vector<CLocalElement*> elements, vector<bool>& localMask) : elements_(elements), localMask_(localMask) {} 
     22      CGridLocalElements(vector<shared_ptr<CLocalElement> > elements) : elements_(elements) {} 
     23      CGridLocalElements(vector<shared_ptr<CLocalElement>> elements, vector<bool>& localMask) : elements_(elements), localMask_(localMask) {} 
    2424 
    2525      bool hasLocalMask() { return !localMask_.empty() ;} 
    2626      vector<bool>& getLocalMask(void) { return localMask_ ;} 
    2727 
    28       std::vector<CLocalElement*>& getElements(void) { return elements_ ; } 
    29       CGridLocalView* getView(CElementView::type type) ; 
    30       CGridLocalConnector* getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask=false) ; 
     28      std::vector<shared_ptr<CLocalElement>>& getElements(void) { return elements_ ; } 
     29      shared_ptr<CGridLocalView> getView(CElementView::type type) ; 
     30      shared_ptr<CGridLocalConnector> getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask=false) ; 
    3131  } ; 
    3232} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_gatherer_connector.hpp

    r2011 r2267  
    1919    private: 
    2020     
    21       vector<CGathererConnector*> elementsConnector_ ; 
     21      vector<shared_ptr<CGathererConnector>> elementsConnector_ ; 
    2222      int dstSize_ ; 
    2323 
    2424    public: 
    25       CGridGathererConnector(vector<CGathererConnector*> elementsConnector) : elementsConnector_(elementsConnector) 
     25      CGridGathererConnector(vector<shared_ptr<CGathererConnector>> elementsConnector) : elementsConnector_(elementsConnector) 
    2626      { 
    2727        dstSize_ = 1 ; 
     
    3333      { 
    3434        int n = elementsConnector_.size()-1 ; 
    35         CGathererConnector** connector = elementsConnector_.data() + n ; 
     35       shared_ptr<CGathererConnector>* connector = elementsConnector_.data() + n ; 
    3636        output.resize(dstSize_) ; 
    3737        for(auto& rankDataIn : input)  
     
    4545      { 
    4646        int n = elementsConnector_.size()-1 ; 
    47         CGathererConnector** connector = elementsConnector_.data() + n ; 
     47        shared_ptr<CGathererConnector>* connector = elementsConnector_.data() + n ; 
    4848        output.resize(dstSize_) ; 
    4949        output = missingValue ; 
     
    9393      { 
    9494        int n = elementsConnector_.size()-1 ; 
    95         CGathererConnector** connector = elementsConnector_.data() + n ; 
     95        shared_ptr<CGathererConnector>* connector = elementsConnector_.data() + n ; 
    9696        output.resize(dstSize_) ; 
    9797        output = false ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_local_connector.cpp

    r1960 r2267  
    88{ 
    99  
    10   CGridLocalConnector::CGridLocalConnector(const std::vector<CLocalConnector*>& elementsConnector) : elementsConnector_(elementsConnector) 
     10  CGridLocalConnector::CGridLocalConnector(const std::vector<shared_ptr<CLocalConnector>>& elementsConnector) : elementsConnector_(elementsConnector) 
    1111  { 
    1212    srcSize_=1 ; 
     
    1616  }  
    1717 
    18   CGridLocalConnector::CGridLocalConnector(CGridLocalElements* parent, CElementView::type srcType, CElementView::type dstType, bool withMask) 
     18  CGridLocalConnector::CGridLocalConnector(shared_ptr<CGridLocalElements> parent, CElementView::type srcType, CElementView::type dstType, bool withMask) 
    1919  { 
    20     CGridLocalView* srcView=parent->getView(srcType) ; 
    21     CGridLocalView* dstView=parent->getView(dstType) ; 
     20    shared_ptr<CGridLocalView> srcView=parent->getView(srcType) ; 
     21    shared_ptr<CGridLocalView> dstView=parent->getView(dstType) ; 
    2222 
    23     vector<CLocalView*> srcViews = srcView->getViews() ;  
    24     vector<CLocalView*> dstViews = dstView->getViews() ; 
     23    vector<shared_ptr<CLocalView>> srcViews = srcView->getViews() ;  
     24    vector<shared_ptr<CLocalView>> dstViews = dstView->getViews() ; 
    2525     
    26     vector<CLocalElement*>& elements = parent->getElements(); 
     26    vector<shared_ptr<CLocalElement>>& elements = parent->getElements(); 
    2727    for(auto element : elements) elementsConnector_.push_back(element->getConnector(srcType, dstType)) ; 
    2828    srcSize_=1 ; 
     
    3333    if (parent->hasLocalMask() && withMask) 
    3434    { 
    35       vector<CLocalConnector*> elementsConnector ; 
     35      vector<shared_ptr<CLocalConnector>> elementsConnector ; 
    3636      for(auto element : elements) elementsConnector.push_back(element->getConnector(CElementView::FULL, dstType)) ; 
    37       CGridLocalConnector localToDst(elementsConnector) ; 
    38       CArray<bool,1> maskIn(localToDst.getSrcSize()) ; 
    39       CArray<bool,1> maskOut1(localToDst.getDstSize()) ; 
    40       CArray<bool,1> maskOut2(localToDst.getDstSize()) ; 
     37      auto localToDst=make_shared<CGridLocalConnector>(elementsConnector) ; 
     38      CArray<bool,1> maskIn(localToDst->getSrcSize()) ; 
     39      CArray<bool,1> maskOut1(localToDst->getDstSize()) ; 
     40      CArray<bool,1> maskOut2(localToDst->getDstSize()) ; 
    4141      maskIn=true ; 
    42       localToDst.transfer(maskIn,maskOut1,false) ; 
     42      localToDst->transfer(maskIn,maskOut1,false) ; 
    4343      auto& localMask = parent->getLocalMask() ; 
    4444      for(int i=0 ; i < maskIn.numElements() ; i++) maskIn(i)=localMask[i] ; 
    45       localToDst.transfer(maskIn,maskOut2,false) ; 
     45      localToDst->transfer(maskIn,maskOut2,false) ; 
    4646      mask_.assign(dstSize_,true) ; 
    4747      for(int i=0;i<dstSize_;i++) if (maskOut1(i)==true && maskOut2(i)==false) mask_[i]=false ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_local_connector.hpp

    r1960 r2267  
    1717 
    1818    private:   
    19       std::vector<CLocalConnector*> elementsConnector_ ; 
     19      std::vector<shared_ptr<CLocalConnector>> elementsConnector_ ; 
    2020      int srcSize_ ; 
    2121      int dstSize_ ; 
     
    2424    public: 
    2525       
    26       CGridLocalConnector(const std::vector<CLocalConnector*>& elementsConnector)  ; 
    27       CGridLocalConnector(CGridLocalElements* parent, CElementView::type srcType, CElementView::type dstType, bool withMask=false) ; 
     26      CGridLocalConnector(const std::vector<shared_ptr<CLocalConnector>>& elementsConnector)  ; 
     27      CGridLocalConnector(shared_ptr<CGridLocalElements> parent, CElementView::type srcType, CElementView::type dstType, bool withMask=false) ; 
    2828      int getSrcSize(void) { return srcSize_ ;} 
    2929      int getDstSize(void) { return dstSize_ ;} 
     
    3737      { 
    3838        int n = elementsConnector_.size()-1 ; 
    39         CLocalConnector** connector = elementsConnector_.data() + n ; 
     39        shared_ptr<CLocalConnector>* connector = elementsConnector_.data() + n ; 
    4040        elementsConnector_[n]->transfer(connector, n, input.dataFirst(), output.dataFirst()) ; 
    4141      } 
     
    4545      { 
    4646        int n = elementsConnector_.size()-1 ; 
    47         CLocalConnector** connector = elementsConnector_.data() + n ; 
     47        shared_ptr<CLocalConnector>* connector = elementsConnector_.data() + n ; 
    4848        elementsConnector_[n]->transfer(connector, n, input.dataFirst(), output.dataFirst(), missingValue) ; 
    4949        if (!computeMask_done_) computeMask() ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_local_view.cpp

    r1930 r2267  
    44namespace xios 
    55{ 
    6   CGridLocalView::CGridLocalView(CGridLocalElements* parent, CElementView::type type) : localMask_(parent->getLocalMask()) 
     6  CGridLocalView::CGridLocalView(shared_ptr<CGridLocalElements> parent, CElementView::type type) : localMask_(parent->getLocalMask()) 
    77  { 
    88    size_ = 1 ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_local_view.hpp

    r1999 r2267  
    1212  { 
    1313    private: 
    14       std::vector<CLocalView*> views_ ; 
     14      std::vector<shared_ptr<CLocalView>> views_ ; 
    1515      std::vector<bool>& localMask_ ; 
    1616      int size_ ; 
    1717     
    1818    public: 
    19       CGridLocalView(CGridLocalElements* parent, CElementView::type type) ; 
    20       std::vector<CLocalView*>& getViews(void) {return views_ ;} 
    21       CLocalView* getView(int i) {return views_[i] ;} 
     19      CGridLocalView(shared_ptr<CGridLocalElements> parent, CElementView::type type) ; 
     20      std::vector<shared_ptr<CLocalView>>& getViews(void) {return views_ ;} 
     21      shared_ptr<CLocalView> getView(int i) {return views_[i] ;} 
    2222      int getSize() { return size_ ;} 
    2323  } ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_mask_connector.hpp

    r1955 r2267  
    1515    public: 
    1616 
    17       CGridMaskConnector(vector<CLocalView*>& views) : views_(views) {} 
     17      CGridMaskConnector(vector<shared_ptr<CLocalView>>& views) : views_(views) {} 
    1818      void computeConnector(CArray<bool,1>& mask) ; 
    1919      
     
    2222     
    2323    private: 
    24       vector<CLocalView*> views_ ; 
     24      vector<shared_ptr<CLocalView>> views_ ; 
    2525      vector<CArray<bool,1>> elementsMask_ ;  
    2626 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.cpp

    r2236 r2267  
    1515   * \param remoteSize Size of the remote communicator 
    1616   */  
    17   CGridRemoteConnector::CGridRemoteConnector(vector<CLocalView*>& srcView, vector<CDistributedView*>& dstView, MPI_Comm localComm, int remoteSize)  
     17  CGridRemoteConnector::CGridRemoteConnector(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CDistributedView>>& dstView, MPI_Comm localComm, int remoteSize)  
    1818                       : srcView_(srcView), dstView_(dstView), localComm_(localComm), remoteSize_(remoteSize)  
    1919  {} 
     
    2626   * \param remoteSize Size of the remote communicator 
    2727   */  
    28   CGridRemoteConnector::CGridRemoteConnector(vector<CLocalView*>& srcView, vector<CLocalView*>& dstView, MPI_Comm localComm, int remoteSize)  
     28  CGridRemoteConnector::CGridRemoteConnector(vector<shared_ptr<CLocalView>>& srcView, vector< shared_ptr<CLocalView> >& dstView, MPI_Comm localComm, int remoteSize)  
    2929                       : srcView_(srcView), localComm_(localComm), remoteSize_(remoteSize)  
    3030  { 
    31     for(auto& it : dstView) dstView_.push_back((CDistributedView*) it) ;  
     31    for(auto& it : dstView) dstView_.push_back((shared_ptr<CDistributedView>) it) ;  
    3232  } 
    3333 
     
    135135  void CGridRemoteConnector::computeConnectorMethods(void) 
    136136  { 
    137     vector<CLocalView*> srcView ; 
    138     vector<CDistributedView*> dstView ; 
     137    vector<shared_ptr<CLocalView>> srcView ; 
     138    vector<shared_ptr<CDistributedView>> dstView ; 
    139139    vector<int> indElements ; 
    140140    elements_.resize(srcView_.size()) ; 
     
    435435  *  \param indElements Index of the view making the correspondance between all views and views distributed (that are in input) 
    436436  */ 
    437   void CGridRemoteConnector::computeGenericMethod(vector<CLocalView*>& srcView, vector<CDistributedView*>& dstView, vector<int>& indElements) 
     437  void CGridRemoteConnector::computeGenericMethod(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CDistributedView>>& dstView, vector<int>& indElements) 
    438438  { 
    439439    // generic method, every element can be distributed 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.hpp

    r2236 r2267  
    1818    public: 
    1919 
    20       CGridRemoteConnector(vector<CLocalView*>& srcView, vector<CDistributedView*>& dstView, MPI_Comm localComm, int remoteSize) ; 
    21       CGridRemoteConnector(vector<CLocalView*>& srcView, vector<CLocalView*>& dstView, MPI_Comm localComm, int remoteSize) ; 
     20      CGridRemoteConnector(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CDistributedView>>& dstView, MPI_Comm localComm, int remoteSize) ; 
     21      CGridRemoteConnector(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CLocalView>>& dstView, MPI_Comm localComm, int remoteSize) ; 
    2222      void computeViewDistribution(void) ; 
    2323      void computeConnector(void) ; 
    2424      void computeConnectorMethods(void) ; 
    25       void computeGenericMethod(vector<CLocalView*>& srcView, vector<CDistributedView*>& dstView, vector<int>& indElements) ; 
     25      void computeGenericMethod(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CDistributedView>>& dstView, vector<int>& indElements) ; 
    2626      void computeSrcDstNonDistributed(int i, map<int,bool>& ranks) ; 
    2727      void computeDstNonDistributed(int i, map<int,bool>& ranks) ; 
     
    3939     * It is feed at construction time 
    4040     */ 
    41       vector<CLocalView*> srcView_ ; 
     41      vector<shared_ptr<CLocalView>> srcView_ ; 
    4242 
    4343    /**  
     
    4545     * It is feed at construction time 
    4646     */ 
    47       vector<CDistributedView*> dstView_ ; 
     47      vector<shared_ptr<CDistributedView>> dstView_ ; 
    4848 
    4949    /**   
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_scatterer_connector.hpp

    r2130 r2267  
    1818  { 
    1919    private: 
    20      vector<CScattererConnector*> elementsConnector_ ; 
     20     vector<shared_ptr<CScattererConnector>> elementsConnector_ ; 
    2121     map<int,int> nbSenders_ ; 
    2222     vector<int> ranks_ ; 
     
    2525 
    2626    public: 
    27       CGridScattererConnector(vector<CScattererConnector*> elementsConnector) : elementsConnector_(elementsConnector)  
     27      CGridScattererConnector(vector<shared_ptr<CScattererConnector>> elementsConnector) : elementsConnector_(elementsConnector)  
    2828      { 
    2929        nbSenders_ = elementsConnector[0]->getNbSenders() ; 
     
    4848      { 
    4949        int n = elementsConnector_.size()-1 ; 
    50         CScattererConnector** connector = elementsConnector_.data() + n ; 
     50        shared_ptr<CScattererConnector>* connector = elementsConnector_.data() + n ; 
    5151        for(int rank : ranks_)  
    5252        { 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_transform_connector.cpp

    r2189 r2267  
    1616    int nElements = srcViews_.size() ; 
    1717 
    18     CGridRemoteConnector remoteConnector(srcViews_, remoteViews_, localComm_, commSize) ;   
    19     remoteConnector.computeConnector() ; 
     18    auto remoteConnector = make_shared<CGridRemoteConnector>(srcViews_, remoteViews_, localComm_, commSize) ;   
     19    remoteConnector->computeConnector() ; 
    2020     
    21     vector<CDistributedElement*> sendElements(nElements) ; 
     21    vector<shared_ptr<CDistributedElement>> sendElements(nElements) ; 
    2222    scattererConnector_.resize(nElements) ; 
    2323    gathererConnector_.resize(nElements) ; 
     
    2525    for(int i=0;i<nElements;i++) 
    2626    { 
    27       sendElements[i] = new CDistributedElement(srcViews_[i]->getGlobalSize(), remoteConnector.getDistributedGlobalIndex(i)) ; 
     27      sendElements[i] = make_shared<CDistributedElement>(srcViews_[i]->getGlobalSize(), remoteConnector->getDistributedGlobalIndex(i)) ; 
    2828      sendElements[i]->addFullView() ; 
    29       scattererConnector_[i] = new CScattererConnector(srcViews_[i], sendElements[i]->getView(CElementView::FULL), localComm_, commSize) ; 
     29      scattererConnector_[i] = make_shared<CScattererConnector>(srcViews_[i], sendElements[i]->getView(CElementView::FULL), localComm_, commSize) ; 
    3030      scattererConnector_[i]->computeConnector() ; 
    3131      std::map<int, CArray<size_t,1>>& sendIndex = sendElements[i]->getGlobalIndex() ; 
     
    7575      // create gatherer connector 
    7676 
    77       CDistributedElement recvElement(remoteViews_[i]->getGlobalSize(), recvIndex) ; 
    78       recvElement.addFullView() ; 
    79       gathererConnector_[i] = new CGathererConnector(recvElement.getView(CElementView::FULL), remoteViews_[i]) ; 
     77      auto recvElement = make_shared<CDistributedElement>(remoteViews_[i]->getGlobalSize(), recvIndex) ; 
     78      recvElement->addFullView() ; 
     79      gathererConnector_[i] = make_shared<CGathererConnector>(recvElement->getView(CElementView::FULL), remoteViews_[i]) ; 
    8080      gathererConnector_[i]->computeConnector() ; 
    8181    } 
    8282 
    83     gridScattererConnector_ = new CGridScattererConnector(scattererConnector_) ; 
    84     gridGathererConnector_  = new CGridGathererConnector(gathererConnector_) ; 
     83    gridScattererConnector_ = make_shared<CGridScattererConnector>(scattererConnector_) ; 
     84    gridGathererConnector_  = make_shared<CGridGathererConnector>(gathererConnector_) ; 
    8585  } 
    8686 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_transform_connector.hpp

    r1999 r2267  
    1818      
    1919    public: 
    20       CGridTransformConnector(vector<CLocalView*> srcViews, vector<CLocalView*> remoteViews, MPI_Comm localComm)  
     20      CGridTransformConnector(vector<shared_ptr<CLocalView>> srcViews, vector<shared_ptr<CLocalView>> remoteViews, MPI_Comm localComm)  
    2121                          : srcViews_(srcViews), remoteViews_(remoteViews), localComm_(localComm)  
    2222                          { computeConnector();} 
     
    2525    protected: 
    2626     MPI_Comm localComm_ ; 
    27      vector<CLocalView*> srcViews_ ; 
    28      vector<CLocalView*> remoteViews_ ; 
     27     vector<shared_ptr<CLocalView>> srcViews_ ; 
     28     vector<shared_ptr<CLocalView>> remoteViews_ ; 
    2929     map<int,int> recvRankSize_ ; 
    3030 
    31      vector<CScattererConnector*> scattererConnector_ ; 
    32      vector<CGathererConnector*>  gathererConnector_ ; 
    33      CGridScattererConnector* gridScattererConnector_ ; 
    34      CGridGathererConnector* gridGathererConnector_ ; 
     31     vector<shared_ptr<CScattererConnector>> scattererConnector_ ; 
     32     vector<shared_ptr<CGathererConnector>>  gathererConnector_ ; 
     33     shared_ptr<CGridScattererConnector> gridScattererConnector_ ; 
     34     shared_ptr<CGridGathererConnector> gridGathererConnector_ ; 
    3535   
    3636    public: 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_connector.hpp

    r1918 r2267  
    1515     
    1616    private: 
    17       CLocalView* srcView_; 
    18       CLocalView* dstView_; 
     17      shared_ptr<CLocalView> srcView_; 
     18      shared_ptr<CLocalView> dstView_; 
    1919      int srcSize_ ; 
    2020      int dstSize_ ; 
     
    2424    public: 
    2525     
    26       CLocalConnector(CLocalView* srcView, CLocalView* dstView) : srcView_(srcView), dstView_(dstView),  
     26      CLocalConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) : srcView_(srcView), dstView_(dstView),  
    2727                                                                  srcSize_(srcView->getSize()), dstSize_(dstView->getSize()) {} 
    2828      void computeConnector(void); 
     
    5959      } 
    6060 
    61       template<typename T> void transfer(CLocalConnector** connectors, int nConnectors, const T* input, T* output) 
     61      template<typename T> void transfer(shared_ptr<CLocalConnector>* connectors, int nConnectors, const T* input, T* output) 
    6262      { 
    6363 
     
    9191      } 
    9292 
    93       template<typename T> void transfer(CLocalConnector** connectors, int nConnectors, const T* input, T* output, T missingValue) 
     93      template<typename T> void transfer(shared_ptr<CLocalConnector>* connectors, int nConnectors, const T* input, T* output, T missingValue) 
    9494      { 
    9595        int size=mask_.size() ; 
     
    123123      } 
    124124 
    125       int getSrcSliceSize(CLocalConnector** connectors, int nConnectors)  
     125      int getSrcSliceSize(shared_ptr<CLocalConnector>* connectors, int nConnectors)  
    126126      { if (nConnectors==0) return srcSize_ ; else return srcSize_ * (*(connectors-1))->getSrcSliceSize(connectors-1,nConnectors-1) ; } 
    127127 
    128       int getDstSliceSize(CLocalConnector** connectors, int nConnectors)  
     128      int getDstSliceSize(shared_ptr<CLocalConnector>* connectors, int nConnectors)  
    129129      { if (nConnectors==0) return dstSize_ ; else return dstSize_ * (*(connectors-1))->getDstSliceSize(connectors-1,nConnectors-1) ; } 
    130130 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_view.cpp

    r1930 r2267  
    66namespace xios 
    77{ 
    8   CLocalView::CLocalView(CLocalElement* parent, CElementView::type type, const CArray<int,1>& indexView)  
     8  CLocalView::CLocalView(shared_ptr<CLocalElement> parent, CElementView::type type, const CArray<int,1>& indexView)  
    99                        : CDistributedView( parent, type, {{  parent->localRank_,  indexView }} ), 
    1010                          localRank_(parent->localRank_), 
     
    1515  } 
    1616 
    17   CLocalView::CLocalView(CLocalElement* parent, CElementView::type type, const CArray<bool,1>& maskView)  
     17  CLocalView::CLocalView(shared_ptr<CLocalElement> parent, CElementView::type type, const CArray<bool,1>& maskView)  
    1818                        : CDistributedView( parent, type, {{  parent->localRank_,  maskView }} ), 
    1919                          localRank_(parent->localRank_), 
     
    2424  } 
    2525 
    26   void CLocalView::sendRemoteElement(CRemoteConnector& connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) 
     26  void CLocalView::sendRemoteElement(shared_ptr<CRemoteConnector> connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) 
    2727  { 
    2828    int n = index_.numElements() ; 
     
    3636    CMessage message(messageHeader) ; 
    3737    message<<globalSize_ ; 
    38     connector.transferToServer(ind, client, event, message) ; 
     38    connector->transferToServer(ind, client, event, message) ; 
    3939  } 
    4040 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_view.hpp

    r1954 r2267  
    1616  { 
    1717    public: 
    18     CLocalView(CLocalElement* parent, CElementView::type type, const CArray<int,1>& indexView) ; 
    19     CLocalView(CLocalElement* parent, CElementView::type type, const CArray<bool,1>& maskView) ; 
     18    CLocalView(shared_ptr<CLocalElement> parent, CElementView::type type, const CArray<int,1>& indexView) ; 
     19    CLocalView(shared_ptr<CLocalElement> parent, CElementView::type type, const CArray<bool,1>& maskView) ; 
    2020 
    2121    const CArray<int,1>& getIndex(void) { return index_ ;} 
     
    3838    }     
    3939 
    40     void getGlobalIndex(vector<size_t>& globalIndex, size_t sliceIndex, size_t* sliceSize, CLocalView** localView, int pos) 
     40    void getGlobalIndex(vector<size_t>& globalIndex, size_t sliceIndex, size_t* sliceSize, shared_ptr<CLocalView>* localView, int pos) 
    4141    { 
    4242      if (pos==0) 
     
    5656    int getLocalSize(void) {return localSize_ ;} 
    5757    int getSize(void) {return size_;}  
    58     void sendRemoteElement(CRemoteConnector& connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) ; 
     58    void sendRemoteElement(shared_ptr<CRemoteConnector> connector, CContextClient* client, CEventClient& event, const CMessage& messageHeader) ; 
    5959    
    6060    CArray<size_t,1>& globalIndex_ ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/reduce_transform_connector.cpp

    r2000 r2267  
    55{ 
    66 
    7   CReduceTransformConnector::CReduceTransformConnector(CLocalView* srcView, CLocalView* dstView, EReduction op,  
     7  CReduceTransformConnector::CReduceTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, EReduction op,  
    88                                                       unordered_map<int, std::vector<int>>& indexMap, bool detectMissingValue) 
    99   : srcView_(srcView), dstView_(dstView), detectMissingValue_(detectMissingValue) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/reduce_transform_connector.hpp

    r2188 r2267  
    1717     
    1818    private: 
    19       CLocalView* srcView_; 
    20       CLocalView* dstView_; 
     19      shared_ptr<CLocalView> srcView_; 
     20      shared_ptr<CLocalView> dstView_; 
    2121 
    2222      vector<int> connector_;  //  sizeof sum(nWeights_)   
     
    3434    public: 
    3535 
    36     CReduceTransformConnector(CLocalView* srcView, CLocalView* dstView, EReduction op, unordered_map<int, std::vector<int>>& indexMap,  
     36    CReduceTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, EReduction op, unordered_map<int, std::vector<int>>& indexMap,  
    3737                              bool detectMissingValue=true) ; 
    3838  
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/remote_connector.hpp

    r1918 r2267  
    1717  { 
    1818    private: 
    19       CLocalView* srcView_; 
    20       CDistributedView* dstView_; 
     19      shared_ptr<CLocalView> srcView_; 
     20      shared_ptr<CDistributedView> dstView_; 
    2121      map<int, vector<int>> connector_ ; // connector[rank][srcIndex] 
    2222 
     
    2626     
    2727    public: 
    28       CRemoteConnector(CLocalView* srcView, CDistributedView* dstView, MPI_Comm localComm) : srcView_(srcView), dstView_(dstView), localComm_(localComm){} ; 
     28      CRemoteConnector(shared_ptr<CLocalView> srcView, shared_ptr<CDistributedView> dstView, MPI_Comm localComm) : srcView_(srcView), dstView_(dstView), localComm_(localComm){} ; 
    2929      void computeConnector(void) ; 
    3030      map<int, CArray<size_t,1>>& getDistributedGlobalIndex() { return element_ ;}  
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/scatterer_connector.hpp

    r2118 r2267  
    2323      int remoteCommSize_ ; 
    2424 
    25       CLocalView* srcView_ ; 
    26       CDistributedView* dstView_ ; 
     25      shared_ptr<CLocalView> srcView_ ; 
     26      shared_ptr<CDistributedView> dstView_ ; 
    2727      map<int,int> nbSenders_ ; // number of participant when sending remote buffer 
    2828      int srcSize_ ; 
     
    3131    public: 
    3232 
    33     CScattererConnector(CLocalView* srcView, CDistributedView* dstView, MPI_Comm localComm, int remoteCommSize)  
     33    CScattererConnector(shared_ptr<CLocalView> srcView, shared_ptr<CDistributedView> dstView, MPI_Comm localComm, int remoteCommSize)  
    3434                       : srcView_(srcView), dstView_(dstView), localComm_(localComm), remoteCommSize_(remoteCommSize) {} 
    3535    void computeConnector(void) ; 
     
    147147 
    148148    template<typename T>  
    149     void transfer(int rank, CScattererConnector** connectors, int nConnectors, const T* input, T* output) 
     149    void transfer(int rank, shared_ptr<CScattererConnector>* connectors, int nConnectors, const T* input, T* output) 
    150150    { 
    151151      auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map 
     
    197197    } 
    198198 
    199     int getSrcSliceSize(CScattererConnector** connectors, int nConnectors)  
     199    int getSrcSliceSize(shared_ptr<CScattererConnector>* connectors, int nConnectors)  
    200200    { if (nConnectors==0) return srcSize_ ; else return srcSize_ * (*(connectors-1))->getSrcSliceSize(connectors-1,nConnectors-1) ; } 
    201201 
    202     int getDstSliceSize(int rank, CScattererConnector** connectors, int nConnectors)  
     202    int getDstSliceSize(int rank, shared_ptr<CScattererConnector>* connectors, int nConnectors)  
    203203    { if (nConnectors==0) return dstSize_[rank] ; else return dstSize_[rank] * (*(connectors-1))->getDstSliceSize(rank, connectors-1,nConnectors-1) ; } 
    204204 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transfer_transform_connector.cpp

    r1996 r2267  
    44{ 
    55 
    6   CTransferTransformConnector::CTransferTransformConnector(CLocalView* srcView, CLocalView* dstView, unordered_map<int, int>& indexMap)  
     6  CTransferTransformConnector::CTransferTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, unordered_map<int, int>& indexMap)  
    77    : srcView_(srcView), dstView_(dstView) 
    88  { 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transfer_transform_connector.hpp

    r1999 r2267  
    1515     
    1616    private: 
    17       CLocalView* srcView_; 
    18       CLocalView* dstView_; 
     17      shared_ptr<CLocalView> srcView_; 
     18      shared_ptr<CLocalView> dstView_; 
    1919 
    2020      vector<int> connector_;     
     
    2727    public: 
    2828 
    29     CTransferTransformConnector(CLocalView* srcView, CLocalView* dstView, unordered_map<int, int>& indexMap) ; 
     29    CTransferTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, unordered_map<int, int>& indexMap) ; 
    3030  
    3131    void transfer(int repeat, int sizeT, const CArray<double,1>& dataIn, CArray<double,1>& dataOut) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.cpp

    r1984 r2267  
    5656 
    5757    // distributed element : where to send data 
    58     CDistributedElement dstElement(srcView_->getGlobalSize(), dstArrayIndex) ; 
    59     dstElement.addFullView() ; 
     58    auto dstElement = make_shared<CDistributedElement>(srcView_->getGlobalSize(), dstArrayIndex) ; 
     59    dstElement->addFullView() ; 
    6060     
    6161    // create scatterer connector 
    6262    int commSize ; 
    6363    MPI_Comm_size(localComm_, &commSize) ; 
    64     scattererConnector_ = new CScattererConnector(srcView_, dstElement.getView(CElementView::FULL), localComm_, commSize ) ; 
     64    scattererConnector_ = make_shared<CScattererConnector>(srcView_, dstElement->getView(CElementView::FULL), localComm_, commSize ) ; 
    6565    scattererConnector_->computeConnector() ; 
    6666 
     
    9898    MPI_Waitall(sendReq.size(),sendReq.data(),sendStatus.data()) ; 
    9999 
    100     CDistributedElement remoteElement(dstView_->getGlobalSize(), remoteArrayIndex) ; 
    101     remoteElement.addFullView() ; 
    102     gathererConnector_=new CGathererConnector(remoteElement.getView(CElementView::FULL),dstView_) ; 
     100    auto remoteElement = make_shared<CDistributedElement>(dstView_->getGlobalSize(), remoteArrayIndex) ; 
     101    remoteElement->addFullView() ; 
     102    gathererConnector_= make_shared<CGathererConnector>(remoteElement->getView(CElementView::FULL),dstView_) ; 
    103103    gathererConnector_->computeConnector() ; 
    104104 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.hpp

    r1984 r2267  
    1818      
    1919    public: 
    20       CTransformConnector(CLocalView* srcView, CLocalView* dstView, MPI_Comm localComm)  
     20      CTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, MPI_Comm localComm)  
    2121                          : srcView_(srcView), dstView_(dstView), localComm_(localComm) {} 
    2222     
     
    2525 
    2626      MPI_Comm localComm_ ; 
    27       CLocalView* srcView_ ; 
    28       CLocalView* dstView_ ; 
     27      shared_ptr<CLocalView> srcView_ ; 
     28      shared_ptr<CLocalView> dstView_ ; 
    2929      map<int,int> recvRankSize_ ; 
    30       CScattererConnector* scattererConnector_=nullptr ; 
    31       CGathererConnector*  gathererConnector_=nullptr ; 
     30      shared_ptr<CScattererConnector> scattererConnector_ ; 
     31      shared_ptr<CGathererConnector>  gathererConnector_ ; 
    3232    
    3333    public: 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.cpp

    r1984 r2267  
    44{ 
    55 
    6   CWeightTransformConnector::CWeightTransformConnector(CLocalView* srcView, CLocalView* dstView, unordered_map<int, std::vector<int>>& indexMap,  
     6  CWeightTransformConnector::CWeightTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, unordered_map<int, std::vector<int>>& indexMap,  
    77                                                   unordered_map<int, std::vector<double>>& weightMap) : srcView_(srcView), dstView_(dstView) 
    88  { 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.hpp

    r1984 r2267  
    1515     
    1616    private: 
    17       CLocalView* srcView_; 
    18       CLocalView* dstView_; 
     17      shared_ptr<CLocalView> srcView_; 
     18      shared_ptr<CLocalView> dstView_; 
    1919 
    2020      vector<double> weights_; //  sizeof sum(nWeights_)   
     
    2828    public: 
    2929 
    30     CWeightTransformConnector(CLocalView* srcView, CLocalView* dstView, unordered_map<int, std::vector<int>>& indexMap,  
     30    CWeightTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, unordered_map<int, std::vector<int>>& indexMap,  
    3131                              unordered_map<int, std::vector<double>>& weightMap) ; 
    3232  
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/file_reader_source_filter.cpp

    r2143 r2267  
    7171  void CFileReaderSourceFilter::readData(CArray<double,1>& data) 
    7272  { 
    73     CGridLocalConnector* connector = grid_->getFullToWorkflowConnector() ; 
     73    shared_ptr<CGridLocalConnector> connector = grid_->getFullToWorkflowConnector() ; 
    7474    CArray<double,1> dataIn(connector->getSrcSize()) ; 
    7575    file_->getDataInput()->readFieldData(field_, nStep_%nStepMax_, dataIn); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_output.cpp

    r2264 r2267  
    14001400              compress = latName + appendDomId + " " + lonName + appendDomId; 
    14011401      
    1402               CLocalView* workflowView = domain->getLocalView(CElementView::WORKFLOW) ; 
     1402              shared_ptr<CLocalView> workflowView = domain->getLocalView(CElementView::WORKFLOW) ; 
    14031403              workflowView->getGlobalIndexView(indexes) ; 
    14041404              nbIndexes = workflowView->getSize() ; 
     
    14351435              compress = axisId; 
    14361436 
    1437               CLocalView* workflowView = axis->getLocalView(CElementView::WORKFLOW) ; 
     1437              shared_ptr<CLocalView> workflowView = axis->getLocalView(CElementView::WORKFLOW) ; 
    14381438              workflowView->getGlobalIndexView(indexes) ; 
    14391439              nbIndexes = workflowView->getSize() ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/memtrack.cpp

    r2212 r2267  
    494494        } 
    495495         
    496         xios::CAddr2line myaddr2line ; 
     496        //xios::CAddr2line myaddr2line ; 
    497497        size_t i = 0 ; 
    498498        for(auto& it : orderedBlocks) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp

    r2206 r2267  
    747747      for (int i=0;i<n;i++) ind(i)=index(i) ; 
    748748 
    749       localElement_ = new CLocalElement(rank, n_glo, ind) ; 
     749      localElement_ = make_shared<CLocalElement>(rank, n_glo, ind) ; 
    750750   } 
    751751 
     
    783783   void CAxis::computeModelToWorkflowConnector(void) 
    784784   {  
    785      CLocalView* srcView=getLocalView(CElementView::MODEL) ; 
    786      CLocalView* dstView=getLocalView(CElementView::WORKFLOW) ; 
    787      modelToWorkflowConnector_ = new CLocalConnector(srcView, dstView);  
     785     shared_ptr<CLocalView> srcView=getLocalView(CElementView::MODEL) ; 
     786     shared_ptr<CLocalView> dstView=getLocalView(CElementView::WORKFLOW) ; 
     787     modelToWorkflowConnector_ = make_shared<CLocalConnector>(srcView, dstView);  
    788788     modelToWorkflowConnector_->computeConnector() ; 
    789789   } 
     
    834834      for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy());  
    835835    } 
    836     remoteElement_[client] = new CDistributedElement(n_glo, globalIndex) ; 
     836    remoteElement_[client] = make_shared<CDistributedElement>(n_glo, globalIndex) ; 
    837837    remoteElement_[client]->addFullView() ; 
    838838  } 
    839839  
    840840  void CAxis::distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex,  
    841                                  CScattererConnector* &scattererConnector, const string& axisId) 
     841                                 shared_ptr<CScattererConnector> &scattererConnector, const string& axisId) 
    842842  { 
    843843    string serverAxisId = axisId.empty() ? this->getId() : axisId ; 
     
    846846    this->sendAllAttributesToServer(client, serverAxisId)  ; 
    847847 
    848     CDistributedElement scatteredElement(n_glo,globalIndex) ; 
    849     scatteredElement.addFullView() ; 
    850     scattererConnector = new CScattererConnector(localElement_->getView(CElementView::FULL), scatteredElement.getView(CElementView::FULL),  
    851                                                  context->getIntraComm(), client->getRemoteSize()) ; 
     848    auto scatteredElement = make_shared<CDistributedElement>(n_glo,globalIndex) ; 
     849    scatteredElement->addFullView() ; 
     850    scattererConnector = make_shared<CScattererConnector>(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL),  
     851                                                          context->getIntraComm(), client->getRemoteSize()) ; 
    852852    scattererConnector->computeConnector() ; 
    853853     
     
    866866    scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; 
    867867 
    868     sendDistributedAttributes(client, *scattererConnector, axisId) ; 
     868    sendDistributedAttributes(client, scattererConnector, axisId) ; 
    869869   
    870870    // phase 2 send the mask : data index + mask2D 
    871871    CArray<bool,1> maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); 
    872872    CArray<bool,1> maskOut ; 
    873     CLocalConnector workflowToFull(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; 
    874     workflowToFull.computeConnector() ; 
     873    auto workflowToFull = make_shared<CLocalConnector>(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; 
     874    workflowToFull->computeConnector() ; 
    875875    maskIn=true ; 
    876     workflowToFull.transfer(maskIn,maskOut,false) ; 
     876    workflowToFull->transfer(maskIn,maskOut,false) ; 
    877877 
    878878    // phase 3 : prepare grid scatterer connector to send data from client to server 
     
    880880    map<int,CArray<bool,1>> maskOut2 ;  
    881881    scattererConnector->transfer(maskOut, maskOut2) ; 
    882     scatteredElement.addView(CElementView::WORKFLOW, maskOut2) ; 
    883     scatteredElement.getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; 
     882    scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; 
     883    scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; 
    884884    // create new workflow view for scattered element 
    885     CDistributedElement clientToServerElement(scatteredElement.getGlobalSize(), workflowGlobalIndex) ; 
    886     clientToServerElement.addFullView() ; 
     885    auto clientToServerElement = make_shared<CDistributedElement>(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; 
     886    clientToServerElement->addFullView() ; 
    887887    CEventClient event2(getType(), EVENT_ID_AXIS_DISTRIBUTION); 
    888888    CMessage message2 ; 
    889889    message2<<serverAxisId<<2 ;  
    890     clientToServerElement.sendToServer(client, event2, message2) ;  
    891     clientToServerConnector_[client] = new CScattererConnector(localElement_->getView(CElementView::WORKFLOW), clientToServerElement.getView(CElementView::FULL),  
    892                                                               context->getIntraComm(), client->getRemoteSize()) ; 
     890    clientToServerElement->sendToServer(client, event2, message2) ;  
     891    clientToServerConnector_[client] = make_shared<CScattererConnector>(localElement_->getView(CElementView::WORKFLOW), clientToServerElement->getView(CElementView::FULL),  
     892                                                                        context->getIntraComm(), client->getRemoteSize()) ; 
    893893    clientToServerConnector_[client]->computeConnector() ; 
    894894 
    895     clientFromServerConnector_[client] = new CGathererConnector(clientToServerElement.getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); 
     895    clientFromServerConnector_[client] = make_shared<CGathererConnector>(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); 
    896896    clientFromServerConnector_[client]->computeConnector() ; 
    897897 
     
    916916    if (phasis==0) // receive the remote element to construct the full view 
    917917    { 
    918       localElement_ = new  CLocalElement(context->getIntraCommRank(),event) ; 
     918      localElement_ = make_shared<CLocalElement>(context->getIntraCommRank(),event) ; 
    919919      localElement_->addFullView() ; 
    920920      // construct the local dimension and indexes 
     
    937937    { 
    938938      CContext* context = CContext::getCurrent(); 
    939       CDistributedElement* elementFrom = new  CDistributedElement(event) ; 
     939      shared_ptr<CDistributedElement> elementFrom = make_shared<CDistributedElement>(event) ; 
    940940      elementFrom->addFullView() ; 
    941       gathererConnector_ = new CGathererConnector(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
     941      gathererConnector_ = make_shared<CGathererConnector>(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
    942942      gathererConnector_->computeConnector() ;  
    943943    } 
     
    945945    { 
    946946//      delete gathererConnector_ ; 
    947       elementFrom_ = new  CDistributedElement(event) ; 
     947      elementFrom_ = make_shared<CDistributedElement>(event) ; 
    948948      elementFrom_->addFullView() ; 
    949 //      gathererConnector_ =  new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
     949//      gathererConnector_ =  make_shared<CGathererConnector>(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
    950950//      gathererConnector_ -> computeConnector() ; 
    951951    } 
     
    961961    mask.reference(serverMask.copy()) ; 
    962962  
    963     serverFromClientConnector_ = new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; 
     963    serverFromClientConnector_ = make_shared<CGathererConnector>(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; 
    964964    serverFromClientConnector_->computeConnector() ; 
    965965       
    966     serverToClientConnector_ = new CScattererConnector(localElement_->getView(CElementView::WORKFLOW), elementFrom_->getView(CElementView::FULL), 
    967                                                          context->getIntraComm(), client->getRemoteSize()) ; 
     966    serverToClientConnector_ = make_shared<CScattererConnector>(localElement_->getView(CElementView::WORKFLOW), elementFrom_->getView(CElementView::FULL), 
     967                                                                context->getIntraComm(), client->getRemoteSize()) ; 
    968968    serverToClientConnector_->computeConnector() ; 
    969969  } 
    970970  CATCH_DUMP_ATTR 
    971971 
    972   void CAxis::sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector, const string& axisId) 
     972  void CAxis::sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector, const string& axisId) 
    973973  { 
    974974    string serverAxisId = axisId.empty() ? this->getId() : axisId ; 
     
    981981        CMessage message ; 
    982982        message<<serverAxisId<<string("value") ;  
    983         scattererConnector.transfer(value, client, event,message) ; 
     983        scattererConnector->transfer(value, client, event,message) ; 
    984984      } 
    985985    } 
     
    991991        CMessage message ; 
    992992        message<<serverAxisId<<string("bounds") ;  
    993         scattererConnector.transfer(2, bounds, client, event,message) ; 
     993        scattererConnector->transfer(2, bounds, client, event,message) ; 
    994994      } 
    995995    } 
     
    10161016        CMessage message ; 
    10171017        message<<serverAxisId<<string("label")<<maxSize ; 
    1018         scattererConnector.transfer(maxSize, charArray, client, event,message) ; 
     1018        scattererConnector->transfer(maxSize, charArray, client, event,message) ; 
    10191019      } 
    10201020    } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp

    r2206 r2267  
    222222          
    223223        private: 
    224          CLocalElement* localElement_ = nullptr ; 
     224         shared_ptr<CLocalElement> localElement_ ; 
    225225         void initializeLocalElement(void) ; 
    226226        public:  
    227          CLocalElement* getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
    228          CLocalView* getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
     227         shared_ptr<CLocalElement> getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
     228         shared_ptr<CLocalView> getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
    229229        private: 
    230230         void addFullView(void) ; 
     
    233233 
    234234        private: 
    235          CLocalConnector* modelToWorkflowConnector_ ; 
     235         shared_ptr<CLocalConnector> modelToWorkflowConnector_ ; 
    236236         void computeModelToWorkflowConnector(void)  ; 
    237237        public: 
    238          CLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
     238         shared_ptr<CLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
    239239        
    240240       public: 
    241241         void computeRemoteElement(CContextClient* client, EDistributionType) ; 
    242          void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector, 
     242         void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, shared_ptr<CScattererConnector>& scattererConnector, 
    243243                                 const string& axisId="") ; 
    244244 
     
    246246         void receivedAxisDistribution(CEventServer& event, int phasis) ; 
    247247         void setServerMask(CArray<bool,1>& serverMask, CContextClient* client ) ; 
    248          void sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector, const string& axisId) ; 
     248         void sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector, const string& axisId) ; 
    249249         static void recvDistributedAttributes(CEventServer& event) ; 
    250250         void recvDistributedAttributes(CEventServer& event, const string& type) ; 
    251251       private: 
    252          map<CContextClient*, CDistributedElement*> remoteElement_ ; 
    253        public:  
    254          CDistributedElement* getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
    255        private: 
    256          map<CContextClient*, CScattererConnector*> clientToServerConnector_ ; 
    257        public:  
    258          CScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
    259        private: 
    260          CGathererConnector*  gathererConnector_ ; 
     252         map<CContextClient*, shared_ptr<CDistributedElement>> remoteElement_ ; 
     253       public:  
     254         shared_ptr<CDistributedElement> getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
     255       private: 
     256         map<CContextClient*, shared_ptr<CScattererConnector>> clientToServerConnector_ ; 
     257       public:  
     258         shared_ptr<CScattererConnector> getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
     259       private: 
     260         shared_ptr<CGathererConnector>  gathererConnector_ ; 
    261261       public: 
    262          CGathererConnector* getGathererConnector(void) { return gathererConnector_ ;} 
    263        private: 
    264          CGathererConnector* serverFromClientConnector_ ; 
    265          CDistributedElement* elementFrom_ ; 
     262         shared_ptr<CGathererConnector> getGathererConnector(void) { return gathererConnector_ ;} 
     263       private: 
     264         shared_ptr<CGathererConnector> serverFromClientConnector_ ; 
     265         shared_ptr<CDistributedElement> elementFrom_ ; 
    266266       public: 
    267         CGathererConnector* getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
    268  
    269        private: 
    270          CScattererConnector* serverToClientConnector_ = nullptr ; 
    271        public:  
    272          CScattererConnector* getServerToClientConnector(void) { return serverToClientConnector_ ;}  
    273  
    274        private: 
    275           map<CContextClient*,CGathererConnector*>  clientFromServerConnector_  ; 
    276        public:  
    277          CGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}  
     267        shared_ptr<CGathererConnector> getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
     268 
     269       private: 
     270         shared_ptr<CScattererConnector> serverToClientConnector_ = nullptr ; 
     271       public:  
     272         shared_ptr<CScattererConnector> getServerToClientConnector(void) { return serverToClientConnector_ ;}  
     273 
     274       private: 
     275          map<CContextClient*,shared_ptr<CGathererConnector>>  clientFromServerConnector_  ; 
     276       public:  
     277        shared_ptr<CGathererConnector> getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}  
    278278 
    279279         DECLARE_REF_FUNC(Axis,axis) 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp

    r2249 r2267  
    17401740      // testing ? 
    17411741     /* 
    1742       CLocalView* local = localElement_->getView(CElementView::WORKFLOW) ; 
    1743       CLocalView* model = localElement_->getView(CElementView::MODEL) ; 
     1742      shared_ptr<CLocalView> local = localElement_->getView(CElementView::WORKFLOW) ; 
     1743      shared_ptr<CLocalView> model = localElement_->getView(CElementView::MODEL) ; 
    17441744 
    17451745      CLocalConnector test1(model, local) ; 
     
    17731773      for(int ij=0; ij<nij ; ij++) ij_index(ij) = i_index(ij)+j_index(ij)*ni_glo ; 
    17741774      int rank = CContext::getCurrent()->getIntraCommRank() ; 
    1775       localElement_ = new CLocalElement(rank, ni_glo*nj_glo, ij_index) ; 
     1775      localElement_ = make_shared<CLocalElement>(rank, ni_glo*nj_glo, ij_index) ; 
    17761776   } 
    17771777 
     
    18301830   void CDomain::computeModelToWorkflowConnector(void) 
    18311831   {  
    1832      CLocalView* srcView=getLocalView(CElementView::MODEL) ; 
    1833      CLocalView* dstView=getLocalView(CElementView::WORKFLOW) ; 
    1834      modelToWorkflowConnector_ = new CLocalConnector(srcView, dstView);  
     1832     shared_ptr<CLocalView> srcView=getLocalView(CElementView::MODEL) ; 
     1833     shared_ptr<CLocalView> dstView=getLocalView(CElementView::WORKFLOW) ; 
     1834     modelToWorkflowConnector_ = make_shared<CLocalConnector>(srcView, dstView);  
    18351835     modelToWorkflowConnector_->computeConnector() ; 
    18361836   } 
     
    19891989      for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer] = indGlo ;  
    19901990    } 
    1991     remoteElement_[client] = new CDistributedElement(ni_glo*nj_glo, globalIndex) ; 
     1991    remoteElement_[client] = make_shared<CDistributedElement>(ni_glo*nj_glo, globalIndex) ; 
    19921992    remoteElement_[client]->addFullView() ; 
    19931993  } 
     
    19971997 
    19981998  void CDomain::distributeToServer(CContextClient* client, map<int, CArray<size_t,1>>& globalIndex, 
    1999                                    CScattererConnector* &scattererConnector, const string& domainId) 
     1999                                   shared_ptr<CScattererConnector> &scattererConnector, const string& domainId) 
    20002000  TRY 
    20012001  { 
     
    20052005    this->sendAllAttributesToServer(client, serverDomainId)  ; 
    20062006 
    2007     CDistributedElement scatteredElement(ni_glo*nj_glo, globalIndex) ; 
    2008     scatteredElement.addFullView() ; 
    2009     scattererConnector = new CScattererConnector(localElement_->getView(CElementView::FULL), scatteredElement.getView(CElementView::FULL),  
    2010                                            context->getIntraComm(), client->getRemoteSize()) ; 
     2007    auto scatteredElement = make_shared<CDistributedElement>(ni_glo*nj_glo, globalIndex) ; 
     2008    scatteredElement->addFullView() ; 
     2009    scattererConnector = make_shared<CScattererConnector>(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL),  
     2010                                                          context->getIntraComm(), client->getRemoteSize()) ; 
    20112011    scattererConnector->computeConnector() ; 
    20122012 
     
    20252025    scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; 
    20262026     
    2027     sendDistributedAttributes(client, *scattererConnector, domainId) ; 
     2027    sendDistributedAttributes(client, scattererConnector, domainId) ; 
    20282028 
    20292029   
     
    20312031    CArray<bool,1> maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); 
    20322032    CArray<bool,1> maskOut ; 
    2033     CLocalConnector workflowToFull(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; 
    2034     workflowToFull.computeConnector() ; 
     2033    auto workflowToFull = make_shared<CLocalConnector>(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; 
     2034    workflowToFull->computeConnector() ; 
    20352035    maskIn=true ; 
    2036     workflowToFull.transfer(maskIn,maskOut,false) ; 
     2036    workflowToFull->transfer(maskIn,maskOut,false) ; 
    20372037 
    20382038 
     
    20412041    map<int,CArray<bool,1>> maskOut2 ;  
    20422042    scattererConnector->transfer(maskOut, maskOut2, false) ; 
    2043     scatteredElement.addView(CElementView::WORKFLOW, maskOut2) ; 
    2044     scatteredElement.getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; 
     2043    scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; 
     2044    scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; 
    20452045    // create new workflow view for scattered element 
    2046     CDistributedElement clientToServerElement(scatteredElement.getGlobalSize(), workflowGlobalIndex) ; 
    2047     clientToServerElement.addFullView() ; 
     2046    auto clientToServerElement = make_shared<CDistributedElement>(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; 
     2047    clientToServerElement->addFullView() ; 
    20482048    CEventClient event2(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); 
    20492049    CMessage message2 ; 
    20502050    message2<<serverDomainId<<2 ;  
    2051     clientToServerElement.sendToServer(client, event2, message2) ;  
    2052     clientToServerConnector_[client] = new CScattererConnector(localElement_->getView(CElementView::WORKFLOW), clientToServerElement.getView(CElementView::FULL), 
    2053                                                                context->getIntraComm(), client->getRemoteSize()) ; 
     2051    clientToServerElement->sendToServer(client, event2, message2) ;  
     2052    clientToServerConnector_[client] = make_shared<CScattererConnector>(localElement_->getView(CElementView::WORKFLOW), clientToServerElement->getView(CElementView::FULL), 
     2053                                                                        context->getIntraComm(), client->getRemoteSize()) ; 
    20542054    clientToServerConnector_[client]->computeConnector() ; 
    20552055 
    2056     clientFromServerConnector_[client] = new CGathererConnector(clientToServerElement.getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); 
     2056    clientFromServerConnector_[client] = make_shared<CGathererConnector>(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); 
    20572057    clientFromServerConnector_[client]->computeConnector() ; 
    20582058 
     
    20762076    if (phasis==0) // receive the remote element to construct the full view 
    20772077    { 
    2078       localElement_ = new  CLocalElement(context->getIntraCommRank(),event) ; 
     2078      localElement_ = make_shared<CLocalElement>(context->getIntraCommRank(),event) ; 
    20792079      localElement_->addFullView() ; 
    20802080      // construct the local dimension and indexes 
     
    21022102    { 
    21032103      CContext* context = CContext::getCurrent(); 
    2104       CDistributedElement* elementFrom = new  CDistributedElement(event) ; 
     2104      shared_ptr<CDistributedElement> elementFrom = make_shared<CDistributedElement>(event) ; 
    21052105      elementFrom->addFullView() ; 
    2106       gathererConnector_ = new CGathererConnector(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
     2106      gathererConnector_ = make_shared<CGathererConnector>(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
    21072107      gathererConnector_->computeConnector() ;  
    21082108    } 
     
    21102110    { 
    21112111//      delete gathererConnector_ ; 
    2112       elementFrom_ = new  CDistributedElement(event) ; 
     2112      elementFrom_ = make_shared<CDistributedElement>(event) ; 
    21132113      elementFrom_->addFullView() ; 
    2114 //      gathererConnector_ =  new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
     2114//      gathererConnector_ =  make_shared<CGathererConnector>(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
    21152115//      gathererConnector_ -> computeConnector() ; 
    21162116    } 
     
    21272127    mask_1d.reference(serverMask.copy()) ; 
    21282128  
    2129     serverFromClientConnector_ = new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; 
     2129    serverFromClientConnector_ = make_shared<CGathererConnector>(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; 
    21302130    serverFromClientConnector_->computeConnector() ; 
    21312131       
    2132     serverToClientConnector_ = new CScattererConnector(localElement_->getView(CElementView::WORKFLOW), elementFrom_->getView(CElementView::FULL), 
    2133                                                        context->getIntraComm(), client->getRemoteSize()) ; 
     2132    serverToClientConnector_ = make_shared<CScattererConnector>(localElement_->getView(CElementView::WORKFLOW), elementFrom_->getView(CElementView::FULL), 
     2133                                                                context->getIntraComm(), client->getRemoteSize()) ; 
    21342134    serverToClientConnector_->computeConnector() ; 
    21352135  } 
     
    21372137 
    21382138 
    2139   void CDomain::sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector,  const string& domainId) 
     2139  void CDomain::sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector,  const string& domainId) 
    21402140  { 
    21412141    string serverDomainId = domainId.empty() ? this->getId() : domainId ; 
     
    21482148        CMessage message ; 
    21492149        message<<serverDomainId<<string("lon") ;  
    2150         scattererConnector.transfer(lonvalue, client, event,message) ; 
     2150        scattererConnector->transfer(lonvalue, client, event,message) ; 
    21512151      } 
    21522152       
     
    21552155        CMessage message ; 
    21562156        message<<serverDomainId<<string("lat") ;  
    2157         scattererConnector.transfer(latvalue, client, event, message) ; 
     2157        scattererConnector->transfer(latvalue, client, event, message) ; 
    21582158      } 
    21592159    } 
     
    21652165        CMessage message ; 
    21662166        message<<serverDomainId<<string("boundslon") ;  
    2167         scattererConnector.transfer(nvertex, bounds_lonvalue, client, event, message ) ; 
     2167        scattererConnector->transfer(nvertex, bounds_lonvalue, client, event, message ) ; 
    21682168      } 
    21692169 
     
    21722172        CMessage message ; 
    21732173        message<<serverDomainId<<string("boundslat") ;  
    2174         scattererConnector.transfer(nvertex, bounds_latvalue, client, event, message ) ; 
     2174        scattererConnector->transfer(nvertex, bounds_latvalue, client, event, message ) ; 
    21752175      } 
    21762176    } 
     
    21812181      CMessage message ; 
    21822182      message<<serverDomainId<<string("area") ;  
    2183       scattererConnector.transfer(areavalue, client, event,message) ; 
     2183      scattererConnector->transfer(areavalue, client, event,message) ; 
    21842184    } 
    21852185  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp

    r2206 r2267  
    285285       ////////////////////////////////////////////////////////////////////////////////////// 
    286286       private: 
    287          CLocalElement* localElement_ = nullptr ; 
     287         shared_ptr<CLocalElement> localElement_ = nullptr ; 
    288288         void initializeLocalElement(void) ; 
    289289        
    290290       public:   
    291          CLocalElement* getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
    292          CLocalView* getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
     291         shared_ptr<CLocalElement> getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
     292         shared_ptr<CLocalView> getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
    293293        
    294294       private:   
     
    298298         
    299299       private: 
    300          CLocalConnector* modelToWorkflowConnector_ ; 
     300         shared_ptr<CLocalConnector> modelToWorkflowConnector_ ; 
    301301         void computeModelToWorkflowConnector(void)  ; 
    302302       public: 
    303          CLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
     303         shared_ptr<CLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
    304304 
    305305       public: 
    306306         void computeRemoteElement(CContextClient* client, EDistributionType) ; 
    307          void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector, 
     307         void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, shared_ptr<CScattererConnector> &scattererConnector, 
    308308                                 const string& domainId="") ; 
    309309 
     
    311311         void receivedDomainDistribution(CEventServer& event, int phasis) ; 
    312312 
    313          void sendDistributedAttributes(CContextClient* client, CScattererConnector& scaterrerConnector, const string& domainId) ; 
     313         void sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scaterrerConnector, const string& domainId) ; 
    314314         static void recvDistributedAttributes(CEventServer& event) ; 
    315315         void recvDistributedAttributes(CEventServer& event, const string& type) ; 
     
    317317 
    318318       private: 
    319          map<CContextClient*, CDistributedElement*> remoteElement_ ; 
     319         map<CContextClient*, shared_ptr<CDistributedElement>> remoteElement_ ; 
    320320       public:  
    321          CDistributedElement* getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
    322        private: 
    323          map<CContextClient*, CScattererConnector*> clientToServerConnector_ ; 
     321         shared_ptr<CDistributedElement> getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
     322       private: 
     323         map<CContextClient*, shared_ptr<CScattererConnector>> clientToServerConnector_ ; 
    324324       public:  
    325          CScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
    326         
    327        private: 
    328          CGathererConnector*  gathererConnector_ ; 
    329        public: 
    330          CGathererConnector* getGathererConnector(void) { return gathererConnector_ ;} 
     325         shared_ptr<CScattererConnector> getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
     326        
     327       private: 
     328         shared_ptr<CGathererConnector>  gathererConnector_ ; 
     329       public: 
     330         shared_ptr<CGathererConnector> getGathererConnector(void) { return gathererConnector_ ;} 
    331331        private: 
    332          CGathererConnector* serverFromClientConnector_ ; 
    333          CDistributedElement* elementFrom_ ; 
    334        public: 
    335          CGathererConnector* getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
    336  
    337        private: 
    338          CScattererConnector*  serverToClientConnector_ = nullptr ; 
     332         shared_ptr<CGathererConnector> serverFromClientConnector_ ; 
     333         shared_ptr<CDistributedElement> elementFrom_ ; 
     334       public: 
     335         shared_ptr<CGathererConnector> getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
     336 
     337       private: 
     338         shared_ptr<CScattererConnector>  serverToClientConnector_ = nullptr ; 
    339339       public:  
    340          CScattererConnector* getServerToClientConnector(void) { return serverToClientConnector_ ;}  
    341  
    342        private: 
    343          map<CContextClient*,CGathererConnector*>  clientFromServerConnector_  ; 
     340         shared_ptr<CScattererConnector> getServerToClientConnector(void) { return serverToClientConnector_ ;}  
     341 
     342       private: 
     343         map<CContextClient*,shared_ptr<CGathererConnector>>  clientFromServerConnector_  ; 
    344344       public:  
    345          CGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}         
     345         shared_ptr<CGathererConnector> getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}         
    346346          
    347347 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r2264 r2267  
    14291429    if (posDistributed==elements.size()) posDistributed=0 ; // grid composed only of scalar 
    14301430     
    1431     vector<CLocalView*> localViews ; 
    1432     vector<CLocalView*> workflowView ; 
    1433     vector<CDistributedView*> remoteViews ; 
     1431    vector<shared_ptr<CLocalView>> localViews ; 
     1432    vector<shared_ptr<CLocalView>> workflowView ; 
     1433    vector<shared_ptr<CDistributedView>> remoteViews ; 
    14341434 
    14351435    for(int i=0 ; i<elements.size() ; i++) 
     
    14621462     
    14631463    // CGridClientServerRemoteConnector : workflowView is added to avoid spurious optimisation with only the fullview 
    1464     CGridClientServerRemoteConnector gridRemoteConnector(localViews, workflowView, remoteViews, context->getIntraComm(), client->getRemoteSize()) ; 
    1465     gridRemoteConnector.computeConnector() ; 
     1464    auto gridRemoteConnector = make_shared<CGridClientServerRemoteConnector>(localViews, workflowView, remoteViews, context->getIntraComm(), client->getRemoteSize()) ; 
     1465    gridRemoteConnector->computeConnector() ; 
    14661466     
    1467     vector<CScattererConnector*> scattererConnectors ; 
    1468     CScattererConnector* scattererConnector; 
     1467    vector<shared_ptr<CScattererConnector>> scattererConnectors ; 
     1468    shared_ptr<CScattererConnector> scattererConnector; 
    14691469    for(int i=0 ; i<elements.size() ; i++) 
    14701470    { 
     
    14721472      {  
    14731473        CDomain* domain = (CDomain*) elements[i].ptr ; 
    1474         if (isCoupling) domain->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector,  domain->getCouplingAlias(fieldId,i)) ; 
     1474        if (isCoupling) domain->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector,  domain->getCouplingAlias(fieldId,i)) ; 
    14751475        else  
    14761476        { 
    14771477          sendAddDomain(domain->getId(),client) ; 
    1478           domain->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector) ; 
     1478          domain->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector) ; 
    14791479        } 
    14801480        scattererConnectors.push_back(scattererConnector) ; 
     
    14831483      { 
    14841484        CAxis* axis = (CAxis*) elements[i].ptr ; 
    1485         if (isCoupling) axis->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector,  axis->getCouplingAlias(fieldId,i)) ; 
     1485        if (isCoupling) axis->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector,  axis->getCouplingAlias(fieldId,i)) ; 
    14861486        else  
    14871487        { 
    14881488          sendAddAxis(axis->getId(),client) ; 
    1489           axis->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector) ; 
     1489          axis->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector) ; 
    14901490        } 
    14911491        scattererConnectors.push_back(scattererConnector) ; 
     
    14941494      { 
    14951495        CScalar* scalar = (CScalar*) elements[i].ptr ; 
    1496         if (isCoupling) scalar->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector,  scalar->getCouplingAlias(fieldId,i)) ; 
     1496        if (isCoupling) scalar->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector,  scalar->getCouplingAlias(fieldId,i)) ; 
    14971497        else  
    14981498        { 
    14991499          sendAddScalar(scalar->getId(),client) ; 
    1500           scalar->distributeToServer(client, gridRemoteConnector.getDistributedGlobalIndex(i), scattererConnector) ; 
     1500          scalar->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector) ; 
    15011501        } 
    15021502        scattererConnectors.push_back(scattererConnector) ; 
     
    15041504    } 
    15051505 
    1506     CGridScattererConnector gridScattererConnector(scattererConnectors) ; 
    1507     CGridLocalConnector* workflowToFull = getGridLocalElements()->getConnector(CElementView::WORKFLOW, CElementView::FULL) ; 
     1506    auto gridScattererConnector = make_shared<CGridScattererConnector>(scattererConnectors) ; 
     1507    shared_ptr<CGridLocalConnector> workflowToFull = getGridLocalElements()->getConnector(CElementView::WORKFLOW, CElementView::FULL) ; 
    15081508    CArray<bool,1> maskIn(workflowToFull->getSrcSize()) ; 
    15091509    CArray<bool,1> maskOut(workflowToFull->getDstSize()) ; 
     
    15151515    if (isCoupling) message<<getCouplingAlias(fieldId) ; 
    15161516    else message<<getId() ;  
    1517     gridScattererConnector.transfer(maskOut, client, event, message) ; 
    1518     for(auto& it : scattererConnectors) delete it ; 
    1519  
    1520     vector<CScattererConnector*> clientToServerConnectors ; 
    1521     vector<CGathererConnector*>  clientFromServerConnectors ; 
     1517    gridScattererConnector->transfer(maskOut, client, event, message) ; 
     1518    
     1519    vector<shared_ptr<CScattererConnector>> clientToServerConnectors ; 
     1520    vector<shared_ptr<CGathererConnector>>  clientFromServerConnectors ; 
    15221521    for(auto& element : elements) 
    15231522    { 
     
    15411540     
    15421541    // compute the grid clientToServerConnector to send flux from client to servers 
    1543     clientToServerConnector_[client] = new CGridScattererConnector(clientToServerConnectors) ; 
    1544     clientFromServerConnector_[client] = new CGridGathererConnector(clientFromServerConnectors) ; 
     1542    clientToServerConnector_[client] = make_shared<CGridScattererConnector>(clientToServerConnectors) ; 
     1543    clientFromServerConnector_[client] = make_shared<CGridGathererConnector>(clientFromServerConnectors) ; 
    15451544 
    15461545  } 
     
    15561555  void CGrid::receiveMask(CEventServer& event) 
    15571556  { 
    1558     vector<CGathererConnector*> gathererConnectors ; 
    1559     vector<CLocalView*> fullViews ; 
     1557    vector<shared_ptr<CGathererConnector>> gathererConnectors ; 
     1558    vector<shared_ptr<CLocalView>> fullViews ; 
    15601559 
    15611560    for(auto& element : getElements()) 
     
    15781577      } 
    15791578    } 
    1580     CGridGathererConnector gridGathererConnector(gathererConnectors) ; 
    1581     CGridMaskConnector gridMaskConnector(fullViews) ; 
     1579    auto gridGathererConnector = make_shared<CGridGathererConnector>(gathererConnectors) ; 
     1580    auto gridMaskConnector = make_shared<CGridMaskConnector>(fullViews) ; 
    15821581 
    15831582    CArray<bool,1> maskOut ; 
    1584     gridGathererConnector.transfer_or(event,maskOut) ; 
    1585     gridMaskConnector.computeConnector(maskOut) ; 
     1583    gridGathererConnector->transfer_or(event,maskOut) ; 
     1584    gridMaskConnector->computeConnector(maskOut) ; 
    15861585 
    15871586    CContextClient* client = event.getContextServer()->getAssociatedClient() ; 
     
    15891588    for(auto& element : getElements()) 
    15901589    { 
    1591       if (element.type==TYPE_DOMAIN) element.domain->setServerMask(gridMaskConnector.getElementMask(i),client); 
    1592       else if (element.type==TYPE_AXIS) element.axis->setServerMask(gridMaskConnector.getElementMask(i),client); 
    1593       else if (element.type==TYPE_SCALAR) element.scalar->setServerMask(gridMaskConnector.getElementMask(i),client); 
     1590      if (element.type==TYPE_DOMAIN) element.domain->setServerMask(gridMaskConnector->getElementMask(i),client); 
     1591      else if (element.type==TYPE_AXIS) element.axis->setServerMask(gridMaskConnector->getElementMask(i),client); 
     1592      else if (element.type==TYPE_SCALAR) element.scalar->setServerMask(gridMaskConnector->getElementMask(i),client); 
    15941593      i++ ; 
    15951594    } 
     
    23102309    auto axis=axisList.begin() ; 
    23112310    auto scalar=scalarList.begin() ; 
    2312     vector<CLocalElement*> elements; 
     2311    vector<shared_ptr<CLocalElement>> elements; 
    23132312    for(auto order : order_) 
    23142313    { 
     
    23322331    { 
    23332332      vector<bool> mask(getMask().getVector()) ; 
    2334       gridLocalElements_ = new CGridLocalElements(elements, mask) ;   
    2335     } 
    2336     else gridLocalElements_ = new CGridLocalElements(elements) ;   
     2333      gridLocalElements_ = make_shared<CGridLocalElements>(elements, mask) ;   
     2334    } 
     2335    else gridLocalElements_ = make_shared<CGridLocalElements>(elements) ;   
    23372336  } 
    23382337 
     
    23592358  void CGrid::computeServerFromClientConnector(void) 
    23602359  { 
    2361     vector<CGathererConnector*> connectors ; 
     2360    vector<shared_ptr<CGathererConnector>> connectors ; 
    23622361    for(auto& element : getElements()) 
    23632362    { 
     
    23662365      else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerFromClientConnector()) ;  
    23672366    } 
    2368     serverFromClientConnector_ = new CGridGathererConnector(connectors) ; 
     2367    serverFromClientConnector_ = make_shared<CGridGathererConnector>(connectors) ; 
    23692368  } 
    23702369 
    23712370  void CGrid::computeServerToClientConnector(void) 
    23722371  { 
    2373     vector<CScattererConnector*> connectors ; 
     2372    vector<shared_ptr<CScattererConnector>> connectors ; 
    23742373    for(auto& element : getElements()) 
    23752374    { 
     
    23782377      else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerToClientConnector()) ;  
    23792378    } 
    2380     serverToClientConnector_ = new CGridScattererConnector(connectors) ; 
     2379    serverToClientConnector_ = make_shared<CGridScattererConnector>(connectors) ; 
    23812380  } 
    23822381 
    23832382  void CGrid::computeClientFromClientConnector(void) 
    23842383  { 
    2385     vector<CGathererConnector*> connectors ; 
     2384    vector<shared_ptr<CGathererConnector>> connectors ; 
    23862385    for(auto& element : getElements()) 
    23872386    { 
     
    23902389      else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerFromClientConnector()) ;  
    23912390    } 
    2392     clientFromClientConnector_ = new CGridGathererConnector(connectors) ; 
     2391    clientFromClientConnector_ = make_shared<CGridGathererConnector>(connectors) ; 
    23932392  } 
    23942393 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp

    r2206 r2267  
    328328 
    329329      private:   
    330         CGridLocalElements* gridLocalElements_= nullptr ; 
     330       shared_ptr<CGridLocalElements> gridLocalElements_= nullptr ; 
    331331        void computeGridLocalElements(void) ; 
    332332      public: 
    333         CGridLocalElements* getGridLocalElements(void) { if (gridLocalElements_==nullptr) computeGridLocalElements() ; return gridLocalElements_ ;} 
    334  
    335       private: 
    336         CGridLocalConnector* modelToWorkflowConnector_ = nullptr ; 
     333        shared_ptr<CGridLocalElements> getGridLocalElements(void) { if (gridLocalElements_==nullptr) computeGridLocalElements() ; return gridLocalElements_ ;} 
     334 
     335      private: 
     336        shared_ptr<CGridLocalConnector> modelToWorkflowConnector_ = nullptr ; 
    337337      public: 
    338338        void computeModelToWorkflowConnector(void) ; 
    339         CGridLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_;} 
    340  
    341       private: 
    342         CGridLocalConnector* workflowToModelConnector_ = nullptr; 
     339        shared_ptr<CGridLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_;} 
     340 
     341      private: 
     342        shared_ptr<CGridLocalConnector> workflowToModelConnector_ = nullptr; 
    343343      public: 
    344344        void computeWorkflowToModelConnector(void) ; 
    345         CGridLocalConnector* getWorkflowToModelConnector(void) { if (workflowToModelConnector_==nullptr) computeWorkflowToModelConnector() ; return workflowToModelConnector_;} 
     345        shared_ptr<CGridLocalConnector> getWorkflowToModelConnector(void) { if (workflowToModelConnector_==nullptr) computeWorkflowToModelConnector() ; return workflowToModelConnector_;} 
    346346 
    347347      public: //?  
     
    350350             
    351351      private: 
    352         CGridLocalConnector* workflowToFullConnector_ = nullptr; 
     352        shared_ptr<CGridLocalConnector> workflowToFullConnector_ = nullptr; 
    353353      public: 
    354354        void computeWorkflowToFullConnector(void) ; 
    355         CGridLocalConnector* getWorkflowToFullConnector(void) { if (workflowToFullConnector_==nullptr) computeWorkflowToFullConnector() ; return workflowToFullConnector_;} 
    356  
    357       private: 
    358         CGridLocalConnector* fullToWorkflowConnector_ = nullptr; 
     355        shared_ptr<CGridLocalConnector> getWorkflowToFullConnector(void) { if (workflowToFullConnector_==nullptr) computeWorkflowToFullConnector() ; return workflowToFullConnector_;} 
     356 
     357      private: 
     358        shared_ptr<CGridLocalConnector> fullToWorkflowConnector_ = nullptr; 
    359359      public: 
    360360        void computeFullToWorkflowConnector(void) ; 
    361         CGridLocalConnector* getFullToWorkflowConnector(void) { if (fullToWorkflowConnector_==nullptr) computeFullToWorkflowConnector() ; return fullToWorkflowConnector_;} 
     361        shared_ptr<CGridLocalConnector> getFullToWorkflowConnector(void) { if (fullToWorkflowConnector_==nullptr) computeFullToWorkflowConnector() ; return fullToWorkflowConnector_;} 
    362362 
    363363     
    364364 
    365365      private: 
    366          CGridGathererConnector* clientFromClientConnector_ = nullptr ; 
    367       public: 
    368          CGridGathererConnector* getClientFromClientConnector(void) { if (clientFromClientConnector_==nullptr) computeClientFromClientConnector() ; return clientFromClientConnector_;} 
     366         shared_ptr<CGridGathererConnector> clientFromClientConnector_ = nullptr ; 
     367      public: 
     368         shared_ptr<CGridGathererConnector> getClientFromClientConnector(void) { if (clientFromClientConnector_==nullptr) computeClientFromClientConnector() ; return clientFromClientConnector_;} 
    369369         void computeClientFromClientConnector(void) ; 
    370370 
    371371      private: 
    372          map<CContextClient*, CGridScattererConnector*> clientToClientConnector_ ; 
    373       public: 
    374          CGridScattererConnector* getClientToClientConnector(CContextClient* client) { return clientToClientConnector_[client] ;} // make some test to see if connector exits for the given client 
     372         map<CContextClient*, shared_ptr<CGridScattererConnector>> clientToClientConnector_ ; 
     373      public: 
     374         shared_ptr<CGridScattererConnector> getClientToClientConnector(CContextClient* client) { return clientToClientConnector_[client] ;} // make some test to see if connector exits for the given client 
    375375   
    376376 
    377377      private: 
    378          map<CContextClient*,CGridGathererConnector*> clientFromServerConnector_  ; 
    379       public: 
    380          CGridGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client];} 
     378         map<CContextClient*,shared_ptr<CGridGathererConnector>> clientFromServerConnector_  ; 
     379      public: 
     380         shared_ptr<CGridGathererConnector> getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client];} 
    381381         void computeClientFromServerConnector(void) ; 
    382382 
    383383      private: 
    384          CGridScattererConnector* serverToClientConnector_=nullptr ; 
    385       public: 
    386          CGridScattererConnector* getServerToClientConnector(void) { if (serverToClientConnector_==nullptr) computeServerToClientConnector() ; return serverToClientConnector_;} 
     384         shared_ptr<CGridScattererConnector> serverToClientConnector_=nullptr ; 
     385      public: 
     386         shared_ptr<CGridScattererConnector> getServerToClientConnector(void) { if (serverToClientConnector_==nullptr) computeServerToClientConnector() ; return serverToClientConnector_;} 
    387387         void computeServerToClientConnector(void) ; 
    388388      private: 
    389          map<CContextClient*, CGridScattererConnector*> clientToServerConnector_ ; 
    390       public: 
    391          CGridScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} // make some test to see if connector exits for the given client 
     389         map<CContextClient*, shared_ptr<CGridScattererConnector>> clientToServerConnector_ ; 
     390      public: 
     391         shared_ptr<CGridScattererConnector> getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} // make some test to see if connector exits for the given client 
    392392          
    393393      private: 
    394          CGridGathererConnector* serverFromClientConnector_ = nullptr ; 
    395       public: 
    396          CGridGathererConnector* getServerFromClientConnector(void) { if (serverFromClientConnector_==nullptr) computeServerFromClientConnector() ; return serverFromClientConnector_;} 
     394         shared_ptr<CGridGathererConnector> serverFromClientConnector_ = nullptr ; 
     395      public: 
     396         shared_ptr<CGridGathererConnector> getServerFromClientConnector(void) { if (serverFromClientConnector_==nullptr) computeServerFromClientConnector() ; return serverFromClientConnector_;} 
    397397         void computeServerFromClientConnector(void) ; 
    398398 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp

    r2264 r2267  
    346346      CArray<size_t,1> index(n) ; 
    347347      if (n==1) index(0)=0 ; 
    348       localElement_ = new CLocalElement(rank, 1, index) ; 
     348      localElement_ = make_shared<CLocalElement>(rank, 1, index) ; 
    349349   } 
    350350 
     
    377377   void CScalar::computeModelToWorkflowConnector(void) 
    378378   {  
    379      CLocalView* srcView=getLocalView(CElementView::MODEL) ; 
    380      CLocalView* dstView=getLocalView(CElementView::WORKFLOW) ; 
    381      modelToWorkflowConnector_ = new CLocalConnector(srcView, dstView);  
     379     shared_ptr<CLocalView> srcView=getLocalView(CElementView::MODEL) ; 
     380     shared_ptr<CLocalView> dstView=getLocalView(CElementView::WORKFLOW) ; 
     381     modelToWorkflowConnector_ = make_shared<CLocalConnector>(srcView, dstView);  
    382382     modelToWorkflowConnector_->computeConnector() ; 
    383383   } 
     
    409409      for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy()) ;  
    410410    } 
    411     remoteElement_[client] = new CDistributedElement(nglo, globalIndex) ; 
     411    remoteElement_[client] = make_shared<CDistributedElement>(nglo, globalIndex) ; 
    412412    remoteElement_[client]->addFullView() ; 
    413413  } 
    414414  
    415415  void CScalar::distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex,  
    416                                    CScattererConnector* &scattererConnector, const string& scalarId) 
     416                                   shared_ptr<CScattererConnector> &scattererConnector, const string& scalarId) 
    417417  { 
    418418    string serverScalarId = scalarId.empty() ? this->getId() : scalarId ; 
     
    421421    this->sendAllAttributesToServer(client, serverScalarId)  ; 
    422422 
    423     CDistributedElement scatteredElement(1,globalIndex) ; 
    424     scatteredElement.addFullView() ; 
    425     scattererConnector = new CScattererConnector(localElement_->getView(CElementView::FULL), scatteredElement.getView(CElementView::FULL),  
    426                                                  context->getIntraComm(), client->getRemoteSize()) ; 
     423    auto scatteredElement = make_shared<CDistributedElement>(1,globalIndex) ; 
     424    scatteredElement->addFullView() ; 
     425    scattererConnector = make_shared<CScattererConnector>(localElement_->getView(CElementView::FULL), scatteredElement->getView(CElementView::FULL),  
     426                                                          context->getIntraComm(), client->getRemoteSize()) ; 
    427427    scattererConnector->computeConnector() ; 
    428428     
     
    441441    scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; 
    442442 
    443     sendDistributedAttributes(client, *scattererConnector, scalarId) ; 
     443    sendDistributedAttributes(client, scattererConnector, scalarId) ; 
    444444   
    445445    // phase 2 send the mask : data index + mask2D 
    446446    CArray<bool,1> maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); 
    447447    CArray<bool,1> maskOut ; 
    448     CLocalConnector workflowToFull(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; 
    449     workflowToFull.computeConnector() ; 
     448    auto workflowToFull = make_shared<CLocalConnector>(localElement_->getView(CElementView::WORKFLOW), localElement_->getView(CElementView::FULL)) ; 
     449    workflowToFull->computeConnector() ; 
    450450    maskIn=true ; 
    451     workflowToFull.transfer(maskIn,maskOut,false) ; 
     451    workflowToFull->transfer(maskIn,maskOut,false) ; 
    452452 
    453453    // phase 3 : prepare grid scatterer connector to send data from client to server 
     
    455455    map<int,CArray<bool,1>> maskOut2 ;  
    456456    scattererConnector->transfer(maskOut, maskOut2) ; 
    457     scatteredElement.addView(CElementView::WORKFLOW, maskOut2) ; 
    458     scatteredElement.getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; 
     457    scatteredElement->addView(CElementView::WORKFLOW, maskOut2) ; 
     458    scatteredElement->getView(CElementView::WORKFLOW)->getGlobalIndexView(workflowGlobalIndex) ; 
    459459    // create new workflow view for scattered element 
    460     CDistributedElement clientToServerElement(scatteredElement.getGlobalSize(), workflowGlobalIndex) ; 
    461     clientToServerElement.addFullView() ; 
     460    auto clientToServerElement = make_shared<CDistributedElement>(scatteredElement->getGlobalSize(), workflowGlobalIndex) ; 
     461    clientToServerElement->addFullView() ; 
    462462    CEventClient event2(getType(), EVENT_ID_SCALAR_DISTRIBUTION); 
    463463    CMessage message2 ; 
    464464    message2<<serverScalarId<<2 ;  
    465     clientToServerElement.sendToServer(client, event2, message2) ;  
    466     clientToServerConnector_[client] = new CScattererConnector(localElement_->getView(CElementView::WORKFLOW), clientToServerElement.getView(CElementView::FULL), 
    467                                                                context->getIntraComm(), client->getRemoteSize()) ; 
     465    clientToServerElement->sendToServer(client, event2, message2) ;  
     466    clientToServerConnector_[client] = make_shared<CScattererConnector>(localElement_->getView(CElementView::WORKFLOW), clientToServerElement->getView(CElementView::FULL), 
     467                                                                        context->getIntraComm(), client->getRemoteSize()) ; 
    468468    clientToServerConnector_[client]->computeConnector() ; 
    469469 
    470     clientFromServerConnector_[client] = new CGathererConnector(clientToServerElement.getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); 
     470    clientFromServerConnector_[client] = make_shared<CGathererConnector>(clientToServerElement->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)); 
    471471    clientFromServerConnector_[client]->computeConnector() ; 
    472472 
     
    489489    if (phasis==0) // receive the remote element to construct the full view 
    490490    { 
    491       localElement_ = new  CLocalElement(context->getIntraCommRank(),event) ; 
     491      localElement_ = make_shared<CLocalElement>(context->getIntraCommRank(),event) ; 
    492492      localElement_->addFullView() ; 
    493493      // construct the local dimension and indexes 
     
    499499    { 
    500500      CContext* context = CContext::getCurrent(); 
    501       CDistributedElement* elementFrom = new  CDistributedElement(event) ; 
     501      shared_ptr<CDistributedElement> elementFrom = make_shared<CDistributedElement>(event) ; 
    502502      elementFrom->addFullView() ; 
    503       gathererConnector_ = new CGathererConnector(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
     503      gathererConnector_ = make_shared<CGathererConnector>(elementFrom->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
    504504      gathererConnector_->computeConnector() ;  
    505505    } 
     
    507507    { 
    508508//      delete gathererConnector_ ; 
    509       elementFrom_ = new  CDistributedElement(event) ; 
     509      elementFrom_ = make_shared<CDistributedElement>(event) ; 
    510510      elementFrom_->addFullView() ; 
    511 //      gathererConnector_ =  new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
     511//      gathererConnector_ =  make_shared<CGathererConnector>(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::FULL)) ; 
    512512//      gathererConnector_ -> computeConnector() ; 
    513513    } 
     
    522522    if (serverMask.numElements()==1) mask = serverMask(0) ; 
    523523  
    524     serverFromClientConnector_ = new CGathererConnector(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; 
     524    serverFromClientConnector_ = make_shared<CGathererConnector>(elementFrom_->getView(CElementView::FULL), localElement_->getView(CElementView::WORKFLOW)) ; 
    525525    serverFromClientConnector_->computeConnector() ; 
    526526       
    527     serverToClientConnector_ = new CScattererConnector(localElement_->getView(CElementView::WORKFLOW), elementFrom_->getView(CElementView::FULL), 
    528                                                          context->getIntraComm(), client->getRemoteSize()) ; 
     527    serverToClientConnector_ = make_shared<CScattererConnector>(localElement_->getView(CElementView::WORKFLOW), elementFrom_->getView(CElementView::FULL), 
     528                                                                context->getIntraComm(), client->getRemoteSize()) ; 
    529529    serverToClientConnector_->computeConnector() ; 
    530530  } 
    531531  CATCH_DUMP_ATTR 
    532532 
    533   void CScalar::sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector, const string& scalarId) 
     533  void CScalar::sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector, const string& scalarId) 
    534534  { 
    535535    string serverScalarId = scalarId.empty() ? this->getId() : scalarId ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp

    r2206 r2267  
    175175    ////////////////////////////////////////////////////////////////////////////////////// 
    176176    private: 
    177       CLocalElement* localElement_ = nullptr ; 
     177      shared_ptr<CLocalElement> localElement_ = nullptr ; 
    178178      void initializeLocalElement(void) ; 
    179179        
    180180    public:   
    181       CLocalElement* getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
    182       CLocalView* getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
     181      shared_ptr<CLocalElement> getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
     182      shared_ptr<CLocalView> getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
    183183        
    184184    private:   
     
    188188         
    189189    private: 
    190       CLocalConnector* modelToWorkflowConnector_ ; 
     190      shared_ptr<CLocalConnector> modelToWorkflowConnector_ ; 
    191191      void computeModelToWorkflowConnector(void)  ; 
    192192    public: 
    193       CLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
     193      shared_ptr<CLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
    194194 
    195195    public: 
    196196      void computeRemoteElement(CContextClient* client, EDistributionType) ; 
    197       void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector, 
     197      void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, shared_ptr<CScattererConnector> &scattererConnector, 
    198198                                 const string& scalarId="") ; 
    199199 
     
    201201      void receivedScalarDistribution(CEventServer& event, int phasis) ; 
    202202      void setServerMask(CArray<bool,1>& serverMask, CContextClient* client) ; 
    203       void sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector, const string& scalarId) ; 
     203      void sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector, const string& scalarId) ; 
    204204      static void recvDistributedAttributes(CEventServer& event) ; 
    205205      void recvDistributedAttributes(CEventServer& event, const string& type) ; 
    206206 
    207207    private: 
    208       map<CContextClient*, CDistributedElement*> remoteElement_ ; 
    209     public:  
    210       CDistributedElement* getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
    211     private: 
    212       map<CContextClient*, CScattererConnector*> clientToServerConnector_ ; 
    213     public:  
    214       CScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
    215  
    216     private: 
    217       CGathererConnector*  gathererConnector_ ; 
    218     public: 
    219       CGathererConnector* getGathererConnector(void) { return gathererConnector_ ;} 
    220     private: 
    221       CGathererConnector* serverFromClientConnector_ ; 
    222       CDistributedElement* elementFrom_ ; 
    223     public: 
    224       CGathererConnector* getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
    225  
    226     private: 
    227       CScattererConnector*  serverToClientConnector_ = nullptr ; 
    228     public:  
    229       CScattererConnector* getServerToClientConnector(void) { return serverToClientConnector_ ;}  
    230  
    231     private: 
    232       map<CContextClient*,CGathererConnector*>  clientFromServerConnector_  ; 
    233     public:  
    234       CGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}  
     208      map<CContextClient*, shared_ptr<CDistributedElement>> remoteElement_ ; 
     209    public:  
     210      shared_ptr<CDistributedElement> getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
     211    private: 
     212      map<CContextClient*, shared_ptr<CScattererConnector>> clientToServerConnector_ ; 
     213    public:  
     214      shared_ptr<CScattererConnector> getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
     215 
     216    private: 
     217      shared_ptr<CGathererConnector>  gathererConnector_ ; 
     218    public: 
     219      shared_ptr<CGathererConnector> getGathererConnector(void) { return gathererConnector_ ;} 
     220    private: 
     221      shared_ptr<CGathererConnector> serverFromClientConnector_ ; 
     222      shared_ptr<CDistributedElement> elementFrom_ ; 
     223    public: 
     224      shared_ptr<CGathererConnector> getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
     225 
     226    private: 
     227     shared_ptr<CScattererConnector>  serverToClientConnector_ = nullptr ; 
     228    public:  
     229      shared_ptr<CScattererConnector> getServerToClientConnector(void) { return serverToClientConnector_ ;}  
     230 
     231    private: 
     232      map<CContextClient*,shared_ptr<CGathererConnector>>  clientFromServerConnector_  ; 
     233    public:  
     234      shared_ptr<CGathererConnector> getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}  
    235235 
    236236    private: 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_reduce.cpp

    r2001 r2267  
    66 
    77 
    8   void CAlgorithmTransformationReduce::computeAlgorithm(CLocalView* srcView, CLocalView* dstView) 
     8  void CAlgorithmTransformationReduce::computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 
    99 { 
    1010    this->computeRecvElement(srcView, dstView) ; 
    11     reduceTransformConnector_ = new  CReduceTransformConnector( recvElement_->getView(CElementView::FULL), dstView, operator_, transformationMapping_, detectMissingValue_) ;  
     11    reduceTransformConnector_ = make_shared<CReduceTransformConnector>(recvElement_->getView(CElementView::FULL), dstView, operator_, transformationMapping_, detectMissingValue_) ;  
    1212  } 
    1313  
     
    1818  } 
    1919   
    20   void CAlgorithmTransformationReduce::computeRecvElement(CLocalView* srcView, CLocalView* dstView) 
     20  void CAlgorithmTransformationReduce::computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 
    2121  { 
    2222    auto& srcMap = transformationMapping_ ; 
     
    2828    int i=0 ; 
    2929    for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;} 
    30     recvElement_ = new CLocalElement(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; 
     30    recvElement_ = make_shared<CLocalElement>(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; 
    3131    recvElement_->addFullView() ; 
    3232  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_reduce.hpp

    r2007 r2267  
    1818      virtual ~CAlgorithmTransformationReduce() {}; 
    1919      virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut); 
    20       virtual void computeRecvElement(CLocalView* srcView, CLocalView* dstView) ; 
     20      virtual void computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) ; 
    2121       
    2222    protected: 
    23       virtual void computeAlgorithm(CLocalView* srcView, CLocalView* dstView) ; 
     23      virtual void computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) ; 
    2424        
    2525      //! Map between global index of destination element and source element 
    2626      EReduction operator_ ; 
    2727      TransformationIndexMap transformationMapping_; 
    28       CReduceTransformConnector* reduceTransformConnector_ ; 
     28      shared_ptr<CReduceTransformConnector> reduceTransformConnector_ ; 
    2929      bool detectMissingValue_=true ; 
    3030      bool eliminateRedondantSrc_ = true ;  
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_transfer.cpp

    r2004 r2267  
    88{ 
    99  
    10   void CAlgorithmTransformationTransfer::computeAlgorithm(CLocalView* srcView, CLocalView* dstView) 
     10  void CAlgorithmTransformationTransfer::computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 
    1111  { 
    1212   this->computeRecvElement(srcView, dstView) ; 
    13    transferTransformConnector_ = new  CTransferTransformConnector( recvElement_->getView(CElementView::FULL), dstView, transformationMapping_) ;  
     13   transferTransformConnector_ = make_shared<CTransferTransformConnector>( recvElement_->getView(CElementView::FULL), dstView, transformationMapping_) ;  
    1414  } 
    1515  
     
    2020  } 
    2121   
    22   void CAlgorithmTransformationTransfer::computeRecvElement(CLocalView* srcView, CLocalView* dstView) 
     22  void CAlgorithmTransformationTransfer::computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 
    2323  { 
    2424    set<size_t> srcIndex ; 
     
    2828    int i=0 ; 
    2929    for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;} 
    30     recvElement_ = new CLocalElement(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; 
     30    recvElement_ = make_shared<CLocalElement>(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; 
    3131    recvElement_->addFullView() ; 
    3232  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_transfer.hpp

    r2145 r2267  
    1616      virtual ~CAlgorithmTransformationTransfer() {}; 
    1717      virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut); 
    18       virtual void computeRecvElement(CLocalView* srcView, CLocalView* dstView) ; 
     18      virtual void computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) ; 
    1919      virtual StdString getAlgoName() {return "\\nCAlgorithm transformation Transfer";} 
    2020    
    2121    protected: 
    22       virtual void computeAlgorithm(CLocalView* srcView, CLocalView* dstView) ; 
     22      virtual void computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) ; 
    2323 
    2424      //! Map between global index of destination element and source element 
    2525      unordered_map<int,int> transformationMapping_; 
    26       CTransferTransformConnector* transferTransformConnector_ ; 
     26      shared_ptr<CTransferTransformConnector> transferTransformConnector_ ; 
    2727  }; 
    2828 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_weight.cpp

    r2001 r2267  
    66 
    77 
    8   void CAlgorithmTransformationWeight::computeAlgorithm(CLocalView* srcView, CLocalView* dstView) 
     8  void CAlgorithmTransformationWeight::computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 
    99  { 
    1010    this->computeRecvElement(srcView, dstView) ; 
    11     weightTransformConnector_ = new  CWeightTransformConnector( recvElement_->getView(CElementView::FULL), dstView, transformationMapping_, transformationWeight_) ;  
     11    weightTransformConnector_ = make_shared<CWeightTransformConnector>(recvElement_->getView(CElementView::FULL), dstView, transformationMapping_, transformationWeight_) ;  
    1212  } 
    1313  
     
    1818  } 
    1919 
    20   void CAlgorithmTransformationWeight::computeRecvElement(CLocalView* srcView, CLocalView* dstView) 
     20  void CAlgorithmTransformationWeight::computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 
    2121  { 
    2222    auto& srcMap = transformationMapping_ ; 
     
    2828    int i=0 ; 
    2929    for(size_t index : srcIndex) { srcArrayIndex(i) = index ; i++ ;} 
    30     recvElement_ = new CLocalElement(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; 
     30    recvElement_ = make_shared<CLocalElement>(CContext::getCurrent()->getIntraCommRank(), srcView->getGlobalSize(), srcArrayIndex) ; 
    3131    recvElement_->addFullView() ; 
    3232  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_weight.hpp

    r2007 r2267  
    1818      virtual ~CAlgorithmTransformationWeight() {}; 
    1919      virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut); 
    20       virtual void computeRecvElement(CLocalView* srcView, CLocalView* dstView); 
     20      virtual void computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView); 
    2121    protected: 
    22       virtual void computeAlgorithm(CLocalView* srcView, CLocalView* dstView) ; 
     22      virtual void computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) ; 
    2323 
    2424      //! Map between global index of destination element and source element 
     
    2626      //! Weight corresponding of source to destination 
    2727      TransformationWeightMap transformationWeight_; 
    28       CWeightTransformConnector* weightTransformConnector_ ; 
     28      shared_ptr<CWeightTransformConnector> weightTransformConnector_ ; 
    2929       
    3030  }; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.cpp

    r2126 r2267  
    106106    { 
    107107      CArray<double,1> coord ; 
    108       CLocalConnector destConnector(axisDest_->getLocalView(CElementView::FULL), axisDest_->getLocalView(CElementView::WORKFLOW)) ; 
    109       destConnector.computeConnector() ; 
    110       destConnector.transfer(axisDest_->value, coord) ; 
     108      auto destConnector = make_shared<CLocalConnector>(axisDest_->getLocalView(CElementView::FULL), axisDest_->getLocalView(CElementView::WORKFLOW)) ; 
     109      destConnector->computeConnector() ; 
     110      destConnector->transfer(axisDest_->value, coord) ; 
    111111      destCoordinate_ = vector<double>(coord.dataFirst(), coord.dataFirst()+nDest_) ; 
    112112    } 
     
    129129      CArray<double,1> coord ; 
    130130      CArray<double,1> coordGlo ; 
    131       CLocalConnector srcConnector(axisSrc_->getLocalView(CElementView::FULL), axisSrc_->getLocalView(CElementView::WORKFLOW)) ; 
    132       srcConnector.computeConnector() ; 
    133       srcConnector.transfer(axisSrc_->value, coord) ; // full view value -> workflow value 
     131      auto srcConnector = make_shared<CLocalConnector>(axisSrc_->getLocalView(CElementView::FULL), axisSrc_->getLocalView(CElementView::WORKFLOW)) ; 
     132      srcConnector->computeConnector() ; 
     133      srcConnector->transfer(axisSrc_->value, coord) ; // full view value -> workflow value 
    134134      transferTransformConnector_ -> transfer(coord, coordGlo) ; // workflow view -> full global view 
    135135      srcCoordinate_ = vector<double>(coordGlo.dataFirst(), coordGlo.dataFirst()+ngloSrc_) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.hpp

    r2145 r2267  
    4848    typedef std::unordered_map<int, std::vector<double> > TransformationWeightMap; 
    4949  
    50     CLocalElement* recvElement_=nullptr ; 
     50    shared_ptr<CLocalElement> recvElement_ ; 
    5151    bool isSource_ ; 
    5252 
    5353  public: 
    54     CLocalElement* getRecvElement(void) { return recvElement_ ;} 
     54    shared_ptr<CLocalElement> getRecvElement(void) { return recvElement_ ;} 
    5555   
    5656}; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm_generic.cpp

    r2122 r2267  
    1818  void CGridAlgorithmGeneric::computeAlgorithm(void) 
    1919  { 
    20     CGridLocalElements* gridSrcElements = gridSrc_->getGridLocalElements() ; 
    21     CGridLocalElements* gridDstElements = gridDst_->getGridLocalElements() ; 
     20    shared_ptr<CGridLocalElements> gridSrcElements = gridSrc_->getGridLocalElements() ; 
     21    shared_ptr<CGridLocalElements> gridDstElements = gridDst_->getGridLocalElements() ; 
    2222     
    23     CGridLocalView* srcView = gridSrcElements->getView(CElementView::WORKFLOW) ; 
    24     CGridLocalView* dstView = gridDstElements->getView(CElementView::WORKFLOW) ; 
     23    shared_ptr<CGridLocalView> srcView = gridSrcElements->getView(CElementView::WORKFLOW) ; 
     24    shared_ptr<CGridLocalView> dstView = gridDstElements->getView(CElementView::WORKFLOW) ; 
    2525    MPI_Comm comm = CContext::getCurrent()->getIntraComm() ; 
    2626    int commSize = CContext::getCurrent()->getIntraCommSize() ; 
     
    2929    auto& elements =  gridSrcElements->getElements() ; 
    3030    int nElements = elements.size() ; 
    31     vector<CLocalElement*> remoteElements(nElements) ; 
    32     vector<CLocalView*> remoteViews(nElements) ; 
     31    vector<shared_ptr<CLocalElement>> remoteElements(nElements) ; 
     32    vector<shared_ptr<CLocalView>> remoteViews(nElements) ; 
    3333    for(int i=0;i<nElements;i++) 
    3434    { 
     
    3838        CArray<size_t,1> globalIndexView ; 
    3939        srcView->getView(i)->getGlobalIndexView(globalIndexView) ; 
    40         remoteElements[i] = new CLocalElement(commRank, srcView->getView(i)->getGlobalSize(),globalIndexView) ; 
     40        remoteElements[i] = make_shared<CLocalElement>(commRank, srcView->getView(i)->getGlobalSize(),globalIndexView) ; 
    4141        remoteElements[i]->addFullView() ; 
    4242        if (i>pos_) dimBefore_ *= srcView->getView(i)->getSize() ; 
     
    4747    } 
    4848 
    49     gridTransformConnector_ = new CGridTransformConnector(srcView->getViews(), remoteViews, comm ) ; 
     49    gridTransformConnector_ = make_shared<CGridTransformConnector>(srcView->getViews(), remoteViews, comm ) ; 
    5050  
    5151  } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm_generic.hpp

    r2011 r2267  
    3131     
    3232  protected: 
    33     CGridTransformConnector* gridTransformConnector_=nullptr ; 
     33    shared_ptr<CGridTransformConnector> gridTransformConnector_=nullptr ; 
    3434    CGrid* gridSrc_ = nullptr ; 
    3535    CGrid* gridDst_ = nullptr ; 
Note: See TracChangeset for help on using the changeset viewer.