Chombo + EB  3.0
EBLevelRedist.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 // dtgraves mon oct 15 2001
12 
13 #ifndef _EBLEVELREDIST_H_
14 #define _EBLEVELREDIST_H_
15 
16 #include "REAL.H"
17 #include "FArrayBox.H"
18 #include "LevelData.H"
19 #include "DisjointBoxLayout.H"
20 #include "EBISLayout.H"
21 #include "EBCellFAB.H"
22 #include "Interval.H"
23 #include "Stencils.H"
24 #include "BaseIVFAB.H"
25 #include "RedistStencil.H"
26 #include "NamespaceHeader.H"
27 
28 ///
29 /**
30  */
32 {
33 public:
34  ///
35  /**
36  Default constructor. User must subsequently call define().
37  */
38  EBLevelRedist();
39 
40  ///
42 
43  ///
44  /**
45  Defining constructor. Constructs a valid object.
46  Equivalent to default construction followed by define().
47  ebisl needs ghost cells out to 3*redistradius of the stencil.
48  This sets the stencil to volume-weighted.
49  Use resetWeights to set to mass weighted or whatever.
50  */
51  EBLevelRedist(const DisjointBoxLayout& a_dbl,
52  const EBISLayout& a_ebisl,
53  const ProblemDomain& a_domain,
54  const int& a_ncomp,
55  int a_redistRad = 1,
56  bool a_do2DStencil = false);
57 
58  ///
59  /**
60  Defines this object. Existing information is overriden.
61  ebisl needs ghost cells out to 3*redistradius
62  */
63  void define(const DisjointBoxLayout& a_dbl,
64  const EBISLayout& a_ebisl,
65  const ProblemDomain& a_domain,
66  const int& a_ncomp,
67  int a_redistRad = 1,
68  bool a_do2DStencil = false);
69 
70  ///
71  /**
72  Modify the weights in the stencil by multiplying by
73  the inputs in a normalized way.
74  If you want mass
75  weighting, send in the density.
76  */
77  void resetWeights(const LevelData<EBCellFAB>& modifier,
78  const int& ivar);
79 
80  ///
81  /**
82  Store the input mass difference in the buffers of the class
83  by INCREMENTING the buffer. \\
84  dm += massDiff
85  */
86  void increment(const BaseIVFAB<Real>& massDiff,
87  const DataIndex& datInd,
88  const Interval& variables);
89 
90  ///
91  /**
92  Redistribute the data contained in the internal buffers. \\
93  solution += weight*dm
94  */
95  void redistribute(LevelData<EBCellFAB>& solution,
96  const Interval& variables);
97 
98  ///
99  /**
100  version where solution is not necessarily ncomp long.
101  intervals have to be the same length.
102  srcVar can be up to m_ncomp long.
103  dstVar can be up to solution.nComp().
104  */
105  void redistribute(LevelData<EBCellFAB>& a_solution,
106  const Interval& a_srcVar,
107  const Interval& a_dstVar);
108 
109  ///
110  /**
111  Adjusts an explicit Laplacian calculation so that:
112  a_solution_i =
113  kappa_i*lap_i + (1-kappa_i)*sum_s(kappa_s*lap_s)/(sum_s kappa_s)
114  where s is the set of cells neighboring, but not including i
115  NOTE: a_solution must be passed in equal to a_kappaLap
116  */
117  void fixExplicitLap(const LevelData<EBCellFAB>& a_kappaLap,
118  LevelData<EBCellFAB>& a_solution,
119  const Interval& variables);
120 
121  ///
122  /**
123  Returns true if this object was created with the defining
124  constructor or if define() has been called.
125  */
126  bool isDefined() const;
127 
128  ///
129  /**
130  Reset the mass buffers of the class.
131  */
132  void setToZero();
133 
134 protected:
137  int m_ncomp;
145 private:
146 
147  //forbidden for all the usual reasons
148  void operator=(const EBLevelRedist& a_stenin)
149  {
150  MayDay::Error("Invalid operator");
151  }
152 
153  EBLevelRedist(const EBLevelRedist& a_stenin)
154  {
155  MayDay::Error("Invalid operator");
156  }
157 };
158 
159 #include "NamespaceFooter.H"
160 #endif
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
RedistStencil m_stencil
Definition: EBLevelRedist.H:136
void resetWeights(const LevelData< EBCellFAB > &modifier, const int &ivar)
void increment(const BaseIVFAB< Real > &massDiff, const DataIndex &datInd, const Interval &variables)
void define(const DisjointBoxLayout &a_dbl, const EBISLayout &a_ebisl, const ProblemDomain &a_domain, const int &a_ncomp, int a_redistRad=1, bool a_do2DStencil=false)
ProblemDomain m_domain
Definition: EBLevelRedist.H:140
Structure for passing component ranges in code.
Definition: Interval.H:23
DisjointBoxLayout m_grids
Definition: EBLevelRedist.H:139
void redistribute(LevelData< EBCellFAB > &solution, const Interval &variables)
int m_ncomp
Definition: EBLevelRedist.H:137
void fixExplicitLap(const LevelData< EBCellFAB > &a_kappaLap, LevelData< EBCellFAB > &a_solution, const Interval &variables)
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
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.
void setToZero()
EBISLayout m_ebisl
Definition: EBLevelRedist.H:141
LayoutData< IntVectSet > m_sets
Definition: EBLevelRedist.H:144
Definition: DataIndex.H:112
stencil for mass redistribution
Definition: RedistStencil.H:38
int m_redistRad
Definition: EBLevelRedist.H:138
int redistRad
Definition: EBLevelRedist.H:135
EBLevelRedist(const EBLevelRedist &a_stenin)
Definition: EBLevelRedist.H:153
bool m_isDefined
Definition: EBLevelRedist.H:142
void operator=(const EBLevelRedist &a_stenin)
Definition: EBLevelRedist.H:148
Definition: EBISLayout.H:39
bool isDefined() const
LevelData< BaseIVFAB< Real > > m_buffer
Definition: EBLevelRedist.H:143
Definition: EBLevelRedist.H:31