Chombo + EB + MF  3.2
ComputeCutCellMoments.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 _COMPUTECUTCELLMOMENTS_H_
12 #define _COMPUTECUTCELLMOMENTS_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 "LSquares.H"
29 #include "IFData.H"
30 #include "CutCellMoments.H"
31 #include "RefinementCriterion.H"
32 
33 #include "NamespaceHeader.H"
34 
35 template <int dim> class LSProblem;
36 
37 template <int dim> class ComputeCutCellMoments
38 {
39 public:
42 
43  typedef map<IvDim,Real,LexLT <IvDim > > PthMoment;
44 
45  typedef map<IndexTM<int,dim-1>,Real,LexLT < IndexTM<int,dim-1> > > PthMomentLesserDimension;
46 
47  typedef map<IndexTM<int,1>,Real > OneDMoments;
48  typedef map<int,IvDim> LocPthMoment;
49  typedef map<IvDim,int,LexLT <IvDim> > PthMomentLoc;
50 
52 
53  // Constructors
55  ComputeCutCellMoments(const ComputeCutCellMoments<dim>& a_computeCutCellMoments);
56 
57  // This is used to build bd ComputeCutCellMoments
58  ComputeCutCellMoments(const IFData<dim>& a_info);
59 
60  // Destructor
62 
63 #if RECURSIVE_GEOMETRY_GENERATION == 0
64  void computeMoments(const int & a_order,
65  const int & a_degreeP,
66  const bool & a_useConstraints,
67  RefinementCriterion<dim> & a_refinementCriterion,
68  const int & a_numberOfRefinements = 0);
69 #else
70  void computeMoments(const int & a_orderPmax,
71  const int & a_degreePmax,
72  const bool & a_useConstraints,
73  RefinementCriterion<dim> & a_refinementCriterion,
74  const int & a_numberOfRefinements = 0);
75 
76  void computeMomentsRecursively(const int & a_orderPmax,
77  const int & a_degreePmax,
78  const bool & a_useConstraints,
79  RefinementCriterion<dim> & a_refinementCriterion,
80  const int & a_numberOfRefinements);
81 #endif
82 
84  const int & a_order);
85 
86  // Solve the problem on a refined cell
87 #if RECURSIVE_GEOMETRY_GENERATION == 0
88  Vector< CutCellMoments<dim> > refine(const int & a_order,
89  const int & a_degreeP,
90 #else
91  Vector< CutCellMoments<dim> > refine(const int & a_orderPmax,
92  const int & a_degreePmax,
93 #endif
94  const bool & a_useConstraints,
95  RefinementCriterion<dim> & a_refinementCriterion,
96  const IndexTM<int,dim> & a_refineInDir,
97  const int & a_numberOfRefinements);
98 
99  void addMomentMaps(const Vector<CutCellMoments<dim> > & a_refinedCutCellVector,
101  const int & a_degreeP,
102 #else
103  const int & a_degreePmax,
104 #endif
105  const bool & a_useConstraints);
106 
107  void addMoments(PthMoment & a_momentMap,
108  PthMoment & a_refinedMomentMap,
109  const IndexTM<Real,dim> & a_refinedCenterDelta);
110 
111  void addBdMoments(CutCellMoments<dim> & a_coarseCutCell,
112  const IFData<dim+1> & a_IFData,
114  const int & a_degreeP,
115 #else
116  const int & a_degreePmax,
117 #endif
118  const bool & a_useConstraints,
119  const IndexTM<Real,dim> & a_refinedCenterDelta,
120  const IndexTM<int,dim> & a_localHilo);
121 
122 #if RECURSIVE_GEOMETRY_GENERATION == 0
123  void computeResiduals(const int & a_order,
124  const int & a_degreeP,
125 #else
126  void computeResiduals(const int & a_orderPmax,
127  const int & a_degreePmax,
128 #endif
129  const bool & a_useConstraints);
130 
131  void computeResiduals(const Vector<CutCellMoments<dim> > & a_refinedCCMoms,
133  const int & a_degreeP);
134 #else
135  const int & a_degreePmax);
136 #endif
137 
138  // Output
139  void print(ostream& out) const;
140 
141  void dump() const;
142 
143  // Operators
144  void operator=(const ComputeCutCellMoments<dim>& a_computeCutCellMoments);
145 
146  Real factorial(const IvDim & a_multiIndex) const;
147 
148  // All the moments (and other data)
150 
151  // Flag whether the boundary moments have been computed already
153 };
154 
155 // One dimensional ComputeCutCellMoments
156 template <> class ComputeCutCellMoments<1>
157 {
158 public:
159  typedef map<IndexTM<int,1>,Real> OneDMoments;
160 
161  // Constructors
163  ComputeCutCellMoments(const ComputeCutCellMoments<1> & a_computeCutCellMoments);
164  ComputeCutCellMoments(const IFData<1>& a_info);
165 
166  // Destructor
168 
169 #if RECURSIVE_GEOMETRY_GENERATION == 0
170  void computeMoments(const int & a_order,
171  const int & a_degree,
172 #else
173  void computeMoments(const int & a_orderPmax,
174  const int & a_degreePmax,
175 #endif
176  const bool & a_useConstraints,
177  RefinementCriterion<1> & a_refinementCriterion);
178 
179  void simpleComputeMoments(const Real & a_loPt,
180  const Real & a_hiPt,
182  const int & a_degree);
183 #else
184  const int & a_degreePmax);
185 #endif
186 
187  void computeMomentsUsingBinomial(const Real & a_loPt,
188  const Real & a_hiPt,
189  const int & a_loSign,
190  const int & a_hiSign,
192  const int & a_degree);
193 #else
194  const int & a_degreePmax);
195 #endif
196 
197  // Output
198  void print(ostream& out) const;
199 
200  void dump() const;
201 
202  // Operators
203  void operator=(const ComputeCutCellMoments<1>& a_computeCutCellMoments);
204 
205  // Member data
207 };
208 
209 #include "NamespaceFooter.H"
210 
212 
213 #endif
Real factorial(const IvDim &a_multiIndex) const
Definition: ComputeCutCellMomentsImplem.H:1004
Definition: CutCellMoments.H:157
void addMoments(PthMoment &a_momentMap, PthMoment &a_refinedMomentMap, const IndexTM< Real, dim > &a_refinedCenterDelta)
Definition: ComputeCutCellMomentsImplem.H:832
Definition: ComputeCutCellMoments.H:156
map< int, IvDim > LocPthMoment
Definition: ComputeCutCellMoments.H:48
void operator=(const ComputeCutCellMoments< dim > &a_computeCutCellMoments)
Definition: ComputeCutCellMomentsImplem.H:988
Definition: ComputeCutCellMoments.H:37
CutCellMoments< 1 > m_cutCellMoments
Definition: ComputeCutCellMoments.H:206
Vector< CutCellMoments< dim > > refine(const int &a_order, const int &a_degreeP, const bool &a_useConstraints, RefinementCriterion< dim > &a_refinementCriterion, const IndexTM< int, dim > &a_refineInDir, const int &a_numberOfRefinements)
Definition: ComputeCutCellMomentsImplem.H:592
map< IvDim, Real, LexLT< IvDim > > PthMoment
Definition: ComputeCutCellMoments.H:43
Vector< Real > computeRhs(LSProblem< dim > &a_lsp, const int &a_order)
Definition: ComputeCutCellMomentsImplem.H:485
~ComputeCutCellMoments()
Definition: ComputeCutCellMomentsImplem.H:82
Definition: IFData.H:145
CutCellMoments< dim > m_cutCellMoments
Definition: ComputeCutCellMoments.H:149
Definition: ComputeCutCellMoments.H:35
Definition: RefinementCriterion.H:27
Definition: IndexTM.H:36
map< IndexTM< int, 1 >, Real > OneDMoments
Definition: ComputeCutCellMoments.H:47
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)
void computeResiduals(const int &a_order, const int &a_degreeP, const bool &a_useConstraints)
Definition: ComputeCutCellMomentsImplem.H:848
IndexTM< Real, dim > RvDim
Definition: ComputeCutCellMoments.H:41
Definition: IFData.H:42
IndexTM< int, dim > IvDim
Definition: ComputeCutCellMoments.H:40
double Real
Definition: REAL.H:33
void addMomentMaps(const Vector< CutCellMoments< dim > > &a_refinedCutCellVector, const int &a_degreeP, const bool &a_useConstraints)
Definition: ComputeCutCellMomentsImplem.H:700
map< Iv2, CutCellMoments< dim-1 >, LexLT< Iv2 > > BdCutCellMoments
Definition: ComputeCutCellMoments.H:51
void computeMoments(const int &a_order, const int &a_degreeP, const bool &a_useConstraints, RefinementCriterion< dim > &a_refinementCriterion, const int &a_numberOfRefinements=0)
Definition: ComputeCutCellMomentsImplem.H:87
void dump() const
Definition: ComputeCutCellMomentsImplem.H:982
map< IndexTM< int, dim-1 >, Real, LexLT< IndexTM< int, dim-1 > > > PthMomentLesserDimension
Definition: ComputeCutCellMoments.H:45
Definition: Notation.H:92
void print(ostream &out) const
Definition: ComputeCutCellMomentsImplem.H:977
map< IndexTM< int, 1 >, Real > OneDMoments
Definition: ComputeCutCellMoments.H:159
ComputeCutCellMoments()
Definition: ComputeCutCellMomentsImplem.H:36
IndexTM< int, 2 > Iv2
Definition: Notation.H:108
int dim
Definition: EBInterface.H:146
bool m_boundaryMomentsComputed
Definition: ComputeCutCellMoments.H:152
Definition: CutCellMoments.H:32
#define RECURSIVE_GEOMETRY_GENERATION
Definition: Notation.H:40
map< IvDim, int, LexLT< IvDim > > PthMomentLoc
Definition: ComputeCutCellMoments.H:49