Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SourceIMP/utilities/RocfracPrep/linked_list.f90
Go to the documentation of this file.
1 !*********************************************************************
2 !* Illinois Open Source License *
3 !* *
4 !* University of Illinois/NCSA *
5 !* Open Source License *
6 !* *
7 !* Copyright@2008, University of Illinois. All rights reserved. *
8 !* *
9 !* Developed by: *
10 !* *
11 !* Center for Simulation of Advanced Rockets *
12 !* *
13 !* University of Illinois *
14 !* *
15 !* www.csar.uiuc.edu *
16 !* *
17 !* Permission is hereby granted, free of charge, to any person *
18 !* obtaining a copy of this software and associated documentation *
19 !* files (the "Software"), to deal with the Software without *
20 !* restriction, including without limitation the rights to use, *
21 !* copy, modify, merge, publish, distribute, sublicense, and/or *
22 !* sell copies of the Software, and to permit persons to whom the *
23 !* Software is furnished to do so, subject to the following *
24 !* conditions: *
25 !* *
26 !* *
27 !* @ Redistributions of source code must retain the above copyright *
28 !* notice, this list of conditions and the following disclaimers. *
29 !* *
30 !* @ Redistributions in binary form must reproduce the above *
31 !* copyright notice, this list of conditions and the following *
32 !* disclaimers in the documentation and/or other materials *
33 !* provided with the distribution. *
34 !* *
35 !* @ Neither the names of the Center for Simulation of Advanced *
36 !* Rockets, the University of Illinois, nor the names of its *
37 !* contributors may be used to endorse or promote products derived *
38 !* from this Software without specific prior written permission. *
39 !* *
40 !* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41 !* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42 !* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43 !* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44 !* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45 !* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46 !* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47 !* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48 !*********************************************************************
49 !* Please acknowledge The University of Illinois Center for *
50 !* Simulation of Advanced Rockets in works and publications *
51 !* resulting from this software or its derivatives. *
52 !*********************************************************************
54  IMPLICIT NONE
55  PUBLIC :: coh_insert_head
56  PUBLIC :: coh_insert_tail
57  PUBLIC :: vol_insert_head
58  PUBLIC :: vol_insert_tail
59  TYPE, public :: coh_info_type
60  INTEGER :: mat_coh
61  INTEGER, DIMENSION(1:6) :: lmcoh
62  INTEGER :: clst_type
63  END TYPE coh_info_type
64 
65  TYPE, public :: coh_comm_info_type
66  INTEGER, DIMENSION(1:3) :: lmcoh_comm
67  ENDTYPE coh_comm_info_type
68 
69  TYPE, public :: vol_info_type
70  INTEGER :: mat_vol
71  INTEGER, DIMENSION(1:10) :: lmvol
72  INTEGER :: iface
73  INTEGER :: press
74  END TYPE vol_info_type
75 
76  TYPE, public :: comm_info_type
77  INTEGER :: NdId
78  END TYPE comm_info_type
79 
80  TYPE :: vol_box_point
81  TYPE(vol_node_type), POINTER :: ptr
82  ENDTYPE vol_box_point
83 
84  TYPE :: coh_box_type
85  TYPE(coh_node_type), POINTER :: coh_next_np ! => NULL()
86  ENDTYPE coh_box_type
88  TYPE(coh_comm_node_type), POINTER :: coh_comm_next_np ! => NULL()
89  ENDTYPE coh_comm_box_type
90 
91  TYPE :: vol_box_type
92  TYPE(vol_node_type), POINTER :: vol_next_np ! => NULL()
93  ENDTYPE vol_box_type
94  TYPE :: comm_box_type
95  TYPE(comm_node_type), POINTER :: comm_next_np ! => NULL()
96  ENDTYPE comm_box_type
97 
98  TYPE :: coh_node_type
99  TYPE(coh_info_type) :: coh_info
100  TYPE(coh_box_type) :: coh_box
101  END TYPE coh_node_type
103  TYPE(coh_comm_info_type) :: coh_comm_info
104  TYPE(coh_comm_box_type) :: coh_comm_box
105  END TYPE coh_comm_node_type
106 
108  TYPE(vol_info_type) :: vol_info
109  TYPE(vol_box_type) :: vol_box
110  END TYPE vol_node_type
111 
112 
114  TYPE(comm_info_type) :: comm_info
115  TYPE(comm_box_type) :: comm_box
116  END TYPE comm_node_type
117 
119  TYPE(coh_node_type), POINTER :: coh_head ! => NULL()
120  TYPE(coh_node_type), POINTER :: coh_tail ! => NULL()
121  ENDTYPE coh_list_type
123  TYPE(coh_comm_node_type), POINTER :: coh_comm_head ! => NULL()
124  TYPE(coh_comm_node_type), POINTER :: coh_comm_tail ! => NULL()
125  INTEGER :: num_comm_nodes ! = 0
126  ENDTYPE coh_comm_list_type
128  TYPE(vol_node_type), POINTER :: vol_head ! => NULL()
129  TYPE(vol_node_type), POINTER :: vol_tail ! => NULL()
130  INTEGER :: num_border_vol ! = 0 ! Number of bordering volumetric. elements
131  ENDTYPE vol_list_type
132 
134  TYPE(comm_node_type), POINTER :: comm_head !=> NULL()
135  TYPE(comm_node_type), POINTER :: comm_tail !=> NULL()
136  INTEGER :: num_border_comm ! = 0 ! Number of bordering volumetric. elements
137  ENDTYPE comm_list_type
138 
139  TYPE :: elemlisttype
140  TYPE(comm_node_type), POINTER :: comm_head ! => NULL()
141  TYPE(comm_node_type), POINTER :: comm_tail ! => NULL()
142 
143  INTEGER :: NumElperProc ! = 0 ! Number of bordering volumetric. elements
144  TYPE(elemlisttype), POINTER :: next
145  ENDTYPE elemlisttype
146 
147 CONTAINS
148 
149  SUBROUTINE coh_insert_head(arg_b,coh_item)
150  TYPE(coh_list_type), TARGET, INTENT(in out) :: arg_b
151  TYPE(coh_info_type), intent(in) :: coh_item
152  TYPE(coh_node_type), POINTER :: new_node
153 
154  ALLOCATE(new_node)
155  new_node%coh_info = coh_item
156 
157  IF(.NOT.ASSOCIATED(arg_b%coh_head))THEN
158  arg_b%coh_head => new_node
159  arg_b%coh_tail => new_node
160  ELSE
161  new_node%coh_box%coh_next_np => arg_b%coh_head
162  arg_b%coh_head => new_node
163  ENDIF
164  RETURN
165  END SUBROUTINE coh_insert_head
166 
167  SUBROUTINE coh_insert_tail(arg_b,coh_item)
168  TYPE(coh_list_type), TARGET, INTENT(in out) :: arg_b
169  TYPE(coh_info_type), intent(in) :: coh_item
170  TYPE(coh_node_type), POINTER :: new_node
171 
172  ALLOCATE(new_node)
173  new_node%coh_info = coh_item
174 
175  IF(.NOT.ASSOCIATED(arg_b%coh_head))THEN
176  arg_b%coh_head => new_node
177  arg_b%coh_tail => new_node
178  ELSE
179  arg_b%coh_tail%coh_box%coh_next_np => new_node
180  arg_b%coh_tail => new_node
181  ENDIF
182 
183  RETURN
184  END SUBROUTINE coh_insert_tail
185 
186  SUBROUTINE print_coh_list(arg_b)
187  TYPE(coh_list_type), TARGET, INTENT(in) :: arg_b
188  TYPE(coh_node_type), POINTER :: current
189  current => arg_b%coh_head
190  DO WHILE (ASSOCIATED(current))
191  CALL print_coh_target(current)
192  current => current%coh_box%coh_next_np
193  ENDDO
194  RETURN
195  CONTAINS
196  SUBROUTINE print_coh_target(arg_np)
197  USE meshdata
198  TYPE(coh_node_type), POINTER :: arg_np
199  IF(ioformat.EQ.0)THEN
200  WRITE(4000) arg_np%coh_info
201  ELSE
202  WRITE(4000,'(8i9)') arg_np%coh_info
203  ENDIF
204  RETURN
205  END SUBROUTINE print_coh_target
206  END SUBROUTINE print_coh_list
207  SUBROUTINE print_coh_comm(arg_b)
208 
209  USE meshdata
210 !
211 ! Number of communicated nodes needed for R_co calculation
212 ! List of the nodes involved in communication for R_co calculation
213 ! (i.e. what nodes are going to be sent by the 'i' processor)
214 !
215  TYPE(coh_comm_list_type), TARGET, INTENT(in) :: arg_b
216  TYPE(coh_comm_node_type), POINTER :: current
217  current => arg_b%coh_comm_head
218  IF(ioformat.EQ.0)THEN
219  WRITE(4000) arg_b%num_comm_nodes*3
220  ELSE
221  WRITE(4000,*) arg_b%num_comm_nodes*3
222  ENDIF
223  DO WHILE (ASSOCIATED(current))
224  CALL print_coh_comm_target(current)
225  current => current%coh_comm_box%coh_comm_next_np
226  ENDDO
227  RETURN
228  CONTAINS
229  SUBROUTINE print_coh_comm_target(arg_np)
230  USE meshdata
231  TYPE(coh_comm_node_type), POINTER :: arg_np
232  IF(ioformat.EQ.0)THEN
233  WRITE(4000) arg_np%coh_comm_info
234  ELSE
235  WRITE(4000,'(6i9)') arg_np%coh_comm_info
236  ENDIF
237  RETURN
238  END SUBROUTINE print_coh_comm_target
239  END SUBROUTINE print_coh_comm
240 
241  SUBROUTINE vol_insert_head(arg_b,vol_item)
242  TYPE(vol_list_type), TARGET, INTENT(in out) :: arg_b
243  TYPE(vol_info_type), intent(in) :: vol_item
244  TYPE(vol_node_type), POINTER :: new_node
245 
246  ALLOCATE(new_node)
247  new_node%vol_info = vol_item
248 
249  IF(.NOT.ASSOCIATED(arg_b%vol_head))THEN
250  arg_b%vol_head => new_node
251  arg_b%vol_tail => new_node
252  arg_b%num_border_vol = 1
253  ELSE
254  new_node%vol_box%vol_next_np => arg_b%vol_head
255  arg_b%vol_head => new_node
256  arg_b%num_border_vol = arg_b%num_border_vol + 1
257  ENDIF
258  RETURN
259  END SUBROUTINE vol_insert_head
260 
261  SUBROUTINE vol_insert_tail(arg_b,vol_item)
262  TYPE(vol_list_type), TARGET, INTENT(in out) :: arg_b
263  TYPE(vol_info_type), intent(in) :: vol_item
264  TYPE(vol_node_type), POINTER :: new_node
265 
266  ALLOCATE(new_node)
267  new_node%vol_info = vol_item
268 
269  IF(.NOT.ASSOCIATED(arg_b%vol_head))THEN
270  arg_b%vol_head => new_node
271  arg_b%vol_tail => new_node
272  ELSE
273  arg_b%vol_tail%vol_box%vol_next_np => new_node
274  arg_b%vol_tail => new_node
275  ENDIF
276 
277  RETURN
278  END SUBROUTINE vol_insert_tail
279 
280  SUBROUTINE addcommnd(arg_b,comm_item)
281  TYPE(comm_list_type), TARGET, INTENT(in out) :: arg_b
282  integer, intent(in) :: comm_item
283  TYPE(comm_node_type), POINTER :: new_node
284 
285  ALLOCATE(new_node)
286  new_node%comm_info%NdId = comm_item
287 
288  IF(.NOT.ASSOCIATED(arg_b%comm_head))THEN
289  arg_b%comm_head => new_node
290  arg_b%comm_tail => new_node
291  arg_b%num_border_comm = 1
292  ELSE
293  arg_b%comm_tail%comm_box%comm_next_np => new_node
294  arg_b%comm_tail => new_node
295  arg_b%num_border_comm = arg_b%num_border_comm + 1
296  ENDIF
297 
298  RETURN
299  END SUBROUTINE addcommnd
300 
301  SUBROUTINE addelpart(arg_b,comm_item)
302  TYPE(elemlisttype), TARGET, INTENT(in out) :: arg_b
303  integer, intent(in) :: comm_item
304  TYPE(comm_node_type), POINTER :: new_node
305 
306  ALLOCATE(new_node)
307  new_node%comm_info%NdId = comm_item
308 
309  IF(.NOT.ASSOCIATED(arg_b%comm_head))THEN
310  arg_b%comm_head => new_node
311  arg_b%comm_tail => new_node
312  arg_b%NumElperProc = 1
313  ELSE
314  arg_b%comm_tail%comm_box%comm_next_np => new_node
315  arg_b%comm_tail => new_node
316  arg_b%NumElperProc = arg_b%NumElperProc + 1
317  ENDIF
318 
319  RETURN
320  END SUBROUTINE addelpart
321 
322 
323  SUBROUTINE vol_insert_ptr(arg_b,ik1_c4)
324  TYPE(vol_list_type), TARGET, INTENT(in) :: arg_b
325  TYPE(vol_box_point) :: ik1_c4
326 
327  ik1_c4%ptr => arg_b%vol_tail
328 
329  RETURN
330  END SUBROUTINE vol_insert_ptr
331 
332  SUBROUTINE coh_comm(arg_b,coh_comm_item)
333  TYPE(coh_comm_list_type), TARGET, INTENT(in out) :: arg_b
334  TYPE(coh_comm_info_type), INTENT(in) :: coh_comm_item
335  TYPE(coh_comm_node_type), POINTER :: new_node
336 
337  ALLOCATE(new_node)
338  new_node%coh_comm_info = coh_comm_item
339 
340  IF(.NOT.ASSOCIATED(arg_b%coh_comm_head))THEN
341  arg_b%coh_comm_head => new_node
342  arg_b%coh_comm_tail => new_node
343  arg_b%num_comm_nodes = 1
344  ELSE
345  arg_b%coh_comm_tail%coh_comm_box%coh_comm_next_np => new_node
346  arg_b%coh_comm_tail => new_node
347  arg_b%num_comm_nodes = arg_b%num_comm_nodes + 1
348  ENDIF
349 
350  RETURN
351  END SUBROUTINE coh_comm
352 
353  SUBROUTINE print_vol_list(arg_b,imat, Inum, ElemCount)
354  TYPE(vol_list_type), TARGET, INTENT(in) :: arg_b
355  TYPE(vol_node_type), POINTER :: current
356  integer :: imat, icnter, inum, i
357  Integer :: elemcount
358  current => arg_b%vol_head
359 ! icnter = 0
360 
361  ! ... ElemCount added to keep track of elements put into this processors
362  ! ... connectivity table (ElConnTable) regardless of the
363  ! ... material. COstoich 10/27/09
364  icnter = elemcount
365 
366 ! DO WHILE (ASSOCIATED(current))
367  DO i = 1, inum
368  CALL print_vol_target(current,imat,icnter)
369  current => current%vol_box%vol_next_np
370  ENDDO
371 
372  RETURN
373  CONTAINS
374  SUBROUTINE print_vol_target(arg_np,imat,icnter)
375  USE meshdata
376  integer :: imat,icnter
377  TYPE(vol_node_type), POINTER :: arg_np
378  IF(ioformat.EQ.0)THEN
379  WRITE(4000) arg_np%vol_info
380  ELSE
381 
382 !!$ WRITE(4000,'(15i9)') imat, &
383 !!$ arg_np%vol_info%lmvol(1:numvertx)
384 
385  icnter = icnter + 1
386  elflag(arg_np%vol_info%press) = icnter
387 
388  mattype(icnter) = imat
389  elconntable(1:numvertx,icnter) = arg_np%vol_info%lmvol(1:numvertx)
390 
391 
392  ENDIF
393  RETURN
394  END SUBROUTINE print_vol_target
395  END SUBROUTINE print_vol_list
396 
397 
398  SUBROUTINE print_comm_list(arg_b,ip, iaux)
399 
400  integer :: ip
401  integer :: iaux
402  integer :: icnt
403  TYPE(comm_list_type), TARGET, INTENT(in) :: arg_b
404  TYPE(comm_node_type), POINTER :: current
405 
406  icnt = 0
407  current => arg_b%comm_head
408  DO WHILE (ASSOCIATED(current))
409  icnt = icnt + 1
410  CALL print_comm_target(current,ip,iaux)
411  IF(icnt.EQ.arg_b%num_border_comm) EXIT ! should not need to do this, fix pointer
412  current => current%comm_box%comm_next_np
413  ENDDO
414  RETURN
415  CONTAINS
416  SUBROUTINE print_comm_target(arg_np,ip,iaux)
417  USE meshdata
418 
419  integer :: ip, iaux
420 
421  TYPE(comm_node_type), POINTER :: arg_np
422 
423 ! NodesToCommunicate_cnt = NodesToCommunicate_cnt + 1
424 ! print*,'NodesToCommunicate_cnt',NodesToCommunicate_cnt
425 ! NodesToCommunicate(NodesToCommunicate_cnt) = NodeFlag(arg_np%comm_info%NdId)
426 
427  iaux = iaux + 1
428 
429  pconn_comm(iaux) = nodeflag(arg_np%comm_info%NdId)
430 
431 
432  RETURN
433  END SUBROUTINE print_comm_target
434  END SUBROUTINE print_comm_list
435 
436  SUBROUTINE linkedlist(arg_b,ip)
437 
438  integer :: ip
439 
440  TYPE(elemlisttype), TARGET, INTENT(in) :: arg_b
441  TYPE(comm_node_type), POINTER, SAVE :: current
442  current => arg_b%comm_head
443 ! DO WHILE (ASSOCIATED(current))
444  CALL print_comm_target2(current,ip)
445  current => current%comm_box%comm_next_np
446 ! ENDDO
447  RETURN
448  CONTAINS
449  SUBROUTINE print_comm_target2(arg_np,ip)
450 
451  integer :: ip
452 
453  TYPE(comm_node_type), POINTER :: arg_np
454 
455 
456  ip = arg_np%comm_info%NdId
457 
458  RETURN
459  END SUBROUTINE print_comm_target2
460  END SUBROUTINE linkedlist
461 
462 
463 END MODULE linked_list
464 
subroutine print_coh_target(arg_np)
subroutine vol_insert_ptr(arg_b, ik1_c4)
subroutine, public vol_insert_head(arg_b, vol_item)
subroutine coh_comm(arg_b, coh_comm_item)
subroutine print_vol_list(arg_b, imat, Inum, ElemCount)
subroutine print_coh_comm_target(arg_np)
subroutine addelpart(arg_b, comm_item)
blockLoc i
Definition: read.cpp:79
subroutine addcommnd(arg_b, comm_item)
subroutine print_vol_target(arg_np, imat, icnter)
subroutine, public coh_insert_tail(arg_b, coh_item)
subroutine print_comm_target2(arg_np, ip)
subroutine, public coh_insert_head(arg_b, coh_item)
subroutine print_comm_target(arg_np, ip, iaux)
subroutine print_comm_list(arg_b, ip, iaux)
subroutine, public vol_insert_tail(arg_b, vol_item)