Chombo + EB + MF  3.2
MBMiscUtil.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 _MBMISCUTIL_H_
12 #define _MBMISCUTIL_H_
13 
14 #include "FArrayBox.H"
15 #include "LevelData.H"
16 #include "RealVect.H"
17 
18 #include "NamespaceHeader.H"
19 
20 /// return a_inputBox intersected with a version of a_domainBox extended indefinitely below if offset is -1 and above if offset is +1
21 Box intersectOffset(const Box& a_inputBox,
22  const Box& a_domainBox,
23  const IntVect& a_offset);
24 
25 ///
26 /**
27  Returns dx * gradient of a_dataFab, using a second-order formula.
28  Takes data in a_dataFab available on a_dataBox
29  and returns dx * gradient in a_gradFab on a_gradBox.
30 
31  Order of components within a_gradFab, with 2D vector data:
32  difference in data[0] in direction 0;
33  difference in data[1] in direction 0;
34  difference in data[0] in direction 1;
35  difference in data[1] in direction 1.
36 
37  That is: dData[0]/dx[0], dData[1]/dx[0], dData[0]/dx[1], dData[1]/dx[1].
38  */
39 void order2gradient(FArrayBox& a_gradFab,
40  const Box& a_gradBox,
41  const FArrayBox& a_dataFab,
42  const Box& a_dataBox,
43  const Vector<int>& a_interpDimsVect);
44 
45 /// returns a_gradData = gradient(a_data) on wherever a_data is defined minus 1 layer
46 void order2gradient(LevelData<FArrayBox>& a_gradData,
47  const LevelData<FArrayBox>& a_data,
48  Vector<int> a_interpDimsVect);
49 
50 /// returns the dimension of the faces of a_box; crashes if not on faces of codimension 1
51 int faceDimension(const Box& a_box);
52 
53 /// returns the faces of a_gridBox that are on the (a_idir, a_side) face of a_blockBox
54 Box faceSlice(const Box& a_gridBox,
55  int a_idir,
56  Side::LoHiSide a_side,
57  const Box& a_blockBox);
58 
59 /// component d of return value is a_dxVect[d]/2 if a_box is cell-centered in dimension d, and 0 if node-centered in dimension d. For a d-face-centered box, returns 0 in dimension d, and a_dxVect/2 in other dimensions.
60 RealVect centeringOffset(const Box& a_box,
61  const RealVect& a_dxVect);
62 
63 /// convert Vector<RealVect> to Vector<Real>
65 
66 /// convert Vector<Real> to Vector<RealVect>
68 
69 /// change a_bx to its minBox across all processors
70 void minBoxGlobal(Box& a_bx);
71 
72 int minBufferSizeAMR(const Vector<int>& a_refRatio,
73  int a_maxLevel,
74  int a_numGhost,
75  int a_order = 4,
76  bool a_fromJU = true);
77 
78 /// returns ceil(a_num / a_denom)
79 int ceilRatio(int a_num,
80  int a_denom);
81 
82 /// returns ceil(a_num / a_denom) component by component
83 IntVect ceilRatio(const IntVect& a_num,
84  const IntVect& a_denom);
85 
86 Real dotSubvectors(const Vector<Real>& a_vec1,
87  int a_start1,
88  const Vector<Real>& a_vec2,
89  int a_start2,
90  int a_length);
91 
92 void addPowersPoint(Vector<Real>& a_powers,
93  const RealVect& a_x,
94  const Vector<IntVect>& a_exponents,
95  Real a_weight);
96 
97 void addPowersVector(Vector<Real>& a_powers,
98  const RealVect& a_x,
99  const Vector<IntVect>& a_exponents,
100  Real a_weight,
101  const Real* const a_vecTransform);
102 
103 #include "NamespaceFooter.H"
104 
105 #endif
void addPowersPoint(Vector< Real > &a_powers, const RealVect &a_x, const Vector< IntVect > &a_exponents, Real a_weight)
void addPowersVector(Vector< Real > &a_powers, const RealVect &a_x, const Vector< IntVect > &a_exponents, Real a_weight, const Real *const a_vecTransform)
Real dotSubvectors(const Vector< Real > &a_vec1, int a_start1, const Vector< Real > &a_vec2, int a_start2, int a_length)
Vector< Real > VectorRealVectToReal(const Vector< RealVect > &a_rv)
convert Vector<RealVect> to Vector<Real>
int ceilRatio(int a_num, int a_denom)
returns ceil(a_num / a_denom)
void minBoxGlobal(Box &a_bx)
change a_bx to its minBox across all processors
Vector< RealVect > VectorRealToRealVect(const Vector< Real > &a_r)
convert Vector<Real> to Vector<RealVect>
void order2gradient(FArrayBox &a_gradFab, const Box &a_gradBox, const FArrayBox &a_dataFab, const Box &a_dataBox, const Vector< int > &a_interpDimsVect)
double Real
Definition: REAL.H:33
RealVect centeringOffset(const Box &a_box, const RealVect &a_dxVect)
component d of return value is a_dxVect[d]/2 if a_box is cell-centered in dimension d...
Box intersectOffset(const Box &a_inputBox, const Box &a_domainBox, const IntVect &a_offset)
return a_inputBox intersected with a version of a_domainBox extended indefinitely below if offset is ...
LoHiSide
Definition: LoHiSide.H:27
int minBufferSizeAMR(const Vector< int > &a_refRatio, int a_maxLevel, int a_numGhost, int a_order=4, bool a_fromJU=true)
Box faceSlice(const Box &a_gridBox, int a_idir, Side::LoHiSide a_side, const Box &a_blockBox)
returns the faces of a_gridBox that are on the (a_idir, a_side) face of a_blockBox ...
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: FArrayBox.H:45
int faceDimension(const Box &a_box)
returns the dimension of the faces of a_box; crashes if not on faces of codimension 1 ...