Overture  Version 25
arrayGetIndex.h
Go to the documentation of this file.
1 /* -*-Mode: c++; -*- */
2 #ifndef ARRAY_GET_INDEX_H
3 #define ARRAY_GET_INDEX_H "arrayGetIndex.h"
4 
5 #include "GenericDataBase.h"
6 #include "A++.h"
7 #include "wdhdefs.h"
8 
9 //=================================================================================================
10 // Define some useful functions for getting A++ indicies for Overture
11 //
12 // Note: An "index Array" is an IntegerArray of dimensions (0:1,0:2) such as indexRange, gridIndexRange,
13 // or dimension.
14 //
15 // getIndex : determine the Indices corresponding to the index space defined by an index array
16 //
17 // getBoundaryIndex : determine the Indices corresponding to one of the boundaries of the
18 // index space defined by an index arry
19 //
20 // getGhostIndex: This returns the indicies corresponding to a ghost line
21 //
22 //=================================================================================================
23 
24 // ----------------------------getIndex---------------------------------------------------
25 
26 const int arrayGetIndexDefaultValue=-999999;
27 
28 void
29 getIndex(const IntegerArray & indexArray, // this index array and determines I1,I2,I3
30  Index & I1, // output: Index for axis1
31  Index & I2, // output: Index for axis2
32  Index & I3, // output: Index for axis3
33  int extra1=0, // increase Index's by this amount along axis1
34  int extra2=arrayGetIndexDefaultValue, // by default extra2=extra1
35  int extra3=arrayGetIndexDefaultValue // by default extra3=extra1
36  );
37 
38 // ----------------------------getBoundaryIndex---------------------------------------------------
39 // These functions return Index's for a Boundary. The boundary is defined by the parameters
40 // side=0,1 and axis=0,1,2.
41 //
42 //-----------------------------------------------------------------------------------------------
43 void
44 getBoundaryIndex(const IntegerArray & indexArray, // get Index's for boundary of an indexArray
45  int side,
46  int axis,
47  Index & Ib1,
48  Index & Ib2,
49  Index & Ib3,
50  int extra1=0,
51  int extra2=arrayGetIndexDefaultValue,
52  int extra3=arrayGetIndexDefaultValue
53  );
54 
55 //-----------------------------------------------------------------------------------------------
56 // These functions return the Index's for a Ghost-line. These are similar to getBoundaryIndex
57 // and in fact will give the same answer as getBoundaryIndex for the choice ghostLine=0.
58 //
59 // Input:
60 // side,axis : get Index's for this side and axis
61 // ghostLine : get Index's for this ghost-line,
62 // ghostLine=1 : first ghost-line
63 // ghostLine=2 : second ghost-line
64 // ghostLine=0 : boundary
65 // ghostLine=-1: first line inside
66 //----------------------------------------------------------------------------------------------
67 void
68 getGhostIndex(const IntegerArray & indexArray, // get Index's for ghost line
69  int side,
70  int axis,
71  Index & Ib1,
72  Index & Ib2,
73  Index & Ib3,
74  int ghostLine=1,
75  int extra1=0,
76  int extra2=arrayGetIndexDefaultValue,
77  int extra3=arrayGetIndexDefaultValue
78  );
79 
80 #endif