Chombo + EB
3.0
src
BoxTools
SpreadingCopier.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 _SPREADINGCOPIER_H_
12
#define _SPREADINGCOPIER_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 spreading of data in dimensionality
23
/**
24
This is a specialized Copier designed to copy from a smaller-dimensional
25
DisjointBoxLayout to a larger-dimensional one by copying all of the
26
data in the transverse direction across the destination boxLayout. It is
27
assumed that this will be used with a different sort of operator (like
28
a spreading 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 spreading.
36
*/
37
38
class
SpreadingCopier
:
public
Copier
39
{
40
public
:
41
42
///null constructor, copy constructor and operator= can be compiler defined.
43
SpreadingCopier
()
44
{}
45
46
/// a_level is the lower-dimensional DBL, dest is the higher-dimensional one
47
SpreadingCopier
(
const
DisjointBoxLayout
& a_level,
const
BoxLayout
& a_dest,
48
int
a_transverseDir,
bool
a_exchange =
false
);
49
50
/// Note that periodic BC's are meaningless for the spreading copier.
51
SpreadingCopier
(
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
SpreadingCopier
(
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
SpreadingCopier
(
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
SpreadingCopier
(
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
SpreadingCopier
(
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
SpreadingCopier
(
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
89
/** note that we ignore periodicity for the SpreadingCopier. Do an exchange
90
of the src data before the copyTo which uses this Copier */
91
SpreadingCopier
(
const
DisjointBoxLayout
& a_level,
92
const
BoxLayout
& a_dest,
93
const
ProblemDomain
& a_domain,
94
const
IntVect
& a_destGhost,
95
const
Vector<int>
& a_transverseDir,
96
bool
a_exchange =
false
);
97
98
///
99
virtual
~SpreadingCopier
();
100
101
///
102
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
103
const
BoxLayout
& a_dest,
104
int
a_transverseDir,
105
bool
a_exchange =
false
);
106
107
/// contains support for periodic BCs
108
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
109
const
BoxLayout
& a_dest,
110
const
ProblemDomain
& a_domain,
111
int
a_transverseDir,
112
bool
a_exchange =
false
);
113
114
///
115
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
116
const
BoxLayout
& a_dest,
117
const
IntVect
& a_destGhost,
118
int
a_transverseDir,
119
bool
a_exchange =
false
);
120
121
/// contains support for periodic BCs
122
virtual
void
define
(
const
BoxLayout
& a_level,
123
const
BoxLayout
& a_dest,
124
const
ProblemDomain
& a_domain,
125
const
IntVect
& a_destGhost,
126
int
a_transverseDir,
127
bool
a_exchange =
false
);
128
129
///
130
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
131
const
BoxLayout
& a_dest,
132
const
Vector<int>
& a_transverseDir,
133
bool
a_exchange =
false
);
134
135
/// contains support for periodic BCs
136
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
137
const
BoxLayout
& a_dest,
138
const
ProblemDomain
& a_domain,
139
const
Vector<int>
& a_transverseDir,
140
bool
a_exchange =
false
);
141
142
///
143
virtual
void
define
(
const
DisjointBoxLayout
& a_level,
144
const
BoxLayout
& a_dest,
145
const
IntVect
& a_destGhost,
146
const
Vector<int>
& a_transverseDir,
147
bool
a_exchange =
false
);
148
149
/// contains support for periodic BCs
150
virtual
void
define
(
const
BoxLayout
& a_level,
151
const
BoxLayout
& a_dest,
152
const
ProblemDomain
& a_domain,
153
const
IntVect
& a_destGhost,
154
const
Vector<int>
& a_transverseDir,
155
bool
a_exchange =
false
);
156
157
/// reverse the direction of copy for an already-defined SpreadingCopier
158
/**
159
This function simply replaces the from data with the to-data for
160
the already-defined copy operation.
161
For now, this function heads right into a MayDay::Error, since what
162
you probably want is to use a ReductionCopier rather than a reversed
163
SpreadingCopier
164
*/
165
void
reverse
();
166
167
168
/// check that this Copier object corresponds to these two BoxLayouts.
169
bool
check
(
const
DisjointBoxLayout
& from,
const
BoxLayout
& to)
const
;
170
171
int
print
()
const
;
172
173
174
protected
:
175
176
friend
class
CopyIterator
;
177
178
friend
void
dumpmemoryatexit
();
179
180
private
:
181
182
// no really good reason to keep this, except for completeness...
183
Vector<int>
m_transverseDir
;
184
185
};
186
187
188
//===========================================================================
189
// end of public interface for SpreadingCopier.
190
//===========================================================================
191
192
193
#include "NamespaceFooter.H"
194
195
#endif
Copier.H
SpreadingCopier::dumpmemoryatexit
friend void dumpmemoryatexit()
SpreadingCopier::SpreadingCopier
SpreadingCopier()
null constructor, copy constructor and operator= can be compiler defined.
Definition:
SpreadingCopier.H:43
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
SpreadingCopier::check
bool check(const DisjointBoxLayout &from, const BoxLayout &to) const
check that this Copier object corresponds to these two BoxLayouts.
SpreadingCopier::m_transverseDir
Vector< int > m_transverseDir
Definition:
SpreadingCopier.H:183
SpreadingCopier::print
int print() const
ProblemDomain.H
DisjointBoxLayout
A BoxLayout that has a concept of disjointedness.
Definition:
DisjointBoxLayout.H:31
SpreadingCopier::~SpreadingCopier
virtual ~SpreadingCopier()
Vector.H
IntVect
An integer Vector in SpaceDim-dimensional space.
Definition:
CHArray.H:42
SpreadingCopier::define
virtual void define(const DisjointBoxLayout &a_level, const BoxLayout &a_dest, int a_transverseDir, bool a_exchange=false)
SpreadingCopier
Specialized copier for doing spreading of data in dimensionality.
Definition:
SpreadingCopier.H:38
CopyIterator
Definition:
Copier.H:335
SpreadingCopier::reverse
void reverse()
reverse the direction of copy for an already-defined SpreadingCopier
Generated by
1.8.13