chombo-discharge
CD_EBAMRData.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_EBAMRData_H
13 #define CD_EBAMRData_H
14 
15 // Chombo includes
16 #include <LevelData.H>
17 #include <RefCountedPtr.H>
18 #include <EBCellFAB.H>
19 #include <EBFluxFAB.H>
20 #include <EBFaceFAB.H>
21 #include <BaseIVFAB.H>
22 #include <BaseIFFAB.H>
23 #include <MFCellFAB.H>
24 #include <MFFluxFAB.H>
25 #include <BinItem.H>
26 
27 // Our includes
28 #include <CD_DomainFluxIFFAB.H>
29 #include <CD_MFBaseIVFAB.H>
30 #include <CD_NamespaceHeader.H>
31 
38 template <typename T>
39 class EBAMRData
40 {
41 public:
45  EBAMRData() noexcept;
46 
50  EBAMRData(const int a_size) noexcept;
51 
55  virtual ~EBAMRData() noexcept;
56 
61  RefCountedPtr<LevelData<T>>&
62  operator[](int a_level) noexcept;
63 
68  const RefCountedPtr<LevelData<T>>&
69  operator[](int a_level) const noexcept;
70 
75  void
76  resize(const int a_size) noexcept;
77 
82  void
83  setRealm(const std::string a_realm) noexcept;
84 
88  int
89  size() const noexcept;
90 
94  void
95  exchange() noexcept;
96 
100  void
101  clear() noexcept;
102 
106  void
107  reserve() noexcept;
108 
112  void
113  release() noexcept;
114 
118  bool
119  isReserved() const noexcept;
120 
124  Vector<RefCountedPtr<LevelData<T>>>&
125  getData() noexcept;
126 
130  const Vector<RefCountedPtr<LevelData<T>>>&
131  getData() const noexcept;
132 
137  void
138  push_back(RefCountedPtr<LevelData<T>>& a_levelData) noexcept;
139 
143  const std::string
144  getRealm() const noexcept;
145 
146 protected:
150  std::string m_realm;
151 
156 
160  Vector<RefCountedPtr<LevelData<T>>> m_data;
161 };
162 
163 #include <CD_NamespaceFooter.H>
164 
165 #include <CD_EBAMRDataImplem.H>
166 
167 #endif
Declaration of a BaseIFFAB wrapper that holds domain fluxes.
Implementation of EBAMRData.H.
Declaration of a multiphase BaseIVFAB<Real>
Default class for holding LevelData<T> data across an EBAMR realm.
Definition: CD_EBAMRData.H:40
EBAMRData() noexcept
Default constructor. Does nothing.
Definition: CD_EBAMRDataImplem.H:23
void reserve() noexcept
Reserve data.
Definition: CD_EBAMRDataImplem.H:84
bool m_reserved
Reserved or not.
Definition: CD_EBAMRData.H:155
void setRealm(const std::string a_realm) noexcept
Sets the realm for this object.
Definition: CD_EBAMRDataImplem.H:142
void push_back(RefCountedPtr< LevelData< T >> &a_levelData) noexcept
Push a LevelData<T> object to the back of the data vector.
Definition: CD_EBAMRDataImplem.H:128
Vector< RefCountedPtr< LevelData< T > > > & getData() noexcept
Get underlying data. Returns m_data.
Definition: CD_EBAMRDataImplem.H:114
void exchange() noexcept
Exchange on all AMR levels.
Definition: CD_EBAMRDataImplem.H:105
void resize(const int a_size) noexcept
Resize m_data to having size a_size.
Definition: CD_EBAMRDataImplem.H:59
std::string m_realm
Identifier for realm.
Definition: CD_EBAMRData.H:150
virtual ~EBAMRData() noexcept
Destructor. Does nothing.
Definition: CD_EBAMRDataImplem.H:38
int size() const noexcept
Get size of m_data.
Definition: CD_EBAMRDataImplem.H:66
bool isReserved() const noexcept
Check if data is reserved.
Definition: CD_EBAMRDataImplem.H:98
void clear() noexcept
Delete all data.
Definition: CD_EBAMRDataImplem.H:73
void release() noexcept
Release data.
Definition: CD_EBAMRDataImplem.H:91
const std::string getRealm() const noexcept
Returns the string identifier for whatever realm this data is supposed to be allocated over.
Definition: CD_EBAMRDataImplem.H:135
Vector< RefCountedPtr< LevelData< T > > > m_data
Underlying data.
Definition: CD_EBAMRData.H:160
RefCountedPtr< LevelData< T > > & operator[](int a_level) noexcept
Indexing operators. Returns m_data[a_level].
Definition: CD_EBAMRDataImplem.H:45