Chombo + EB  3.0
ReductionOps.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 _REDUCTIONOPS_H_
12 #define _REDUCTIONOPS_H_
13 
14 #include "BoxLayoutData.H"
15 #include "FArrayBox.H"
16 #include "FluxBox.H"
17 
18 #include "NamespaceHeader.H"
19 
20 
21 /// Class to do summing operation in the context of CopyTo
22 /**
23  This class will perform a summing operation of the data in src
24  in the summingDir direction(s), multiplying by the scale, and placing
25  the sum in the corresponding location in dest
26 */
27 
28 class SumOp : public LDOperator<FArrayBox>
29 {
30 public:
33  SumOp();
34 
35  // single-direction
36  SumOp(int a_summingDir);
37 
38  // allows for a multidimensional reduction
39  SumOp(const Vector<int>& a_summingDir);
40 
41  virtual void linearOut(const FArrayBox& arg, void* buf, const Box& R,
42  const Interval& comps) const;
43 
44  virtual void linearIn(FArrayBox& arg, void* buf, const Box& R,
45  const Interval& comps) const;
46  void op(FArrayBox& dest,
47  const Box& RegionFrom,
48  const Interval& Cdest,
49  const Box& RegionTo,
50  const FArrayBox& src,
51  const Interval& Csrc) const;
52 
53 };
54 
55 // (DFM 11/13/08) as currently implemented, FaceSumOp doesn't
56 // do the right thing for multiple adjoining grids -- it will
57 // double-count overlying faces where boxes adjoin. Since we don't
58 // actually need the face-centered summing operator at the moment,
59 // take the cowardly path of just commenting it out to revisit if it
60 // becomes a needed member of the Chombo family
61 
62 #if 0
63 class FaceSumOp : public LDOperator<FluxBox>
64 {
65 public:
66  Real scale;
67  int m_summingDir;
68  FaceSumOp();
69 
70  FaceSumOp(int a_summingDir);
71 
72  virtual void linearOut(const FluxBox& arg, void* buf, const Box& R,
73  const Interval& comps) const;
74 
75  virtual void linearIn(FluxBox& arg, void* buf, const Box& R,
76  const Interval& comps) const;
77  void op(FluxBox& dest,
78  const Box& RegionFrom,
79  const Interval& Cdest,
80  const Box& RegionTo,
81  const FluxBox& src,
82  const Interval& Csrc) const;
83 
84 };
85 
86 #endif
87 
88 /// Class to do spreading operation in the context of CopyTo
89 /**
90  This class will perform a spreading operation of the data in src
91  along the summingDir direction(s), multiplying by the scale, and placing
92  the src values in the corresponding locations in dest.
93 */
94 
95 class SpreadingOp : public LDOperator<FArrayBox>
96 {
97 public:
100  SpreadingOp();
101 
102  // single spreading direction
103  SpreadingOp(int a_spreadingDir);
104 
105  SpreadingOp(const Vector<int>& a_spreadingDir);
106 
107  virtual void linearIn(FArrayBox& arg, void* buf, const Box& R,
108  const Interval& comps) const;
109  void op(FArrayBox& dest,
110  const Box& RegionFrom,
111  const Interval& Cdest,
112  const Box& RegionTo,
113  const FArrayBox& src,
114  const Interval& Csrc) const;
115 
116 
117  void applyOp(FArrayBox& dest,
118  const Box& RegionFrom,
119  const Interval& Cdest,
120  const Box& RegionTo,
121  const FArrayBox& src,
122  const Interval& Csrc,
123  Real a_scale) const;
124 
125 };
126 
127 
128 /// Class to do spreading operation in the context of CopyTo
129 /**
130  This class will perform a spreading operation of the data in src
131  along the summingDir direction(s), multiplying by the scale, and placing
132  the src values in the corresponding locations in dest.
133 */
134 
135 class FaceSpreadingOp : public LDOperator<FluxBox>
136 {
137 public:
140  FaceSpreadingOp();
141 
142  // single spreading direction
143  FaceSpreadingOp(int a_spreadingDir);
144 
145  // allows for multiple directions
146  FaceSpreadingOp(const Vector<int>& a_spreadingDir);
147 
148  virtual void linearIn(FluxBox& arg, void* buf, const Box& R,
149  const Interval& comps) const;
150  void op(FluxBox& dest,
151  const Box& RegionFrom,
152  const Interval& Cdest,
153  const Box& RegionTo,
154  const FluxBox& src,
155  const Interval& Csrc) const;
156 
157 
158  void applyOp(FluxBox& dest,
159  const Box& RegionFrom,
160  const Interval& Cdest,
161  const Box& RegionTo,
162  const FluxBox& src,
163  const Interval& Csrc,
164  Real a_scale) const;
165 
166 };
167 
168 
169 
170 
171 
172 
173 #include "NamespaceFooter.H"
174 
175 #endif
virtual void linearIn(FArrayBox &arg, void *buf, const Box &R, const Interval &comps) const
Vector< int > m_spreadingDir
Definition: ReductionOps.H:99
Vector< int > m_spreadingDir
Definition: ReductionOps.H:139
Vector< int > m_summingDir
Definition: ReductionOps.H:32
void op(FArrayBox &dest, const Box &RegionFrom, const Interval &Cdest, const Box &RegionTo, const FArrayBox &src, const Interval &Csrc) const
Real scale
Definition: ReductionOps.H:98
Class to do spreading operation in the context of CopyTo.
Definition: ReductionOps.H:95
A FArrayBox-like container for face-centered fluxes.
Definition: FluxBox.H:22
Structure for passing component ranges in code.
Definition: Interval.H:23
double Real
Definition: REAL.H:33
Real scale
Definition: ReductionOps.H:31
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
Definition: FArrayBox.H:44
Class to do summing operation in the context of CopyTo.
Definition: ReductionOps.H:28
Definition: BoxLayoutData.H:139
Real scale
Definition: ReductionOps.H:138
virtual void linearOut(const FArrayBox &arg, void *buf, const Box &R, const Interval &comps) const
Class to do spreading operation in the context of CopyTo.
Definition: ReductionOps.H:135