Chombo + EB  3.2
WrappedGShop.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 _WRAPPEDGSHOP_H_
12 #define _WRAPPEDGSHOP_H_
13 
14 #include "REAL.H"
15 #include "RealVect.H"
16 #include "Box.H"
17 #include "IntVect.H"
18 #include "EBISBox.H"
19 #include "GeometryService.H"
20 #include "WrappedGShop.H"
21 #include "LSquares.H"
22 #include "BaseIF.H"
23 #include "AMRIO.H"
24 #include "IrregNode.H"
25 #include "CutCellMoments.H"
26 #include "RefCountedPtr.H"
27 #include "NamespaceHeader.H"
28 ///base class for special refinement
30 {
31 public:
32  //default says no special refinement at any point
33  virtual bool refineHere(const IrregNode& a_node, const IntVect& a_iv, const Real& a_dx) const
34  {
35  return false;
36  }
37 
39  {
40  }
41 
43  {
44  }
45 };
46 ///
47 /**
48  This is a much simplified version of GeometryShop.
49  Refinement has been taken out of the internals of computecutcellmoments and
50  the constrained least squares stuff is gone alltogether.
51  This is also done for isotropic dx and there is no more stuff
52  about globaldim.
53 */
55 {
56 
57 public:
58 
59  int m_phase;
60 
61  ///
62  /**
63  This class will refine a cell if it is between min and max refinements.
64  If it violates bounds, that triggers refinement until max refinement.
65  */
66  WrappedGShop(const RefCountedPtr<BaseIF> & a_baseIF,
67  const RealVect & a_origin,
68  const Real & a_dx,
69  const ProblemDomain & a_domain,
70  int minNumberRefines,
71  int maxNumberRefines);
72 
73 
74 
75  ///
76  /**
77  This checks to see if moments are within sane bounds.
78  If a_bindMoments = true, it enforces those bounds.
79  Only returns true if the bounds are violated by the relative tolerance.
80  */
81  bool checkNodeMoments(IrregNode & a_node,
82  const Real& a_dx,
83  const bool& a_bindMoments,
84  const Real& a_tolerance) const;
85 
86  virtual const BaseIF* getBaseIFPtr() const
87  {
88  //used for exact geometry generation.
89  return &(*m_baseIF);
90  }
91 
92 
93  ///
95  {
96  }
97 
98  ///this does return higher order moments.
99  virtual bool generatesHigherOrderMoments() const
100  {
101  return true;
102  }
103 
104  ///
105  /**
106  Return true if every cell in region is regular at the
107  refinement described by dx.
108  */
109  virtual bool isRegular(const Box & a_region,
110  const ProblemDomain & a_domain,
111  const RealVect & a_origin,
112  const Real & a_dx) const;
113 
114  ///
115  /**
116  Return true if every cell in region is covered at the
117  refinement described by dx.
118  */
119  virtual bool isCovered(const Box & a_region,
120  const ProblemDomain & a_domain,
121  const RealVect & a_origin,
122  const Real & a_dx) const;
123 
124 
125  virtual bool isIrregular(const Box & a_region,
126  const ProblemDomain & a_domain,
127  const RealVect & a_origin,
128  const Real & a_dx) const;
129 
130  virtual bool canGenerateMultiCells() const
131  {
132  return false;
133  }
134 
135  bool onBoxBoundary(const IntVect & a_iv,
136  const Box & a_box,
137  const int & a_dir,
138  const Side::LoHiSide & a_sd) const;
139 
140  ///
141  /**
142  Define the internals of the input ebisRegion.
143  */
144  virtual void fillGraph(BaseFab<int>& a_regIrregCovered,
145  Vector<IrregNode>& a_nodes,
146  const Box& a_validRegion,
147  const Box& a_ghostRegion,
148  const ProblemDomain& a_domain,
149  const RealVect& a_origin,
150  const Real& a_dx,
151  const DataIndex& a_di ) const;
152  /**
153  */
154  void
155  computeVoFInternals(IrregNode & a_node,
156  const IntVectSet & a_ivsIrreg,
157  const ProblemDomain & a_domain,
158  const RealVect & a_origin,
159  const Real & a_dx,
160  const IntVect & a_iv) const;
161 
162 
163 
164  //will bound moments and check the number of refinements
165  bool needToRefine(IrregNode & a_node,
166  const Real & a_dx,
167  const int & a_numRefSoFar)const ;
168 
169  void agglomerateMoments(IrregNode & a_node,
170  const Vector<IrregNode>& a_refNodes,
171  const Box & a_refBox,
172  const Real & a_fineDx,
173  const Real & a_coarDx) const;
174 
175  //converts a RealVect in physical coordinates to a RealVect in coordinates relative to a cell center
176  RealVect convert2RelativeCoord(const RealVect& a_rVect)const;
177 
178  //converts a IndexTM<Real,SpaceDim> in physical coordinates to a
179  //RealVect in coordinates relative to a cell center
180  RealVect convert2RelativeCoord(const IndexTM<Real,SpaceDim>& a_rVect)const;
181 
182  void
183  fillNewNode(IrregNode & a_node,
184  const IntVectSet & a_ivsIrreg,
185  const ProblemDomain & a_domain,
186  const RealVect & a_origin,
187  const Real & a_dx,
188  const IntVect & a_iv) const;
189 
191  {
192  m_refCrit = a_refCrit;
193  }
194 
195 private:
196  void
197  fixRegularCellsNextToCovered(Vector<IrregNode> & a_nodes,
198  BaseFab<int> & a_regIrregCovered,
199  const Box & a_validRegion,
200  const Box & a_domain,
201  const IntVect & a_iv,
202  const Real & a_dx) const;
203  void
204  getFullNodeWithCoveredFace(IrregNode & a_newNode,
205  const BaseFab<int> & a_regIrregCovered,
206  const IntVect & a_iv,
207  const Real & a_dx,
208  const Box & a_domain) const;
209 
210 
212 
214 
215  //origin
217 
218  int m_order;
222 
224 
226 
228  /**
229  Return true if every cell in region is regular at the
230  refinement described by dx.
231  */
232  bool isRegularEveryPoint(const Box& a_region,
233  const ProblemDomain& a_domain,
234  const RealVect& a_origin,
235  const Real& a_dx) const;
236 
237  ///
238  /**
239  Return true if every cell in region is covered at the
240  refinement described by dx.
241  */
242  bool isCoveredEveryPoint(const Box& a_region,
243  const ProblemDomain& a_domain,
244  const RealVect& a_origin,
245  const Real& a_dx) const;
246 
247 
248  void fillArc(Vector<int> a_arc[SpaceDim],
249  CutCellMoments<SpaceDim> & a_cutCellMoments,
250  const int & a_hilo,
251  const IntVectSet & a_ivsIrreg,
252  const IntVect & a_curriv) const;
253 
254 
255  //stuff disallowed for all the usual reasons.
257  {
258  MayDay::Abort("WrappedGShop uses strong construction only");
259  }
260  WrappedGShop(const WrappedGShop& a_workshopin)
261  {
262  MayDay::Abort("WrappedGShop disallows copy contruction");
263  }
264  void operator=(const WrappedGShop& a_workshopin)
265  {
266  MayDay::Abort("WrappedGShop disallows the assignment operator");
267  }
268 
269 };
270 #include "NamespaceFooter.H"
271 #endif
WGSRefinementCriterion()
Definition: WrappedGShop.H:42
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
int m_degreeP
Definition: WrappedGShop.H:219
~WrappedGShop()
Definition: WrappedGShop.H:94
int m_order
Definition: WrappedGShop.H:218
one dimensional dynamic array
Definition: Vector.H:53
void operator=(const WrappedGShop &a_workshopin)
Definition: WrappedGShop.H:264
virtual ~WGSRefinementCriterion()
Definition: WrappedGShop.H:38
virtual bool canGenerateMultiCells() const
Definition: WrappedGShop.H:130
virtual const BaseIF * getBaseIFPtr() const
Definition: WrappedGShop.H:86
base class for special refinement
Definition: WrappedGShop.H:29
RealVect m_origin
Definition: WrappedGShop.H:216
WrappedGShop(const WrappedGShop &a_workshopin)
Definition: WrappedGShop.H:260
virtual bool refineHere(const IrregNode &a_node, const IntVect &a_iv, const Real &a_dx) const
Definition: WrappedGShop.H:33
const int SpaceDim
Definition: SPACE.H:38
Definition: IndexTM.H:36
Definition: WrappedGShop.H:54
Definition: BaseIF.H:32
RefCountedPtr< BaseIF > m_baseIF
Definition: WrappedGShop.H:225
virtual bool generatesHigherOrderMoments() const
this does return higher order moments.
Definition: WrappedGShop.H:99
int m_phase
Definition: WrappedGShop.H:59
double Real
Definition: REAL.H:33
Definition: IrregNode.H:33
static Real s_relativeTol
Definition: WrappedGShop.H:227
Definition: GeometryService.H:37
LoHiSide
Definition: LoHiSide.H:27
int m_maxNumberRefines
Definition: WrappedGShop.H:221
int m_minNumberRefines
Definition: WrappedGShop.H:220
WrappedGShop()
Definition: WrappedGShop.H:256
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Definition: DataIndex.H:112
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
void setRefinementCriterion(const RefCountedPtr< WGSRefinementCriterion > &a_refCrit)
Definition: WrappedGShop.H:190
Definition: CutCellMoments.H:32
Real m_threshold
Definition: WrappedGShop.H:213
RefCountedPtr< WGSRefinementCriterion > m_refCrit
Definition: WrappedGShop.H:211
ProblemDomain m_domain
Definition: WrappedGShop.H:223
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).