Chombo + EB + MF  3.2
CutCellMoments.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 _CUTCELLMOMENTS_H_
12 #define _CUTCELLMOMENTS_H_
13 
14 #if defined(CH_Darwin) && defined(__GNUC__) && ( __GNUC__ == 3 )
15 // deal with the broken isnan()/isinf() in GCC on MacOS
16 #include <unistd.h>
17 #define _GLIBCPP_USE_C99 1
18 #endif
19 
20 #include <map>
21 using std::map;
22 
23 #include "Vector.H"
24 #include "REAL.H"
25 #include "IndexTM.H"
26 
27 #include "Notation.H"
28 #include "IFData.H"
29 
30 #include "NamespaceHeader.H"
31 
32 template <int dim> class CutCellMoments
33 {
34 public:
37 
38  typedef map<IvDim,Real > PthMoment;
39 
40  typedef map<IndexTM<int,dim-1>,Real > PthMomentLesserDimension;
41 
42  typedef map<IndexTM<int,1>,Real > OneDMoments;
43  typedef map<int,IvDim> LocPthMoment;
44  typedef map<IvDim,int > PthMomentLoc;
45 
47 
48  // Constructors
50  CutCellMoments(const CutCellMoments<dim>& a_cutCellMoments);
51 
52  // This is used to build bd CutCellMoments
53  CutCellMoments(const IFData<dim>& a_info);
54 
55  // Destructor
57 
58  // Returns a boundary element of one dim less
59  const CutCellMoments<dim - 1> getBdCutCellMoments(const Iv2& a_bdId) const;
60 
61  Real changeMomentCoordinates(PthMoment & a_refinedMomentMap,
62  const IndexTM<int,dim> & a_monomial,
63  const IndexTM<Real,dim> & a_refinedCenterDelta);
64 
66 
68 
69  void initialize(CutCellMoments<dim> & a_refinedCutCell);
70 
71  void initializeMap(PthMoment & a_map1,
72  PthMoment & a_map2);
73 
75  PthMomentLesserDimension & a_map2);
76 
77 
78  // Get the value of the moment depending on the values of the booleans
79  // m_allVerticesIn/Out these functions are used under refinement, when
80  // moments on the faces are needed even on a covered/regular cell
81  Real getBdMoment(const IvDim & a_mono,
82  const IFData<dim+1> & a_IFData,
83  const IndexTM<Real,dim> & a_refinedCenterDelta,
84  PthMoment a_fullCellMap = PthMoment());
85 
86  Real getBdEBMoment(const IvDim & a_mono,
87  const IFData<dim+1> & a_IFData,
88  const IndexTM<Real,dim> & a_refinedCenterDelta);
89 
90  void addBdMoments(CutCellMoments<dim> & a_coarseCutCell,
91  const IFData<dim+1> & a_IFData,
92  const int & a_degreePmax,
93  const bool & a_useConstraints,
94  const IndexTM<Real,dim> & a_refinedCenterDelta,
95  const IndexTM<int,dim> & a_localHilo);
96 
97  // Integrates a monomial over a full cell
99  const CoordinateSystem<dim> & a_coord);
100 
101  // Output methods that check a_mono is in the map
102  Real getMoment(const IvDim & a_mono,
103  const EBorVol & a_EBorVOL) const;
104 
105  // Methods for reading geom data that do sanity checks on results
106  Real getVol(const EBorVol & a_EBorVol) const;
107 
108  RvDim getCentroid(const EBorVol & a_EBorVOL) const;
109 
110  Real getResidual(const int & a_iDegree,
111  const int & a_normJ) const;
112 
113  void setResidual(const Real& a_value,
114  const int & a_iDegree,
115  const int & a_normJ);
116 
117  Vector<Real> sliceResidual(const int & a_iDegree) const;
118 
119  bool isCovered() const;
120 
121  bool isRegular() const;
122 
123  // Output
124  void print(ostream& out) const;
125 
126  void dump() const;
127 
128  // Operators
129  void operator=(const CutCellMoments<dim>& a_cutCellMoments);
130 
131  //volume moments
133 
134  //eb moments
136 
137  //lower dimensional cut cells
139 
140  //edge interesections,normals and derivatives of normals
142 
143  //indicates that a boundary CutCellMoment coincides with the interface
144  bool m_bdCCOn;
145 
146  //residual from the least squares problem at the highest dimension
148 
149  //number of active constraints
151 
152  // records whether this cutCellMoment or any elements of BdCutCellMoments are using the zero vector for a normal
154 };
155 
156 // One dimensional cutCellMoments
157 template <> class CutCellMoments<1>
158 {
159 public:
160  typedef map<IndexTM<int,1>,Real> OneDMoments;
161 
162  // Constructors
163  CutCellMoments();
164  CutCellMoments(const CutCellMoments<1> & a_cutCellMoments);
165 
166  CutCellMoments(const IFData<1>& a_info);
167 
168  // Destructor
169  ~CutCellMoments();
170 
172  const IndexTM<int,1> & a_monomial,
173  const IndexTM<Real,1> & a_refinedCenterDelta);
174 
176 
178 
179  void initialize(CutCellMoments<1> & a_refinedCutCell);
180 
181  void initializeMap(OneDMoments & a_map1,
182  OneDMoments & a_map2);
183 
184  Real getBdMoment(const IndexTM<int,1> & a_mono,
185  const IFData<2> & a_IFData,
186  const IndexTM<Real,1> & a_refinedCenterDelta,
187  OneDMoments a_fullCellMap = OneDMoments());
188 
189  Real getBdEBMoment(const IndexTM<int,1> & a_mono,
190  const IFData<2> & a_IFData,
191  const IndexTM<Real,1> & a_refinedCenterDelta);
192 
193  void addBdMoments(CutCellMoments<1> & a_coarseCutCell,
194  const IFData<2> & a_IFData,
195  const int & a_degreePmax,
196  const bool & a_useConstraints,
197  const IndexTM<Real,1> & a_refinedCenterDelta,
198  const IndexTM<int,1> & a_localHilo);
199 
200  // Output method that check a_mono is in the map
201  Real getMoment(const IndexTM<int,1> & a_mono,
202  const EBorVol & a_EBorVOL) const;
203 
204  Real getMoment(const IndexTM<int,1>& a_mono) const;
205 
206  // Methods for reading geom data that do sanity checks on results
207  Real getVol(const EBorVol& a_EBorVol) const;
208 
209  IndexTM<Real,1> getCentroid(const EBorVol& a_EBorVol) const;
210 
211  bool isCovered() const;
212 
213  bool isRegular() const;
214 
215  // Output
216  void print(ostream& out) const;
217 
218  void dump() const;
219 
220  // Operators
221  void operator=(const CutCellMoments<1>& a_cutCellMoments);
222 
223  // Member data
226  bool m_bdCCOn;
229 
230  // This is a dummy quantity: no EB in 1D
232 };
233 
234 #include "NamespaceFooter.H"
235 
236 #include "CutCellMomentsImplem.H"
237 
238 #endif
BdCutCellMoments m_bdCutCellMoments
Definition: CutCellMoments.H:138
void addBdMoments(CutCellMoments< dim > &a_coarseCutCell, const IFData< dim+1 > &a_IFData, const int &a_degreePmax, const bool &a_useConstraints, const IndexTM< Real, dim > &a_refinedCenterDelta, const IndexTM< int, dim > &a_localHilo)
Definition: CutCellMomentsImplem.H:112
IndexTM< Real, dim > RvDim
Definition: CutCellMoments.H:36
Definition: CoordinateSystem.H:34
Definition: CutCellMoments.H:157
map< IndexTM< int, 1 >, Real > OneDMoments
Definition: CutCellMoments.H:42
map< IndexTM< int, 1 >, Real > OneDMoments
Definition: CutCellMoments.H:160
void changeMomentCoordinatesToCellCenter()
Definition: CutCellMomentsImplem.H:367
RvDim getCentroid(const EBorVol &a_EBorVOL) const
Definition: CutCellMomentsImplem.H:553
EBorVol
Definition: Notation.H:101
map< IndexTM< int, dim-1 >, Real > PthMomentLesserDimension
Definition: CutCellMoments.H:40
Definition: IFData.H:145
bool m_badNormal
Definition: CutCellMoments.H:153
IFData< 1 > m_IFData
Definition: CutCellMoments.H:225
void dump() const
Definition: CutCellMomentsImplem.H:741
~CutCellMoments()
Definition: CutCellMomentsImplem.H:92
OneDMoments m_EBmoments
Definition: CutCellMoments.H:231
bool isCovered() const
Definition: CutCellMomentsImplem.H:624
Definition: IndexTM.H:36
Vector< Real > sliceResidual(const int &a_iDegree) const
Definition: CutCellMomentsImplem.H:611
void print(ostream &out) const
Definition: CutCellMomentsImplem.H:634
CutCellMoments()
Definition: CutCellMomentsImplem.H:35
void setResidual(const Real &a_value, const int &a_iDegree, const int &a_normJ)
Definition: CutCellMomentsImplem.H:597
IFData< dim > m_IFData
Definition: CutCellMoments.H:141
Vector< Vector< Real > > m_residual
Definition: CutCellMoments.H:147
Definition: IFData.H:42
bool m_bdCCOn
Definition: CutCellMoments.H:144
double Real
Definition: REAL.H:33
const CutCellMoments< dim-1 > getBdCutCellMoments(const Iv2 &a_bdId) const
Definition: CutCellMomentsImplem.H:96
Real fullCellQuadrature(const IndexTM< int, dim > &a_mono, const CoordinateSystem< dim > &a_coord)
Definition: CutCellMomentsImplem.H:237
IndexTM< int, dim > IvDim
Definition: CutCellMoments.H:35
void initialize(CutCellMoments< dim > &a_refinedCutCell)
Definition: CutCellMomentsImplem.H:411
int m_numActiveBounds
Definition: CutCellMoments.H:150
map< int, IvDim > LocPthMoment
Definition: CutCellMoments.H:43
void changeMomentCoordinatesToParentCenter()
Definition: CutCellMomentsImplem.H:389
PthMoment m_moments
Definition: CutCellMoments.H:132
OneDMoments m_moments
Definition: CutCellMoments.H:224
Real getMoment(const IvDim &a_mono, const EBorVol &a_EBorVOL) const
Definition: CutCellMomentsImplem.H:501
int m_numActiveBounds
Definition: CutCellMoments.H:227
map< IvDim, Real > PthMoment
Definition: CutCellMoments.H:38
map< Iv2, CutCellMoments< dim-1 > > BdCutCellMoments
Definition: CutCellMoments.H:46
Real getBdMoment(const IvDim &a_mono, const IFData< dim+1 > &a_IFData, const IndexTM< Real, dim > &a_refinedCenterDelta, PthMoment a_fullCellMap=PthMoment())
Definition: CutCellMomentsImplem.H:454
void initializeMap(PthMoment &a_map1, PthMoment &a_map2)
Definition: CutCellMomentsImplem.H:444
Real getVol(const EBorVol &a_EBorVol) const
Definition: CutCellMomentsImplem.H:542
PthMoment m_EBmoments
Definition: CutCellMoments.H:135
void operator=(const CutCellMoments< dim > &a_cutCellMoments)
Definition: CutCellMomentsImplem.H:747
IndexTM< int, 2 > Iv2
Definition: Notation.H:108
bool isRegular() const
Definition: CutCellMomentsImplem.H:629
Real getBdEBMoment(const IvDim &a_mono, const IFData< dim+1 > &a_IFData, const IndexTM< Real, dim > &a_refinedCenterDelta)
Definition: CutCellMomentsImplem.H:480
map< IvDim, int > PthMomentLoc
Definition: CutCellMoments.H:44
int dim
Definition: EBInterface.H:146
bool m_badNormal
Definition: CutCellMoments.H:228
Definition: CutCellMoments.H:32
Real changeMomentCoordinates(PthMoment &a_refinedMomentMap, const IndexTM< int, dim > &a_monomial, const IndexTM< Real, dim > &a_refinedCenterDelta)
Definition: CutCellMomentsImplem.H:261
Real getResidual(const int &a_iDegree, const int &a_normJ) const
Definition: CutCellMomentsImplem.H:581
bool m_bdCCOn
Definition: CutCellMoments.H:226