chombo-discharge
CD_MFBaseIVFAB.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_MFBaseIVFAB_H
13 #define CD_MFBaseIVFAB_H
14 
15 // Chombo includes
16 #include <BoxLayoutData.H>
17 #include <BaseIVFAB.H>
18 #include <IntVectSet.H>
19 #include <EBGraph.H>
20 #include <EBISLayout.H>
21 
22 // Our includes
23 #include <CD_NamespaceHeader.H>
24 
29 {
30 public:
34  MFBaseIVFAB();
35 
42  MFBaseIVFAB(const Vector<IntVectSet>& a_regions, const Vector<EBGraph>& a_phaseGraphs, const Vector<int>& a_nComp);
43 
47  virtual ~MFBaseIVFAB();
48 
53  virtual BaseIVFAB<Real>&
54  getIVFAB(const int a_phase);
55 
60  virtual const BaseIVFAB<Real>&
61  getIVFAB(const int a_phase) const;
62 
67  virtual BaseIVFAB<Real>*
68  getPhasePtr(int a_phase);
69 
73  virtual int
74  numPhases();
75 
80  virtual void
81  setVal(Real a_value);
82 
91  virtual void
92  copy(const Box& a_fromBox,
93  const Interval& a_dst_interv,
94  const Box& a_toBox,
95  const MFBaseIVFAB& a_src,
96  const Interval& a_srcInterv);
97 
98  static int
99  preAllocatable();
100 
104  virtual int
105  size(const Box& R, const Interval& comps) const;
106 
110  virtual void
111  linearOut(void* buf, const Box& R, const Interval& comps) const;
112 
116  virtual void
117  linearIn(void* buf, const Box& R, const Interval& comps);
118 
119 protected:
120  Vector<BaseIVFAB<Real>*> m_phase;
121 };
122 
126 class MFBaseIVFABFactory : public DataFactory<MFBaseIVFAB>
127 {
128 public:
132  MFBaseIVFABFactory() = delete;
133 
137  MFBaseIVFABFactory(Vector<EBISLayout>& a_ebisl, const Vector<int>& a_nComp);
138 
142  virtual ~MFBaseIVFABFactory();
143 
147  virtual void
148  define(Vector<EBISLayout>& a_ebisl, const Vector<int>& a_nComp);
149 
153  virtual MFBaseIVFAB*
154  create(const Box& a_box, int a_ignored_argument, const DataIndex& a_dit) const;
155 
156 protected:
160  Vector<EBISLayout> m_ebisl;
161 
165  Vector<int> m_nComp;
166 };
167 
168 #include <CD_NamespaceFooter.H>
169 
170 #endif
Factory class for creating MFBaseIVFABs.
Definition: CD_MFBaseIVFAB.H:127
Vector< int > m_nComp
Componenents.
Definition: CD_MFBaseIVFAB.H:165
MFBaseIVFABFactory()=delete
Don't see why we need a default constructor.
virtual MFBaseIVFAB * create(const Box &a_box, int a_ignored_argument, const DataIndex &a_dit) const
Factory method.
Definition: CD_MFBaseIVFAB.cpp:158
virtual ~MFBaseIVFABFactory()
Destructor.
Definition: CD_MFBaseIVFAB.cpp:143
Vector< EBISLayout > m_ebisl
EBIS layouts for different phases.
Definition: CD_MFBaseIVFAB.H:160
virtual void define(Vector< EBISLayout > &a_ebisl, const Vector< int > &a_nComp)
Define function.
Definition: CD_MFBaseIVFAB.cpp:149
Multiphase BaseIVFAB<Real>.
Definition: CD_MFBaseIVFAB.H:29
MFBaseIVFAB()
Weak construction.
Definition: CD_MFBaseIVFAB.cpp:16
virtual ~MFBaseIVFAB()
Destructor (does nothing)
Definition: CD_MFBaseIVFAB.cpp:37
virtual void linearIn(void *buf, const Box &R, const Interval &comps)
Linearization function.
Definition: CD_MFBaseIVFAB.cpp:122
virtual void linearOut(void *buf, const Box &R, const Interval &comps) const
Linearization function.
Definition: CD_MFBaseIVFAB.cpp:106
virtual BaseIVFAB< Real > & getIVFAB(const int a_phase)
Get BaseIVFAB for specified phase.
Definition: CD_MFBaseIVFAB.cpp:45
virtual void copy(const Box &a_fromBox, const Interval &a_dst_interv, const Box &a_toBox, const MFBaseIVFAB &a_src, const Interval &a_srcInterv)
Copy function (see Chombo docs)
Definition: CD_MFBaseIVFAB.cpp:77
virtual int numPhases()
Get number of phases.
Definition: CD_MFBaseIVFAB.cpp:63
virtual void setVal(Real a_value)
Set value.
Definition: CD_MFBaseIVFAB.cpp:69
virtual int size(const Box &R, const Interval &comps) const
Size function. Required for LevelData construction.
Definition: CD_MFBaseIVFAB.cpp:95
virtual BaseIVFAB< Real > * getPhasePtr(int a_phase)
Get BaseIVFAB pointer for phase.
Definition: CD_MFBaseIVFAB.cpp:57
constexpr Real R
Universal gas constant.
Definition: CD_Units.H:64