Chombo + EB + MF  3.2
NonAggregatedEBStencil.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _NONAGGREGATEDEBSTENCIL_H_
12 #define _NONAGGREGATEDEBSTENCIL_H_
13 
14 #include "Stencils.H"
15 #include "Vector.H"
16 #include "VolIndex.H"
17 #include "REAL.H"
18 #include "Box.H"
19 #include "FArrayBox.H"
20 #include "EBIndexSpace.H"
21 #include "EBCellFAB.H"
22 #include "NamespaceHeader.H"
23 
24 
25 /// Very slow, bad version of EB stencil
26 /**
27  Slow version of the stencil used only
28  to illustrate just how good an idea aggregation is.
29  It also could be useful for debugging if an issue
30  ever comes up with the aggregated version.
31  Under no circumstances should this class be used as
32  anything but as an educational or debugging tool. Using this
33  will absolutely destroy your performance. Really.
34 */
36 {
37 public:
38  ///
39  /**
40  Destructor
41  */
43 
44  ///
45  /**
46  Full constructor. Box is unghosted.
47  When setting Lphi(i,j) = L(phi(i,j))
48  GhostVectPhi is the ghost vect of phi
49  GhostVectLph is the ghost vect of lphi
50  */
52  const BaseIVFAB<VoFStencil>& a_vofstencil,
53  const Box& a_box,
54  const EBISBox& a_ebisbox,
55  const IntVect& a_ghostVectPhi,
56  const IntVect& a_ghostVectLph,
57  int a_varDest = 0,
58  bool a_doRelaxOpt = false,
59  int ncomp = 1,
60  IntVectSet a_setIrreg = IntVectSet(),
61  bool a_useInputSets = false);
62 
63  ///
64  /**
65  Second constructor for creating stencil
66  where dest and src live on 2 different levels
67  and dest is Lphi and src is Phi.
68  no relax optimization here
69  */
71  const Vector<VoFStencil>& a_vofStencil,
72  const Box& a_boxLph,
73  const Box& a_boxPhi,
74  const EBISBox& a_ebisBoxLph,
75  const EBISBox& a_ebisBoxPhi,
76  const IntVect& a_ghostVectLph,
77  const IntVect& a_ghostVectPhi,
78  int a_varDest = 0,
79  int ncomp = 1,
80  IntVectSet a_setIrreg = IntVectSet(),
81  bool a_useInputSets = false);
82 
83 
84 
85  ///
86  /**
87  Applies stencil to each component of phi using the stencil weights and offsets to compute L.
88  If incrementOnly = true, a_lofphi is incremented without any set to zero.
89  If false, a_lofphi is set to zero and set equal to L(phi).
90  ivar is so you can apply a scalar ebstencil to a component of a
91  larger holder
92  */
93  void
94  apply(EBCellFAB& a_lofphi, const EBCellFAB& a_phi, bool incrementOnly = false, int ivar = 0) const;
95 
96 
97  ///
98  /**
99  Applies stencil to each component of phi using the stencil weights and offsets to compute L.
100  but with constants.
101  a_lofphi_i = alpha*phi_i + beta*lphi_i
102  If incrementOnly = true, a_lofphi is incremented without any set to zero.
103  If false, a_lofphi is set to zero and set equal to a_lofphi_i
104  Alpha and beta are defined over getIrregIVS(lphBox) where lphBox = grow(a_box, a_ghostVectLph)
105  where a_box are given in the constructor.
106  */
107  void
108  apply(EBCellFAB& a_lofphi, const EBCellFAB& a_phi,
109  const BaseIVFAB<Real>& a_alphaWeight,
110  Real a_alpha, Real a_beta, bool incrementOnly = false) const;
111 
112  void
113  apply(EBCellFAB& a_lofphi,
114  const EBCellFAB& a_phi,
115  const Real a_lambdaFactor,
116  const Real a_alpha,
117  const BaseIVFAB<Real>& a_alphaWeight,
118  const Real a_beta,
119  const BaseIVFAB<Real>& a_betaWeight,
120  Real a_one,
121  bool incrementOnly = false) const;
122 
123  void
124  applyInhomDomBC(EBCellFAB& a_lofphi,
125  const EBCellFAB& a_phi,
126  const Real a_factor) const;
127 
128  ///
129  void
130  relax(EBCellFAB& a_phi,
131  const EBCellFAB& a_rhs,
132  const BaseIVFAB<Real>& a_alphaWeight,
133  const BaseIVFAB<Real>& a_betaWeight,
134  Real a_alpha, Real a_beta, Real a_safety) const;
135 
136  ///
137  void
138  relaxClone(EBCellFAB& a_phi,
139  const EBCellFAB& a_phiOld,
140  const EBCellFAB& a_rhs,
141  const BaseIVFAB<Real>& a_alphaWeight,
142  const BaseIVFAB<Real>& a_betaWeight,
143  Real a_alpha, Real a_beta, Real a_safety) const;
144 
145  ///
146  /**
147  Cache lphi.
148  ivar is so you can apply a scalar ebstencil to a component of a
149  larger holder */
150  void
151  cache(const EBCellFAB& a_lphi, int a_ivar = 0) const;
152 
153  ///
154  /**
155  Cache phi
156  ivar is so you can apply a scalar ebstencil to a component of a
157  larger holder */
158  void
159  cachePhi(const EBCellFAB& a_lphi, int a_ivar = 0) const;
160 
161 
162  ///
163  /**
164  Uncache lphi
165  ivar is so you can apply a scalar ebstencil to a component of a
166  larger holder */
167  void
168  uncache(EBCellFAB& a_lphi, int a_ivar = 0) const;
169 
170  ///
171  /**
172  Uncache phi
173  ivar is so you can apply a scalar ebstencil to a component of a
174  larger holder */
175  void
176  uncachePhi(EBCellFAB& a_phi, int a_ivar = 0) const;
177 
178 protected:
183 
187  int m_nComp;
190  //only used when debugging
191  //Vector<VolIndex> m_srcVoFs;
192 private:
193  ///
194  /*
195  Default constructor.
196  */
198  {
199  MayDay::Error("invalid operator");
200  }
201 
202  ///
203  /*
204  Operator =.
205  */
206  void
208  {
209  MayDay::Error("invalid operator");
210  }
211 
212  ///
213  /*
214  Copy constructor.
215  */
217  {
218  MayDay::Error("invalid operator");
219  }
220 
221 };
222 
223 
224 #include "NamespaceFooter.H"
225 #endif
IntVectSet m_setIrreg
Definition: NonAggregatedEBStencil.H:188
Vector< Real > m_cacheLph
Definition: NonAggregatedEBStencil.H:184
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
NonAggregatedEBStencil(const NonAggregatedEBStencil &stenin)
Definition: NonAggregatedEBStencil.H:216
Very slow, bad version of EB stencil.
Definition: NonAggregatedEBStencil.H:35
Definition: EBISBox.H:46
void operator=(const NonAggregatedEBStencil &stenin)
Definition: NonAggregatedEBStencil.H:207
Vector< VolIndex > m_srcVofs
Definition: NonAggregatedEBStencil.H:179
bool m_doRelaxOpt
Definition: NonAggregatedEBStencil.H:186
EBISBox m_ebisBox
Definition: NonAggregatedEBStencil.H:181
void relaxClone(EBCellFAB &a_phi, const EBCellFAB &a_phiOld, const EBCellFAB &a_rhs, const BaseIVFAB< Real > &a_alphaWeight, const BaseIVFAB< Real > &a_betaWeight, Real a_alpha, Real a_beta, Real a_safety) const
void cachePhi(const EBCellFAB &a_lphi, int a_ivar=0) const
NonAggregatedEBStencil()
Definition: NonAggregatedEBStencil.H:197
void uncachePhi(EBCellFAB &a_phi, int a_ivar=0) const
Definition: EBCellFAB.H:29
double Real
Definition: REAL.H:33
int m_destVar
Definition: NonAggregatedEBStencil.H:182
void cache(const EBCellFAB &a_lphi, int a_ivar=0) const
void uncache(EBCellFAB &a_lphi, int a_ivar=0) const
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
Vector< Real > m_cachePhi
Definition: NonAggregatedEBStencil.H:185
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
void applyInhomDomBC(EBCellFAB &a_lofphi, const EBCellFAB &a_phi, const Real a_factor) const
bool m_useInputSets
Definition: NonAggregatedEBStencil.H:189
void relax(EBCellFAB &a_phi, const EBCellFAB &a_rhs, const BaseIVFAB< Real > &a_alphaWeight, const BaseIVFAB< Real > &a_betaWeight, Real a_alpha, Real a_beta, Real a_safety) const
void apply(EBCellFAB &a_lofphi, const EBCellFAB &a_phi, bool incrementOnly=false, int ivar=0) const
Definition: BaseIVFAB.H:32
Vector< VoFStencil > m_vofStencil
Definition: NonAggregatedEBStencil.H:180
int m_nComp
Definition: NonAggregatedEBStencil.H:187