Chombo + EB  3.2
Moments.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 _MOMENTS_H_
12 #define _MOMENTS_H_
13 
14 #include "Vector.H"
15 #include "REAL.H"
16 #include "RealVect.H"
17 #include "NamespaceHeader.H"
18 
19 /////////////////////////////////class edgeMo///////////////////////////////////
20 ///
21 /**
22  This class stores data about an edge of a control volume
23  */
24 class edgeMo
25 {
26 public:
28  {
29  }
30 
31  void define (const RealVect& a_loPt,
32  const RealVect& a_hiPt,
33  const bool& a_intersectLo,
34  const int& a_direction,
35  const bool& a_covered,
36  const bool& a_regular,
37  const bool& a_dontKnow);
38 
39  ///access member data
40  RealVect getLo() const;
41  RealVect getHi() const;
42  bool getIntersectLo() const;
43 
44  Real getEdgeLength() const;
45  RealVect getEdgeCentroid() const;
46 
47  bool isCovered() const;
48  bool isRegular() const;
49  bool dontKnow() const;
50 
51  int direction() const;
52 
53  ///integrate monomial
54  Real moment(const IntVect& a_exponent) const;
55 
56 private:
59 
61 
64 
65  bool m_covered;
66  bool m_regular;
67  bool m_dontKnow;
68 
70 };
71 
72 /////////////////////////////////class faceMo///////////////////////////////////
73 class faceMo
74 {
75 public:
77  {
78  }
79 
80  void define(const edgeMo a_edges[4],
81  const int& a_faceNormal,
82  const bool& a_covered,
83  const bool& a_regular,
84  const bool& a_dontKnow);
85 
86  void setFaceArea(const Real& a_area);
87  Real getFaceArea() const;
88 
89  void setFaceCentroid(const RealVect& a_centroid);
90  RealVect getFaceCentroid() const;
91 
92  bool isRegular() const;
93  bool isCovered() const;
94  bool dontKnow() const;
95 
96  Real getBdLength() const;
97  void getNormal(Real a_normal[2]) const;
98  void getEdges(edgeMo a_Edges[4]) const;
99  edgeMo retrieveEdge(int& a_iEdge) const;
100 
101  int getFaceNormal()const;
102  void makeNormal();
103  void normalize(Real a_normalVec[2]);
104 
105 private:
106  edgeMo m_edges[4]; //lexigraphic order:0Lo,0Hi,1Lo,1Hi,2Ho,2Hi
107 
109 
110  bool m_covered;
111  bool m_regular;
113 
118 
119  // disallowed for all the usual reasons
120  void operator=(const faceMo& a_input)
121  {
122  MayDay::Abort("invalid operator");
123  };
124 
125  // disallowed for all the usual reasons
126  faceMo(const faceMo& a_input)
127  {
128  MayDay::Abort("invalid operator");
129  };
130 };
131 
132 /////////////////////////////////class vofMo////////////////////////////////////
133 class vofMo
134 {
135 public:
137  {
138  }
139 
140  void define(const faceMo a_faces[6]);
141 
142  void makeNormal();
143  void setNormal(Real a_normalVec[3]);
144  void getNormal(Real a_normalVec[3]) const;
145  void normalize(Real a_normalVec[3]);
146 
147  void getFaces(faceMo a_faces[6]) const;
148 
149  Real getBdArea() const;
150 
151 private:
153 
156 };
157 
158 //////////////////////classMoments//////////////////////////////////////
159 class Moments
160 {
161 public:
162  Moments();
163 
164  Vector<Real> momentCalc3D(const int& a_order,
165  vofMo& a_vof);
166 
167  Vector<Real> momentCalc2D(const int& a_order,
168  const faceMo& a_face);
169 
170  void listOfMoments(const int& a_order,
171  Vector<IntVect>& a_exponents);
172 
173  void makeMatrix(const Vector<IntVect>& a_list,
174  const Vector<IntVect>& a_listPlus,
175  const Vector<Real>& a_normalVec,
176  Real** a_A,
177  const int& a_faceNormal=999
178  ); //use default faceNormal for 3D matrix or when SpaceDim==2
179 };
180 
181 #include "NamespaceFooter.H"
182 #endif
faceMo(const faceMo &a_input)
Definition: Moments.H:126
bool m_covered
Definition: Moments.H:110
bool m_regular
Definition: Moments.H:111
bool m_dontKnow
Definition: Moments.H:67
Definition: Moments.H:159
bool m_regular
Definition: Moments.H:66
Real m_areaFrac
Definition: Moments.H:115
RealVect m_Hi
Definition: Moments.H:58
void makeNormal()
void makeMatrix(const Vector< IntVect > &a_list, const Vector< IntVect > &a_listPlus, const Vector< Real > &a_normalVec, Real **a_A, const int &a_faceNormal=999)
Definition: Moments.H:24
RealVect m_Lo
Definition: Moments.H:57
vofMo()
Definition: Moments.H:136
RealVect getHi() const
Real m_normalVec[2]
Definition: Moments.H:108
void getNormal(Real a_normalVec[3]) const
void define(const RealVect &a_loPt, const RealVect &a_hiPt, const bool &a_intersectLo, const int &a_direction, const bool &a_covered, const bool &a_regular, const bool &a_dontKnow)
Real getBdArea() const
Real getBdLength() const
int m_varOfInt
Definition: Moments.H:69
bool isCovered() const
void listOfMoments(const int &a_order, Vector< IntVect > &a_exponents)
Definition: Moments.H:133
Real m_bdLength
Definition: Moments.H:117
faceMo()
Definition: Moments.H:76
void setNormal(Real a_normalVec[3])
bool isRegular() const
Real getFaceArea() const
bool m_dontKnow
Definition: Moments.H:112
Vector< Real > momentCalc2D(const int &a_order, const faceMo &a_face)
bool isRegular() const
void makeNormal()
edgeMo retrieveEdge(int &a_iEdge) const
edgeMo()
Definition: Moments.H:27
edgeMo m_edges[4]
Definition: Moments.H:106
faceMo m_faces[6]
Definition: Moments.H:152
double Real
Definition: REAL.H:33
bool getIntersectLo() const
Definition: Moments.H:73
void operator=(const faceMo &a_input)
Definition: Moments.H:120
void getEdges(edgeMo a_Edges[4]) const
bool dontKnow() const
Real m_edgeLength
Definition: Moments.H:62
RealVect getEdgeCentroid() const
void setFaceCentroid(const RealVect &a_centroid)
void define(const faceMo a_faces[6])
void define(const edgeMo a_edges[4], const int &a_faceNormal, const bool &a_covered, const bool &a_regular, const bool &a_dontKnow)
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
RealVect m_edgeCentroid
Definition: Moments.H:63
bool isCovered() const
RealVect m_centroid
Definition: Moments.H:114
RealVect getFaceCentroid() const
int m_faceNormal
Definition: Moments.H:116
bool m_intersectLo
Definition: Moments.H:60
void setFaceArea(const Real &a_area)
int getFaceNormal() const
Real getEdgeLength() const
bool dontKnow() const
void getNormal(Real a_normal[2]) const
void getFaces(faceMo a_faces[6]) const
void normalize(Real a_normalVec[3])
Vector< Real > momentCalc3D(const int &a_order, vofMo &a_vof)
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
bool m_covered
Definition: Moments.H:65
void normalize(Real a_normalVec[2])
Real moment(const IntVect &a_exponent) const
integrate monomial
RealVect getLo() const
access member data
Real m_bdArea
Definition: Moments.H:155
Real m_normalVec[3]
Definition: Moments.H:154
int direction() const
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).