Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModRenumberList.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: Suite of routines to renumber and denumber lists.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModRenumberList.F90,v 1.6 2008/12/06 08:44:23 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2004-2005 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE moddatatypes
42  USE modparameters
43  USE moderror
44  USE modglobal, ONLY: t_global
45 
46  USE modsortsearch
47 
48  IMPLICIT NONE
49 
50  PRIVATE
51  PUBLIC :: rflu_denumberlist, &
54 
55 ! ******************************************************************************
56 ! Declarations and definitions
57 ! ******************************************************************************
58 
59  CHARACTER(CHRLEN) :: &
60  RCSIdentString = '$RCSfile: RFLU_ModRenumberList.F90,v $ $Revision: 1.6 $'
61 
62 ! ******************************************************************************
63 ! Routines
64 ! ******************************************************************************
65 
66  CONTAINS
67 
68 
69 
70 
71 
72 ! ******************************************************************************
73 !
74 ! Purpose: Denumber list.
75 !
76 ! Description: None.
77 !
78 ! Input:
79 ! global Global pointer
80 ! listDim1 Leading dimension of list
81 ! listDim2 Trailing dimension of list
82 ! list List to be denumbered
83 ! keyDim Dimension of key
84 ! key Key for renumbering
85 !
86 ! Output:
87 ! list Denumbered list
88 !
89 ! Notes: None.
90 !
91 ! ******************************************************************************
92 
93  SUBROUTINE rflu_denumberlist(global,listDim1,listDim2,list,keyDim,key)
94 
95  IMPLICIT NONE
96 
97 ! ******************************************************************************
98 ! Declarations and definitions
99 ! ******************************************************************************
100 
101 ! ==============================================================================
102 ! Arguments
103 ! ==============================================================================
104 
105  INTEGER, INTENT(IN) :: listdim1,listdim2,keydim
106  INTEGER, INTENT(INOUT) :: list(listdim1,listdim2)
107  INTEGER, INTENT(IN) :: key(keydim)
108  TYPE(t_global), POINTER :: global
109 
110 ! ==============================================================================
111 ! Locals
112 ! ==============================================================================
113 
114  INTEGER :: i,j,k
115 
116 ! ******************************************************************************
117 ! Start
118 ! ******************************************************************************
119 
120  CALL registerfunction(global,'RFLU_DenumberList',&
121  'RFLU_ModRenumberList.F90')
122 
123 ! ******************************************************************************
124 ! Denumber list
125 ! ******************************************************************************
126 
127  DO j = 1,listdim2
128  DO i = 1,listdim1
129  k = list(i,j)
130 
131  IF ( k /= vert_none ) THEN
132  IF ( k > keydim ) THEN
133  CALL errorstop(global,err_denumber_list,__line__)
134  ELSE
135  list(i,j) = key(k)
136  END IF ! k
137  END IF ! k
138  END DO ! i
139  END DO ! j
140 
141 ! ******************************************************************************
142 ! End
143 ! ******************************************************************************
144 
145  CALL deregisterfunction(global)
146 
147  END SUBROUTINE rflu_denumberlist
148 
149 
150 
151 
152 ! ******************************************************************************
153 !
154 ! Purpose: Renumber list.
155 !
156 ! Description: None.
157 !
158 ! Input:
159 ! global Global pointer
160 ! listDim1 Leading dimension of list
161 ! listDim2 Trailing dimension of list
162 ! list List to be renumbered
163 ! keyDim Dimension of key
164 ! key Key for renumbering
165 !
166 ! Output:
167 ! list Renumbered list
168 !
169 ! Notes:
170 ! 1. IMPORTANT: key is assumed to be in ascending order - otherwise binary
171 ! search will fail.
172 !
173 ! ******************************************************************************
174 
175  SUBROUTINE rflu_renumberlist(global,listDim1,listDim2,list,keyDim,key)
176 
177  IMPLICIT NONE
178 
179 ! ******************************************************************************
180 ! Declarations and definitions
181 ! ******************************************************************************
182 
183 ! ==============================================================================
184 ! Arguments
185 ! ==============================================================================
186 
187  INTEGER, INTENT(IN) :: listdim1,listdim2,keydim
188  INTEGER, INTENT(INOUT) :: list(listdim1,listdim2)
189  INTEGER, INTENT(IN) :: key(keydim)
190  TYPE(t_global), POINTER :: global
191 
192 ! ==============================================================================
193 ! Locals
194 ! ==============================================================================
195 
196  INTEGER :: i,iloc,j,k
197 
198 ! ******************************************************************************
199 ! Start
200 ! ******************************************************************************
201 
202  CALL registerfunction(global,'RFLU_RenumberList',&
203  'RFLU_ModRenumberList.F90')
204 
205 ! ******************************************************************************
206 ! Renumber list
207 ! ******************************************************************************
208 
209  DO j = 1,listdim2
210  DO i = 1,listdim1
211  k = list(i,j)
212 
213  IF ( k /= vert_none ) THEN
214  CALL binarysearchinteger(key,keydim,k,iloc)
215 
216  IF ( iloc /= element_not_found ) THEN
217  list(i,j) = iloc
218  ELSE
219  CALL errorstop(global,err_binary_search,__line__)
220  END IF ! iLoc
221  END IF ! k
222  END DO ! i
223  END DO ! j
224 
225 ! ******************************************************************************
226 ! End
227 ! ******************************************************************************
228 
229  CALL deregisterfunction(global)
230 
231  END SUBROUTINE rflu_renumberlist
232 
233 
234 
235 
236 
237 
238 
239 
240 ! ******************************************************************************
241 !
242 ! Purpose: Renumber list based on two keys.
243 !
244 ! Description: None.
245 !
246 ! Input:
247 ! global Global pointer
248 ! listDim1 Leading dimension of list
249 ! listDim2 Trailing dimension of list
250 ! list List to be renumbered
251 ! keyDim Dimension of key
252 ! key1 Key for renumbering
253 ! key2 Second key for renumbering
254 !
255 ! Output:
256 ! list Renumbered list
257 !
258 ! Notes:
259 ! 1. IMPORTANT: key1 is assumed to be in ascending order - otherwise binary
260 ! search will fail.
261 !
262 ! ******************************************************************************
263 
264  SUBROUTINE rflu_renumberlist2(global,listDim1,listDim2,list,keyDim,key1, &
265  key2)
266 
267  IMPLICIT NONE
268 
269 ! ******************************************************************************
270 ! Declarations and definitions
271 ! ******************************************************************************
272 
273 ! ==============================================================================
274 ! Arguments
275 ! ==============================================================================
276 
277  INTEGER, INTENT(IN) :: listdim1,listdim2,keydim
278  INTEGER, INTENT(INOUT) :: list(listdim1,listdim2)
279  INTEGER, INTENT(IN) :: key1(keydim),key2(keydim)
280  TYPE(t_global), POINTER :: global
281 
282 ! ==============================================================================
283 ! Locals
284 ! ==============================================================================
285 
286  INTEGER :: i,iloc,j,k
287 
288 ! ******************************************************************************
289 ! Start
290 ! ******************************************************************************
291 
292  CALL registerfunction(global,'RFLU_RenumberList',&
293  'RFLU_ModRenumberList.F90')
294 
295 ! ******************************************************************************
296 ! Renumber list
297 ! ******************************************************************************
298 
299  DO j = 1,listdim2
300  DO i = 1,listdim1
301  k = list(i,j)
302 
303  IF ( k /= vert_none ) THEN
304  CALL binarysearchinteger(key1,keydim,k,iloc)
305 
306  IF ( iloc /= element_not_found ) THEN
307  list(i,j) = key2(iloc)
308  ELSE
309  CALL errorstop(global,err_binary_search,__line__)
310  END IF ! iLoc
311  END IF ! k
312  END DO ! i
313  END DO ! j
314 
315 ! ******************************************************************************
316 ! End
317 ! ******************************************************************************
318 
319  CALL deregisterfunction(global)
320 
321  END SUBROUTINE rflu_renumberlist2
322 
323 
324 
325 
326 
327 
328 
329 
330 ! ******************************************************************************
331 ! End
332 ! ******************************************************************************
333 
334 END MODULE rflu_modrenumberlist
335 
336 
337 ! ******************************************************************************
338 !
339 ! RCS Revision history:
340 !
341 ! $Log: RFLU_ModRenumberList.F90,v $
342 ! Revision 1.6 2008/12/06 08:44:23 mtcampbe
343 ! Updated license.
344 !
345 ! Revision 1.5 2008/11/19 22:17:34 mtcampbe
346 ! Added Illinois Open Source License/Copyright
347 !
348 ! Revision 1.4 2006/04/07 15:19:20 haselbac
349 ! Removed tabs
350 !
351 ! Revision 1.3 2006/03/25 21:56:15 haselbac
352 ! Cosmetics only
353 !
354 ! Revision 1.2 2004/12/04 03:32:20 haselbac
355 ! Added new renumbering routine, used for partitioning
356 !
357 ! Revision 1.1 2004/10/19 19:27:02 haselbac
358 ! Initial revision
359 !
360 ! ******************************************************************************
361 
362 
363 
364 
365 
366 
367 
368 
369 
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine binarysearchinteger(a, n, v, i, j)
subroutine, public rflu_denumberlist(global, listDim1, listDim2, list, keyDim, key)
subroutine, public rflu_renumberlist2(global, listDim1, listDim2, list, keyDim, key1, key2)
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
subroutine, public rflu_renumberlist(global, listDim1, listDim2, list, keyDim, key)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
static T_Key key
Definition: vinci_lass.c:76
subroutine deregisterfunction(global)
Definition: ModError.F90:469