subroutine ufconn(j,itype,lm,nnodmx) c c CONTACT: ap@marc.de c c* * * * * * c c User subroutine to enter or modify element connectivity. c c* * * * * * c* * * * * * c c Used here to read the connectivity from a MENTATII .mfd file. c The name must be: jobid_name.mfd, where jobid_name is the c name of the input file whitout the '.dat' suffix. c c The elements specified in the ufconn option must be in the c same order as their appearance in the .mfd file. The element c numbers must be consecutive and start at number 1 (one). c The node numbers must also be consecutive and start at c number 1 (one). c c* * * * * * c* * * * * * c c INPUT: j element number c nnodmx maximun number of nodes per element c OUTPUT: itype element type c lm connectivity c c* * * * * * implicit real*8 (a-h,o-z) dp c character*80 jidnam common/jname/jidnam(4),ilen(4) c character*80 line dimension lm(1) c logical is_open c c... open MENTAT .mfd file if not yet open inquire(99,opened=is_open) if (.not.is_open) then ios = 0 open(99,file = jidnam(1)(1:ilen(1))//'.mfd', * status = 'old', * form = 'formatted', * iostat = ios) if (ios.ne.0) then write(0,*) 'file: '//jidnam(1)(1:ilen(1))//'.mfd' write(0,*) 'error opening above MENTAT .mfd file from ufconn.' stop endif endif c c... position on start of elements block if (j.eq.1) then rewind(99) 10 read(99,1000,err=9990) line if (line(1:10).ne.'=beg= 202') go to 10 endif c c... read lines with element id and its connectivity read(99,1000,end=9991) line if (line(1:5).ne.'=end=') then read(line(1:20),*) jid if (jid.eq.j) then read(line(41:60),*) itype read(99,1000,end=9991) line read(99,1000,end=9991) line read(line(1:20),*) nnodes nrd = min(nnodes,3) ilm = 0 do i1=1,nrd read(line(i1*20+1:(i1+1)*20),*) lm(i1) enddo nrest = nnodes - nrd 20 if (nrest.le.0) goto 30 ilm = ilm + nrd read(99,1000,end=9991) line nrd = min(nrest,4) do i1=0,nrd-1 read(line(i1*20+1:(i1+1)*20),*) lm(ilm+i1+1) enddo nrest = nrest - nrd goto 20 30 continue c write(1,*) j,(lm(ijk),ijk=1,nnodes) else write(0,*) 'mismatch in element sequences on .dat & .mfd files' stop endif else write(0,*) 'unexpected end of elements block in MENTAT .mfd file' stop endif c return c 9990 write(0,*) 'no elements block in MENTAT .mfd file.' stop 9991 write(0,*) 'unexpected end of file in MENTAT .mfd file.' stop c 1000 format(a80) c end