Chombo + EB
3.0
src
BoxTools
ReductionCopier.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 _REDUCTIONCOPIER_H_
12
#define _REDUCTIONCOPIER_H_
13
14
15
#include "
DisjointBoxLayout.H
"
16
#include "
Pool.H
"
17
#include "
Vector.H
"
18
#include "
ProblemDomain.H
"
19
#include "
Copier.H
"
20
#include "NamespaceHeader.H"
21
22
/// Specialized copier for doing reductions in dimensionality
23
/**
24
This is a specialized Copier designed to copy from a multi-dimensional
25
DisjointBoxLayout to a smaller-dimensional one by copying all of the
26
data in the transverse direction to the destination boxLayout. It is
27
assumed that this will be used with a different sort of operator (like
28
a summation operator, for example), since a straight copy operation
29
wouldn't make much sense. Anyway, this just defines the intersection
30
regions; what you do with them is your problem.
31
32
Note also that both the Spreading and Reduction Copiers ignore periodicity,
33
since it can lead to unintended side-effects and multiple-counting of data.
34
The way to handle periodicity is to do an exchange on the source data before
35
calling the copyTo which does the reduction.
36
*/
37
38
class
ReductionCopier
:
public
Copier
39
{
40
public
:
41
42
///null constructor, copy constructor and operator= can be compiler defined.
43
ReductionCopier
()
44
{}
45
46
///
47
ReductionCopier
(
const
DisjointBoxLayout
& a_level,
const
BoxLayout
& a_dest,
48
int
a_transverseDir,
bool
a_exchange =
false
);
49
50
/// this constructor contains support for periodic BC's
51
ReductionCopier
(
const
DisjointBoxLayout
& a_level,
const
BoxLayout
& a_dest,
52
const
ProblemDomain
& a_domain,
53
int
a_transverseDir,
54
bool
a_exchange =
false
);
55
56
/// Copier to copy data into the valid and invalid regions of a_dest from a_level
57
ReductionCopier
(
const
DisjointBoxLayout
& a_level,
58
const
BoxLayout
& a_dest,
59
const
IntVect
& a_destGhost,
60
int
a_transverseDir,
61
bool
a_exchange =
false
);
62
63
/// Copier to copy data into the valid and invalid regions of a_dest from a_level with support for periodic BCs
64
ReductionCopier
(
const
DisjointBoxLayout
& a_level,
65
const
BoxLayout
& a_dest,
66
const
ProblemDomain
& a_domain,
67
const
IntVect
& a_destGhost,
68
int
a_transverseDir,
69
bool
a_exchange =
false
);
70
71
///
72
ReductionCopier
(
const
DisjointBoxLayout
& a_level,
const
BoxLayout
& a_dest,
73
const
Vector<int>
& a_transverseDir,
bool
a_exchange =
false
);
74
75
/// this constructor contains support for periodic BC's
76
ReductionCopier
(
const
DisjointBoxLayout
& a_level,
const
BoxLayout
& a_dest,
77
const
ProblemDomain
& a_domain,
78
const
Vector<int>
& a_transverseDir,
79
bool
a_exchange =
false
);
80
81
/// Copier to copy data into the valid and invalid regions of a_dest from a_level
82
ReductionCopier
(
const
DisjointBoxLayout
& a_level,
83
const
BoxLayout
& a_dest,
84
const
IntVect
& a_destGhost,
85
const
Vector<int>
& a_transverseDir,
86
bool
a_exchange =
false
);
87
88
/// Copier to copy data into the valid and invalid regions of a_dest from a_level with support for periodic BCs
89
ReductionCopier
(
const
DisjointBoxLayout
& a_level,
90
const
BoxLayout
& a_dest,
91
const
ProblemDomain
& a_domain,
92
const
IntVect
& a_destGhost,
93
const
Vector<int>
& a_transverseDir,
94
bool
a_exchange =
false
);
95
96
///
97
virtual
~ReductionCopier
();
98
99
///
100
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
101
const
BoxLayout
& a_dest,
102
int
a_transverseDir,
103
bool
a_exchange =
false
);
104
105
/// contains support for periodic BCs
106
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
107
const
BoxLayout
& a_dest,
108
const
ProblemDomain
& a_domain,
109
int
a_transverseDir,
110
bool
a_exchange =
false
);
111
112
///
113
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
114
const
BoxLayout
& a_dest,
115
const
IntVect
& a_destGhost,
116
int
a_transverseDir,
117
bool
a_exchange =
false
);
118
119
/// contains support for periodic BCs
120
virtual
void
define
(
const
BoxLayout
& a_level,
121
const
BoxLayout
& a_dest,
122
const
ProblemDomain
& a_domain,
123
const
IntVect
& a_destGhost,
124
int
a_transverseDir,
125
bool
a_exchange =
false
);
126
127
///
128
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
129
const
BoxLayout
& a_dest,
130
const
Vector<int>
& a_transverseDir,
131
bool
a_exchange =
false
);
132
133
/// contains support for periodic BCs
134
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
135
const
BoxLayout
& a_dest,
136
const
ProblemDomain
& a_domain,
137
const
Vector<int>
& a_transverseDir,
138
bool
a_exchange =
false
);
139
140
///
141
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
142
const
BoxLayout
& a_dest,
143
const
IntVect
& a_destGhost,
144
const
Vector<int>
& a_transverseDir,
145
bool
a_exchange =
false
);
146
147
/// contains support for periodic BCs
148
virtual
void
define
(
const
BoxLayout
& a_level,
149
const
BoxLayout
& a_dest,
150
const
ProblemDomain
& a_domain,
151
const
IntVect
& a_destGhost,
152
const
Vector<int>
& a_transverseDir,
153
bool
a_exchange =
false
);
154
155
/// reverse the direction of copy for an already-defined ReductionCopier
156
/**
157
This function simply replaces the from data with the to-data for
158
the already-defined copy operation.
159
For now, this function heads right into a MayDay::Error, since what
160
you probably want is to use a SpreadingCopier rather than a reversed
161
ReductionCopier
162
*/
163
void
reverse
();
164
165
166
/// check that this Copier object corresponds to these two BoxLayouts.
167
bool
check
(
const
DisjointBoxLayout
& from,
const
BoxLayout
& to)
const
;
168
169
int
print
()
const
;
170
171
172
protected
:
173
174
friend
class
CopyIterator
;
175
176
friend
void
dumpmemoryatexit
();
177
178
private
:
179
180
// no really good reason to keep this, except for completeness...
181
Vector<int>
m_transverseDir
;
182
183
};
184
185
186
//===========================================================================
187
// end of public interface for ReductionCopier.
188
//===========================================================================
189
190
191
#include "NamespaceFooter.H"
192
193
#endif
Copier.H
ProblemDomain
A class to facilitate interaction with physical boundary conditions.
Definition:
ProblemDomain.H:130
Pool.H
BoxLayout
A not-necessarily-disjoint collective of boxes.
Definition:
BoxLayout.H:146
Vector< int >
Copier
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition:
Copier.H:137
DisjointBoxLayout.H
ReductionCopier::print
int print() const
ReductionCopier::ReductionCopier
ReductionCopier()
null constructor, copy constructor and operator= can be compiler defined.
Definition:
ReductionCopier.H:43
ProblemDomain.H
DisjointBoxLayout
A BoxLayout that has a concept of disjointedness.
Definition:
DisjointBoxLayout.H:31
ReductionCopier::define
virtual void define(const DisjointBoxLayout &a_level, const BoxLayout &a_dest, int a_transverseDir, bool a_exchange=false)
ReductionCopier::dumpmemoryatexit
friend void dumpmemoryatexit()
ReductionCopier::m_transverseDir
Vector< int > m_transverseDir
Definition:
ReductionCopier.H:181
ReductionCopier::reverse
void reverse()
reverse the direction of copy for an already-defined ReductionCopier
ReductionCopier::check
bool check(const DisjointBoxLayout &from, const BoxLayout &to) const
check that this Copier object corresponds to these two BoxLayouts.
Vector.H
IntVect
An integer Vector in SpaceDim-dimensional space.
Definition:
CHArray.H:42
ReductionCopier::~ReductionCopier
virtual ~ReductionCopier()
ReductionCopier
Specialized copier for doing reductions in dimensionality.
Definition:
ReductionCopier.H:38
CopyIterator
Definition:
Copier.H:335
Generated by
1.8.13