Overture  Version 25
OGgetIndex.h
Go to the documentation of this file.
1 /* -*-Mode: c++; -*- */
2 #ifndef OG_GET_INDEX_H
3 #define OG_GET_INDEX_H "OGgetIndex.h"
4 
5 #include "GenericDataBase.h"
6 #include "A++.h"
7 #include "wdhdefs.h"
8 #include "arrayGetIndex.h"
9 
10 class floatMappedGridFunction; // forward declaration
11 class doubleMappedGridFunction; // forward declaration
12 class intMappedGridFunction; // forward declaration
13 class MappedGrid;
14 
15 
16 //=================================================================================================
17 // Define some useful functions for getting A++ indicies for Overture
18 //
19 // Note: An "index Array" is an IntegerArray of dimensions (0:1,0:2) such as indexRange, gridIndexRange,
20 // or dimension.
21 //
22 // getIndex : determine the Indices corresponding to the index space defined by an index array
23 //
24 // getBoundaryIndex : determine the Indices corresponding to one of the boundaries of the
25 // index space defined by an index arry
26 //
27 // getGhostIndex: This returns the indicies corresponding to a ghost line
28 //
29 //=================================================================================================
30 
31 // ----------------------------getIndex---------------------------------------------------
32 
33 const int OGgetIndexDefaultValue=-999999;
34 
35 void
36 getIndex(const floatMappedGridFunction & u, // the interior+boundary points of this function determine I1,I2,I3
37  Index & I1, // output: Index for axis1
38  Index & I2,
39  Index & I3,
40  int extra1=0, // increase Index's by this amount along axis1
41  int extra2=OGgetIndexDefaultValue, // by default extra2=extra1
42  int extra3=OGgetIndexDefaultValue // by default extra3=extra1
43  );
44 
45 void
47  Index & I1,
48  Index & I2,
49  Index & I3,
50  int extra1=0,
51  int extra2=OGgetIndexDefaultValue,
52  int extra3=OGgetIndexDefaultValue
53  );
54 
55 void
57  Index & I1,
58  Index & I2,
59  Index & I3,
60  int extra1=0,
61  int extra2=OGgetIndexDefaultValue,
62  int extra3=OGgetIndexDefaultValue
63  );
64 
65 //-------------------------------------------------------------------------------------
66 // This getIndex takes a grid function and a component number and returns 3 Index's
67 //
68 // This getIndex is normally used for face centered grid functions in which case
69 // component indicates the value of the face-centred component (of which there can
70 // only be one) which was declared using the setFaceCentering member function or
71 // by declaring or updating a grid function with a "faceRange".
72 //
73 // For grid functions that are not face-centred, component indicates
74 // the value of the first component.
75 //-------------------------------------------------------------------------------------
76 void
77 getIndex(const floatMappedGridFunction & u, // return Index's for a given component
78  int component,
79  Index & I1,
80  Index & I2,
81  Index & I3,
82  int extra1=0,
83  int extra2=OGgetIndexDefaultValue,
84  int extra3=OGgetIndexDefaultValue
85  );
86 
87 void
88 getIndex(const doubleMappedGridFunction & u, // return Index's for a given component
89  int component,
90  Index & I1,
91  Index & I2,
92  Index & I3,
93  int extra1=0,
94  int extra2=OGgetIndexDefaultValue,
95  int extra3=OGgetIndexDefaultValue
96  );
97 
98 void
99 getIndex(const intMappedGridFunction & u, // return Index's for a given component
100  int component,
101  Index & I1,
102  Index & I2,
103  Index & I3,
104  int extra1=0,
105  int extra2=OGgetIndexDefaultValue,
106  int extra3=OGgetIndexDefaultValue
107  );
108 
109 // ----------------------------getBoundaryIndex---------------------------------------------------
110 // These functions return Index's for a Boundary. The boundary is defined by the parameters
111 // side=0,1 and axis=0,1,2.
112 //
113 //-----------------------------------------------------------------------------------------------
114 void
115 getBoundaryIndex(const floatMappedGridFunction & u, // get Index's for boundary
116  int component,
117  int side,
118  int axis,
119  Index & Ib1,
120  Index & Ib2,
121  Index & Ib3,
122  int extra1=0,
123  int extra2=OGgetIndexDefaultValue,
124  int extra3=OGgetIndexDefaultValue
125  );
126 void
128  int component,
129  int side,
130  int axis,
131  Index & Ib1,
132  Index & Ib2,
133  Index & Ib3,
134  int extra1=0,
135  int extra2=OGgetIndexDefaultValue,
136  int extra3=OGgetIndexDefaultValue
137  );
138 void
140  int component,
141  int side,
142  int axis,
143  Index & Ib1,
144  Index & Ib2,
145  Index & Ib3,
146  int extra1=0,
147  int extra2=OGgetIndexDefaultValue,
148  int extra3=OGgetIndexDefaultValue
149  );
150 void
151 getBoundaryIndex(const floatMappedGridFunction & u, // get Index's for boundary, component=0
152  int side,
153  int axis,
154  Index & Ib1,
155  Index & Ib2,
156  Index & Ib3,
157  int extra1=0,
158  int extra2=OGgetIndexDefaultValue,
159  int extra3=OGgetIndexDefaultValue
160  );
161 void
162 getBoundaryIndex(const doubleMappedGridFunction & u, // get Index's for boundary, component=0
163  int side,
164  int axis,
165  Index & Ib1,
166  Index & Ib2,
167  Index & Ib3,
168  int extra1=0,
169  int extra2=OGgetIndexDefaultValue,
170  int extra3=OGgetIndexDefaultValue
171  );
172 void
173 getBoundaryIndex(const intMappedGridFunction & u, // get Index's for boundary, component=0
174  int side,
175  int axis,
176  Index & Ib1,
177  Index & Ib2,
178  Index & Ib3,
179  int extra1=0,
180  int extra2=OGgetIndexDefaultValue,
181  int extra3=OGgetIndexDefaultValue
182  );
183 
184 //-----------------------------------------------------------------------------------------------
185 // These functions return the Index's for a Ghost-line. These are similar to getBoundaryIndex
186 // and in fact will give the same answer as getBoundaryIndex for the choice ghostLine=0.
187 //
188 // Input:
189 // side,axis : get Index's for this side and axis
190 // ghostLine : get Index's for this ghost-line,
191 // ghostLine=1 : first ghost-line
192 // ghostLine=2 : second ghost-line
193 // ghostLine=0 : boundary
194 // ghostLine=-1: first line inside
195 //----------------------------------------------------------------------------------------------
196 void
197 getGhostIndex(const floatMappedGridFunction & u, // get Index's for ghost line for a grid function
198  int component,
199  int side,
200  int axis,
201  Index & Ib1,
202  Index & Ib2,
203  Index & Ib3,
204  int ghostLine=1,
205  int extra1=0,
206  int extra2=OGgetIndexDefaultValue,
207  int extra3=OGgetIndexDefaultValue
208  );
209 void
210 getGhostIndex(const doubleMappedGridFunction & u, // get Index's for ghost line for a grid function
211  int component,
212  int side,
213  int axis,
214  Index & Ib1,
215  Index & Ib2,
216  Index & Ib3,
217  int ghostLine=1,
218  int extra1=0,
219  int extra2=OGgetIndexDefaultValue,
220  int extra3=OGgetIndexDefaultValue
221  );
222 void
223 getGhostIndex(const intMappedGridFunction & u, // get Index's for ghost line for a grid function
224  int component,
225  int side,
226  int axis,
227  Index & Ib1,
228  Index & Ib2,
229  Index & Ib3,
230  int ghostLine=1,
231  int extra1=0,
232  int extra2=OGgetIndexDefaultValue,
233  int extra3=OGgetIndexDefaultValue
234  );
235 void
236 getGhostIndex(const floatMappedGridFunction & u, // get Index's for ghost line for a grid function, component=0
237  int side,
238  int axis,
239  Index & Ib1,
240  Index & Ib2,
241  Index & Ib3,
242  int ghostLine=1,
243  int extra1=0,
244  int extra2=OGgetIndexDefaultValue,
245  int extra3=OGgetIndexDefaultValue
246  );
247 void
248 getGhostIndex(const doubleMappedGridFunction & u, // get Index's for ghost line for a grid function, component=0
249  int side,
250  int axis,
251  Index & Ib1,
252  Index & Ib2,
253  Index & Ib3,
254  int ghostLine=1,
255  int extra1=0,
256  int extra2=OGgetIndexDefaultValue,
257  int extra3=OGgetIndexDefaultValue
258  );
259 void
260 getGhostIndex(const intMappedGridFunction & u, // get Index's for ghost line for a grid function, component=0
261  int side,
262  int axis,
263  Index & Ib1,
264  Index & Ib2,
265  Index & Ib3,
266  int ghostLine=1,
267  int extra1=0,
268  int extra2=OGgetIndexDefaultValue,
269  int extra3=OGgetIndexDefaultValue
270  );
271 
273 extendedGridIndexRange(const MappedGrid & mg); // gridIndexRange extended for interpolation boundaries
274 
276 extendedGridRange(const MappedGrid & mg); // gridIndexRange extended for interpolation and mixed boundaries
277 
278 
279 #endif