chombo-discharge
CD_IrregStencil.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_IrregStencil_H
13 #define CD_IrregStencil_H
14 
15 // Chombo includes
16 #include <DisjointBoxLayout.H>
17 #include <EBISLayout.H>
18 #include <BaseIVFAB.H>
19 #include <EBCellFAB.H>
20 #include <RefCountedPtr.H>
21 #include <Stencils.H>
22 #include <LayoutData.H>
23 #include <VoFIterator.H>
24 
25 // Our includes
26 #include <CD_NamespaceHeader.H>
27 
38 {
39 public:
43  enum class StencilType
44  {
45  NoType,
46  Linear,
47  TaylorExtrapolation,
49  PiecewiseLinear
50  };
51 
55  IrregStencil();
56 
67  IrregStencil(const DisjointBoxLayout& a_dbl,
68  const EBISLayout& a_ebisl,
69  const ProblemDomain& a_domain,
70  const Real& a_dx,
71  const int a_order,
72  const int a_radius,
73  const IrregStencil::StencilType a_type);
74 
78  virtual ~IrregStencil();
79 
83  const BaseIVFAB<VoFStencil>&
84  operator[](const DataIndex& a_dit) const;
85 
89  BaseIVFAB<VoFStencil>&
90  operator[](const DataIndex& a_dit);
91 
95  virtual void
96  apply(EBCellFAB& a_dst, const EBCellFAB& a_src, const DataIndex& a_dit) const;
97 
101  virtual void
102  apply(BaseIVFAB<Real>& a_dst, const EBCellFAB& a_src, const DataIndex& a_dit) const;
103 
104 protected:
108  static constexpr int m_defaultStenComp = 0;
109 
113  static constexpr int m_defaultNumSten = 1;
114 
118  LayoutData<RefCountedPtr<BaseIVFAB<VoFStencil>>> m_stencils;
119 
123  mutable LayoutData<VoFIterator> m_vofIter;
124 
128  DisjointBoxLayout m_dbl;
129 
133  EBISLayout m_ebisl;
134 
138  Real m_dx;
139 
143  int m_radius;
144 
148  int m_order;
149 
154 
158  ProblemDomain m_domain;
159 
163  virtual void
164  define(const DisjointBoxLayout& a_dbl,
165  const EBISLayout& a_ebisl,
166  const ProblemDomain& a_domain,
167  const Real& a_dx,
168  const int a_order,
169  const int a_radius,
170  const IrregStencil::StencilType a_type);
171 
175  virtual void
176  buildStencil(VoFStencil& a_sten,
177  const VolIndex& a_vof,
178  const DisjointBoxLayout& a_dbl,
179  const ProblemDomain& a_domain,
180  const EBISBox& a_ebisbox,
181  const Box& a_box,
182  const Real& a_dx,
183  const IntVectSet& a_cfivs) = 0;
184 };
185 
186 #include <CD_NamespaceFooter.H>
187 
188 #endif
Class for holding stencils on irregular cells over a single AMR level.
Definition: CD_IrregStencil.H:38
IrregStencil()
Weak constructor (does nothing)
Definition: CD_IrregStencil.cpp:23
virtual void buildStencil(VoFStencil &a_sten, const VolIndex &a_vof, const DisjointBoxLayout &a_dbl, const ProblemDomain &a_domain, const EBISBox &a_ebisbox, const Box &a_box, const Real &a_dx, const IntVectSet &a_cfivs)=0
Build the desired stencil.
virtual ~IrregStencil()
Destructor.
Definition: CD_IrregStencil.cpp:26
LayoutData< RefCountedPtr< BaseIVFAB< VoFStencil > > > m_stencils
Stencil.
Definition: CD_IrregStencil.H:118
int m_order
Stencil order.
Definition: CD_IrregStencil.H:148
virtual void define(const DisjointBoxLayout &a_dbl, const EBISLayout &a_ebisl, const ProblemDomain &a_domain, const Real &a_dx, const int a_order, const int a_radius, const IrregStencil::StencilType a_type)
Define function.
Definition: CD_IrregStencil.cpp:54
IrregStencil::StencilType m_stencilType
Stencil type.
Definition: CD_IrregStencil.H:153
const BaseIVFAB< VoFStencil > & operator[](const DataIndex &a_dit) const
Get the stencils over a single box.
Definition: CD_IrregStencil.cpp:42
static constexpr int m_defaultStenComp
Default stencil component.
Definition: CD_IrregStencil.H:108
ProblemDomain m_domain
Domain.
Definition: CD_IrregStencil.H:158
LayoutData< VoFIterator > m_vofIter
VoFIterators.
Definition: CD_IrregStencil.H:123
DisjointBoxLayout m_dbl
Grids.
Definition: CD_IrregStencil.H:128
EBISLayout m_ebisl
EBIS layout.
Definition: CD_IrregStencil.H:133
Real m_dx
Level resolution.
Definition: CD_IrregStencil.H:138
static constexpr int m_defaultNumSten
Default stencil component.
Definition: CD_IrregStencil.H:113
int m_radius
Stencil radius.
Definition: CD_IrregStencil.H:143
StencilType
Enum for identifying stencil – only meant for enhancing code visibility.
Definition: CD_IrregStencil.H:44
virtual void apply(EBCellFAB &a_dst, const EBCellFAB &a_src, const DataIndex &a_dit) const
Apply the stencil.
Definition: CD_IrregStencil.cpp:120
Static class containing useful routines for (weighted) least squares polynomial reconstruction.
Definition: CD_LeastSquares.H:31