Overture
Version 25
Main Page
Namespaces
Classes
Files
File List
File Members
Overture.v25.d
include
ParallelOverlappingGridInterpolator.h
Go to the documentation of this file.
1
#ifndef ParallelOverlappingGridInterpolator_h
2
#define ParallelOverlappingGridInterpolator_h
3
4
#include "
Overture.h
"
5
#include "A++.h"
6
#include "
OvertureDefine.h
"
7
8
#include "
SparseArray.h
"
9
10
#ifndef OV_USE_DOUBLE
11
// typedef float real;
12
// typedef floatArray realArray;
13
// typedef floatSerialArray realSerialArray;
14
// #define MPI_Real MPI_FLOAT
15
#else
16
// typedef double real;
17
// typedef doubleArray realArray;
18
// typedef doubleSerialArray realSerialArray;
19
// #define MPI_Real MPI_DOUBLE
20
#endif
21
22
#ifndef _CompositeGrid
23
class
realCompositeGridFunction
;
// forward declaration
24
#endif
25
26
27
class
ParallelOverlappingGridInterpolator
28
{
29
public
:
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
ParallelOverlappingGridInterpolator
();
39
~ParallelOverlappingGridInterpolator
();
40
41
42
// turn on or off the computation of the residual (for implicit interpolation)
43
void
turnOnResidualComputation
(
const
bool
trueOrFalse=
true
);
44
45
int
getMaximumRefinementLevelToInterpolate
()
const
;
46
47
// return the maximum residual from the last call to interpolate
48
real
getMaximumResidual
()
const
;
49
50
int
interpolate
(
realCompositeGridFunction
& u,
51
const
Range & C0 =
nullRange
,
// optionally specify components to interpolate
52
const
Range & C1 =
nullRange
,
53
const
Range & C2 =
nullRange
);
54
55
int
interpolate
(
int
gridToInterpolate,
// only interpolate this grid.
56
realCompositeGridFunction
& u,
57
const
Range & C0 =
nullRange
,
// optionally specify components to interpolate
58
const
Range & C1 =
nullRange
,
59
const
Range & C2 =
nullRange
);
60
61
int
interpolate
(
realCompositeGridFunction
& u,
62
const
IntegerArray
& gridsToInterpolate,
// specify which grids to interpolate
63
const
Range & C0 =
nullRange
,
// optionally specify components to interpolate
64
const
Range & C1 =
nullRange
,
65
const
Range & C2 =
nullRange
);
66
67
int
interpolate
(
realCompositeGridFunction
& u,
68
const
IntegerArray
& gridsToInterpolate,
// specify which grids to interpolate
69
const
IntegerArray
& gridsToInterpolateFrom,
// specify which grids to interpolate from
70
const
Range & C0 =
nullRange
,
// optionally specify components to interpolate
71
const
Range & C1 =
nullRange
,
72
const
Range & C2 =
nullRange
);
73
74
int
interpolate
(
realArray
& ui,
// save results here
75
int
gridToInterpolate,
// only interpolate values on this grid that
76
int
interpoleeGrid
,
// interpolate from this grid.
77
realCompositeGridFunction
& u,
78
const
Range & C0 =
nullRange
,
// optionally specify components to interpolate
79
const
Range & C1 =
nullRange
,
80
const
Range & C2 =
nullRange
);
81
82
83
int
setExplicitInterpolationStorageOption
(
ExplicitInterpolationStorageOptionEnum
option);
84
85
int
setMaximumRefinementLevelToInterpolate
(
int
maxLevelToInterpolate );
86
87
int
setup
(
realCompositeGridFunction
& u );
88
89
int
setup
();
90
91
// return size of this object
92
real
sizeOf
(FILE *file =
NULL
)
const
;
93
94
int
updateToMatchGrid
(
CompositeGrid
& cg,
int
refinementLevel =0 );
95
int
updateToMatchGrid
(
realCompositeGridFunction
& u,
int
refinementLevel =0 );
96
97
98
// these next functions are for testing
99
100
int
bruteForceInterpolate
(
realCompositeGridFunction
& u );
101
102
real
computeError
();
103
104
int
resetSolution
();
105
106
static
int
debug
;
107
108
FILE *
debugFile
;
109
110
protected
:
111
ExplicitInterpolationStorageOptionEnum
explicitInterpolationStorageOption
;
112
113
int
initializeExplicitInterpolation
();
114
115
// Here is the routine that actually performs the interpolation
116
int
internalInterpolate
(
realCompositeGridFunction
& u,
117
const
Range & C0,
118
const
Range & C1,
119
const
Range & C2,
120
const
IntegerArray
*gridsToInterpolate =
NULL
,
// specify which grids to interpolate
121
const
IntegerArray
*gridsToInterpolateFrom =
NULL
);
122
123
// destroy all data
124
int
destroy
();
125
126
127
int
numberOfDimensions
,
numberOfComponentGrids
,
numberOfBaseGrids
;
128
intSerialArray
numberOfInterpolationPoints
;
129
intSerialArray *
interpolationPoint
, *
interpoleeLocation
, *
interpoleeGrid
, *
variableInterpolationWidth
;
130
realSerialArray
*
interpolationCoordinates
;
131
132
intSerialArray
numberOfInterpolationPointsPerDonor
,
interpolationStartEndIndex
;
133
// todo: SparseArray<int> numberOfInterpolationPointsPerDonor, interpolationStartEndIndex;
134
135
intSerialArray *
dimension
, *
indexRange
, *
isCellCentered
;
136
realSerialArray
*
gridSpacing
;
137
138
realArray
*
ucg
;
139
realArray
*
vcg
;
// for brute force solution
140
141
int
maxInterpolationWidth
;
142
int
coeffWidthDimension
;
// dimension of the 2nd component of coeff
143
int
maximumRefinementLevelToInterpolate
;
144
145
// Store interp data in sparse arrays:
146
SparseArray<int>
nila
,
nipa
;
147
SparseArray<int*>
ila
,
ipa
;
148
SparseArray<real*>
cia
,
coeffa
;
149
150
bool
computeResidual
;
151
real
maximumResidual
;
152
153
bool
allGridsHaveLocalData
,
onlyAmrGridsHaveLocalData
,
noGridsHaveLocalData
;
154
155
#ifdef USE_PPP
156
MPI_Comm
POGI_COMM
;
// Communicator for the parallel interpolator
157
#else
158
int
POGI_COMM
;
159
#endif
160
161
};
162
163
164
#endif
Generated on Fri Jan 4 2013 10:17:57 for Overture by
1.8.3