SPEED
READ_FILEMESH.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine read_filemesh (gridfile, nb_mat, lab_mat, nb_dirix, lab_dirx, nb_diriy, lab_diry, nb_dir
 Reads dimensions in gridfile (*.mesh)
 

Function/Subroutine Documentation

◆ read_filemesh()

subroutine read_filemesh ( character*70  gridfile,
integer*4  nb_mat,
integer*4, dimension(nb_mat)  lab_mat,
integer*4  nb_dirix,
integer*4, dimension(nb_dirix)  lab_dirx,
integer*4  nb_diriy,
integer*4, dimension(nb_diriy)  lab_diry,
  nb_dir 
)

Reads dimensions in gridfile (*.mesh)

Author
Ilario Mazzieri
Date
September, 2013
Version
1.0
Parameters
[in]gridfilefile name (*.mesh)
[in]nb_matnumber of blocks (materials)
[in]lab_mat(nb_mat)label for the materials
[in]nb_diriXnumber of Dirichlet boundary conditions (x-direction)
[in]lab_dirXlabel for Dirichelet boundary conditions (x-direction)
[in]nb_diriYnumber of Dirichlet boundary conditions (x-direction)
[in]nb_diriZnumber of Dirichlet boundary conditions (x-direction)
[in]lab_dirYlabel for Dirichelet boundary conditions (y-direction)
[in]lab_dirZlabel for Dirichelet boundary conditions (z-direction)
[in]nb_neuXnumber of Neumann boundary conditions (x-direction)
[in]lab_neuXlabel for Neumann boundary conditions (x-direction)
[in]nb_neuYnumber of Neumann boundary conditions (y-direction)
[in]lab_neuYlabel for Neumann boundary conditions (y-direction)
[in]nb_neuZnumber of Neumann boundary conditions (z-direction)
[in]lab_neuZlabel for Neumann boundary conditions (z-direction)
[in]nb_neuNnumber of Neumann boundary conditions (N-direction)
[in]lab_neuNlabel for Neumann boundary conditions (z-direction)
[in]nb_abcnumber of absorbing boundary conditions
[in]lab_abclabel for absorbing boundary conditions
[in]nb_dgnumber of Discontinuous Galerkin interface conditions
[in]lab_dglabel for Discontinuous Galerkin interface conditions
[in]nb_nodenunmber of grid nodes
[out]xx,yy,zzreal numbers (dummy)
[in]nb_hexanumber of hexes in the mesh
[out]con_hexamatrix connectivity for the hexes of the mesh (1-el, 2-,...,9-nodes)
[in]nb_quadnumber of quads in the mesh
[out]con_quadmatrix connectivity for the quads of the mesh (1-el, 2-,...,5-nodes)

Definition at line 51 of file READ_FILEMESH.f90.

53 nb_neux,lab_neux,nb_neuy,lab_neuy,nb_neuz,lab_neuz,&
54 nb_neun,lab_neun,&
55 nb_abc,lab_abc,&
56 nb_dg,lab_dg,&
57 nb_node,xx,yy,zz,nb_hexa,con_hexa,nb_quad,con_quad)
58
59 implicit none
60
61 character*110 :: inline
62 character*20 :: el_code
63 character*70 :: gridfile
64
65 integer*4 :: nb_mat,nb_diriX,nb_diriY,nb_diriZ,nb_neuX,nb_neuY,nb_neuZ,nb_abc,nb_dg
66 integer*4 :: nb_neuN
67 integer*4 :: nb_node,nb_hexa,nb_quad
68 integer*4 :: inode,ihexa,iquad
69 integer*4 :: nb_elem,ie,i,j,mat_code,ileft,iright,sl,trash,status,control
70
71 integer*4, dimension(nb_mat) :: lab_mat
72 integer*4, dimension(nb_diriX) :: lab_dirX
73 integer*4, dimension(nb_diriY) :: lab_dirY
74 integer*4, dimension(nb_diriZ) :: lab_dirZ
75 integer*4, dimension(nb_neuX) :: lab_neuX
76 integer*4, dimension(nb_neuY) :: lab_neuY
77 integer*4, dimension(nb_neuZ) :: lab_neuZ
78 integer*4, dimension(nb_neuN) :: lab_neuN
79 integer*4, dimension(nb_abc) :: lab_abc
80 integer*4, dimension(nb_dg) :: lab_dg
81
82 integer*4, dimension(nb_hexa,9) :: con_hexa
83 integer*4, dimension(nb_quad,5) :: con_quad
84
85 real*8 :: xx,yy,zz
86
87 inode = 0
88 ihexa = 0
89 iquad = 0
90
91 status = 0
92
93 open(40,file=gridfile)
94
95 do
96 read(40,'(A)') inline
97 if (inline(1:1) .ne. '#') exit
98 enddo
99
100 read(inline,*)nb_node,nb_elem
101
102 do i = 1,nb_node
103 read(40,*)inode,xx,yy,zz
104
105 if (inode.ne.i) then
106 status = 1
107 endif
108 enddo
109
110 do ie = 1,nb_elem
111 read(40,'(A)')inline
112
113 sl = len(inline)
114 ileft = 0
115 iright = 0
116 do i = 1,sl
117 if (inline(i:i).ge.'A') exit
118 enddo
119 ileft = i
120 do i = ileft,sl
121 if (inline(i:i).lt.'A') exit
122 enddo
123 iright = i
124
125 el_code = inline(ileft:iright)
126
127 read(inline(1:ileft),*)trash,mat_code
128
129 if ((el_code.eq.'hex').or.(el_code.eq.'HEX')) then
130 control = 0
131 do i = 1,nb_mat
132 if (lab_mat(i).eq.mat_code) control = 1
133 enddo
134 !
135 if (control.ne.0) then
136 ihexa = ihexa + 1
137 con_hexa(ihexa,1) = mat_code
138 read(inline(iright:sl),*)(con_hexa(ihexa,j),j=2,9)
139 endif
140 !
141 elseif ((el_code.eq.'quad').or.(el_code.eq.'QUAD')) then
142 control = 0
143 do i = 1,nb_dirix
144 if (lab_dirx(i).eq.mat_code) control = 1
145 enddo
146 do i = 1,nb_diriy
147 if (lab_diry(i).eq.mat_code) control = 1
148 enddo
149 do i = 1,nb_diriz
150 if (lab_dirz(i).eq.mat_code) control = 1
151 enddo
152 do i = 1,nb_neux
153 if (lab_neux(i).eq.mat_code) control = 1
154 enddo
155 do i = 1,nb_neuy
156 if (lab_neuy(i).eq.mat_code) control = 1
157 enddo
158 do i = 1,nb_neuz
159 if (lab_neuz(i).eq.mat_code) control = 1
160 enddo
161 do i = 1,nb_neun
162 if (lab_neun(i).eq.mat_code) control = 1
163 enddo
164 do i = 1,nb_abc
165 if (lab_abc(i).eq.mat_code) control = 1
166 enddo
167 do i = 1,nb_dg
168 if (lab_dg(i).eq.mat_code) control = 1
169 enddo
170
171
172 if (control .ne. 0) then
173 iquad = iquad +1
174 con_quad(iquad,1) = mat_code
175 read(inline(iright:sl),*)(con_quad(iquad,j),j=2,5)
176 endif
177
178 endif
179 enddo
180
181 close(40)
182
183 return
184

Referenced by read_input_files().

Here is the caller graph for this function: