Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ModIndexing.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: calculation of pointers to grid cells/nodes or of i,j,k indices
26 ! from a pointer.
27 !
28 ! Description: - GetIJK = i,j,k indices from a pointer
29 ! - IndIJKMap = pointer to grid cell/node based on i,j,k indices
30 ! of a patch and mapping matrix to source patch
31 !
32 ! Notes: subroutines RFLO_GetCellOffset or RFLO_GetNodeOffset must be called
33 ! BEFORE the functions are used in order to set the correct offsets.
34 ! Further, the subroutine RFLO_GetPatchMapping has to be called before
35 ! the function IndIJKMap can be invoked, in order to set the mapping
36 ! matrix.
37 !
38 !******************************************************************************
39 !
40 ! $Id: ModIndexing.F90,v 1.4 2008/12/06 08:44:14 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2001 by the University of Illinois
43 !
44 !******************************************************************************
45 
47 
48  IMPLICIT NONE
49 
50  CONTAINS
51 
52 ! from a pointer to i, j, k ---------------------------------------------------
53 
54  SUBROUTINE getijk( ijk,iOffset,ijOffset,nDumCells,i,j,k )
55  INTEGER :: ijk, ioffset, ijoffset, ndumcells, i, j, k
56  INTEGER :: ijkmin, q
57 
58  ijkmin = 1 - ndumcells*(1+ioffset+ijoffset)
59  q = (ijk-ijkmin)/ioffset
60  i = mod(ijk-ijkmin,ioffset) - ndumcells + 1
61  j = mod(q,ijoffset/ioffset) - ndumcells + 1
62  k = (ijk-ijkmin)/ijoffset - ndumcells + 1
63  END SUBROUTINE getijk
64 
65 ! pointer to cell/node using patch mapping ------------------------------------
66 
67  INTEGER FUNCTION indijkmap( i,j,k,mapMat,iOffset,ijOffset )
68  INTEGER :: i, j, k, mapmat(3,4), ioffset, ijoffset
69  INTEGER :: is, js, ks
70 
71  is = i*mapmat(1,1) + j*mapmat(1,2) + k*mapmat(1,3) + mapmat(1,4)
72  js = i*mapmat(2,1) + j*mapmat(2,2) + k*mapmat(2,3) + mapmat(2,4)
73  ks = i*mapmat(3,1) + j*mapmat(3,2) + k*mapmat(3,3) + mapmat(3,4)
74 
75  indijkmap = is + (js-1)*ioffset + (ks-1)*ijoffset
76  END FUNCTION indijkmap
77 
78 END MODULE modindexing
79 
80 !******************************************************************************
81 !
82 ! RCS Revision history:
83 !
84 ! $Log: ModIndexing.F90,v $
85 ! Revision 1.4 2008/12/06 08:44:14 mtcampbe
86 ! Updated license.
87 !
88 ! Revision 1.3 2008/11/19 22:17:27 mtcampbe
89 ! Added Illinois Open Source License/Copyright
90 !
91 ! Revision 1.2 2003/05/15 02:57:02 jblazek
92 ! Inlined index function.
93 !
94 ! Revision 1.1 2002/09/27 00:57:09 jblazek
95 ! Changed makefiles - no makelinks needed.
96 !
97 ! Revision 1.5 2002/03/18 22:46:07 jblazek
98 ! Finished multiblock and MPI.
99 !
100 ! Revision 1.4 2002/01/12 00:02:48 jblazek
101 ! Added postprocessor.
102 !
103 ! Revision 1.3 2001/12/11 21:59:28 jblazek
104 ! memory allocation added.
105 !
106 ! Revision 1.2 2001/12/08 00:18:41 jblazek
107 ! Added routines to read BC input file.
108 !
109 ! Revision 1.1.1.1 2001/12/03 21:44:05 jblazek
110 ! Import of RocfluidMP
111 !
112 !******************************************************************************
113 
114 
115 
116 
117 
118 
j indices k indices k
Definition: Indexing.h:6
INTEGER function indijkmap(i, j, k, mapMat, iOffset, ijOffset)
Definition: ModIndexing.F90:67
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
NT q
subroutine getijk(ijk, iOffset, ijOffset, nDumCells, i, j, k)
Definition: ModIndexing.F90:54