Changeset 2267 for XIOS/dev/dev_ym/XIOS_COUPLING/src/node
- Timestamp:
- 12/01/21 16:52:24 (3 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src/node
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
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:
Note: See TracChangeset
for help on using the changeset viewer.