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