34 2 STFN ,XYZM ,NSV ,II_STOK ,
36 4 VOXEL ,NBX ,NBY ,NBZ ,NRTM ,
37 5 GAP_S ,GAP_M ,MARGE ,
38 6 NBINFLG,MBINFLG ,ILEV ,MSEGTYP ,
39 7 IGAP ,GAP_S_L ,GAP_M_L,EDGE_L2 ,LEDGMAX ,
41 9 IPARTS ,NPARTNS ,LPARTNS ,IELEM ,ICODE ,
42 A ISKEW ,DRAD, IS_LARGE_NODE, LARGE_NODE ,
43 B NB_LARGE_NODES,DGAPLOAD,NRTMT,FLAG_REMOVED_NODE,
44 C IELEM_M,LOCAL_NEXT_NOD,IIX,IIY,IIZ,
45 D intbuf_tab,ipari,nin)
55#include "implicit_f.inc"
62 parameter(nvecsz = mvsiz)
102 INTEGER ESHIFT,,NRTM,IGAP,
105 . IRECT(4,*), VOXEL(NBX+2,NBY+2,NBZ+2),II_STOK,
106 . NBINFLG(*),MBINFLG(*),ILEV,MSEGTYP(*),
107 . KREMNODE(*),REMNODE(*),
108 . IPARTS(*), (*), LPARTNS(*), ICODE(*), ISKEW(*)
109 LOGICAL,
INTENT(in) :: FLAG_REMOVED_NODE
112 . (3,*),XYZM(6),STFN(*),GAP_S(*),GAP_M(*),
113 . GAP_S_L(*),GAP_M_L(*), EDGE_L2(*)
115 . ledgmax, marge, bgapsmx
116 my_real ,
INTENT(IN) :: drad, dgapload
117 INTEGER :: LARGE_NODE(NSN)
119 INTEGER :: NB_LARGE_NODES
120 INTEGER ,
INTENT(IN) :: NRTMT
121 INTEGER ,
INTENT(IN) :: IELEM_M(2,NRTM), IELEM(NRTM)
122 integer,
intent(in) :: nin
123 INTEGER,
dimension(nsn),
intent(inout) :: IIX,IIY,IIZ,LOCAL_NEXT_NOD
124 integer,
dimension(npari),
intent(inout) :: ipari
125 type(intbuf_struct_),
intent(inout) :: intbuf_tab
130 . nn,ne,k,l,j_stok,jj,
131 . prov_n(mvsiz),prov_e(mvsiz),
135 . xs,ys,zs,sx,sy,sz,s2,
136 . xmin, xmax,ymin,
ymax,zmin, zmax,
137 . xx1,xx2,xx3,xx4,yy1,yy2,yy3,yy4,zz1,zz2,zz3,zz4,
138 . d1x,d1y,d1z,d2x,d2y,d2z,dd1,dd2,d2,a2
140 INTEGER,
DIMENSION(:),
ALLOCATABLE :: LAST_NOD
141 INTEGER IX,IY,IZ,M1,M2,M3,M4,
142 . ix1,iy1,iz1,ix2,iy2,iz2
144 . xminb,yminb,zminb,xmaxb,ymaxb,zmaxb,
145 . xmine,ymine,zmine,xmaxe,ymaxe,zmaxe,aaa
147 INTEGER,
DIMENSION(:),
ALLOCATABLE :: TAGNOD
149 integer ,
external :: omp_get_thread_num,omp_get_num_threads
150 integer :: itask,nthreads
151 integer :: my_old_size,my_address
152 integer :: local_i_stok,multimp
153 integer :: local_cand_n_size,local_cand_e_size
155 integer,
dimension(:),
allocatable,
save :: cand_n_size,cand_e_size
156 integer,
dimension(:),
allocatable,
save :: address_cand_n,address_cand_e
157 type(array_type_int_1d) :: local_cand_n
158 type(array_type_int_1d) :: local_cand_e
160 integer :: my_size,mode
161 integer,
dimension(:),
allocatable :: my_index
162 integer,
dimension(:,:),
allocatable :: sort_array,save_array
163 integer,
dimension(70000) :: work
166 itask = omp_get_thread_num()
167 nthreads = omp_get_num_threads()
168 local_cand_n_size =
size(intbuf_tab%cand_n) / nthreads + 1
169 local_cand_e_size =
size(intbuf_tab%cand_e) / nthreads + 1
171 local_cand_n%size_int_array_1d = local_cand_n_size
172 local_cand_e%size_int_array_1d = local_cand_e_size
191 allocate( cand_n_size(nthreads+1),cand_e_size(nthreads+1) )
192 allocate( address_cand_n(nthreads+1),address_cand_e(nthreads+1) )
193 cand_n_size(1:nthreads+1) = 0
194 cand_e_size(1:nthreads+1) = 0
195 address_cand_n(1:nthreads+1) = 0
196 address_cand_e(1:nthreads+1) = 0
197 ALLOCATE(last_nod(nsn))
209 IF(stfn(i) == zero)cycle
213 IF(x(1,j) < xmin) cycle
214 IF(x(1,j) > xmax) cycle
215 IF(x(2,j) < ymin) cycle
216 IF(x(2,j) >
ymax) cycle
217 IF(x(3,j) < zmin) cycle
218 IF(x(3,j) > zmax) cycle
220 iix(i)=int(nbx*(x(1,j)-xminb)/(xmaxb-xminb))
221 iiy(i)=int(nby*(x(2,j)-yminb)/(ymaxb-yminb))
222 iiz(i)=int(nbz*(x(3,j)-zminb)/(zmaxb-zminb))
224 iix(i)=
max(1,2+
min(nbx,iix(i)))
225 iiy(i)=
max(1,2+
min(nby,iiy(i)))
226 iiz(i)=
max(1,2+
min(nbz,iiz(i)))
228 first = voxel(iix(i),iiy(i),iiz(i))
231 voxel(iix(i),iiy(i),iiz(i)) = i
232 local_next_nod(i) = 0
234 ELSEIF(last_nod(first) == 0)
THEN
237 local_next_nod(first) = i
239 local_next_nod(i) = 0
243 last = last_nod(first)
244 local_next_nod(last) = i
246 local_next_nod(i) = 0
257 ALLOCATE( tagnod(numnod) )
263 IF(ielem_m(2,ne) /=0) cycle
274 IF(flag_removed_node)
THEN
278 tagnod(remnode(m)) = 1
282 IF (msegtyp(ne)==0 .OR. msegtyp(ne)>nrtmt)
THEN
284 aaa =
max(marge+
max(bgapsmx+gap_m(ne)+dgapload,drad),ledgmax+bgapsmx+gap_m(ne)+dgapload)
286 aaa = marge+
max(bgapsmx+gap_m(ne)+dgapload,drad)
294 xmaxe=
max(xx1,xx2,xx3,xx4)
295 xmine=
min(xx1,xx2,xx3,xx4)
301 ymaxe=
max(yy1,yy2,yy3,yy4)
302 ymine=
min(yy1,yy2,yy3,yy4)
308 zmaxe=
max(zz1,zz2,zz3,zz4)
309 zmine=
min(zz1,zz2,zz3,zz4)
314 sx = (yy3-yy1)*(zz4-zz2) - (zz3-zz1)*(yy4-yy2)
315 sy = (zz3-zz1)*(xx4-xx2) - (xx3-xx1)*(zz4-zz2)
316 sz = (xx3-xx1)*(yy4-yy2) - (yy3
317 s2 = sx*sx + sy*sy + sz*sz
321 ix1=int(nbx*(xmine-aaa-xminb)/(xmaxb-xminb))
322 iy1=int(nby*(ymine-aaa-yminb)/(ymaxb-yminb))
323 iz1=int(nbz*(zmine-aaa-zminb)/(zmaxb-zminb))
329 ix2=int(nbx*(xmaxe+aaa-xminb)/(xmaxb-xminb))
330 iy2=int(nby*(ymaxe+aaa-yminb)/(ymaxb-yminb))
331 iz2=int(nbz*(zmaxe+aaa-zminb)/(zmaxb-zminb))
337 IF (msegtyp(ne)==0 .OR. msegtyp(ne)>nrtmt)
THEN
340 DO i = 1, nb_large_nodes
347 IF(tagnod(nn) == 1)
GOTO 400
357 aaa =
max(marge+
max(gap_s(jj)+gap_m(ne)+dgapload,drad)+dgapload,edge_l2(jj)+gap_s(jj)+gap_m(ne)+dgapload)
358 IF(xs<=xmine-aaa)
GOTO 400
359 IF(xs>=xmaxe+aaa)
GOTO 400
360 IF(ys<=ymine-aaa)
GOTO 400
361 IF(ys>=ymaxe+aaa)
GOTO 400
362 IF(zs<=zmine-aaa)
GOTO 400
363 IF(zs>=zmaxe+aaa)
GOTO 400
369 DO j=npartns(jj)+1,npartns(jj+1)
370 IF(lpartns(j)==ipm
THEN
374 IF(ipm==ips)
GOTO 400
383 dd1 = d1x*sx+d1y*sy+d1z*sz
384 dd2 = d2x*sx+d2y*sy+d2z*sz
385 IF(dd1*dd2 > zero)
THEN
386 d2 =
min(dd1*dd1,dd2*dd2)
393 IF(j_stok == nvsiz)
THEN
395 1 nvsiz ,irect ,x ,nsv ,local_i_stok,
396 2 local_cand_n,local_cand_e ,marge ,
397 3 prov_n ,prov_e,eshift,nsn ,
398 4 nrtm ,gap_s ,gap_m ,nbinflg ,mbinflg,
399 5 ilev,msegtyp,igap ,gap_s_l,
400 6 gap_m_l,edge_l2,icode,iskew,drad ,
425 IF(tagnod(nn) == 1)
GOTO 300
435 IF (msegtyp(ne)==0 .OR. msegtyp(ne)>nrtmt)
THEN
436 IF(is_large_node(jj)==1)
GOTO 300
438 aaa =
max(marge+
max(gap_s(jj)+gap_m(ne)+dgapload,drad),edge_l2(jj)+gap_s(jj)+gap_m(ne)+dgapload)
440 aaa = marge+
max(gap_s(jj)+gap_m(ne)+dgapload,drad)
443 IF(xs<=xmine-aaa)
GOTO 300
444 IF(xs>=xmaxe+aaa)
GOTO 300
445 IF(ys<=ymine-aaa)
GOTO 300
446 IF(ys>=ymaxe+aaa)
GOTO 300
447 IF(zs<=zmine-aaa)
GOTO 300
448 IF(zs>=zmaxe+aaa)
GOTO 300
454 DO j=npartns(jj)+1,npartns(jj+1)
455 IF(lpartns(j)==ipm)
THEN
460 IF(ipm==ips)
GOTO 300
474 dd1 = d1x*sx+d1y*sy+d1z*sz
475 dd2 = d2x*sx+d2y*sy+d2z*sz
476 IF(dd1*dd2 > zero)
THEN
477 d2 =
min(dd1*dd1,dd2*dd2)
485 IF(j_stok == nvsiz)
THEN
488 1 nvsiz ,irect ,x ,nsv ,local_i_stok,
489 2 local_cand_n,local_cand_e ,marge ,
490 3 prov_n ,prov_e,eshift,nsn ,
491 4 nrtm ,gap_s ,gap_m ,nbinflg ,mbinflg,
492 5 ilev,msegtyp,igap ,gap_s_l,
493 6 gap_m_l,edge_l2,icode,iskew,drad ,
500 jj = local_next_nod(jj)
508 IF(flag_removed_node)
THEN
512 tagnod(remnode(m)) = 0
525 2 local_cand_n,local_cand_e ,marge ,
526 3 prov_n ,prov_e,eshift,nsn ,
527 4 nrtm ,gap_s ,gap_m ,nbinflg ,mbinflg,
534 cand_n_size(itask+1) = local_i_stok
535 cand_e_size(itask+1) = local_i_stok
540 address_cand_n(1) = 0
541 address_cand_e(1) = 0
544 address_cand_n(i+1) = cand_n_size(i) + address_cand_n(i)
545 address_cand_e(i+1) = cand_e_size(i) + address_cand_e(i)
547 cand_n_size(nthreads+1) = cand_n_size(nthreads+1) + cand_n_size(i)
548 cand_e_size(nthreads+1) = cand_e_size(nthreads+1) + cand_e_size(i)
554 my_old_size = ipari(18)*ipari(23)
555 if(cand_n_size(nthreads+1) > my_old_size)
then
556 multimp = cand_n_size(nthreads+1)/ipari(18) + 1
559 ii_stok = cand_n_size(nthreads+1)
564 my_address = address_cand_n(itask+1)
565 intbuf_tab%cand_n(my_address+1:my_address+local_i_stok) = local_cand_n%int_array_1d(1:local_i_stok)
566 my_address = address_cand_e(itask+1)
567 intbuf_tab%cand_e(my_address+1:my_address+local_i_stok) = local_cand_e%int_array_1d(1:local_i_stok
581 my_size = cand_n_size(nthreads+1)
582 allocate(my_index(2*my_size))
583 allocate(sort_array(2,my_size))
584 allocate(save_array(2,my_size))
586 my_address = address_cand_n(1)
587 sort_array(1,1:my_size) = intbuf_tab%cand_n(my_address+1:my_address+my_size)
588 my_address = address_cand_e(1)
589 sort_array(2,1:my_size) = intbuf_tab%cand_e(my_address+1:my_address+my_size)
593 save_array(1:2,1:my_size) = sort_array(1:2,1:my_size)
596 call my_orders( mode,work,sort_array,my_index,my_size,2)
597 my_address = address_cand_n(1)
599 intbuf_tab%cand_n(my_address+i) = save_array(1,my_index(i))
601 my_address = address_cand_e(1)
603 intbuf_tab%cand_e(my_address+i) = save_array(2,my_index(i))
606 deallocate(sort_array)
607 deallocate(save_array)
615 voxel(iix(i),iiy(i),iiz(i))=0
622 deallocate( cand_n_size,cand_e_size )
623 deallocate( address_cand_n,address_cand_e )
subroutine i25trivox1(nsn, irect, x, stfn, xyzm, nsv, ii_stok, eshift, bgapsmx, voxel, nbx, nby, nbz, nrtm, gap_s, gap_m, marge, nbinflg, mbinflg, ilev, msegtyp, igap, gap_s_l, gap_m_l, edge_l2, ledgmax, kremnode, remnode, iparts, npartns, lpartns, ielem, icode, iskew, drad, is_large_node, large_node, nb_large_nodes, dgapload, nrtmt, flag_removed_node, ielem_m, local_next_nod, iix, iiy, iiz, intbuf_tab, ipari, nin)