source: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_elements.hpp @ 2338

Last change on this file since 2338 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:executable set to *
File size: 1.3 KB
Line 
1#ifndef __GRID_ELEMENTS_HPP__
2#define __GRID_ELEMENTS_HPP__
3
4#include "xios_spl.hpp"
5#include "array_new.hpp"
6#include "element.hpp"
7
8namespace xios
9{
10  class CGridLocalView ;
11  class CGridLocalConnector ;
12
13  class CGridLocalElements : public std::enable_shared_from_this<CGridLocalElements>
14  {
15    private:
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      vector<bool> localMask_ ;
20 
21    public:
22      CGridLocalElements(vector<shared_ptr<CLocalElement> > elements) : elements_(elements) {}
23      CGridLocalElements(vector<shared_ptr<CLocalElement>> elements, vector<bool>& localMask) : elements_(elements), localMask_(localMask) {}
24
25      bool hasLocalMask() { return !localMask_.empty() ;}
26      vector<bool>& getLocalMask(void) { return localMask_ ;}
27
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  } ;
32}
33
34#endif
Note: See TracBrowser for help on using the repository browser.