#$b001
TEXT(TRANSFER_BETWEEN_TWO_SHAPES :       B539
TITLE
  display
 
     This Q1 demonstrates the use of the "Transfer" feature of
     the GSET command. This feature is used for creating smooth
     transitions between regions of different shape.
     In this example it is used to create a circle-to-square
     transition.
 
     The commands for creating the circle and the square are the
     same as in case 538. They will therefore not be dwelt on at
     length.
 
 
     Set the grid type to BFC by the command:
CT1=BFC=T
#$b002
     Please enter circle radius (default 1.m):
REAL(RADIUS,ROOT,SIDE)
READVDU(radius,real,1.0)
     Enter length of square side (default 0.5m)
READVDU(side,real,0.5)
INTEGER(NAB,NBC)
root=0.707*radius
 
     The input data to be used in this example are therefore:
MESG(    radius=:radius:
MESG(    root  =:root:
MESG(    side  =:side:
      where root is defined as 0.707*radius
 
      -- Create a circle --
     Define points A,B,C and D by the following command:
     Point A positioned at (0,-root,root)
GSET(P,A,0,-root,root)
       GSET(P,A,0,-root,root)
     Point B positioned at (0,root,root)
       GSET(P,B,0,root,root)
GSET(P,B,0,root,root)
GSET(P,C,0,root,-root)
     Point C positioned at (0,root,-root)
       GSET(P,C,0,root,-root)
     Point D positioned at (0,-root,-root)
CT1=GSET(P,D,0,-root,-root)
#$b003
  *
     Draw  four arc lines (AB,BC,CD,DA) from A to D
     to create a circle.
     Lines AB&CD must have equal number of cells, as
     well as lines BC&DA. Power is set to 1.0, ie. cells
     are uniformly distributed.
 
     Enter number of cells for AB(&CD) lines (default 10)
readvdu(nab,int,10)
     Arc AB (A-B) goes through point (0,0,radius)
       GSET(L,AB,A,B,nab,1.0,ARC,0,0,radius)
GSET(L,AB,A,B,NAB,1.0,ARC,0,0,RADIUS)
 
     Enter number of cells for BC(&DA) lines (default 5)
readvdu(nbc,int,5)
     Arc BC (B-C) goes through point (0,radius,0)
       GSET(L,BC,B,C,nbc,1.0,ARC,0,radius,0)
GSET(L,BC,B,C,NBC,1.0,ARC,0,RADIUS,0)
     Arc CD (C-D) goes through point (0,0,-radius)
       GSET(L,CD,C,D,nab,1.0,ARC,0,0,-RADIUS)
GSET(L,CD,C,D,NAB,1.0,ARC,0,0,-RADIUS)
     Arc DA (D-A) goes through point (0,-radius,0)
CT1=GSET(L,DA,D,A,nbc,1.0,ARC,0,-radius,0)
#$b003
     Define frame ABCD (circle) which has corner points
     A,B,C,D by the command:
CT1=GSET(F,ABCD,A,-,B,-,C,-,D,-)
#$b003
#$021
     !!!! The following is a point of difference from case 538
          in which the square and the circle were just 1 I-interval
          apart. !!!!
 
     Please enter number of cells for I direction (default 10)
readvdu(nx,int,10)
     Set the BFC grid dimension as nx x nab x nbc cells with
     reference length radius+side x side x side by the command:
CT1=GSET(D,:nx:,:nab:,:nbc:,:radius+side:,:side:,:side:)
#$b003
  *
 
it1=nx+1
it1
MESG(     Match grid plane I:it1: on frame ABCD using the
     Laplace method with 10 iterations by the command:
lflag=t
CT1=GSET(M,ABCD,+J-K,:it1:,1,:nbc:+1,LAP10)
#$B004
lflag=f
      -- Create a square --
     Define points E,F,G and H by the following commands:
     Point E positioned at (-side,-side/2,side/2)
GSET(P,E,-SIDE,-SIDE/2,SIDE/2)
       GSET(P,E,-side,-side/2,side/2)
     Point F positioned at (-side,side/2,side/2)
       GSET(P,F,-side,side/2,side/2)
GSET(P,F,-SIDE,SIDE/2,SIDE/2)
GSET(P,G,-SIDE,SIDE/2,-SIDE/2)
     Point G positioned at (-side,side/2,-side/2)
       GSET(P,G,-side,side/2,-side/2)
     Point H positioned at (-side,-side/2,-side/2)
CT1=GSET(P,H,-side,-side/2,-side/2)
#$b003
  *
     Draw  four lines (EF,FG,GH,HE) from E to H
     to create a square. Lines EF&GH have nab uniformly
     distributed cells each and lines FG&HE have nbc
     uniformly distributed cells each; they have to
     match number of cells on the circle.
 
     The commands are:
 
       GSET(L,EF,E,F,nab,1.0)
GSET(L,EF,E,F,NAB,1.0)
       GSET(L,FG,F,G,nbc,1.0)
GSET(L,FG,F,G,NBC,1.0)
       GSET(L,GH,G,H,nab,1.0)
GSET(L,GH,G,H,NAB,1.0)
CT1=GSET(L,HE,H,E,nbc,1.0)
#$b003
  *
     Define frame EFGH (square) which has corner points
     E,F,G,H by the command:
CT1=GSET(F,EFGH,E,-,F,-,G,-,H,-)
#$b003
  *
     Match grid plane I1 on frame EFGH using the trans-finite
     method of interpolation by the command:
 
CT1=GSET(M,EFGH,+J-K,1,1,nbc+1,TRANS)
#$B004
  *
it1=nx+1
     !!!! This where the "transfer feature" is employed !!!!
          ---------------------------------------------
 
     Use Transfer command to connect smoothly circle (plane I:it1:)
     and square (plane I1). Include all internal planes and use
     power-law distribution for them.
 
     Enter power (default 1.5); for symmetric-law precede number
     with S.
READVDU(PWR,CHAR,1.5)
     The PIL command for effecting the transfer is:
 
CT1=GSET(T,I1,F,I:it1:,1,nab,1,nbc,:pwr:)
#$B004
  enddis