Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModVertexLists.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 for vertex lists.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModVertexLists.F90,v 1.4 2008/12/06 08:44:24 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2005 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE modglobal, ONLY: t_global
42  USE modparameters
43  USE moddatatypes
44  USE moderror
45  USE modbndpatch, ONLY: t_patch
46  USE moddatastruct, ONLY: t_region
47  USE modgrid, ONLY: t_grid
48  USE modstencil, ONLY: t_stencil
49  USE modsortsearch
50  USE modmpi
51 
52  IMPLICIT NONE
53 
54  PRIVATE
55  PUBLIC :: rflu_buildvert2celllist, &
59 
60 
61 ! ******************************************************************************
62 ! Declarations and definitions
63 ! ******************************************************************************
64 
65  CHARACTER(CHRLEN) :: RCSIdentString = &
66  '$RCSfile: RFLU_ModVertexLists.F90,v $ $Revision: 1.4 $'
67 
68 ! ******************************************************************************
69 ! Routines
70 ! ******************************************************************************
71 
72  CONTAINS
73 
74 
75 
76 
77 
78 
79 ! *******************************************************************************
80 !
81 ! Purpose: Build vertex-to-cell list.
82 !
83 ! Description: None.
84 !
85 ! Input:
86 ! pRegion Pointer to region
87 !
88 ! Output: None.
89 !
90 ! Notes: None.
91 !
92 ! ******************************************************************************
93 
94  SUBROUTINE rflu_buildvert2celllist(pRegion)
95 
97 
98  IMPLICIT NONE
99 
100 ! ******************************************************************************
101 ! Declarations and definitions
102 ! ******************************************************************************
103 
104 ! ==============================================================================
105 ! Arguments
106 ! ==============================================================================
107 
108  TYPE(t_region), POINTER :: pregion
109 
110 ! ==============================================================================
111 ! Locals
112 ! ==============================================================================
113 
114  INTEGER :: errorflag,icg,icl,ict,ivg,ivl,v2cbeg,v2cdegrsum,v2cend,v2cindx
115  INTEGER, DIMENSION(:), ALLOCATABLE :: v2cdegr
116  TYPE(t_grid), POINTER :: pgrid
117  TYPE(t_global), POINTER :: global
118 
119 ! ******************************************************************************
120 ! Start
121 ! ******************************************************************************
122 
123  global => pregion%global
124 
125  CALL registerfunction(global,'RFLU_BuildVert2CellList',&
126  'RFLU_ModVertexLists.F90')
127 
128  IF ( global%myProcid == masterproc .AND. &
129  global%verbLevel >= verbose_high ) THEN
130  WRITE(stdout,'(A,1X,A)') solver_name, &
131  'Building vertex-to-cell list...'
132  END IF ! global%verbLevel
133 
134 ! ******************************************************************************
135 ! Set grid pointer and set constants
136 ! ******************************************************************************
137 
138  pgrid => pregion%grid
139 
140 ! ******************************************************************************
141 ! Allocate temporary memory
142 ! ******************************************************************************
143 
144  ALLOCATE(v2cdegr(pgrid%nVertTot),stat=errorflag)
145  global%error = errorflag
146  IF ( global%error /= err_none ) THEN
147  CALL errorstop(global,err_allocate,__line__,'v2cDegr')
148  END IF ! global%error
149 
150  DO ivg = 1,pgrid%nVertTot
151  v2cdegr(ivg) = 0
152  END DO ! ivg
153 
154 ! ******************************************************************************
155 ! Loop over cells and determine degree of each vertex
156 ! ******************************************************************************
157 
158  DO icg = 1,pgrid%nCellsTot
159  ict = rflu_getglobalcelltype(global,pgrid,icg)
160  icl = pgrid%cellGlob2Loc(2,icg)
161 
162  SELECT CASE ( ict )
163  CASE ( cell_type_tet )
164  DO ivl = 1,4
165  ivg = pgrid%tet2v(ivl,icl)
166  v2cdegr(ivg) = v2cdegr(ivg) + 1
167  END DO ! ivl
168  CASE ( cell_type_hex )
169  DO ivl = 1,8
170  ivg = pgrid%hex2v(ivl,icl)
171  v2cdegr(ivg) = v2cdegr(ivg) + 1
172  END DO ! ivl
173  CASE ( cell_type_pri )
174  DO ivl = 1,6
175  ivg = pgrid%pri2v(ivl,icl)
176  v2cdegr(ivg) = v2cdegr(ivg) + 1
177  END DO ! ivl
178  CASE ( cell_type_pyr )
179  DO ivl = 1,5
180  ivg = pgrid%pyr2v(ivl,icl)
181  v2cdegr(ivg) = v2cdegr(ivg) + 1
182  END DO ! ivl
183  CASE default
184  CALL errorstop(global,err_reached_default,__line__)
185  END SELECT ! ict
186  END DO ! icg
187 
188 ! ******************************************************************************
189 ! Build information array
190 ! ******************************************************************************
191 
192  v2cdegrsum = 0
193 
194  DO ivg = 1,pgrid%nVertTot
195  IF ( ivg > 1 ) THEN
196  pgrid%v2cInfo(v2c_beg,ivg) = pgrid%v2cInfo(v2c_end,ivg-1) + 1
197  ELSE
198  pgrid%v2cInfo(v2c_beg,ivg) = 1
199  END IF ! ivg
200 
201  v2cdegrsum = v2cdegrsum + v2cdegr(ivg)
202 
203  pgrid%v2cInfo(v2c_end,ivg) = v2cdegrsum
204  END DO ! ivg
205 
206 ! ******************************************************************************
207 ! Allocate actual v2c array
208 ! ******************************************************************************
209 
210  ALLOCATE(pgrid%v2c(v2cdegrsum),stat=errorflag)
211  global%error = errorflag
212  IF ( global%error /= err_none ) THEN
213  CALL errorstop(global,err_allocate,__line__,'pGrid%v2c')
214  END IF ! global%error
215 
216 ! ******************************************************************************
217 ! Build actual array
218 ! ******************************************************************************
219 
220  DO ivg = 1,pgrid%nVertTot ! Reinitialize degree counter
221  v2cdegr(ivg) = 0
222  END DO ! ivg
223 
224  DO icg = 1,pgrid%nCellsTot
225  ict = rflu_getglobalcelltype(global,pgrid,icg)
226  icl = pgrid%cellGlob2Loc(2,icg)
227 
228  SELECT CASE ( ict )
229  CASE ( cell_type_tet )
230  DO ivl = 1,4
231  ivg = pgrid%tet2v(ivl,icl)
232  v2cindx = pgrid%v2cInfo(v2c_beg,ivg) + v2cdegr(ivg)
233  pgrid%v2c(v2cindx) = icg
234  v2cdegr(ivg) = v2cdegr(ivg) + 1
235  END DO ! ivl
236  CASE ( cell_type_hex )
237  DO ivl = 1,8
238  ivg = pgrid%hex2v(ivl,icl)
239  v2cindx = pgrid%v2cInfo(v2c_beg,ivg) + v2cdegr(ivg)
240  pgrid%v2c(v2cindx) = icg
241  v2cdegr(ivg) = v2cdegr(ivg) + 1
242  END DO ! ivl
243  CASE ( cell_type_pri )
244  DO ivl = 1,6
245  ivg = pgrid%pri2v(ivl,icl)
246  v2cindx = pgrid%v2cInfo(v2c_beg,ivg) + v2cdegr(ivg)
247  pgrid%v2c(v2cindx) = icg
248  v2cdegr(ivg) = v2cdegr(ivg) + 1
249  END DO ! ivl
250  CASE ( cell_type_pyr )
251  DO ivl = 1,5
252  ivg = pgrid%pyr2v(ivl,icl)
253  v2cindx = pgrid%v2cInfo(v2c_beg,ivg) + v2cdegr(ivg)
254  pgrid%v2c(v2cindx) = icg
255  v2cdegr(ivg) = v2cdegr(ivg) + 1
256  END DO ! ivl
257  CASE default
258  CALL errorstop(global,err_reached_default,__line__)
259  END SELECT ! ict
260  END DO ! icg
261 
262 ! ******************************************************************************
263 ! Deallocate temporary memory
264 ! ******************************************************************************
265 
266  DEALLOCATE(v2cdegr,stat=errorflag)
267  global%error = errorflag
268  IF ( global%error /= err_none ) THEN
269  CALL errorstop(global,err_deallocate,__line__,'v2cDegr')
270  END IF ! global%error
271 
272 
273 #ifdef CHECK_DATASTRUCT
274 ! ******************************************************************************
275 ! Data structure output for checking
276 ! ******************************************************************************
277 
278  WRITE(stdout,'(A)') solver_name
279  WRITE(stdout,'(A,1X,A)') solver_name,'### START CHECK OUTPUT ###'
280  WRITE(stdout,'(A,1X,A)') solver_name,'Vertex-to-cell list'
281 
282  DO ivg = 1,pgrid%nVertTot
283  v2cbeg = pgrid%v2cInfo(v2c_beg,ivg)
284  v2cend = pgrid%v2cInfo(v2c_end,ivg)
285 
286  WRITE(stdout,'(A,1X,I6,1X,I3,3X,20(1X,I6))') solver_name,ivg, &
287  v2cend-v2cbeg+1,pgrid%v2c(v2cbeg:v2cend)
288  END DO ! ivg
289 #endif
290 
291 ! ******************************************************************************
292 ! End
293 ! ******************************************************************************
294 
295  IF ( global%myProcid == masterproc .AND. &
296  global%verbLevel >= verbose_high ) THEN
297  WRITE(stdout,'(A,1X,A)') solver_name, &
298  'Building vertex-to-cell list done.'
299  END IF ! global%verbLevel
300 
301  CALL deregisterfunction(global)
302 
303  END SUBROUTINE rflu_buildvert2celllist
304 
305 
306 
307 
308 
309 
310 
311 
312 ! *******************************************************************************
313 !
314 ! Purpose: Create vertex-to-cell list.
315 !
316 ! Description: None.
317 !
318 ! Input:
319 ! pRegion Pointer to region
320 !
321 ! Output: None.
322 !
323 ! Notes: None.
324 !
325 ! ******************************************************************************
326 
327  SUBROUTINE rflu_createvert2celllist(pRegion)
328 
329  IMPLICIT NONE
330 
331 ! ******************************************************************************
332 ! Declarations and definitions
333 ! ******************************************************************************
334 
335 ! ==============================================================================
336 ! Arguments
337 ! ==============================================================================
338 
339  TYPE(t_region), POINTER :: pregion
340 
341 ! ==============================================================================
342 ! Locals
343 ! ==============================================================================
344 
345  INTEGER :: errorflag,ic
346  TYPE(t_grid), POINTER :: pgrid
347  TYPE(t_global), POINTER :: global
348 
349 ! ******************************************************************************
350 ! Start
351 ! ******************************************************************************
352 
353  global => pregion%global
354 
355  CALL registerfunction(global,'RFLU_CreateVert2CellList',&
356  'RFLU_ModVertexLists.F90')
357 
358  IF ( global%myProcid == masterproc .AND. &
359  global%verbLevel >= verbose_high ) THEN
360  WRITE(stdout,'(A,1X,A)') solver_name, &
361  'Creating vertex-to-cell list...'
362  END IF ! global%verbLevel
363 
364 ! ******************************************************************************
365 ! Nullify memory
366 ! ******************************************************************************
367 
368  CALL rflu_nullifyvert2celllist(pregion)
369 
370 ! ******************************************************************************
371 ! Set grid pointer
372 ! ******************************************************************************
373 
374  pgrid => pregion%grid
375 
376 ! ******************************************************************************
377 ! Allocate memory
378 ! ******************************************************************************
379 
380  ALLOCATE(pgrid%v2cInfo(v2c_beg:v2c_end,pgrid%nVertTot),stat=errorflag)
381  global%error = errorflag
382  IF ( global%error /= err_none ) THEN
383  CALL errorstop(global,err_allocate,__line__,'v2cInfo')
384  END IF ! global%error
385 
386 ! ******************************************************************************
387 ! End
388 ! ******************************************************************************
389 
390  IF ( global%myProcid == masterproc .AND. &
391  global%verbLevel >= verbose_high ) THEN
392  WRITE(stdout,'(A,1X,A)') solver_name, &
393  'Creating vertex-to-cell list done.'
394  END IF ! global%verbLevel
395 
396  CALL deregisterfunction(global)
397 
398  END SUBROUTINE rflu_createvert2celllist
399 
400 
401 
402 
403 
404 
405 
406 ! *******************************************************************************
407 !
408 ! Purpose: Destroy vertex-to-cell list.
409 !
410 ! Description: None.
411 !
412 ! Input:
413 ! pRegion Pointer to region
414 !
415 ! Output: None.
416 !
417 ! Notes: None.
418 !
419 ! ******************************************************************************
420 
421  SUBROUTINE rflu_destroyvert2celllist(pRegion)
422 
423  IMPLICIT NONE
424 
425 ! ******************************************************************************
426 ! Declarations and definitions
427 ! ******************************************************************************
428 
429 ! ==============================================================================
430 ! Arguments
431 ! ==============================================================================
432 
433  TYPE(t_region), POINTER :: pregion
434 
435 ! ==============================================================================
436 ! Locals
437 ! ==============================================================================
438 
439  INTEGER :: errorflag
440  TYPE(t_grid), POINTER :: pgrid
441  TYPE(t_global), POINTER :: global
442 
443 ! ******************************************************************************
444 ! Start
445 ! ******************************************************************************
446 
447  global => pregion%global
448 
449  CALL registerfunction(global,'RFLU_DestroyVert2CellList',&
450  'RFLU_ModVertexLists.F90')
451 
452  IF ( global%myProcid == masterproc .AND. &
453  global%verbLevel >= verbose_high ) THEN
454  WRITE(stdout,'(A,1X,A)') solver_name, &
455  'Destroying vertex-to-cell list...'
456  END IF ! global%verbLevel
457 
458 ! ******************************************************************************
459 ! Set grid pointer
460 ! ******************************************************************************
461 
462  pgrid => pregion%grid
463 
464 ! ******************************************************************************
465 ! Deallocate memory
466 ! ******************************************************************************
467 
468  DEALLOCATE(pgrid%v2c,stat=errorflag)
469  global%error = errorflag
470  IF ( global%error /= err_none ) THEN
471  CALL errorstop(global,err_deallocate,__line__,'pGrid%v2c')
472  END IF ! global%error
473 
474 ! ******************************************************************************
475 ! Nullify memory
476 ! ******************************************************************************
477 
478  CALL rflu_nullifyvert2celllist(pregion)
479 
480 ! ******************************************************************************
481 ! End
482 ! ******************************************************************************
483 
484  IF ( global%myProcid == masterproc .AND. &
485  global%verbLevel >= verbose_high ) THEN
486  WRITE(stdout,'(A,1X,A)') solver_name, &
487  'Destroying vertex-to-cell list done.'
488  END IF ! global%verbLevel
489 
490  CALL deregisterfunction(global)
491 
492  END SUBROUTINE rflu_destroyvert2celllist
493 
494 
495 
496 
497 
498 
499 
500 ! *******************************************************************************
501 !
502 ! Purpose: Nullify vertex-to-cell list.
503 !
504 ! Description: None.
505 !
506 ! Input:
507 ! pRegion Pointer to region
508 !
509 ! Output: None.
510 !
511 ! Notes: None.
512 !
513 ! ******************************************************************************
514 
515  SUBROUTINE rflu_nullifyvert2celllist(pRegion)
516 
517  IMPLICIT NONE
518 
519 ! ******************************************************************************
520 ! Declarations and definitions
521 ! ******************************************************************************
522 
523 ! ==============================================================================
524 ! Arguments
525 ! ==============================================================================
526 
527 
528  TYPE(t_region), POINTER :: pregion
529 
530 ! ==============================================================================
531 ! Locals
532 ! ==============================================================================
533 
534  TYPE(t_grid), POINTER :: pgrid
535  TYPE(t_global), POINTER :: global
536 
537 ! ******************************************************************************
538 ! Start
539 ! ******************************************************************************
540 
541  global => pregion%global
542 
543  CALL registerfunction(global,'RFLU_NullifyVert2CellList',&
544  'RFLU_ModVertexLists.F90')
545 
546  IF ( global%myProcid == masterproc .AND. &
547  global%verbLevel >= verbose_high ) THEN
548  WRITE(stdout,'(A,1X,A)') solver_name, &
549  'Nullifying vertex-to-cell list...'
550  END IF ! global%verbLevel
551 
552 ! ******************************************************************************
553 ! Set grid pointer
554 ! ******************************************************************************
555 
556  pgrid => pregion%grid
557 
558 ! ******************************************************************************
559 ! Nullify memory
560 ! ******************************************************************************
561 
562  nullify(pgrid%v2c)
563  nullify(pgrid%v2cInfo)
564 
565 ! ******************************************************************************
566 ! End
567 ! ******************************************************************************
568 
569  IF ( global%myProcid == masterproc .AND. &
570  global%verbLevel >= verbose_high ) THEN
571  WRITE(stdout,'(A,1X,A)') solver_name, &
572  'Nullifying vertex-to-cell list done.'
573  END IF ! global%verbLevel
574 
575  CALL deregisterfunction(global)
576 
577  END SUBROUTINE rflu_nullifyvert2celllist
578 
579 
580 
581 
582 
583 
584 
585 ! ******************************************************************************
586 ! End
587 ! ******************************************************************************
588 
589 END MODULE rflu_modvertexlists
590 
591 
592 ! ******************************************************************************
593 !
594 ! RCS Revision history:
595 !
596 ! $Log: RFLU_ModVertexLists.F90,v $
597 ! Revision 1.4 2008/12/06 08:44:24 mtcampbe
598 ! Updated license.
599 !
600 ! Revision 1.3 2008/11/19 22:17:35 mtcampbe
601 ! Added Illinois Open Source License/Copyright
602 !
603 ! Revision 1.2 2006/04/07 15:19:21 haselbac
604 ! Removed tabs
605 !
606 ! Revision 1.1 2005/10/05 14:33:44 haselbac
607 ! Initial revision
608 !
609 ! ******************************************************************************
610 
611 
612 
613 
614 
615 
616 
617 
618 
619 
subroutine, public rflu_nullifyvert2celllist(pRegion)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ic
subroutine, public rflu_createvert2celllist(pRegion)
subroutine, public rflu_destroyvert2celllist(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public rflu_buildvert2celllist(pRegion)
INTEGER function, public rflu_getglobalcelltype(global, pGrid, icg)