28       logical nodesonaxis,cylindrical,replace,left,right,multistage
    31       character*20 labmpc(*)
    32       character*81 set(*),leftset,rightset,tieset(3,*),temp,indepties,
    35       integer istartset(*),iendset(*),ialset(*),ipompc(*),nodempc(3,*),
    36      &     nset,i,j,k,nk,nmpc,nmpc_,mpcfree,ics(*),l,ikmpc(*),ilmpc(*),
    37      &     lcs(*),kflag,ncsnodes,ncs_,mcs,ntie,nrcg(*),nzcg(*),jcs(*),
    38      &     kontri(3,*),ne,ipkon(*),kon(*),ifacetet(*),inodface(*),
    39      &     nodel(5),noder(5),nkon,indexe,nope,ipos,nelem,
    40      &     indcs, node_cycle,itemp(5),nx(*),ny(*),netri,noder0,
    41      &     nodef(8),nterms,kseg,k2,ndir,idof,number,id,mpcfreeold,
    42      &     lathyp(3,6),inum,ier
    49       real*8 tolloc,co(3,* ),coefmpc(*),xind(*),yind(*),xind0(*),
    50      &     yind0(*),dd,xap,yap,zap,tietol(3,*),cs(17,*),xp,yp,
    51      &     phi,rcscg(*),rcs0cg(*),zcscg(*),zcs0cg(*),zp,rp,
    52      &     straight(9,*),t(3,3),csab(7),ratio(8),tinv(3,3),
    53      &     coord(3),node(3),t2d(3,3),phi0,al(3,3),ar(3,3),
    54      &     rind, dxmax, dxmin, drmax, drmin, pi,phi_min
    56       data lathyp /1,2,3,1,3,2,2,1,3,2,3,1,3,1,2,3,2,1/
    64          if (tieset(1,i)(81:81).eq.
'M') 
then    65             tieset(1,i)(81:81)=
' '    84             if (tietol(1,i).eq.-1.d0) 
then    87      &           
'*INFO in multistages: no tolerance was defined'    88                write(*,*) 
'      in the *TIE option; a tolerance of ',
    90                write(*,*) 
'      will be used'    99                if(leftset.eq.set(j)) 
then   100                   nodel(1)=ialset(istartset(j))
   102                elseif(rightset.eq.set(j)) 
then   103                   noder(1)=ialset(istartset(j))
   115                if(indexe.lt.0) cycle
   119                if(lakon(k)(1:5).eq.
'C3D8I') 
then   121                elseif(lakon(k)(4:4).eq.
'2') 
then   123                elseif(lakon(k)(4:4).eq.
'8') 
then   125                elseif(lakon(k)(4:5).eq.
'10') 
then   127                elseif(lakon(k)(4:4).eq.
'4') 
then   129                elseif(lakon(k)(4:5).eq.
'15') 
then   131                elseif(lakon(k)(4:4).eq.
'6') 
then   133                elseif(lakon(k)(1:2).eq.
'ES') 
then   134                   read(lakon(k)(8:8),
'(i1)') nope
   138                do l=indexe+1,indexe+nope
   140                      if(nodel(1).eq.kon(l))
then   146                      if(noder(1).eq.kon(l))
then   151                    if(left.and.right) 
exit loop
   181                do l=istartset(int(cs(13,j))),iendset(int(cs(13,j)))
   182                   if (ialset(l).eq.nodel(3)) 
then   185                   elseif (ialset(l).eq.noder(3)) 
then   202             if (nodel(4).ge.noder(4)) 
then   204                phi0=(2.d0*pi)/nodel(4)
   215                phi0=(2.d0*pi)/noder(4)
   220             indepties=tieset(3,int(cs(17,indcs)))
   222             ipos=index(indepties,
' ')
   223             indepties(ipos:ipos)=
'S'   224             indeptiet(ipos:ipos)=
'T'   226                if(indepties.eq.set(j)) 
then   230                   node_cycle=ialset(istartset(j))
   232                elseif(indeptiet.eq.set(j)) 
then   236                   nelem=int(ialset(istartset(j))/10)
   237                   node_cycle=kon(ipkon(nelem)+1)
   250             t(1,1)=csab(4)-csab(1)
   251             t(1,2)=csab(5)-csab(2)
   252             t(1,3)=csab(6)-csab(3)
   253             dd=dsqrt(t(1,1)*t(1,1)+t(1,2)*t(1,2)+t(1,3)*t(1,3))
   261             xap=co(1,node_cycle)-csab(1)
   262             yap=co(2,node_cycle)-csab(2)
   263             zap=co(3,node_cycle)-csab(3)
   265             zp=xap*t(1,1)+yap*t(1,2)+zap*t(1,3)
   266             rp=((xap-t(1,1)*zp)**2+(yap-zp*t(1,2))**2+
   267      &               (zap-zp*t(1,3))**2)
   272             if(rp.gt.1.d-10) 
then   273                t(2,1)=(xap-zp*t(1,1))/rp
   274                t(2,2)=(yap-zp*t(1,2))/rp
   275                t(2,3)=(zap-zp*t(1,3))/rp
   276                t(3,1)=t(1,2)*t(2,3)-t(2,2)*t(1,3)
   277                t(3,2)=t(2,1)*t(1,3)-t(1,1)*t(2,3)
   278                t(3,3)=t(1,1)*t(2,2)-t(2,1)*t(1,2)
   289             do j=istartset(noder(2)),iendset(noder(2))
   291                node(1)=co(1,ialset(j))-csab(1)
   292                node(2)=co(2,ialset(j))-csab(2)
   293                node(3)=co(3,ialset(j))-csab(3)
   294                call mprod(t,node,coord,3)
   302                rind=dsqrt(coord(2)**2+coord(3)**2)
   303                phi=datan2(-coord(3),coord(2))
   305                   dxmax=
max(dxmax,dabs(coord(1)))
   306                   drmax=
max(drmax,dabs(rind))
   308                   dxmin=
min(dxmin,dabs(coord(1)))
   309                   drmin=
min(drmin,dabs(rind))
   310                   phi_min=
min(phi_min,phi)
   321             if ((dxmax-dxmin).ge.(drmax-drmin)) 
then   323                do j=istartset(noder(2)),iendset(noder(2))
   325                   node(1)=co(1,ialset(j))-csab(1)
   326                   node(2)=co(2,ialset(j))-csab(2)
   327                   node(3)=co(3,ialset(j))-csab(3)
   328                   call mprod(t,node,coord,3)
   330                   yind(l)=datan2(-coord(3),coord(2))
   349             call dsort(xind,nx,ncsnodes,kflag)
   350             call dsort(yind,ny,ncsnodes,kflag)
   353      &           rcscg,rcs0cg,zcscg,zcs0cg,nrcg,nzcg,jcs,kontri,
   354      &           straight,ne,ipkon,kon,lakon,lcs,netri,ifacetet,
   357             do j=istartset(nodel(2)),iendset(nodel(2))
   358                node(1)=co(1,ialset(j))-csab(1)
   359                node(2)=co(2,ialset(j))-csab(2)
   360                node(3)=co(3,ialset(j))-csab(3)
   364                call mprod(t,node,coord,3)
   368                phi=datan2(-coord(3),coord(2))
   369                if (phi.gt.(-1.d-5+phi_min)) 
then   370                   kseg=int(noder(4)*0.5d0*(phi-phi_min)/pi)
   372                   kseg=int(noder(4)*0.5d0*(2.d0*pi+(phi-phi_min))/pi)
   379                t2d(2,2)=dcos(-kseg*phi0)
   380                t2d(2,3)=dsin(-kseg*phi0)
   382                t2d(3,2)=-dsin(-kseg*phi0)
   383                t2d(3,3)=dcos(-kseg*phi0)
   388                call mprod(t2d,coord,node,3)
   392                if (cylindrical) 
then   404                call mprod(tinv,node,coord,3)
   405                co(1,noder0)=coord(1)
   406                co(2,noder0)=coord(2)
   407                co(3,noder0)=coord(3)
   411      &              rcscg,rcs0cg,zcscg,zcs0cg,nrcg,nzcg,
   412      &              straight,nodef,ratio,nterms,yp,zp,netri,
   413      &              noder0,ifacetet,inodface,ialset(j),
   414      &              t(1,1),t(1,2),t(1,3),ier,multistage)
   416                if ((kseg.eq.(noder(4))-1.d0).and.(replace)) 
then   417                   cs(1,mcs+1)=-noder(4)
   419                      cs(k,mcs+1)=cs(k,noder(5))
   434                   if((dabs(al(lathyp(1,inum),1)).gt.1.d-3).and.
   435      &                 (dabs(al(lathyp(2,inum),2)).gt.1.d-3).and.
   436      &                 (dabs(al(lathyp(3,inum),3)).gt.1.d-3)) 
exit   442                   if((kseg.ne.0).or.(kseg.eq.(noder(4))-1.d0)) 
then   443                      labmpc(nmpc)=
'CYCLIC              '   445                         if (noder(5).lt.10) 
then   446                            write(labmpc(nmpc)(7:7),
'(i1)') noder(5)
   448                            write(labmpc(nmpc)(7:8),
'(i2)') noder(5)
   451                      if (kseg.eq.(noder(4))-1.d0) 
then   453                            write(labmpc(nmpc)(7:7),
'(i1)') mcs
   454                         elseif (mcs.lt.100) 
then   455                            write(labmpc(nmpc)(7:8),
'(i2)') mcs
   458      &                       
'*ERROR in multistages: no more than 49'   460      &                      
'       cyclic symmetry definitions allowed'   465                      number=lathyp(ndir,inum)
   472                      idof=8*(ialset(j)-1)+number
   473                      call nident(ikmpc,idof,nmpc-1,id)
   475                         if(ikmpc(id).eq.idof) 
then   477      &                     
'*WARNING in multistages: cyclic MPC in node'   478                            write(*,*) 
'         ',ialset(j),
   479      &                       
' and direction',ndir
   480                            write(*,*) 
'         cannot be created: the'   482      &                      
'         DOF in this node is already used'   499                         if(number.gt.3) number=1
   500                         if(dabs(al(number,ndir)).lt.1.d-5) cycle
   501                         nodempc(1,mpcfree)=ialset(j)
   502                         nodempc(2,mpcfree)=number
   503                         coefmpc(mpcfree)=al(number,ndir)
   504                         mpcfree=nodempc(3,mpcfree)
   505                         if(mpcfree.eq.0) 
then   507      &                       
'*ERROR in multistages: increase memmpc_'   513                         if(number.gt.3) number=1
   514                         if(dabs(ar(number,ndir)).lt.1.d-5) cycle
   516                            if (dabs(ratio(k2)).gt.1.d-10) 
then   517                               nodempc(1,mpcfree)=nodef(k2)
   518                               nodempc(2,mpcfree)=number
   520      %                           -ar(number,ndir)*ratio(k2)
   522                               mpcfree=nodempc(3,mpcfree)
   524                            if(mpcfree.eq.0) 
then   526      &                         
'*ERROR in multistages: increase memmpc_'   531                      nodempc(3,mpcfreeold)=0
   543                      idof=8*(ialset(j)-1)+ndir
   544                      call nident(ikmpc,idof,nmpc-1,id)
   546                         if(ikmpc(id).eq.idof) 
then   548      &                     
'*WARNING in multistages: cyclic MPC in node'   549                            write(*,*) 
'         ',ialset(j),
   550      &                       
' and direction',ndir
   551                            write(*,*) 
'         cannot be created: the'   553      &                       
'         DOF in this node is already used'   567                      nodempc(1,mpcfree)=ialset(j)
   568                      nodempc(2,mpcfree)=ndir
   570                      mpcfree=nodempc(3,mpcfree)
   571                      if(mpcfree.eq.0) 
then   573      &                     
'*ERROR in multistages: increase memmpc_'   578                         if (dabs(ratio(k2)).gt.1.d-6) 
then   579                            nodempc(1,mpcfree)=nodef(k2)
   580                            nodempc(2,mpcfree)=ndir
   581                            coefmpc(mpcfree)=ratio(k2)
   583                            mpcfree=nodempc(3,mpcfree)
   585                         if(mpcfree.eq.0) 
then   587      &                      
'*ERROR in multistages: increase memmpc_'   592                   nodempc(3,mpcfreeold)=0
 #define max(a, b)
Definition: cascade.c:32
 
subroutine triangulate(ics, rcs0, zcs0, ncsnodes, rcscg, rcs0cg, zcscg, zcs0cg, nrcg, nzcg, jcs, kontri, straight, ne, ipkon, kon, lakon, lcs, netri, ifacetet, inodface)
Definition: triangulate.f:22
 
#define min(a, b)
Definition: cascade.c:31
 
subroutine mprod(M, v_in, v_out, size)
Definition: multistages.f:605
 
subroutine invert3d(M, Minv, size)
Definition: multistages.f:623
 
subroutine nident(x, px, n, id)
Definition: nident.f:26
 
subroutine linkdissimilar(co, csab, rcscg, rcs0cg, zcscg, zcs0cg, nrcg, nzcg, straight, nodef, ratio, nterms, rp, zp, netri, nodei, ifacetet, inodface, noded, xn, yn, zn, ier, multistage)
Definition: linkdissimilar.f:23
 
subroutine dsort(dx, iy, n, kflag)
Definition: dsort.f:6