-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmod_struct_to_array.f90
53 lines (41 loc) · 1.36 KB
/
mod_struct_to_array.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module mod_struct_to_array
use mod_cell_2D
use mod_fvm_face_2D
implicit none
real(8), dimension(:), allocatable :: vol, norm_x, norm_y, len_norm
integer, dimension(:), allocatable :: bc_typ
integer, dimension(:,:), allocatable :: lr_cell
contains
!----------------------------------------------------------------------
subroutine struct_to_array
implicit none
integer :: icel, ifac
if (.not. allocated(vol)) then
allocate(vol(nbelm))
endif
if (.not. allocated(norm_x)) then
allocate(norm_x(nbfaces))
endif
if (.not. allocated(norm_y)) then
allocate(norm_y(nbfaces))
endif
if (.not. allocated(len_norm)) then
allocate(len_norm(nbfaces))
endif
if (.not. allocated(bc_typ)) then
allocate(bc_typ(nbfaces))
endif
if (.not. allocated(lr_cell)) then
allocate(lr_cell(nbfaces,2))
endif
do icel = 1, nbelm
vol(icel) = cell(icel)%p%vol
enddo
do ifac = 1, nbfaces
norm_x(ifac) = face_2D(ifac)%f%normal_vector%x
norm_y(ifac) = face_2D(ifac)%f%normal_vector%y
len_norm(ifac) = face_2D(ifac)%f%len_nor
bc_typ(ifac) = face_2D(ifac)%f%bc_typ
enddo
end subroutine struct_to_array
end module