Chombo + EB  3.0
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,LexLT <IvDim > > PthMoment;
39 
40  typedef map<IndexTM<int,dim-1>,Real,LexLT < IndexTM<int,dim-1> > > PthMomentLesserDimension;
41 
42  typedef map<IndexTM<int,1>,Real > OneDMoments;
43  typedef map<int,IvDim> LocPthMoment;
44  typedef map<IvDim,int,LexLT <IvDim> > 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 
74  void initializeMap(PthMomentLesserDimension & a_map1,
75  PthMomentLesserDimension & a_map2);
76 
77  void initializeMap(OneDMoments & a_map1,
78  OneDMoments & a_map2);
79 
80  // Get the value of the moment depending on the values of the booleans
81  // m_allVerticesIn/Out these functions are used under refinement, when
82  // moments on the faces are needed even on a covered/regular cell
83  Real getBdMoment(const IvDim & a_mono,
84  const IFData<dim+1> & a_IFData,
85  const IndexTM<Real,dim> & a_refinedCenterDelta,
86  PthMoment a_fullCellMap = PthMoment());
87 
88  Real getBdEBMoment(const IvDim & a_mono,
89  const IFData<dim+1> & a_IFData,
90  const IndexTM<Real,dim> & a_refinedCenterDelta);
91 
92  void addBdMoments(CutCellMoments<dim> & a_coarseCutCell,
93  const IFData<dim+1> & a_IFData,
95  const int & a_degreeP,
96 #else
97  const int & a_degreePmax,
98 #endif
99  const bool & a_useConstraints,
100  const IndexTM<Real,dim> & a_refinedCenterDelta,
101  const IndexTM<int,dim> & a_localHilo);
102 
103  // Integrates a monomial over a full cell
104  Real fullCellQuadrature(const IndexTM<int,dim> & a_mono,
105  const CoordinateSystem<dim> & a_coord);
106 
107  // Output methods that check a_mono is in the map
108  Real getMoment(const IvDim & a_mono,
109  const EBorVol & a_EBorVOL) const;
110 
111  // Methods for reading geom data that do sanity checks on results
112  Real getVol(const EBorVol & a_EBorVol) const;
113 
114  RvDim getCentroid(const EBorVol & a_EBorVOL) const;
115 
116  Real getResidual(const int & a_iDegree,
117  const int & a_normJ) const;
118 
119  void setResidual(const Real& a_value,
120  const int & a_iDegree,
121  const int & a_normJ);
122 
123  Vector<Real> sliceResidual(const int & a_iDegree) const;
124 
125  bool isCovered() const;
126 
127  bool isRegular() const;
128 
129  // Output
130  void print(ostream& out) const;
131 
132  void dump() const;
133 
134  // Operators
135  void operator=(const CutCellMoments<dim>& a_cutCellMoments);
136 
137  //volume moments
138  PthMoment m_moments;
139 
140  //eb moments
141  PthMoment m_EBmoments;
142 
143  //lower dimensional cut cells
144  BdCutCellMoments m_bdCutCellMoments;
145 
146  //edge interesections,normals and derivatives of normals
148 
149  //indicates that a boundary CutCellMoment coincides with the interface
150  bool m_bdCCOn;
151 
152  //residual from the least squares problem at the highest dimension
154 
155  //number of active constraints
157 
158  // records whether this cutCellMoment or any elements of BdCutCellMoments are using the zero vector for a normal
160 };
161 
162 // One dimensional cutCellMoments
163 template <> class CutCellMoments<1>
164 {
165 public:
166  typedef map<IndexTM<int,1>,Real> OneDMoments;
167 
168  // Constructors
169  CutCellMoments();
170  CutCellMoments(const CutCellMoments<1> & a_cutCellMoments);
171 
172  CutCellMoments(const IFData<1>& a_info);
173 
174  // Destructor
175  ~CutCellMoments();
176 
177  Real changeMomentCoordinates(OneDMoments & a_refinedMap,
178  const IndexTM<int,1> & a_monomial,
179  const IndexTM<Real,1> & a_refinedCenterDelta);
180 
182 
184 
185  void initialize(CutCellMoments<1> & a_refinedCutCell);
186 
187  void initializeMap(OneDMoments & a_map1,
188  OneDMoments & a_map2);
189 
190  Real getBdMoment(const IndexTM<int,1> & a_mono,
191  const IFData<2> & a_IFData,
192  const IndexTM<Real,1> & a_refinedCenterDelta,
193  OneDMoments a_fullCellMap = OneDMoments());
194 
195  Real getBdEBMoment(const IndexTM<int,1> & a_mono,
196  const IFData<2> & a_IFData,
197  const IndexTM<Real,1> & a_refinedCenterDelta);
198 
199  void addBdMoments(CutCellMoments<1> & a_coarseCutCell,
200  const IFData<2> & a_IFData,
202  const int & a_degreeP,
203 #else
204  const int & a_degreePmax,
205 #endif
206  const bool & a_useConstraints,
207  const IndexTM<Real,1> & a_refinedCenterDelta,
208  const IndexTM<int,1> & a_localHilo);
209 
210  // Output method that check a_mono is in the map
211  Real getMoment(const IndexTM<int,1> & a_mono,
212  const EBorVol & a_EBorVOL) const;
213 
214  Real getMoment(const IndexTM<int,1>& a_mono) const;
215 
216  // Methods for reading geom data that do sanity checks on results
217  Real getVol(const EBorVol& a_EBorVol) const;
218 
219  IndexTM<Real,1> getCentroid(const EBorVol& a_EBorVol) const;
220 
221  bool isCovered() const;
222 
223  bool isRegular() const;
224 
225  // Output
226  void print(ostream& out) const;
227 
228  void dump() const;
229 
230  // Operators
231  void operator=(const CutCellMoments<1>& a_cutCellMoments);
232 
233  // Member data
234  OneDMoments m_moments;
236  bool m_bdCCOn;
239 
240  // This is a dummy quantity: no EB in 1D
241  OneDMoments m_EBmoments;
242 };
243 
244 #include "NamespaceFooter.H"
245 
246 #include "CutCellMomentsImplem.H"
247 
248 #endif
bool isCovered() const
Definition: CutCellMomentsImplem.H:664
Real getVol(const EBorVol &a_EBorVol) const
Definition: CutCellMomentsImplem.H:582
BdCutCellMoments m_bdCutCellMoments
Definition: CutCellMoments.H:144
IndexTM< Real, dim > RvDim
Definition: CutCellMoments.H:36
Definition: CoordinateSystem.H:34
Definition: CutCellMoments.H:163
map< IndexTM< int, 1 >, Real > OneDMoments
Definition: CutCellMoments.H:42
Real getResidual(const int &a_iDegree, const int &a_normJ) const
Definition: CutCellMomentsImplem.H:621
map< IndexTM< int, 1 >, Real > OneDMoments
Definition: CutCellMoments.H:166
void changeMomentCoordinatesToCellCenter()
Definition: CutCellMomentsImplem.H:399
EBorVol
Definition: Notation.H:101
Vector< Real > sliceResidual(const int &a_iDegree) const
Definition: CutCellMomentsImplem.H:651
Real getMoment(const IvDim &a_mono, const EBorVol &a_EBorVOL) const
Definition: CutCellMomentsImplem.H:541
Definition: IFData.H:138
bool m_badNormal
Definition: CutCellMoments.H:159
map< Iv2, CutCellMoments< dim-1 >, LexLT< Iv2 > > BdCutCellMoments
Definition: CutCellMoments.H:46
IFData< 1 > m_IFData
Definition: CutCellMoments.H:235
~CutCellMoments()
Definition: CutCellMomentsImplem.H:96
OneDMoments m_EBmoments
Definition: CutCellMoments.H:241
void print(ostream &out) const
Definition: CutCellMomentsImplem.H:674
Definition: IndexTM.H:36
CutCellMoments()
Definition: CutCellMomentsImplem.H:35
void setResidual(const Real &a_value, const int &a_iDegree, const int &a_normJ)
Definition: CutCellMomentsImplem.H:637
IFData< dim > m_IFData
Definition: CutCellMoments.H:147
Vector< Vector< Real > > m_residual
Definition: CutCellMoments.H:153
Definition: IFData.H:35
bool m_bdCCOn
Definition: CutCellMoments.H:150
double Real
Definition: REAL.H:33
Real fullCellQuadrature(const IndexTM< int, dim > &a_mono, const CoordinateSystem< dim > &a_coord)
Definition: CutCellMomentsImplem.H:269
bool isRegular() const
Definition: CutCellMomentsImplem.H:669
map< IvDim, int, LexLT< IvDim > > PthMomentLoc
Definition: CutCellMoments.H:44
IndexTM< int, dim > IvDim
Definition: CutCellMoments.H:35
map< IndexTM< int, dim-1 >, Real, LexLT< IndexTM< int, dim-1 > > > PthMomentLesserDimension
Definition: CutCellMoments.H:40
void initialize(CutCellMoments< dim > &a_refinedCutCell)
Definition: CutCellMomentsImplem.H:443
int m_numActiveBounds
Definition: CutCellMoments.H:156
map< int, IvDim > LocPthMoment
Definition: CutCellMoments.H:43
void changeMomentCoordinatesToParentCenter()
Definition: CutCellMomentsImplem.H:421
PthMoment m_moments
Definition: CutCellMoments.H:138
OneDMoments m_moments
Definition: CutCellMoments.H:234
int m_numActiveBounds
Definition: CutCellMoments.H:237
void addBdMoments(CutCellMoments< dim > &a_coarseCutCell, const IFData< dim+1 > &a_IFData, const int &a_degreeP, const bool &a_useConstraints, const IndexTM< Real, dim > &a_refinedCenterDelta, const IndexTM< int, dim > &a_localHilo)
Definition: CutCellMomentsImplem.H:116
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:494
Definition: Notation.H:92
void initializeMap(PthMoment &a_map1, PthMoment &a_map2)
Definition: CutCellMomentsImplem.H:476
RvDim getCentroid(const EBorVol &a_EBorVOL) const
Definition: CutCellMomentsImplem.H:593
PthMoment m_EBmoments
Definition: CutCellMoments.H:141
const CutCellMoments< dim - 1 > getBdCutCellMoments(const Iv2 &a_bdId) const
Definition: CutCellMomentsImplem.H:100
map< IvDim, Real, LexLT< IvDim > > PthMoment
Definition: CutCellMoments.H:38
void operator=(const CutCellMoments< dim > &a_cutCellMoments)
Definition: CutCellMomentsImplem.H:787
IndexTM< int, 2 > Iv2
Definition: Notation.H:108
Real getBdEBMoment(const IvDim &a_mono, const IFData< dim+1 > &a_IFData, const IndexTM< Real, dim > &a_refinedCenterDelta)
Definition: CutCellMomentsImplem.H:520
void dump() const
Definition: CutCellMomentsImplem.H:781
int dim
Definition: EBInterface.H:146
bool m_badNormal
Definition: CutCellMoments.H:238
Definition: CutCellMoments.H:32
Real changeMomentCoordinates(PthMoment &a_refinedMomentMap, const IndexTM< int, dim > &a_monomial, const IndexTM< Real, dim > &a_refinedCenterDelta)
Definition: CutCellMomentsImplem.H:293
#define RECURSIVE_GEOMETRY_GENERATION
Definition: Notation.H:40
bool m_bdCCOn
Definition: CutCellMoments.H:236