source: XIOS3/trunk/src/distribution/grid_elements.cpp @ 2396

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

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

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 921 bytes
Line 
1#include "grid_elements.hpp"
2#include "grid_local_view.hpp"
3#include "grid_local_connector.hpp"
4
5namespace xios
6{
7
8  shared_ptr<CGridLocalView> CGridLocalElements::getView(CElementView::type type)
9  { 
10    if (views_[type]==nullptr) views_[type] = make_shared<CGridLocalView>(shared_from_this(), type) ;
11    return views_[type] ;
12  }
13 
14  shared_ptr<CGridLocalConnector> CGridLocalElements::getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask)
15  {
16    auto newPair = pair<CElementView::type,CElementView::type>(srcType,dstType);
17    auto it = connectors_.find(newPair) ;
18    if (it==connectors_.end()) 
19    {
20      auto insertPair=pair<pair<CElementView::type,CElementView::type>, shared_ptr<CGridLocalConnector>>(newPair, make_shared<CGridLocalConnector>(shared_from_this(), srcType, dstType, withMask)) ;
21      it=connectors_.insert(insertPair).first ;
22    }
23    return it->second ;
24  }
25}
Note: See TracBrowser for help on using the repository browser.