Overture  Version 25
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 
28 {
29  public:
30 
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 
40 
41 
42  // turn on or off the computation of the residual (for implicit interpolation)
43  void turnOnResidualComputation(const bool trueOrFalse=true );
44 
46 
47  // return the maximum residual from the last call to interpolate
48  real getMaximumResidual() const;
49 
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.
57  const Range & C0 = nullRange, // optionally specify components to interpolate
58  const Range & C1 = nullRange,
59  const Range & C2 = nullRange );
60 
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 
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.
78  const Range & C0 = nullRange, // optionally specify components to interpolate
79  const Range & C1 = nullRange,
80  const Range & C2 = nullRange );
81 
82 
84 
85  int setMaximumRefinementLevelToInterpolate(int maxLevelToInterpolate );
86 
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 
101 
102  real computeError();
103 
104  int resetSolution();
105 
106  static int debug;
107 
108  FILE *debugFile;
109 
110  protected:
112 
114 
115  // Here is the routine that actually performs the interpolation
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 
131 
133  // todo: SparseArray<int> numberOfInterpolationPointsPerDonor, interpolationStartEndIndex;
134 
135  intSerialArray *dimension, *indexRange, *isCellCentered;
137 
139  realArray *vcg; // for brute force solution
140 
142  int coeffWidthDimension; // dimension of the 2nd component of coeff
144 
145  // Store interp data in sparse arrays:
149 
152 
154 
155  #ifdef USE_PPP
156  MPI_Comm POGI_COMM; // Communicator for the parallel interpolator
157  #else
159  #endif
160 
161 };
162 
163 
164 #endif