- Timestamp:
- 12/01/21 16:52:24 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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() ;
Note: See TracChangeset
for help on using the changeset viewer.