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)
101 INTEGER ESHIFT,NSN,NRTM,IGAP,
104 . IRECT(4,*), VOXEL(NBX+2,NBY+2,NBZ+2),II_STOK,
105 . NBINFLG(*),MBINFLG(*),ILEV,MSEGTYP(*),
106 . KREMNODE(*),REMNODE(*),
107 . IPARTS(*), NPARTNS(*), LPARTNS(*), ICODE(*), ISKEW(*)
108 LOGICAL,
INTENT(in) :: FLAG_REMOVED_NODE
111 . X(3,*),XYZM(6),STFN(*),(*),GAP_M(*),
112 . GAP_S_L(*),GAP_M_L(*), EDGE_L2(*)
114 . ledgmax, marge, bgapsmx
115 my_real ,
INTENT(IN) :: drad, dgapload
116 INTEGER :: LARGE_NODE(NSN)
117 INTEGER :: IS_LARGE_NODE(NSN)
118 INTEGER :: NB_LARGE_NODES
119 INTEGER ,
INTENT(IN) :: NRTMT
120 INTEGER ,
INTENT(IN) :: IELEM_M(2,NRTM), IELEM(NRTM)
121 integer,
intent(in) :: nin
122 INTEGER,
dimension(nsn),
intent(inout) :: IIX,IIY,IIZ,LOCAL_NEXT_NOD
123 integer,
dimension(npari),
intent(inout) :: ipari
124 type(intbuf_struct_),
intent(inout) :: intbuf_tab
129 . nn,ne,k,l,j_stok,jj,
130 . prov_n(mvsiz),prov_e(mvsiz),
134 . xs,ys,zs,sx,sy,sz,s2,
135 . xmin, xmax,ymin,
ymax,zmin, zmax,
136 . xx1,xx2,xx3,xx4,yy1,yy2,yy3,yy4,zz1,zz2,zz3,zz4,
137 . d1x,d1y,d1z,d2x,d2y,d2z,dd1,dd2,d2,a2
139 INTEGER,
DIMENSION(:),
ALLOCATABLE
140INTEGER IX,IY,IZ,M1,M2,M3,M4,
141 . ix1,iy1,iz1,ix2,iy2,iz2
143 . xminb,yminb,zminb,xmaxb,ymaxb,zmaxb,
144 . xmine,ymine,zmine,xmaxe,ymaxe,zmaxe,aaa
146 INTEGER,
DIMENSION(:),
ALLOCATABLE :: TAGNOD
148 integer ,
external :: omp_get_thread_num,omp_get_num_threads
149 integer :: itask,nthreads
150 integer :: my_old_size,my_address
151 integer :: local_i_stok,multimp
152 integer :: local_cand_n_size,local_cand_e_size
154 integer,
dimension(:),
allocatable,
save :: cand_n_size,cand_e_size
155 integer,
dimension(:),
allocatable,
save :: address_cand_n,address_cand_e
156 type(array_type_int_1d) :: local_cand_n
157 type(array_type_int_1d) :: local_cand_e
159 integer :: my_size,mode
160 integer,
dimension(:),
allocatable :: my_index
161 integer,
dimension(:,:),
allocatable :: sort_array,save_array
162 integer,
dimension(70000) :: work
165 itask = omp_get_thread_num()
166 nthreads = omp_get_num_threads()
167 local_cand_n_size =
size(intbuf_tab%cand_n) / nthreads + 1
168 local_cand_e_size =
size(intbuf_tab%cand_e) / nthreads + 1
170 local_cand_n%size_int_array_1d = local_cand_n_size
171 local_cand_e%size_int_array_1d = local_cand_e_size
190 allocate( cand_n_size(nthreads+1),cand_e_size(nthreads+1) )
191 allocate( address_cand_n(nthreads+1),address_cand_e(nthreads+1) )
192 cand_n_size(1:nthreads+1) = 0
193 cand_e_size(1:nthreads+1) = 0
194 address_cand_n(1:nthreads+1) = 0
195 address_cand_e(1:nthreads+1) = 0
196 ALLOCATE(last_nod(nsn))
208 IF(stfn(i) == zero)cycle
212 IF(x(1,j) < xmin) cycle
213 IF(x(1,j) > xmax) cycle
214 IF(x(2,j) < ymin) cycle
215 IF(x(2,j) >
ymax) cycle
216 IF(x(3,j) < zmin) cycle
217 IF(x(3,j) > zmax) cycle
219 iix(i)=int(nbx*(x(1,j)-xminb)/(xmaxb-xminb
220 iiy(i)=int(nby*(x(2,j)-yminb)/(ymaxb-yminb))
221 iiz(i)=int(nbz*(x(3,j)-zminb)/(zmaxb-zminb))
223 iix(i)=
max(1,2+
min(nbx,iix(i)))
224 iiy(i)=
max(1,2+
min(nby,iiy(i)))
225 iiz(i)=
max(1,2+
min(nbz,iiz(i)))
227 first = voxel(iix(i),iiy(i),iiz(i))
230 voxel(iix(i),iiy(i),iiz(i)) = i
231 local_next_nod(i) = 0
233 ELSEIF(last_nod(first) == 0)
THEN
236 local_next_nod(first) = i
238 local_next_nod(i) = 0
242 last = last_nod(first)
243 local_next_nod(last) = i
245 local_next_nod(i) = 0
256 ALLOCATE( tagnod(numnod) )
262 IF(ielem_m(2,ne) /=0) cycle
273 IF(flag_removed_node)
THEN
277 tagnod(remnode(m)) = 1
281 IF (msegtyp(ne)==0 .OR. msegtyp(ne)>nrtmt)
THEN
283 aaa =
max(marge+
max(bgapsmx+gap_m(ne)+dgapload,drad),ledgmax+bgapsmx+gap_m(ne)+dgapload)
285 aaa = marge+
max(bgapsmx+gap_m(ne)+dgapload,drad)
293 xmaxe=
max(xx1,xx2,xx3,xx4)
294 xmine=
min(xx1,xx2,xx3,xx4)
300 ymaxe=
max(yy1,yy2,yy3,yy4)
301 ymine=
min(yy1,yy2,yy3,yy4)
307 zmaxe=
max(zz1,zz2,zz3,zz4)
308 zmine=
min(zz1,zz2,zz3,zz4)
313 sx = (yy3-yy1)*(zz4-zz2) - (zz3-zz1)*(yy4-yy2)
314 sy = (zz3-zz1)*(xx4-xx2) - (xx3-xx1)*(zz4-zz2)
315 sz = (xx3-xx1)*(yy4-yy2) - (yy3-yy1)*(xx4-xx2)
316 s2 = sx*sx + sy*sy + sz*sz
320 ix1=int(nbx*(xmine-aaa-xminb)/(xmaxb-xminb))
321 iy1=int(nby*(ymine-aaa-yminb)/(ymaxb-yminb))
322 iz1=int(nbz*(zmine-aaa-zminb)/(zmaxb-zminb))
328 ix2=int(nbx*(xmaxe+aaa-xminb)/(xmaxb-xminb))
329 iy2=int(nby*(ymaxe+aaa-yminb)/(ymaxb-yminb))
330 iz2=int(nbz*(zmaxe+aaa-zminb)/(zmaxb-zminb))
336 IF (msegtyp(ne)==0 .OR. msegtyp(ne)>nrtmt)
THEN
339 DO i = 1, nb_large_nodes
346 IF(tagnod(nn) == 1)
GOTO 400
356 aaa =
max(marge+
max(gap_s(jj)+gap_m(ne)+dgapload,drad)+dgapload,edge_l2(jj)+gap_s(jj)+gap_m(ne)+dgapload)
357 IF(xs<=xmine-aaa)
GOTO 400
358 IF(xs>=xmaxe+aaa)
GOTO 400
359 IF(ys<=ymine-aaa)
GOTO 400
360 IF(ys>=ymaxe+aaa)
GOTO 400
361 IF(zs<=zmine-aaa)
GOTO 400
362 IF(zs>=zmaxe+aaa)
GOTO 400
368 DO j=npartns(jj)+1,npartns(jj+1)
369 IF(lpartns(j)==ipm)
THEN
373 IF(ipm==ips)
GOTO 400
382 dd1 = d1x*sx+d1y*sy+d1z*sz
383 dd2 = d2x*sx+d2y*sy+d2z*sz
384 IF(dd1*dd2 > zero)
THEN
385 d2 =
min(dd1*dd1,dd2*dd2)
392 IF(j_stok == nvsiz)
THEN
394 1 nvsiz ,irect ,x ,nsv ,local_i_stok,
395 2 local_cand_n,local_cand_e ,marge ,
396 3 prov_n ,prov_e,eshift,nsn ,
397 4 nrtm ,gap_s ,gap_m ,nbinflg ,mbinflg,
398 5 ilev,msegtyp,igap ,gap_s_l,
399 6 gap_m_l,edge_l2,icode,iskew,drad ,
424 IF(tagnod(nn) == 1)
GOTO 300
434 IF (msegtyp(ne)==0 .OR. msegtyp(ne)>nrtmt)
THEN
435 IF(is_large_node(jj)==1)
GOTO 300
436 ! ledgmax /=0 <=> inacti=5 or -1 and iddlevel=1
437 aaa =
max(marge+
max(gap_s(jj)+gap_m(ne)+dgapload,drad),edge_l2(jj)+gap_s(jj)+gap_m(ne)+dgapload)
439 aaa = marge+
max(gap_s(jj)+gap_m(ne)+dgapload,drad)
442 IF(xs<=xmine-aaa)
GOTO 300
443 IF(xs>=xmaxe+aaa)
GOTO 300
444 IF(ys<=ymine-aaa)
GOTO 300
445 IF(ys>=ymaxe+aaa)
GOTO 300
446 IF(zs<=zmine-aaa)
GOTO 300
447 IF(zs>=zmaxe+aaa)
GOTO 300
453 DO j=npartns(jj)+1,npartns(jj+1)
454 IF(lpartns(j)==ipm)
THEN
459 IF(ipm==ips)
GOTO 300
473 dd1 = d1x*sx+d1y*sy+d1z*sz
474 dd2 = d2x*sx+d2y*sy+d2z*sz
475 IF(dd1*dd2 > zero)
THEN
476 d2 =
min(dd1*dd1,dd2*dd2)
484 IF(j_stok == nvsiz)
THEN
487 1 nvsiz ,irect ,x ,nsv ,local_i_stok,
488 2 local_cand_n,local_cand_e ,marge ,
489 3 prov_n ,prov_e,eshift,nsn ,
490 4 nrtm ,gap_s ,gap_m ,nbinflg ,mbinflg,
491 5 ilev,msegtyp,igap ,gap_s_l,
492 6 gap_m_l,edge_l2,icode,iskew,drad ,
499 jj = local_next_nod(jj)
507 IF(flag_removed_node)
THEN
511 tagnod(remnode(m)) = 0
523 1 j_stok,irect ,x ,nsv ,local_i_stok,
524 2 local_cand_n,local_cand_e ,marge ,
525 3 prov_n ,prov_e,eshift,nsn ,
526 4 nrtm ,gap_s ,gap_m ,nbinflg ,mbinflg,
527 5 ilev,msegtyp,igap ,gap_s_l,
528 6 gap_m_l,edge_l2,icode,iskew,drad ,
533 cand_n_size(itask+1) = local_i_stok
534 cand_e_size(itask+1) = local_i_stok
539 address_cand_n(1) = 0
540 address_cand_e(1) = 0
543 address_cand_n(i+1) = cand_n_size(i) + address_cand_n(i)
544 address_cand_e(i+1) = cand_e_size(i) + address_cand_e(i)
546 cand_n_size(nthreads+1) = cand_n_size(nthreads+1) + cand_n_size(i)
547 cand_e_size(nthreads+1) = cand_e_size(nthreads+1) + cand_e_size(i)
553 my_old_size = ipari(18)*ipari(23)
554 if(cand_n_size(nthreads+1) > my_old_size)
then
555 multimp = cand_n_size(nthreads+1)/ipari(18) + 1
558 ii_stok = cand_n_size(nthreads+1)
563 my_address = address_cand_n(itask+1)
564 intbuf_tab%cand_n(my_address+1:my_address+local_i_stok) = local_cand_n%int_array_1d(1:local_i_stok)
565 my_address = address_cand_e(itask+1)
566 intbuf_tab%cand_e(my_address+1:my_address+local_i_stok) = local_cand_e%int_array_1d(1:local_i_stok)
580 my_size = cand_n_size(nthreads+1)
581 allocate(my_index(2*my_size))
582 allocate(sort_array(2,my_size))
583 allocate(save_array(2,my_size))
585 my_address = address_cand_n(1)
586 sort_array(1,1:my_size) = intbuf_tab%cand_n(my_address+1:my_address+my_size)
587 my_address = address_cand_e(1)
588 sort_array(2,1:my_size) = intbuf_tab%cand_e(my_address+1:my_address+my_size)
592 save_array(1:2,1:my_size) = sort_array(1:2,1:my_size)
595 call my_orders( mode,work,sort_array,my_index,my_size,2)
596 my_address = address_cand_n(1)
598 intbuf_tab%cand_n(my_address+i) = save_array(1,my_index(i))
600 my_address = address_cand_e(1)
602 intbuf_tab%cand_e(my_address+i) = save_array(2,my_index(i))
605 deallocate(sort_array)
606 deallocate(save_array)
614 voxel(iix(i),iiy(i),iiz(i))=0
621 deallocate( cand_n_size,cand_e_size )
622 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)