Overture
Version 25
Main Page
Namespaces
Classes
Files
File List
File Members
Overture.v25.d
include
InterpolatePointsOnAGrid.h
Go to the documentation of this file.
1
#ifndef INTERPOLATE_POINTS_ONAGRID_H
2
#define INTERPOLATE_POINTS_ONAGRID_H
3
4
// -----------------------------------------------------------------------------
5
// This class can be used to interpolate arbitrary points on a Composite grid.
6
// *new* parallel version
7
// -----------------------------------------------------------------------------
8
9
// class ParallelOverlappingGridInterpolatePoints; // forward declaration
10
11
#include "
SparseArray.h
"
12
// class SparseArray; // forward declaration
13
14
class
InterpolatePointsOnAGrid
15
{
16
public
:
17
18
enum
InterpolationStatusEnum
19
{
20
notInterpolated
=0,
21
extrapolated
=1,
22
interpolated
=2
23
};
24
25
enum
26
{
27
defaultNumberOfValidGhostPoints
=-123456,
28
interpolateAllGhostPoints
=-234567
29
};
30
31
enum
ExplicitInterpolationStorageOptionEnum
32
{
33
precomputeAllCoefficients
,
// requires w^d coefficients per interp pt (w=width of interp stencil)
34
precomputeSomeCoefficients
,
// requires w*d coefficients per interp pt (d=dimension, 1,2, or 3)
35
precomputeNoCoefficients
// requires d coefficients per interp point
36
};
37
38
39
enum
InterpolationTypeEnum
40
{
41
implicitInterpolation
=0,
42
explicitInterpolation
43
};
44
45
46
InterpolatePointsOnAGrid
();
47
~InterpolatePointsOnAGrid
();
48
49
// This function will find the nearest valid (mask!=0) grid point on a CompositeGrid
50
static
int
findNearestValidGridPoint
(
CompositeGrid
& cg,
const
RealArray
& x,
IntegerArray
& il,
RealArray
& ci );
51
52
int
getMaximumRefinementLevelToInterpolate
()
const
;
53
54
// These functions return info about the last interpolation operation
55
int
getNumberBackupInterpolation
()
const
;
56
int
getNumberExtrapolated
()
const
;
57
int
getNumberInterpolated
()
const
;
58
int
getNumberUnassigned
()
const
;
59
60
61
// Utility function to compute the lower left index in the interpolation stencil
62
static
int
getInterpolationStencil
(
MappedGrid
& mg,
const
int
width,
const
real
*rv,
int
*iv );
63
64
// return the total number of points that are assigned from a grid
65
int
getTotalNumberOfPointsAssigned
(
int
grid );
66
67
// Interpolate points : The first time this function is called the interpolation schedule will be generated.
68
int
interpolatePoints
(
const
RealArray
& positionToInterpolate,
69
const
realCompositeGridFunction
& u,
70
RealArray
& uInterpolated,
71
const
Range & R0=
nullRange
,
72
const
Range & R1=
nullRange
,
73
const
Range & R2=
nullRange
,
74
const
Range & R3=
nullRange
,
75
const
Range & R4=
nullRange
);
76
77
int
interpolationCoefficients
(
const
CompositeGrid
&cg,
78
RealArray
& uInterpolationCoeff);
79
80
int
interpolateAllPoints
(
const
realCompositeGridFunction
& uFrom,
81
realCompositeGridFunction
& uTo,
82
const
Range & componentsFrom=
nullRange
,
83
const
Range & componentsTo=
nullRange
,
84
const
int
numberOfGhostPointsToInterpolate=
interpolateAllGhostPoints
);
85
86
int
interpolateAllPoints
(
const
realCompositeGridFunction
& uFrom,
87
realMappedGridFunction
& uTo,
88
const
Range & componentsFrom=
nullRange
,
89
const
Range & componentsTo=
nullRange
,
90
const
int
numberOfGhostPointsToInterpolate=
interpolateAllGhostPoints
);
91
92
93
// Here is a way to interpolate in two steps, this will save the interpolation info
94
int
buildInterpolationInfo
(
const
RealArray
& positionToInterpolate,
CompositeGrid
& cg,
95
RealArray
*projectedPoints=
NULL
,
96
IntegerArray
*checkTheseGrids=
NULL
);
97
int
interpolatePoints
(
const
realCompositeGridFunction
& u,
98
RealArray
& uInterpolated,
99
const
Range & R0=
nullRange
,
100
const
Range & R1=
nullRange
,
101
const
Range & R2=
nullRange
,
102
const
Range & R3=
nullRange
,
103
const
Range & R4=
nullRange
);
104
105
// return the status array for the last interpolation.
106
const
IntegerArray
&
getStatus
()
const
;
107
108
// return the index values and interpoleeGrid for the last interpolation.
109
int
getInterpolationInfo
(
CompositeGrid
& cg,
IntegerArray
& indexValues,
IntegerArray
& interpoleeGrid)
const
;
110
111
// Indicate whether all points should be assigned, using extrapolation if necessary
112
int
setAssignAllPoints
(
bool
trueOrFalse=
true
);
113
114
// return size of this object
115
real
sizeOf
(FILE *file =
NULL
)
const
;
116
117
int
setExplicitInterpolationStorageOption
(
ExplicitInterpolationStorageOptionEnum
option);
118
119
// flag for specfying what information messages should be printed:
120
int
setInfoLevel
(
int
info );
121
122
// Set the width the interpolation stencil.
123
int
setInterpolationWidth
(
int
width );
124
125
// Set the offset in grid lines from the unit cube where we are allowed to interpolate
126
int
setInterpolationOffset
(
real
widthInGridLines );
127
128
// Specify whether to use implicit or explicit interpolation
129
int
setInterpolationType
(
InterpolationTypeEnum
interpType );
130
131
int
setMaximumRefinementLevelToInterpolate
(
int
maxLevelToInterpolate );
132
133
// Set the number of valid ghost points that can be used when interpolating from a grid function
134
int
setNumberOfValidGhostPoints
(
int
numValidGhost=
defaultNumberOfValidGhostPoints
);
135
136
static
int
debug
;
137
138
protected
:
139
140
friend
class
InterfaceTransfer
;
141
142
int
parallelInterpolate
(
RealArray
& ui,
// save results here
143
const
realCompositeGridFunction
& u,
// interpolate from this grid function.
144
const
Range & C0 =
nullRange
,
// optionally specify components to interpolate
145
const
Range & C1 =
nullRange
,
146
const
Range & C2 =
nullRange
);
147
148
// Setup routine that creates the parallel communication schedule for interpolation a list of points
149
int
parallelSetup
(
CompositeGrid
& cg,
150
const
RealArray
& xp,
151
const
IntegerArray
&
numberOfInterpolationPoints
,
152
const
RealArray
*
interpolationCoordinates
,
153
const
IntegerArray
*
indirection
,
154
const
IntegerArray
*
interpolationLocation
,
155
const
IntegerArray
*
variableInterpolationWidth
);
156
157
int
interpolationIsInitialized
;
// this is set to true when the interpolation has been initialized.
158
159
int
numberOfBackupInterpolation
;
160
int
numberOfExtrapolated
;
161
int
numberOfInterpolated
;
162
int
numberOfUnassigned
;
163
164
IntegerArray
*
indirection
;
165
IntegerArray
*
interpolationLocation
;
166
IntegerArray
*
variableInterpolationWidth
;
167
RealArray
*
interpolationCoordinates
;
168
169
IntegerArray
numberOfInterpolationPoints
;
170
IntegerArray
status
;
171
172
real
interpolationOffset
;
// offset in grid lines from the unit cube where we are allowed to interpolate
173
174
int
interpolationWidth
;
// width of the interpolation stencil.
175
InterpolationTypeEnum
interpolationType
;
// explicit or implicit interpolation
176
int
infoLevel
;
// flag for specifying what information messages should be printed.
177
int
numberOfValidGhostPoints
;
178
179
bool
assignAllPoints
;
// if true assign all points using extrapolation if necessary
180
181
// For interpolateAll:
182
int
totalNumToInterpolate
;
183
IntegerArray
*
pInterpAllIndirection
;
184
int
*
numToInterpolatePerGrid
;
185
186
// ParallelOverlappingGridInterpolatePoints *pogip; // for parallel interpolation of points
187
188
189
FILE *
logFile
,*
plogFile
;
// log file to save info for users (plogFile = log file for a given processor)
190
191
// -- replace the next by plogFile:
192
FILE *
debugFile
;
193
194
ExplicitInterpolationStorageOptionEnum
explicitInterpolationStorageOption
;
195
196
int
initializeExplicitInterpolation
(
CompositeGrid
& cg);
197
198
// Here is the routine that actually performs the interpolation in serial
199
int
internalInterpolate
(
RealArray
& ui,
// save results here
200
const
realCompositeGridFunction
& u,
// interpolate from this grid function.
201
const
Range & C0,
202
const
Range & C1,
203
const
Range & C2 );
204
205
// Here is the routine that actually performs the interpolation in parallel
206
int
parallelInternalInterpolate
(
RealArray
& ui,
// save results here
207
const
realCompositeGridFunction
& u,
// interpolate from this grid function.
208
const
Range & C0,
209
const
Range & C1,
210
const
Range & C2 );
211
212
// destroy all data
213
int
destroy
();
214
215
// put this here for now:
216
// static int checkCanInterpolate(CompositeGrid & cg ,
217
// int grid, int donor, RealArray & r, IntegerArray & interpolates,
218
// IntegerArray & useBackupRules );
219
220
int
numberOfDimensions
,
numberOfComponentGrids
,
numberOfBaseGrids
;
221
int
maxInterpolationWidth
;
222
int
coeffWidthDimension
;
// dimension of the 2nd component of coeff
223
int
maximumRefinementLevelToInterpolate
;
224
225
// Store interp data in sparse arrays:
226
SparseArray<int>
nila
,
nipa
;
227
SparseArray<int*>
ila
,
ipa
;
228
SparseArray<real*>
cia
,
coeffa
;
229
230
int
npr
,
nps
;
231
int
*
pMapr
, *
pMaps
;
232
233
bool
allGridsHaveLocalData
,
onlyAmrGridsHaveLocalData
,
noGridsHaveLocalData
;
234
235
#ifdef USE_PPP
236
MPI_Comm
POGI_COMM
;
// Communicator for the parallel interpolator
237
#else
238
int
POGI_COMM
;
239
#endif
240
241
};
242
243
#endif
Generated on Fri Jan 4 2013 10:17:54 for Overture by
1.8.3