Changeset 2267
- Timestamp:
- 12/01/21 16:52:24 (3 years ago)
- 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 6 6 { 7 7 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) 9 9 : globalIndex_(parent->globalIndex_), globalSize_(parent->globalSize_), localSize_(parent->localSize_) 10 10 { … … 16 16 } 17 17 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) 19 19 : globalIndex_(parent->globalIndex_), globalSize_(parent->globalSize_), localSize_(parent->localSize_) 20 20 { -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/distributed_view.hpp
r2180 r2267 14 14 public: 15 15 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) ; 18 18 19 19 std::map<int,CArray<int,1>>& getIndex(void) { return index_ ;} … … 48 48 } 49 49 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) 51 51 { 52 52 // using map can be expensive, find an otherway later -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/element.cpp
r1930 r2267 28 28 void CDistributedElement::addView(CElementView::type type, std::map<int, CArray<int,1>>& indexView) 29 29 { 30 views_[type] = new CDistributedView(this, type, indexView) ;30 views_[type] = make_shared<CDistributedView>(shared_from_this(), type, indexView) ; 31 31 } 32 32 33 33 void CDistributedElement::addView(CElementView::type type, std::map<int, CArray<bool,1>>& maskView) 34 34 { 35 views_[type] = new CDistributedView(this, type, maskView) ;35 views_[type] = make_shared<CDistributedView>(shared_from_this(), type, maskView) ; 36 36 } 37 37 … … 120 120 void CLocalElement::addView(CElementView::type type, CArray<int,1>& indexView) 121 121 { 122 views_[type] = new CLocalView(this, type, indexView) ;122 views_[type] = make_shared<CLocalView>(static_pointer_cast<CLocalElement>(shared_from_this()), type, indexView) ; 123 123 } 124 124 125 125 void CLocalElement::addView(CElementView::type type, CArray<bool,1>& maskView) 126 126 { 127 views_[type] = new CLocalView(this, type, maskView) ;127 views_[type] = make_shared<CLocalView>(static_pointer_cast<CLocalElement>(shared_from_this()), type, maskView) ; 128 128 } 129 129 … … 137 137 } 138 138 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) 140 146 { 141 147 auto newPair = pair<CElementView::type,CElementView::type>(srcType,dstType); … … 143 149 if (it==connectors_.end()) 144 150 { 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))) ; 146 152 it=connectors_.insert(insertPair).first ; 147 153 it->second->computeConnector() ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/element.hpp
r1999 r2267 15 15 class CLocalConnector ; 16 16 17 class CDistributedElement 17 class CDistributedElement : public std::enable_shared_from_this<CDistributedElement> 18 18 { 19 19 … … 22 22 std::map<int, int> localSize_ ; 23 23 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_) ; 25 25 CDistributedElement(void) {} ; 26 26 … … 34 34 std::map<int, CArray<size_t,1>>& getGlobalIndex(void) { return globalIndex_;} 35 35 36 CDistributedView*getView(CElementView::type type)36 shared_ptr<CDistributedView> getView(CElementView::type type) 37 37 { 38 38 if (views_[(size_t)type]==nullptr) { ERROR("CDistributedElement::getView(CElementView::type type)",<<"View is not initialized");} … … 51 51 { 52 52 // 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_ ; 54 54 55 55 public: … … 61 61 void addView(CElementView::type type, CArray<bool,1>& maskView) ; 62 62 void addFullView(void) ; 63 CLocalView* getView(CElementView::type type) 64 { 63 64 shared_ptr<CLocalView> getView(CElementView::type type) ; 65 /* { 65 66 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]) ; 67 68 } 68 69 CLocalConnector*getConnector(CElementView::type srcType, CElementView::type dstType) ;69 */ 70 shared_ptr<CLocalConnector> getConnector(CElementView::type srcType, CElementView::type dstType) ; 70 71 71 72 private : -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/gatherer_connector.hpp
r2118 r2267 17 17 { 18 18 private: 19 CDistributedView*srcView_;20 CLocalView*dstView_;19 shared_ptr<CDistributedView> srcView_; 20 shared_ptr<CLocalView> dstView_; 21 21 map<int, vector<int>> connector_ ; 22 22 map<int, vector<bool>> mask_ ; // mask is on src view … … 25 25 26 26 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) {} ; 28 28 void computeConnector(void) ; 29 29 … … 75 75 76 76 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) 78 78 { 79 79 auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map … … 111 111 112 112 // 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) 114 114 { 115 115 auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map … … 210 210 } 211 211 212 int getSrcSliceSize(int rank, CGathererConnector** connectors, int nConnectors)212 int getSrcSliceSize(int rank, shared_ptr<CGathererConnector>* connectors, int nConnectors) 213 213 { if (nConnectors==0) return srcSize_[rank] ; else return srcSize_[rank] * (*(connectors-1))->getSrcSliceSize(rank, connectors-1,nConnectors-1) ; } 214 214 215 int getDstSliceSize( CGathererConnector** connectors, int nConnectors)215 int getDstSliceSize(shared_ptr<CGathererConnector>* connectors, int nConnectors) 216 216 { if (nConnectors==0) return dstSize_ ; else return dstSize_ * (*(connectors-1))->getDstSliceSize(connectors-1,nConnectors-1) ; } 217 217 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_client_server_remote_connector.cpp
r2236 r2267 10 10 * \param remoteSize Size of the remote communicator 11 11 */ 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) 13 14 : CGridRemoteConnector(srcFullView, dstView, localComm, remoteSize) , srcWorkflowView_(srcWorkflowView) 14 15 {} … … 17 18 void CGridClientServerRemoteConnector::computeConnector(void) 18 19 { 19 CGridRemoteConnector workflowRemoteConnector(srcWorkflowView_,dstView_,localComm_,remoteSize_) ;20 workflowRemoteConnector .computeConnector() ;20 auto workflowRemoteConnector=make_shared<CGridRemoteConnector>(srcWorkflowView_,dstView_,localComm_,remoteSize_) ; 21 workflowRemoteConnector->computeConnector() ; 21 22 computeViewDistribution() ; 22 23 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] ; 24 25 computeConnectorMethods() ; 25 26 computeRedondantRanks() ; 26 27 27 28 for(auto& rank : rankToRemove_) 28 if (workflowRemoteConnector .getRankToRemove().count(rank)!=0)29 if (workflowRemoteConnector->getRankToRemove().count(rank)!=0) 29 30 for(auto& element : elements_) element.erase(rank) ; 30 31 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_client_server_remote_connector.hpp
r2236 r2267 12 12 public: 13 13 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) ; 15 15 void computeConnector(void) ; 16 vector< CLocalView*> srcWorkflowView_ ;16 vector<shared_ptr<CLocalView>> srcWorkflowView_ ; 17 17 } ; 18 18 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_elements.cpp
r1960 r2267 6 6 { 7 7 8 CGridLocalView*CGridLocalElements::getView(CElementView::type type)8 shared_ptr<CGridLocalView> CGridLocalElements::getView(CElementView::type type) 9 9 { 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) ; 11 11 return views_[type] ; 12 12 } 13 13 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) 15 15 { 16 16 auto newPair = pair<CElementView::type,CElementView::type>(srcType,dstType); … … 18 18 if (it==connectors_.end()) 19 19 { 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)) ; 21 21 it=connectors_.insert(insertPair).first ; 22 22 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_elements.hpp
r1960 r2267 11 11 class CGridLocalConnector ; 12 12 13 class CGridLocalElements 13 class CGridLocalElements : public std::enable_shared_from_this<CGridLocalElements> 14 14 { 15 15 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_ ; 19 19 vector<bool> localMask_ ; 20 20 21 21 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) {} 24 24 25 25 bool hasLocalMask() { return !localMask_.empty() ;} 26 26 vector<bool>& getLocalMask(void) { return localMask_ ;} 27 27 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) ; 31 31 } ; 32 32 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_gatherer_connector.hpp
r2011 r2267 19 19 private: 20 20 21 vector< CGathererConnector*> elementsConnector_ ;21 vector<shared_ptr<CGathererConnector>> elementsConnector_ ; 22 22 int dstSize_ ; 23 23 24 24 public: 25 CGridGathererConnector(vector< CGathererConnector*> elementsConnector) : elementsConnector_(elementsConnector)25 CGridGathererConnector(vector<shared_ptr<CGathererConnector>> elementsConnector) : elementsConnector_(elementsConnector) 26 26 { 27 27 dstSize_ = 1 ; … … 33 33 { 34 34 int n = elementsConnector_.size()-1 ; 35 CGathererConnector** connector = elementsConnector_.data() + n ;35 shared_ptr<CGathererConnector>* connector = elementsConnector_.data() + n ; 36 36 output.resize(dstSize_) ; 37 37 for(auto& rankDataIn : input) … … 45 45 { 46 46 int n = elementsConnector_.size()-1 ; 47 CGathererConnector** connector = elementsConnector_.data() + n ;47 shared_ptr<CGathererConnector>* connector = elementsConnector_.data() + n ; 48 48 output.resize(dstSize_) ; 49 49 output = missingValue ; … … 93 93 { 94 94 int n = elementsConnector_.size()-1 ; 95 CGathererConnector** connector = elementsConnector_.data() + n ;95 shared_ptr<CGathererConnector>* connector = elementsConnector_.data() + n ; 96 96 output.resize(dstSize_) ; 97 97 output = false ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_local_connector.cpp
r1960 r2267 8 8 { 9 9 10 CGridLocalConnector::CGridLocalConnector(const std::vector< CLocalConnector*>& elementsConnector) : elementsConnector_(elementsConnector)10 CGridLocalConnector::CGridLocalConnector(const std::vector<shared_ptr<CLocalConnector>>& elementsConnector) : elementsConnector_(elementsConnector) 11 11 { 12 12 srcSize_=1 ; … … 16 16 } 17 17 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) 19 19 { 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) ; 22 22 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() ; 25 25 26 vector< CLocalElement*>& elements = parent->getElements();26 vector<shared_ptr<CLocalElement>>& elements = parent->getElements(); 27 27 for(auto element : elements) elementsConnector_.push_back(element->getConnector(srcType, dstType)) ; 28 28 srcSize_=1 ; … … 33 33 if (parent->hasLocalMask() && withMask) 34 34 { 35 vector< CLocalConnector*> elementsConnector ;35 vector<shared_ptr<CLocalConnector>> elementsConnector ; 36 36 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()) ; 41 41 maskIn=true ; 42 localToDst .transfer(maskIn,maskOut1,false) ;42 localToDst->transfer(maskIn,maskOut1,false) ; 43 43 auto& localMask = parent->getLocalMask() ; 44 44 for(int i=0 ; i < maskIn.numElements() ; i++) maskIn(i)=localMask[i] ; 45 localToDst .transfer(maskIn,maskOut2,false) ;45 localToDst->transfer(maskIn,maskOut2,false) ; 46 46 mask_.assign(dstSize_,true) ; 47 47 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 17 17 18 18 private: 19 std::vector< CLocalConnector*> elementsConnector_ ;19 std::vector<shared_ptr<CLocalConnector>> elementsConnector_ ; 20 20 int srcSize_ ; 21 21 int dstSize_ ; … … 24 24 public: 25 25 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) ; 28 28 int getSrcSize(void) { return srcSize_ ;} 29 29 int getDstSize(void) { return dstSize_ ;} … … 37 37 { 38 38 int n = elementsConnector_.size()-1 ; 39 CLocalConnector** connector = elementsConnector_.data() + n ;39 shared_ptr<CLocalConnector>* connector = elementsConnector_.data() + n ; 40 40 elementsConnector_[n]->transfer(connector, n, input.dataFirst(), output.dataFirst()) ; 41 41 } … … 45 45 { 46 46 int n = elementsConnector_.size()-1 ; 47 CLocalConnector** connector = elementsConnector_.data() + n ;47 shared_ptr<CLocalConnector>* connector = elementsConnector_.data() + n ; 48 48 elementsConnector_[n]->transfer(connector, n, input.dataFirst(), output.dataFirst(), missingValue) ; 49 49 if (!computeMask_done_) computeMask() ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_local_view.cpp
r1930 r2267 4 4 namespace xios 5 5 { 6 CGridLocalView::CGridLocalView( CGridLocalElements*parent, CElementView::type type) : localMask_(parent->getLocalMask())6 CGridLocalView::CGridLocalView(shared_ptr<CGridLocalElements> parent, CElementView::type type) : localMask_(parent->getLocalMask()) 7 7 { 8 8 size_ = 1 ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_local_view.hpp
r1999 r2267 12 12 { 13 13 private: 14 std::vector< CLocalView*> views_ ;14 std::vector<shared_ptr<CLocalView>> views_ ; 15 15 std::vector<bool>& localMask_ ; 16 16 int size_ ; 17 17 18 18 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] ;} 22 22 int getSize() { return size_ ;} 23 23 } ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_mask_connector.hpp
r1955 r2267 15 15 public: 16 16 17 CGridMaskConnector(vector< CLocalView*>& views) : views_(views) {}17 CGridMaskConnector(vector<shared_ptr<CLocalView>>& views) : views_(views) {} 18 18 void computeConnector(CArray<bool,1>& mask) ; 19 19 … … 22 22 23 23 private: 24 vector< CLocalView*> views_ ;24 vector<shared_ptr<CLocalView>> views_ ; 25 25 vector<CArray<bool,1>> elementsMask_ ; 26 26 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.cpp
r2236 r2267 15 15 * \param remoteSize Size of the remote communicator 16 16 */ 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) 18 18 : srcView_(srcView), dstView_(dstView), localComm_(localComm), remoteSize_(remoteSize) 19 19 {} … … 26 26 * \param remoteSize Size of the remote communicator 27 27 */ 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) 29 29 : srcView_(srcView), localComm_(localComm), remoteSize_(remoteSize) 30 30 { 31 for(auto& it : dstView) dstView_.push_back(( CDistributedView*) it) ;31 for(auto& it : dstView) dstView_.push_back((shared_ptr<CDistributedView>) it) ; 32 32 } 33 33 … … 135 135 void CGridRemoteConnector::computeConnectorMethods(void) 136 136 { 137 vector< CLocalView*> srcView ;138 vector< CDistributedView*> dstView ;137 vector<shared_ptr<CLocalView>> srcView ; 138 vector<shared_ptr<CDistributedView>> dstView ; 139 139 vector<int> indElements ; 140 140 elements_.resize(srcView_.size()) ; … … 435 435 * \param indElements Index of the view making the correspondance between all views and views distributed (that are in input) 436 436 */ 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) 438 438 { 439 439 // generic method, every element can be distributed -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.hpp
r2236 r2267 18 18 public: 19 19 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) ; 22 22 void computeViewDistribution(void) ; 23 23 void computeConnector(void) ; 24 24 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) ; 26 26 void computeSrcDstNonDistributed(int i, map<int,bool>& ranks) ; 27 27 void computeDstNonDistributed(int i, map<int,bool>& ranks) ; … … 39 39 * It is feed at construction time 40 40 */ 41 vector< CLocalView*> srcView_ ;41 vector<shared_ptr<CLocalView>> srcView_ ; 42 42 43 43 /** … … 45 45 * It is feed at construction time 46 46 */ 47 vector< CDistributedView*> dstView_ ;47 vector<shared_ptr<CDistributedView>> dstView_ ; 48 48 49 49 /** -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_scatterer_connector.hpp
r2130 r2267 18 18 { 19 19 private: 20 vector< CScattererConnector*> elementsConnector_ ;20 vector<shared_ptr<CScattererConnector>> elementsConnector_ ; 21 21 map<int,int> nbSenders_ ; 22 22 vector<int> ranks_ ; … … 25 25 26 26 public: 27 CGridScattererConnector(vector< CScattererConnector*> elementsConnector) : elementsConnector_(elementsConnector)27 CGridScattererConnector(vector<shared_ptr<CScattererConnector>> elementsConnector) : elementsConnector_(elementsConnector) 28 28 { 29 29 nbSenders_ = elementsConnector[0]->getNbSenders() ; … … 48 48 { 49 49 int n = elementsConnector_.size()-1 ; 50 CScattererConnector** connector = elementsConnector_.data() + n ;50 shared_ptr<CScattererConnector>* connector = elementsConnector_.data() + n ; 51 51 for(int rank : ranks_) 52 52 { -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_transform_connector.cpp
r2189 r2267 16 16 int nElements = srcViews_.size() ; 17 17 18 CGridRemoteConnector remoteConnector(srcViews_, remoteViews_, localComm_, commSize) ;19 remoteConnector .computeConnector() ;18 auto remoteConnector = make_shared<CGridRemoteConnector>(srcViews_, remoteViews_, localComm_, commSize) ; 19 remoteConnector->computeConnector() ; 20 20 21 vector< CDistributedElement*> sendElements(nElements) ;21 vector<shared_ptr<CDistributedElement>> sendElements(nElements) ; 22 22 scattererConnector_.resize(nElements) ; 23 23 gathererConnector_.resize(nElements) ; … … 25 25 for(int i=0;i<nElements;i++) 26 26 { 27 sendElements[i] = new CDistributedElement(srcViews_[i]->getGlobalSize(), remoteConnector.getDistributedGlobalIndex(i)) ;27 sendElements[i] = make_shared<CDistributedElement>(srcViews_[i]->getGlobalSize(), remoteConnector->getDistributedGlobalIndex(i)) ; 28 28 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) ; 30 30 scattererConnector_[i]->computeConnector() ; 31 31 std::map<int, CArray<size_t,1>>& sendIndex = sendElements[i]->getGlobalIndex() ; … … 75 75 // create gatherer connector 76 76 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]) ; 80 80 gathererConnector_[i]->computeConnector() ; 81 81 } 82 82 83 gridScattererConnector_ = new CGridScattererConnector(scattererConnector_) ;84 gridGathererConnector_ = new CGridGathererConnector(gathererConnector_) ;83 gridScattererConnector_ = make_shared<CGridScattererConnector>(scattererConnector_) ; 84 gridGathererConnector_ = make_shared<CGridGathererConnector>(gathererConnector_) ; 85 85 } 86 86 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_transform_connector.hpp
r1999 r2267 18 18 19 19 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) 21 21 : srcViews_(srcViews), remoteViews_(remoteViews), localComm_(localComm) 22 22 { computeConnector();} … … 25 25 protected: 26 26 MPI_Comm localComm_ ; 27 vector< CLocalView*> srcViews_ ;28 vector< CLocalView*> remoteViews_ ;27 vector<shared_ptr<CLocalView>> srcViews_ ; 28 vector<shared_ptr<CLocalView>> remoteViews_ ; 29 29 map<int,int> recvRankSize_ ; 30 30 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_ ; 35 35 36 36 public: -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_connector.hpp
r1918 r2267 15 15 16 16 private: 17 CLocalView*srcView_;18 CLocalView*dstView_;17 shared_ptr<CLocalView> srcView_; 18 shared_ptr<CLocalView> dstView_; 19 19 int srcSize_ ; 20 20 int dstSize_ ; … … 24 24 public: 25 25 26 CLocalConnector( CLocalView* srcView, CLocalView*dstView) : srcView_(srcView), dstView_(dstView),26 CLocalConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) : srcView_(srcView), dstView_(dstView), 27 27 srcSize_(srcView->getSize()), dstSize_(dstView->getSize()) {} 28 28 void computeConnector(void); … … 59 59 } 60 60 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) 62 62 { 63 63 … … 91 91 } 92 92 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) 94 94 { 95 95 int size=mask_.size() ; … … 123 123 } 124 124 125 int getSrcSliceSize( CLocalConnector** connectors, int nConnectors)125 int getSrcSliceSize(shared_ptr<CLocalConnector>* connectors, int nConnectors) 126 126 { if (nConnectors==0) return srcSize_ ; else return srcSize_ * (*(connectors-1))->getSrcSliceSize(connectors-1,nConnectors-1) ; } 127 127 128 int getDstSliceSize( CLocalConnector** connectors, int nConnectors)128 int getDstSliceSize(shared_ptr<CLocalConnector>* connectors, int nConnectors) 129 129 { if (nConnectors==0) return dstSize_ ; else return dstSize_ * (*(connectors-1))->getDstSliceSize(connectors-1,nConnectors-1) ; } 130 130 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_view.cpp
r1930 r2267 6 6 namespace xios 7 7 { 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) 9 9 : CDistributedView( parent, type, {{ parent->localRank_, indexView }} ), 10 10 localRank_(parent->localRank_), … … 15 15 } 16 16 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) 18 18 : CDistributedView( parent, type, {{ parent->localRank_, maskView }} ), 19 19 localRank_(parent->localRank_), … … 24 24 } 25 25 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) 27 27 { 28 28 int n = index_.numElements() ; … … 36 36 CMessage message(messageHeader) ; 37 37 message<<globalSize_ ; 38 connector .transferToServer(ind, client, event, message) ;38 connector->transferToServer(ind, client, event, message) ; 39 39 } 40 40 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/local_view.hpp
r1954 r2267 16 16 { 17 17 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) ; 20 20 21 21 const CArray<int,1>& getIndex(void) { return index_ ;} … … 38 38 } 39 39 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) 41 41 { 42 42 if (pos==0) … … 56 56 int getLocalSize(void) {return localSize_ ;} 57 57 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) ; 59 59 60 60 CArray<size_t,1>& globalIndex_ ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/reduce_transform_connector.cpp
r2000 r2267 5 5 { 6 6 7 CReduceTransformConnector::CReduceTransformConnector( CLocalView* srcView, CLocalView*dstView, EReduction op,7 CReduceTransformConnector::CReduceTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, EReduction op, 8 8 unordered_map<int, std::vector<int>>& indexMap, bool detectMissingValue) 9 9 : srcView_(srcView), dstView_(dstView), detectMissingValue_(detectMissingValue) -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/reduce_transform_connector.hpp
r2188 r2267 17 17 18 18 private: 19 CLocalView*srcView_;20 CLocalView*dstView_;19 shared_ptr<CLocalView> srcView_; 20 shared_ptr<CLocalView> dstView_; 21 21 22 22 vector<int> connector_; // sizeof sum(nWeights_) … … 34 34 public: 35 35 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, 37 37 bool detectMissingValue=true) ; 38 38 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/remote_connector.hpp
r1918 r2267 17 17 { 18 18 private: 19 CLocalView*srcView_;20 CDistributedView*dstView_;19 shared_ptr<CLocalView> srcView_; 20 shared_ptr<CDistributedView> dstView_; 21 21 map<int, vector<int>> connector_ ; // connector[rank][srcIndex] 22 22 … … 26 26 27 27 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){} ; 29 29 void computeConnector(void) ; 30 30 map<int, CArray<size_t,1>>& getDistributedGlobalIndex() { return element_ ;} -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/scatterer_connector.hpp
r2118 r2267 23 23 int remoteCommSize_ ; 24 24 25 CLocalView*srcView_ ;26 CDistributedView*dstView_ ;25 shared_ptr<CLocalView> srcView_ ; 26 shared_ptr<CDistributedView> dstView_ ; 27 27 map<int,int> nbSenders_ ; // number of participant when sending remote buffer 28 28 int srcSize_ ; … … 31 31 public: 32 32 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) 34 34 : srcView_(srcView), dstView_(dstView), localComm_(localComm), remoteCommSize_(remoteCommSize) {} 35 35 void computeConnector(void) ; … … 147 147 148 148 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) 150 150 { 151 151 auto& connector = connector_[rank] ; // probably costly, find a better way to avoid the map … … 197 197 } 198 198 199 int getSrcSliceSize( CScattererConnector** connectors, int nConnectors)199 int getSrcSliceSize(shared_ptr<CScattererConnector>* connectors, int nConnectors) 200 200 { if (nConnectors==0) return srcSize_ ; else return srcSize_ * (*(connectors-1))->getSrcSliceSize(connectors-1,nConnectors-1) ; } 201 201 202 int getDstSliceSize(int rank, CScattererConnector** connectors, int nConnectors)202 int getDstSliceSize(int rank, shared_ptr<CScattererConnector>* connectors, int nConnectors) 203 203 { if (nConnectors==0) return dstSize_[rank] ; else return dstSize_[rank] * (*(connectors-1))->getDstSliceSize(rank, connectors-1,nConnectors-1) ; } 204 204 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transfer_transform_connector.cpp
r1996 r2267 4 4 { 5 5 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) 7 7 : srcView_(srcView), dstView_(dstView) 8 8 { -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transfer_transform_connector.hpp
r1999 r2267 15 15 16 16 private: 17 CLocalView*srcView_;18 CLocalView*dstView_;17 shared_ptr<CLocalView> srcView_; 18 shared_ptr<CLocalView> dstView_; 19 19 20 20 vector<int> connector_; … … 27 27 public: 28 28 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) ; 30 30 31 31 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 56 56 57 57 // 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() ; 60 60 61 61 // create scatterer connector 62 62 int commSize ; 63 63 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 ) ; 65 65 scattererConnector_->computeConnector() ; 66 66 … … 98 98 MPI_Waitall(sendReq.size(),sendReq.data(),sendStatus.data()) ; 99 99 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_) ; 103 103 gathererConnector_->computeConnector() ; 104 104 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/transform_connector.hpp
r1984 r2267 18 18 19 19 public: 20 CTransformConnector( CLocalView* srcView, CLocalView*dstView, MPI_Comm localComm)20 CTransformConnector(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView, MPI_Comm localComm) 21 21 : srcView_(srcView), dstView_(dstView), localComm_(localComm) {} 22 22 … … 25 25 26 26 MPI_Comm localComm_ ; 27 CLocalView*srcView_ ;28 CLocalView*dstView_ ;27 shared_ptr<CLocalView> srcView_ ; 28 shared_ptr<CLocalView> dstView_ ; 29 29 map<int,int> recvRankSize_ ; 30 CScattererConnector* scattererConnector_=nullptr;31 CGathererConnector* gathererConnector_=nullptr;30 shared_ptr<CScattererConnector> scattererConnector_ ; 31 shared_ptr<CGathererConnector> gathererConnector_ ; 32 32 33 33 public: -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.cpp
r1984 r2267 4 4 { 5 5 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, 7 7 unordered_map<int, std::vector<double>>& weightMap) : srcView_(srcView), dstView_(dstView) 8 8 { -
XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/weight_transform_connector.hpp
r1984 r2267 15 15 16 16 private: 17 CLocalView*srcView_;18 CLocalView*dstView_;17 shared_ptr<CLocalView> srcView_; 18 shared_ptr<CLocalView> dstView_; 19 19 20 20 vector<double> weights_; // sizeof sum(nWeights_) … … 28 28 public: 29 29 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, 31 31 unordered_map<int, std::vector<double>>& weightMap) ; 32 32 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/file_reader_source_filter.cpp
r2143 r2267 71 71 void CFileReaderSourceFilter::readData(CArray<double,1>& data) 72 72 { 73 CGridLocalConnector*connector = grid_->getFullToWorkflowConnector() ;73 shared_ptr<CGridLocalConnector> connector = grid_->getFullToWorkflowConnector() ; 74 74 CArray<double,1> dataIn(connector->getSrcSize()) ; 75 75 file_->getDataInput()->readFieldData(field_, nStep_%nStepMax_, dataIn); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_output.cpp
r2264 r2267 1400 1400 compress = latName + appendDomId + " " + lonName + appendDomId; 1401 1401 1402 CLocalView*workflowView = domain->getLocalView(CElementView::WORKFLOW) ;1402 shared_ptr<CLocalView> workflowView = domain->getLocalView(CElementView::WORKFLOW) ; 1403 1403 workflowView->getGlobalIndexView(indexes) ; 1404 1404 nbIndexes = workflowView->getSize() ; … … 1435 1435 compress = axisId; 1436 1436 1437 CLocalView*workflowView = axis->getLocalView(CElementView::WORKFLOW) ;1437 shared_ptr<CLocalView> workflowView = axis->getLocalView(CElementView::WORKFLOW) ; 1438 1438 workflowView->getGlobalIndexView(indexes) ; 1439 1439 nbIndexes = workflowView->getSize() ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/memtrack.cpp
r2212 r2267 494 494 } 495 495 496 xios::CAddr2line myaddr2line ;496 //xios::CAddr2line myaddr2line ; 497 497 size_t i = 0 ; 498 498 for(auto& it : orderedBlocks) -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp
r2206 r2267 747 747 for (int i=0;i<n;i++) ind(i)=index(i) ; 748 748 749 localElement_ = new CLocalElement(rank, n_glo, ind) ;749 localElement_ = make_shared<CLocalElement>(rank, n_glo, ind) ; 750 750 } 751 751 … … 783 783 void CAxis::computeModelToWorkflowConnector(void) 784 784 { 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); 788 788 modelToWorkflowConnector_->computeConnector() ; 789 789 } … … 834 834 for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy()); 835 835 } 836 remoteElement_[client] = new CDistributedElement(n_glo, globalIndex) ;836 remoteElement_[client] = make_shared<CDistributedElement>(n_glo, globalIndex) ; 837 837 remoteElement_[client]->addFullView() ; 838 838 } 839 839 840 840 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) 842 842 { 843 843 string serverAxisId = axisId.empty() ? this->getId() : axisId ; … … 846 846 this->sendAllAttributesToServer(client, serverAxisId) ; 847 847 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()) ; 852 852 scattererConnector->computeConnector() ; 853 853 … … 866 866 scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; 867 867 868 sendDistributedAttributes(client, *scattererConnector, axisId) ;868 sendDistributedAttributes(client, scattererConnector, axisId) ; 869 869 870 870 // phase 2 send the mask : data index + mask2D 871 871 CArray<bool,1> maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); 872 872 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() ; 875 875 maskIn=true ; 876 workflowToFull .transfer(maskIn,maskOut,false) ;876 workflowToFull->transfer(maskIn,maskOut,false) ; 877 877 878 878 // phase 3 : prepare grid scatterer connector to send data from client to server … … 880 880 map<int,CArray<bool,1>> maskOut2 ; 881 881 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) ; 884 884 // 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() ; 887 887 CEventClient event2(getType(), EVENT_ID_AXIS_DISTRIBUTION); 888 888 CMessage message2 ; 889 889 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()) ; 893 893 clientToServerConnector_[client]->computeConnector() ; 894 894 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)); 896 896 clientFromServerConnector_[client]->computeConnector() ; 897 897 … … 916 916 if (phasis==0) // receive the remote element to construct the full view 917 917 { 918 localElement_ = new CLocalElement(context->getIntraCommRank(),event) ;918 localElement_ = make_shared<CLocalElement>(context->getIntraCommRank(),event) ; 919 919 localElement_->addFullView() ; 920 920 // construct the local dimension and indexes … … 937 937 { 938 938 CContext* context = CContext::getCurrent(); 939 CDistributedElement* elementFrom = new CDistributedElement(event) ;939 shared_ptr<CDistributedElement> elementFrom = make_shared<CDistributedElement>(event) ; 940 940 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)) ; 942 942 gathererConnector_->computeConnector() ; 943 943 } … … 945 945 { 946 946 // delete gathererConnector_ ; 947 elementFrom_ = new CDistributedElement(event) ;947 elementFrom_ = make_shared<CDistributedElement>(event) ; 948 948 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)) ; 950 950 // gathererConnector_ -> computeConnector() ; 951 951 } … … 961 961 mask.reference(serverMask.copy()) ; 962 962 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)) ; 964 964 serverFromClientConnector_->computeConnector() ; 965 965 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()) ; 968 968 serverToClientConnector_->computeConnector() ; 969 969 } 970 970 CATCH_DUMP_ATTR 971 971 972 void CAxis::sendDistributedAttributes(CContextClient* client, CScattererConnector&scattererConnector, const string& axisId)972 void CAxis::sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector, const string& axisId) 973 973 { 974 974 string serverAxisId = axisId.empty() ? this->getId() : axisId ; … … 981 981 CMessage message ; 982 982 message<<serverAxisId<<string("value") ; 983 scattererConnector .transfer(value, client, event,message) ;983 scattererConnector->transfer(value, client, event,message) ; 984 984 } 985 985 } … … 991 991 CMessage message ; 992 992 message<<serverAxisId<<string("bounds") ; 993 scattererConnector .transfer(2, bounds, client, event,message) ;993 scattererConnector->transfer(2, bounds, client, event,message) ; 994 994 } 995 995 } … … 1016 1016 CMessage message ; 1017 1017 message<<serverAxisId<<string("label")<<maxSize ; 1018 scattererConnector .transfer(maxSize, charArray, client, event,message) ;1018 scattererConnector->transfer(maxSize, charArray, client, event,message) ; 1019 1019 } 1020 1020 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp
r2206 r2267 222 222 223 223 private: 224 CLocalElement* localElement_ = nullptr;224 shared_ptr<CLocalElement> localElement_ ; 225 225 void initializeLocalElement(void) ; 226 226 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) ;} 229 229 private: 230 230 void addFullView(void) ; … … 233 233 234 234 private: 235 CLocalConnector*modelToWorkflowConnector_ ;235 shared_ptr<CLocalConnector> modelToWorkflowConnector_ ; 236 236 void computeModelToWorkflowConnector(void) ; 237 237 public: 238 CLocalConnector*getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;}238 shared_ptr<CLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 239 239 240 240 public: 241 241 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, 243 243 const string& axisId="") ; 244 244 … … 246 246 void receivedAxisDistribution(CEventServer& event, int phasis) ; 247 247 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) ; 249 249 static void recvDistributedAttributes(CEventServer& event) ; 250 250 void recvDistributedAttributes(CEventServer& event, const string& type) ; 251 251 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_ ; 261 261 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_ ; 266 266 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] ;} 278 278 279 279 DECLARE_REF_FUNC(Axis,axis) -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp
r2249 r2267 1740 1740 // testing ? 1741 1741 /* 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) ; 1744 1744 1745 1745 CLocalConnector test1(model, local) ; … … 1773 1773 for(int ij=0; ij<nij ; ij++) ij_index(ij) = i_index(ij)+j_index(ij)*ni_glo ; 1774 1774 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) ; 1776 1776 } 1777 1777 … … 1830 1830 void CDomain::computeModelToWorkflowConnector(void) 1831 1831 { 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); 1835 1835 modelToWorkflowConnector_->computeConnector() ; 1836 1836 } … … 1989 1989 for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer] = indGlo ; 1990 1990 } 1991 remoteElement_[client] = new CDistributedElement(ni_glo*nj_glo, globalIndex) ;1991 remoteElement_[client] = make_shared<CDistributedElement>(ni_glo*nj_glo, globalIndex) ; 1992 1992 remoteElement_[client]->addFullView() ; 1993 1993 } … … 1997 1997 1998 1998 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) 2000 2000 TRY 2001 2001 { … … 2005 2005 this->sendAllAttributesToServer(client, serverDomainId) ; 2006 2006 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()) ; 2011 2011 scattererConnector->computeConnector() ; 2012 2012 … … 2025 2025 scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; 2026 2026 2027 sendDistributedAttributes(client, *scattererConnector, domainId) ;2027 sendDistributedAttributes(client, scattererConnector, domainId) ; 2028 2028 2029 2029 … … 2031 2031 CArray<bool,1> maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); 2032 2032 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() ; 2035 2035 maskIn=true ; 2036 workflowToFull .transfer(maskIn,maskOut,false) ;2036 workflowToFull->transfer(maskIn,maskOut,false) ; 2037 2037 2038 2038 … … 2041 2041 map<int,CArray<bool,1>> maskOut2 ; 2042 2042 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) ; 2045 2045 // 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() ; 2048 2048 CEventClient event2(getType(), EVENT_ID_DOMAIN_DISTRIBUTION); 2049 2049 CMessage message2 ; 2050 2050 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()) ; 2054 2054 clientToServerConnector_[client]->computeConnector() ; 2055 2055 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)); 2057 2057 clientFromServerConnector_[client]->computeConnector() ; 2058 2058 … … 2076 2076 if (phasis==0) // receive the remote element to construct the full view 2077 2077 { 2078 localElement_ = new CLocalElement(context->getIntraCommRank(),event) ;2078 localElement_ = make_shared<CLocalElement>(context->getIntraCommRank(),event) ; 2079 2079 localElement_->addFullView() ; 2080 2080 // construct the local dimension and indexes … … 2102 2102 { 2103 2103 CContext* context = CContext::getCurrent(); 2104 CDistributedElement* elementFrom = new CDistributedElement(event) ;2104 shared_ptr<CDistributedElement> elementFrom = make_shared<CDistributedElement>(event) ; 2105 2105 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)) ; 2107 2107 gathererConnector_->computeConnector() ; 2108 2108 } … … 2110 2110 { 2111 2111 // delete gathererConnector_ ; 2112 elementFrom_ = new CDistributedElement(event) ;2112 elementFrom_ = make_shared<CDistributedElement>(event) ; 2113 2113 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)) ; 2115 2115 // gathererConnector_ -> computeConnector() ; 2116 2116 } … … 2127 2127 mask_1d.reference(serverMask.copy()) ; 2128 2128 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)) ; 2130 2130 serverFromClientConnector_->computeConnector() ; 2131 2131 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()) ; 2134 2134 serverToClientConnector_->computeConnector() ; 2135 2135 } … … 2137 2137 2138 2138 2139 void CDomain::sendDistributedAttributes(CContextClient* client, CScattererConnector&scattererConnector, const string& domainId)2139 void CDomain::sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector, const string& domainId) 2140 2140 { 2141 2141 string serverDomainId = domainId.empty() ? this->getId() : domainId ; … … 2148 2148 CMessage message ; 2149 2149 message<<serverDomainId<<string("lon") ; 2150 scattererConnector .transfer(lonvalue, client, event,message) ;2150 scattererConnector->transfer(lonvalue, client, event,message) ; 2151 2151 } 2152 2152 … … 2155 2155 CMessage message ; 2156 2156 message<<serverDomainId<<string("lat") ; 2157 scattererConnector .transfer(latvalue, client, event, message) ;2157 scattererConnector->transfer(latvalue, client, event, message) ; 2158 2158 } 2159 2159 } … … 2165 2165 CMessage message ; 2166 2166 message<<serverDomainId<<string("boundslon") ; 2167 scattererConnector .transfer(nvertex, bounds_lonvalue, client, event, message ) ;2167 scattererConnector->transfer(nvertex, bounds_lonvalue, client, event, message ) ; 2168 2168 } 2169 2169 … … 2172 2172 CMessage message ; 2173 2173 message<<serverDomainId<<string("boundslat") ; 2174 scattererConnector .transfer(nvertex, bounds_latvalue, client, event, message ) ;2174 scattererConnector->transfer(nvertex, bounds_latvalue, client, event, message ) ; 2175 2175 } 2176 2176 } … … 2181 2181 CMessage message ; 2182 2182 message<<serverDomainId<<string("area") ; 2183 scattererConnector .transfer(areavalue, client, event,message) ;2183 scattererConnector->transfer(areavalue, client, event,message) ; 2184 2184 } 2185 2185 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp
r2206 r2267 285 285 ////////////////////////////////////////////////////////////////////////////////////// 286 286 private: 287 CLocalElement*localElement_ = nullptr ;287 shared_ptr<CLocalElement> localElement_ = nullptr ; 288 288 void initializeLocalElement(void) ; 289 289 290 290 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) ;} 293 293 294 294 private: … … 298 298 299 299 private: 300 CLocalConnector*modelToWorkflowConnector_ ;300 shared_ptr<CLocalConnector> modelToWorkflowConnector_ ; 301 301 void computeModelToWorkflowConnector(void) ; 302 302 public: 303 CLocalConnector*getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;}303 shared_ptr<CLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 304 304 305 305 public: 306 306 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, 308 308 const string& domainId="") ; 309 309 … … 311 311 void receivedDomainDistribution(CEventServer& event, int phasis) ; 312 312 313 void sendDistributedAttributes(CContextClient* client, CScattererConnector&scaterrerConnector, const string& domainId) ;313 void sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scaterrerConnector, const string& domainId) ; 314 314 static void recvDistributedAttributes(CEventServer& event) ; 315 315 void recvDistributedAttributes(CEventServer& event, const string& type) ; … … 317 317 318 318 private: 319 map<CContextClient*, CDistributedElement*> remoteElement_ ;319 map<CContextClient*, shared_ptr<CDistributedElement>> remoteElement_ ; 320 320 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_ ; 324 324 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_ ;} 331 331 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 ; 339 339 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_ ; 344 344 public: 345 CGathererConnector*getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}345 shared_ptr<CGathererConnector> getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;} 346 346 347 347 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r2264 r2267 1429 1429 if (posDistributed==elements.size()) posDistributed=0 ; // grid composed only of scalar 1430 1430 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 ; 1434 1434 1435 1435 for(int i=0 ; i<elements.size() ; i++) … … 1462 1462 1463 1463 // 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() ; 1466 1466 1467 vector< CScattererConnector*> scattererConnectors ;1468 CScattererConnector*scattererConnector;1467 vector<shared_ptr<CScattererConnector>> scattererConnectors ; 1468 shared_ptr<CScattererConnector> scattererConnector; 1469 1469 for(int i=0 ; i<elements.size() ; i++) 1470 1470 { … … 1472 1472 { 1473 1473 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)) ; 1475 1475 else 1476 1476 { 1477 1477 sendAddDomain(domain->getId(),client) ; 1478 domain->distributeToServer(client, gridRemoteConnector .getDistributedGlobalIndex(i), scattererConnector) ;1478 domain->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector) ; 1479 1479 } 1480 1480 scattererConnectors.push_back(scattererConnector) ; … … 1483 1483 { 1484 1484 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)) ; 1486 1486 else 1487 1487 { 1488 1488 sendAddAxis(axis->getId(),client) ; 1489 axis->distributeToServer(client, gridRemoteConnector .getDistributedGlobalIndex(i), scattererConnector) ;1489 axis->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector) ; 1490 1490 } 1491 1491 scattererConnectors.push_back(scattererConnector) ; … … 1494 1494 { 1495 1495 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)) ; 1497 1497 else 1498 1498 { 1499 1499 sendAddScalar(scalar->getId(),client) ; 1500 scalar->distributeToServer(client, gridRemoteConnector .getDistributedGlobalIndex(i), scattererConnector) ;1500 scalar->distributeToServer(client, gridRemoteConnector->getDistributedGlobalIndex(i), scattererConnector) ; 1501 1501 } 1502 1502 scattererConnectors.push_back(scattererConnector) ; … … 1504 1504 } 1505 1505 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) ; 1508 1508 CArray<bool,1> maskIn(workflowToFull->getSrcSize()) ; 1509 1509 CArray<bool,1> maskOut(workflowToFull->getDstSize()) ; … … 1515 1515 if (isCoupling) message<<getCouplingAlias(fieldId) ; 1516 1516 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 ; 1522 1521 for(auto& element : elements) 1523 1522 { … … 1541 1540 1542 1541 // 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) ; 1545 1544 1546 1545 } … … 1556 1555 void CGrid::receiveMask(CEventServer& event) 1557 1556 { 1558 vector< CGathererConnector*> gathererConnectors ;1559 vector< CLocalView*> fullViews ;1557 vector<shared_ptr<CGathererConnector>> gathererConnectors ; 1558 vector<shared_ptr<CLocalView>> fullViews ; 1560 1559 1561 1560 for(auto& element : getElements()) … … 1578 1577 } 1579 1578 } 1580 CGridGathererConnector gridGathererConnector(gathererConnectors) ;1581 CGridMaskConnector gridMaskConnector(fullViews) ;1579 auto gridGathererConnector = make_shared<CGridGathererConnector>(gathererConnectors) ; 1580 auto gridMaskConnector = make_shared<CGridMaskConnector>(fullViews) ; 1582 1581 1583 1582 CArray<bool,1> maskOut ; 1584 gridGathererConnector .transfer_or(event,maskOut) ;1585 gridMaskConnector .computeConnector(maskOut) ;1583 gridGathererConnector->transfer_or(event,maskOut) ; 1584 gridMaskConnector->computeConnector(maskOut) ; 1586 1585 1587 1586 CContextClient* client = event.getContextServer()->getAssociatedClient() ; … … 1589 1588 for(auto& element : getElements()) 1590 1589 { 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); 1594 1593 i++ ; 1595 1594 } … … 2310 2309 auto axis=axisList.begin() ; 2311 2310 auto scalar=scalarList.begin() ; 2312 vector< CLocalElement*> elements;2311 vector<shared_ptr<CLocalElement>> elements; 2313 2312 for(auto order : order_) 2314 2313 { … … 2332 2331 { 2333 2332 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) ; 2337 2336 } 2338 2337 … … 2359 2358 void CGrid::computeServerFromClientConnector(void) 2360 2359 { 2361 vector< CGathererConnector*> connectors ;2360 vector<shared_ptr<CGathererConnector>> connectors ; 2362 2361 for(auto& element : getElements()) 2363 2362 { … … 2366 2365 else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerFromClientConnector()) ; 2367 2366 } 2368 serverFromClientConnector_ = new CGridGathererConnector(connectors) ;2367 serverFromClientConnector_ = make_shared<CGridGathererConnector>(connectors) ; 2369 2368 } 2370 2369 2371 2370 void CGrid::computeServerToClientConnector(void) 2372 2371 { 2373 vector< CScattererConnector*> connectors ;2372 vector<shared_ptr<CScattererConnector>> connectors ; 2374 2373 for(auto& element : getElements()) 2375 2374 { … … 2378 2377 else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerToClientConnector()) ; 2379 2378 } 2380 serverToClientConnector_ = new CGridScattererConnector(connectors) ;2379 serverToClientConnector_ = make_shared<CGridScattererConnector>(connectors) ; 2381 2380 } 2382 2381 2383 2382 void CGrid::computeClientFromClientConnector(void) 2384 2383 { 2385 vector< CGathererConnector*> connectors ;2384 vector<shared_ptr<CGathererConnector>> connectors ; 2386 2385 for(auto& element : getElements()) 2387 2386 { … … 2390 2389 else if (element.type==TYPE_SCALAR) connectors.push_back(element.scalar->getServerFromClientConnector()) ; 2391 2390 } 2392 clientFromClientConnector_ = new CGridGathererConnector(connectors) ;2391 clientFromClientConnector_ = make_shared<CGridGathererConnector>(connectors) ; 2393 2392 } 2394 2393 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
r2206 r2267 328 328 329 329 private: 330 CGridLocalElements*gridLocalElements_= nullptr ;330 shared_ptr<CGridLocalElements> gridLocalElements_= nullptr ; 331 331 void computeGridLocalElements(void) ; 332 332 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 ; 337 337 public: 338 338 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; 343 343 public: 344 344 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_;} 346 346 347 347 public: //? … … 350 350 351 351 private: 352 CGridLocalConnector*workflowToFullConnector_ = nullptr;352 shared_ptr<CGridLocalConnector> workflowToFullConnector_ = nullptr; 353 353 public: 354 354 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; 359 359 public: 360 360 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_;} 362 362 363 363 364 364 365 365 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_;} 369 369 void computeClientFromClientConnector(void) ; 370 370 371 371 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 client372 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 375 375 376 376 377 377 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];} 381 381 void computeClientFromServerConnector(void) ; 382 382 383 383 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_;} 387 387 void computeServerToClientConnector(void) ; 388 388 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 client389 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 392 392 393 393 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_;} 397 397 void computeServerFromClientConnector(void) ; 398 398 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp
r2264 r2267 346 346 CArray<size_t,1> index(n) ; 347 347 if (n==1) index(0)=0 ; 348 localElement_ = new CLocalElement(rank, 1, index) ;348 localElement_ = make_shared<CLocalElement>(rank, 1, index) ; 349 349 } 350 350 … … 377 377 void CScalar::computeModelToWorkflowConnector(void) 378 378 { 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); 382 382 modelToWorkflowConnector_->computeConnector() ; 383 383 } … … 409 409 for (auto& rankServer : client->getRanksServerLeader()) globalIndex[rankServer].reference(indGlo.copy()) ; 410 410 } 411 remoteElement_[client] = new CDistributedElement(nglo, globalIndex) ;411 remoteElement_[client] = make_shared<CDistributedElement>(nglo, globalIndex) ; 412 412 remoteElement_[client]->addFullView() ; 413 413 } 414 414 415 415 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) 417 417 { 418 418 string serverScalarId = scalarId.empty() ? this->getId() : scalarId ; … … 421 421 this->sendAllAttributesToServer(client, serverScalarId) ; 422 422 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()) ; 427 427 scattererConnector->computeConnector() ; 428 428 … … 441 441 scattererConnector->transfer(localElement_->getView(CElementView::FULL)->getGlobalIndex(),client,event1,message1) ; 442 442 443 sendDistributedAttributes(client, *scattererConnector, scalarId) ;443 sendDistributedAttributes(client, scattererConnector, scalarId) ; 444 444 445 445 // phase 2 send the mask : data index + mask2D 446 446 CArray<bool,1> maskIn(localElement_->getView(CElementView::WORKFLOW)->getSize()); 447 447 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() ; 450 450 maskIn=true ; 451 workflowToFull .transfer(maskIn,maskOut,false) ;451 workflowToFull->transfer(maskIn,maskOut,false) ; 452 452 453 453 // phase 3 : prepare grid scatterer connector to send data from client to server … … 455 455 map<int,CArray<bool,1>> maskOut2 ; 456 456 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) ; 459 459 // 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() ; 462 462 CEventClient event2(getType(), EVENT_ID_SCALAR_DISTRIBUTION); 463 463 CMessage message2 ; 464 464 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()) ; 468 468 clientToServerConnector_[client]->computeConnector() ; 469 469 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)); 471 471 clientFromServerConnector_[client]->computeConnector() ; 472 472 … … 489 489 if (phasis==0) // receive the remote element to construct the full view 490 490 { 491 localElement_ = new CLocalElement(context->getIntraCommRank(),event) ;491 localElement_ = make_shared<CLocalElement>(context->getIntraCommRank(),event) ; 492 492 localElement_->addFullView() ; 493 493 // construct the local dimension and indexes … … 499 499 { 500 500 CContext* context = CContext::getCurrent(); 501 CDistributedElement* elementFrom = new CDistributedElement(event) ;501 shared_ptr<CDistributedElement> elementFrom = make_shared<CDistributedElement>(event) ; 502 502 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)) ; 504 504 gathererConnector_->computeConnector() ; 505 505 } … … 507 507 { 508 508 // delete gathererConnector_ ; 509 elementFrom_ = new CDistributedElement(event) ;509 elementFrom_ = make_shared<CDistributedElement>(event) ; 510 510 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)) ; 512 512 // gathererConnector_ -> computeConnector() ; 513 513 } … … 522 522 if (serverMask.numElements()==1) mask = serverMask(0) ; 523 523 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)) ; 525 525 serverFromClientConnector_->computeConnector() ; 526 526 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()) ; 529 529 serverToClientConnector_->computeConnector() ; 530 530 } 531 531 CATCH_DUMP_ATTR 532 532 533 void CScalar::sendDistributedAttributes(CContextClient* client, CScattererConnector&scattererConnector, const string& scalarId)533 void CScalar::sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector, const string& scalarId) 534 534 { 535 535 string serverScalarId = scalarId.empty() ? this->getId() : scalarId ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp
r2206 r2267 175 175 ////////////////////////////////////////////////////////////////////////////////////// 176 176 private: 177 CLocalElement*localElement_ = nullptr ;177 shared_ptr<CLocalElement> localElement_ = nullptr ; 178 178 void initializeLocalElement(void) ; 179 179 180 180 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) ;} 183 183 184 184 private: … … 188 188 189 189 private: 190 CLocalConnector*modelToWorkflowConnector_ ;190 shared_ptr<CLocalConnector> modelToWorkflowConnector_ ; 191 191 void computeModelToWorkflowConnector(void) ; 192 192 public: 193 CLocalConnector*getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;}193 shared_ptr<CLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 194 194 195 195 public: 196 196 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, 198 198 const string& scalarId="") ; 199 199 … … 201 201 void receivedScalarDistribution(CEventServer& event, int phasis) ; 202 202 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) ; 204 204 static void recvDistributedAttributes(CEventServer& event) ; 205 205 void recvDistributedAttributes(CEventServer& event, const string& type) ; 206 206 207 207 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] ;} 235 235 236 236 private: -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_reduce.cpp
r2001 r2267 6 6 7 7 8 void CAlgorithmTransformationReduce::computeAlgorithm( CLocalView* srcView, CLocalView*dstView)8 void CAlgorithmTransformationReduce::computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 9 9 { 10 10 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_) ; 12 12 } 13 13 … … 18 18 } 19 19 20 void CAlgorithmTransformationReduce::computeRecvElement( CLocalView* srcView, CLocalView*dstView)20 void CAlgorithmTransformationReduce::computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 21 21 { 22 22 auto& srcMap = transformationMapping_ ; … … 28 28 int i=0 ; 29 29 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) ; 31 31 recvElement_->addFullView() ; 32 32 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_reduce.hpp
r2007 r2267 18 18 virtual ~CAlgorithmTransformationReduce() {}; 19 19 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) ; 21 21 22 22 protected: 23 virtual void computeAlgorithm( CLocalView* srcView, CLocalView*dstView) ;23 virtual void computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) ; 24 24 25 25 //! Map between global index of destination element and source element 26 26 EReduction operator_ ; 27 27 TransformationIndexMap transformationMapping_; 28 CReduceTransformConnector*reduceTransformConnector_ ;28 shared_ptr<CReduceTransformConnector> reduceTransformConnector_ ; 29 29 bool detectMissingValue_=true ; 30 30 bool eliminateRedondantSrc_ = true ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_transfer.cpp
r2004 r2267 8 8 { 9 9 10 void CAlgorithmTransformationTransfer::computeAlgorithm( CLocalView* srcView, CLocalView*dstView)10 void CAlgorithmTransformationTransfer::computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 11 11 { 12 12 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_) ; 14 14 } 15 15 … … 20 20 } 21 21 22 void CAlgorithmTransformationTransfer::computeRecvElement( CLocalView* srcView, CLocalView*dstView)22 void CAlgorithmTransformationTransfer::computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 23 23 { 24 24 set<size_t> srcIndex ; … … 28 28 int i=0 ; 29 29 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) ; 31 31 recvElement_->addFullView() ; 32 32 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_transfer.hpp
r2145 r2267 16 16 virtual ~CAlgorithmTransformationTransfer() {}; 17 17 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) ; 19 19 virtual StdString getAlgoName() {return "\\nCAlgorithm transformation Transfer";} 20 20 21 21 protected: 22 virtual void computeAlgorithm( CLocalView* srcView, CLocalView*dstView) ;22 virtual void computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) ; 23 23 24 24 //! Map between global index of destination element and source element 25 25 unordered_map<int,int> transformationMapping_; 26 CTransferTransformConnector*transferTransformConnector_ ;26 shared_ptr<CTransferTransformConnector> transferTransformConnector_ ; 27 27 }; 28 28 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_weight.cpp
r2001 r2267 6 6 7 7 8 void CAlgorithmTransformationWeight::computeAlgorithm( CLocalView* srcView, CLocalView*dstView)8 void CAlgorithmTransformationWeight::computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 9 9 { 10 10 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_) ; 12 12 } 13 13 … … 18 18 } 19 19 20 void CAlgorithmTransformationWeight::computeRecvElement( CLocalView* srcView, CLocalView*dstView)20 void CAlgorithmTransformationWeight::computeRecvElement(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) 21 21 { 22 22 auto& srcMap = transformationMapping_ ; … … 28 28 int i=0 ; 29 29 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) ; 31 31 recvElement_->addFullView() ; 32 32 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/algorithm_transformation_weight.hpp
r2007 r2267 18 18 virtual ~CAlgorithmTransformationWeight() {}; 19 19 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); 21 21 protected: 22 virtual void computeAlgorithm( CLocalView* srcView, CLocalView*dstView) ;22 virtual void computeAlgorithm(shared_ptr<CLocalView> srcView, shared_ptr<CLocalView> dstView) ; 23 23 24 24 //! Map between global index of destination element and source element … … 26 26 //! Weight corresponding of source to destination 27 27 TransformationWeightMap transformationWeight_; 28 CWeightTransformConnector*weightTransformConnector_ ;28 shared_ptr<CWeightTransformConnector> weightTransformConnector_ ; 29 29 30 30 }; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.cpp
r2126 r2267 106 106 { 107 107 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) ; 111 111 destCoordinate_ = vector<double>(coord.dataFirst(), coord.dataFirst()+nDest_) ; 112 112 } … … 129 129 CArray<double,1> coord ; 130 130 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 value131 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 134 134 transferTransformConnector_ -> transfer(coord, coordGlo) ; // workflow view -> full global view 135 135 srcCoordinate_ = vector<double>(coordGlo.dataFirst(), coordGlo.dataFirst()+ngloSrc_) ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/generic_algorithm_transformation.hpp
r2145 r2267 48 48 typedef std::unordered_map<int, std::vector<double> > TransformationWeightMap; 49 49 50 CLocalElement* recvElement_=nullptr;50 shared_ptr<CLocalElement> recvElement_ ; 51 51 bool isSource_ ; 52 52 53 53 public: 54 CLocalElement*getRecvElement(void) { return recvElement_ ;}54 shared_ptr<CLocalElement> getRecvElement(void) { return recvElement_ ;} 55 55 56 56 }; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm_generic.cpp
r2122 r2267 18 18 void CGridAlgorithmGeneric::computeAlgorithm(void) 19 19 { 20 CGridLocalElements*gridSrcElements = gridSrc_->getGridLocalElements() ;21 CGridLocalElements*gridDstElements = gridDst_->getGridLocalElements() ;20 shared_ptr<CGridLocalElements> gridSrcElements = gridSrc_->getGridLocalElements() ; 21 shared_ptr<CGridLocalElements> gridDstElements = gridDst_->getGridLocalElements() ; 22 22 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) ; 25 25 MPI_Comm comm = CContext::getCurrent()->getIntraComm() ; 26 26 int commSize = CContext::getCurrent()->getIntraCommSize() ; … … 29 29 auto& elements = gridSrcElements->getElements() ; 30 30 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) ; 33 33 for(int i=0;i<nElements;i++) 34 34 { … … 38 38 CArray<size_t,1> globalIndexView ; 39 39 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) ; 41 41 remoteElements[i]->addFullView() ; 42 42 if (i>pos_) dimBefore_ *= srcView->getView(i)->getSize() ; … … 47 47 } 48 48 49 gridTransformConnector_ = new CGridTransformConnector(srcView->getViews(), remoteViews, comm ) ;49 gridTransformConnector_ = make_shared<CGridTransformConnector>(srcView->getViews(), remoteViews, comm ) ; 50 50 51 51 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/grid_algorithm_generic.hpp
r2011 r2267 31 31 32 32 protected: 33 CGridTransformConnector*gridTransformConnector_=nullptr ;33 shared_ptr<CGridTransformConnector> gridTransformConnector_=nullptr ; 34 34 CGrid* gridSrc_ = nullptr ; 35 35 CGrid* gridDst_ = nullptr ;
Note: See TracChangeset
for help on using the changeset viewer.