12 common /nekmpi/ nidd,npp,nekcomm,nekgroup,nekreal
21 if (ifheat) nfldt = 2+npscal
22 if (ifmhd ) nfldt = 2+npscal+1
25 if (param(33).gt.0) ibc = int(param(33))
28 if (param(32).gt.0) nfldt = ibc + int(param(32)) - 1
30 call blank(cbc,3*
size(cbc))
31 call rzero(bc ,
size(bc))
34 call fgslib_crystal_setup(cr_re2,nekcomm,np)
37 call err_chk(ierr,
' Cannot open .re2 file!$')
42 call readp_re2_bc(cbc(1,1,ifield),bc(1,1,1,ifield),ifbswap)
45 call fgslib_crystal_free(cr_re2)
54 call bin_rd1_bc (cbc(1,1,ifield),bc(1,1,1,ifield),ifbswap)
61 if(nio.eq.0)
write(6,
'(A,1(1g9.2),A,/)')
62 &
' done :: read .re2 file ',
73 logical ifbswap, ifdistri
75 parameter(nrmax = lelt)
76 parameter(lrs = 1+ldim*(2**ldim))
77 parameter(li = 2*lrs+2)
79 integer bufr(li-2,nrmax)
82 integer vi (li ,nrmax)
85 integer*8 lre2off_b,dtmp8
88 if (nio.eq.0)
write(6,*)
'reading mesh '
95 lre2off_b = re2off_b + dtmp8*lrs*wdsizi
102 re2off_b = re2off_b + nrg*4*lrs4
103 if (ierr.gt.0)
goto 100
105 if (.not.ifdistri)
then
118 call icopy(vi(3,i),bufr(jj,1),lrs4)
124 call fgslib_crystal_tuple_transfer(cr_re2,n,nrmax,vi,li,vl,0,vr,0,
136 call icopy (bufr,vi(3,i),lrs4)
140 100
call err_chk(ierr,
'Error reading .re2 mesh$')
152 common /nekmpi/ nidd,npp,nekcomm,nekgroup,nekreal
154 parameter(nrmax = 12*lelt)
155 parameter(lrs = 2+1+5)
156 parameter(li = 2*lrs+1)
158 integer bufr(li-1,nrmax)
161 integer vi (li ,nrmax)
164 integer*8 lre2off_b,dtmp8
174 if(ierr.gt.0)
goto 100
178 call copy(dnrg,nrg4,1)
184 re2off_b = re2off_b + 4*nwds4r
187 if(nio.eq.0)
write(6,*)
'reading curved sides '
192 do i = 0,mod(nrg,dtmp8)-1
193 if(i.eq.nid) nr = nr + 1
197 lre2off_b = re2off_b + dtmp8*lrs*wdsizi
204 re2off_b = re2off_b + nrg*4*lrs4
205 if(ierr.gt.0)
goto 100
212 lrs4s = lrs4 - wdsizi/4
214 if(wdsizi.eq.4)
call byte_reverse (bufr(jj,1),lrs4s,ierr)
218 if(wdsizi.eq.8)
call copyi4(ielg,bufr(jj,1),1)
220 if(ielg.le.0 .or. ielg.gt.nelgt)
goto 100
223 call icopy (vi(2,i),bufr(jj,1),lrs4)
229 call fgslib_crystal_tuple_transfer(cr_re2,n,nrmax,vi,li,vl,0,vr,0,
233 if(n.gt.nrmax)
goto 100
235 call icopy (bufr,vi(2,i),lrs4)
242 call err_chk(ierr,
'Error reading .re2 curved data$')
251 character*3 cbl( 6,lelt)
255 parameter(nrmax = 6*lelt)
256 parameter(lrs = 2+1+5)
257 parameter(li = 2*lrs+1)
259 integer bufr(li-1,nrmax)
262 integer vi (li ,nrmax)
265 integer*8 lre2off_b,dtmp8
282 if(ierr.gt.0)
goto 100
286 call copy(dnrg,nrg4,1)
292 re2off_b = re2off_b + 4*nwds4r
295 if(nio.eq.0)
write(6,*)
'reading bc for ifld',ifield
300 do i = 0,mod(nrg,dtmp8)-1
301 if(i.eq.nid) nr = nr + 1
305 lre2off_b = re2off_b + dtmp8*lrs*wdsizi
312 re2off_b = re2off_b + nrg*4*lrs4
313 if(ierr.gt.0)
goto 100
320 lrs4s = lrs4 - wdsizi/4
322 if(wdsizi.eq.4)
call byte_reverse (bufr(jj,1),lrs4s,ierr)
326 if(wdsizi.eq.8)
call copyi4(ielg,bufr(jj,1),1)
328 if(ielg.le.0 .or. ielg.gt.nelgt)
goto 100
331 call icopy (vi(2,i),bufr(jj,1),lrs4)
337 call fgslib_crystal_tuple_transfer(cr_re2,n,nrmax,vi,li,vl,0,vr,0,
341 if(n.gt.nrmax)
goto 100
343 call icopy (bufr,vi(2,i),lrs4)
350 call err_chk(ierr,
'Error reading .re2 boundary data$')
361 integer e,eg,buf(0:49)
363 nwds = (1 + ldim*(2**ldim))*(wdsizi/4)
365 if (ifbswap.and.ierr.eq.0.and.wdsizi.eq.8)
then
367 elseif (ifbswap.and.ierr.eq.0.and.wdsizi.eq.4)
then
373 call copyi4(igroup(e),buf(0),1)
375 call copy (xc(1,e),buf( 2),8)
376 call copy (yc(1,e),buf(18),8)
377 call copy (zc(1,e),buf(34),8)
379 call copy (xc(1,e),buf( 2),4)
380 call copy (yc(1,e),buf(10),4)
385 call copy4r(xc(1,e),buf( 1),8)
386 call copy4r(yc(1,e),buf( 9),8)
387 call copy4r(zc(1,e),buf(17),8)
389 call copy4r(xc(1,e),buf( 1),4)
390 call copy4r(yc(1,e),buf( 5),4)
402 integer e,eg,f,buf(30)
410 call copy ( curve(1,f,e),buf(5) ,5)
411 call chcopy(ccurve( f,e),buf(15),1)
417 call copy4r( curve(1,f,e),buf(3),5)
418 call chcopy(ccurve(f,e) ,buf(8),1)
432 character*3 cbl(6,lelt)
435 integer e,eg,f,buf(30)
443 call copy (bl(1,f,e),buf(5),5)
444 call chcopy(cbl( f,e),buf(15),3)
446 if(nelt.ge.1000000.and.cbl(f,e).eq.
'P ')
447 $
call copyi4(bl(1,f,e),buf(5),1)
454 call copy4r ( bl(1,f,e),buf(3),5)
455 call chcopy (cbl( f,e),buf(8),3)
457 if (nelgt.ge.1 000 000.and.cbl(f,e).eq.
'P ')
477 if (nio.eq.0)
write(6,*)
' reading mesh '
479 nwds = (1 + ldim*(2**ldim))*(wdsizi/4)
482 if (nwds.gt.55.or.isize.gt.4)
then
483 write(6,*) nid,
' Error in bin_rd1_mesh: buf size',nwds,isize
491 if (nelgt/niop .lt. 100)
goto 10
504 if (nio.eq.0.and.mod(eg,niop).eq.0)
write(6,*) eg,
' mesh read'
506 if (mid.ne.nid.and.nid.eq.0)
then
510 call csend(e,ierr,len1,mid,0)
511 if(ierr.eq.0)
call csend(e,buf,len,mid,0)
513 call csend(e,ierr,len1,mid,0)
516 elseif (mid.eq.nid.and.nid.ne.0)
then
518 call crecv (e,ierr,len1)
520 call crecv (e,buf,len)
524 elseif (mid.eq.nid.and.nid.eq.0)
then
534 call err_chk(ierr,
'Error reading .re2 mesh. Abort. $')
548 nwds = (2 + 1 + 5)*(wdsizi/4)
551 if (nwds.gt.55.or.isize.gt.4)
then
552 write(6,*)nid,
' Error in bin_rd1_curve: buf size',nwds,isize
571 if(ncurve.ne.0)
write(6,*)
' reading curved sides '
584 if (mid.eq.0.and.ierr.eq.0)
then
588 call csend(mid,buf,len,mid,0)
604 call crecv(nid,buf,len)
606 call copyi4(ichk,buf(1),1)
607 if(ichk.eq.0)
goto 99
609 elseif (buf(1).eq.0)
then
619 call err_chk(ierr,
'Error reading .re2 curved data. Abort.$')
631 character*3 cbl(6,lelt)
637 nwds = (2 + 1 + 5)*(wdsizi/4)
640 if (nwds.gt.55.or.isize.gt.4)
then
641 write(6,*) nid,
' Error in bin_rd1_bc: buf size',nwds,isize
665 if(nbc_max.ne.0)
write(6,*)
' reading bc for ifld',ifield
680 if (mid.eq.0.and.ierr.eq.0)
then
685 call csend(mid,buf,len,mid,0)
701 nbc_max = 2*ldim*nelt
705 call crecv(nid,buf,len)
709 call copyi4(ichk,buf(1),1)
710 if(ichk.eq.0)
goto 99
712 elseif (buf(1).eq.0)
then
723 call err_chk(ierr,
'Error reading boundary data for re2. Abort.$')
741 if(wdsizi.eq.8)
call csend(mid,rzero,len,mid,0)
742 if(wdsizi.eq.4)
call csend(mid, zero,len,mid,0)
763 if(wdsizi.eq.8)
call csend(mid,rzero,len,mid,0)
764 if(wdsizi.eq.4)
call csend(mid, zero,len,mid,0)
776 logical ifbswap, ifverbose
777 logical if_byte_swap_test
781 equivalence(fname,fnami)
792 if (ifverbose)
write(6,
'(A,A)')
' Reading ', re2fle
794 m =
indx2(re2fle,132,
' ',1)-1
795 call chcopy(fname,re2fle,m)
797 inquire(
file=fname, exist=iffound)
798 if(.not.iffound) ierr = 1
800 call err_chk(ierr,
' Cannot find re2 file!$')
804 if(ierr.ne.0)
goto 100
806 if(ierr.ne.0)
goto 100
808 read (hdr,1) version,nelgt,ldimr,nelgv
809 1
format(a5,i9,i3,i9)
812 if(version.eq.
'#v002') wdsizi = 8
813 if(version.eq.
'#v003')
then
819 if(ierr.ne.0)
goto 100
820 ifbswap = if_byte_swap_test(test,ierr)
821 if(ierr.ne.0)
goto 100
826 100
call err_chk(ierr,
'Error reading re2 header$')
828 call bcast(wdsizi, isize)
829 call bcast(ifbswap,lsize)
830 call bcast(nelgv ,isize)
831 call bcast(nelgt ,isize)
832 call bcast(ldimr ,isize)
833 call bcast(param(32),wdsize)
835 if(wdsize.eq.4.and.wdsizi.eq.8)
836 $
call exitti(
'wdsize=4 & wdsizi(re2)=8 not compatible$',wdsizi)
subroutine byte_open_mpi(fnamei, mpi_fh, ifro, ierr)
subroutine byte_read_mpi(buf, icount, iorank, mpi_fh, ierr)
subroutine byte_close_mpi(mpi_fh, ierr)
subroutine byte_set_view(ioff_in, mpi_fh)
function igl_running_sum(in)
subroutine crecv(mtype, buf, lenm)
subroutine exitti(stringi, idata)
subroutine csend(mtype, buf, len, jnid, jpid)
subroutine bcast(buf, len)
subroutine err_chk(ierr, string)
real *8 function dnekclock_sync()
integer function gllel(ieg)
integer function gllnid(ieg)
integer function indx2(s1, l1, s2, l2)
subroutine icopy(a, b, n)
subroutine copyi4(a, b, n)
subroutine chcopy(a, b, n)
subroutine copy4r(a, b, n)
subroutine bin_rd1_curve(ifbswap)
subroutine buf_close_outv
subroutine read_re2_hdr(ifbswap, ifverbose)
subroutine bin_rd1_mesh(ifbswap)
subroutine buf_to_bc(cbl, bl, buf)
subroutine buf_to_xyz(buf, e, ifbswap, ierr)
subroutine buf_to_curve(buf)
subroutine readp_re2_mesh(ifbswap, ifdistri)
subroutine readp_re2_bc(cbl, bl, ifbswap)
subroutine bin_rd1_bc(cbl, bl, ifbswap)
subroutine readp_re2_curve(ifbswap)
subroutine read_re2_data(ifbswap)