PROGRAM SET1UP
C======================================================================
C  DATA ASSEMBLY PROGRAM FOR APPLICATIONS BUCKLEX.FOR
C  EIJI FUKUMORI  15-NOV-1995
C======================================================================
      PARAMETER ( MXND=3,MXE=100, MXN=MXE+1 )
      DIMENSION NODEX(MXE,MXND),EI(MXE),X(MXN),IBTYPE(2), BV(2)
      LOGICAL YES
      CHARACTER INPFILE*12, FSTATUS*3
C------------------- DATA INPUT FROM CONSOLE 
      WRITE (*,*)" SELECT ELEMENT TYPE. LINEAR AND PARABOLIC AVAILABLE"
      WRITE (*,102)
  102 FORMAT ( " IF LINEAR, TYPE 1. IF PARABOLIC, TYPE 2: " $ )
      READ (*,*) LORP
      IF ( LORP .LT. 1 ) STOP "INVALID TYPE"
      IF ( LORP .GT. 2 ) STOP "INVALID TYPE"
      ND = LORP + 1
      IF ( ND .EQ. 2 ) INPFILE = "BUCKLE.DAT"
      IF ( ND .EQ. 3 ) INPFILE = "BUCKLE2.DAT"
      WRITE (*,110)
      READ (*,*) P
  110 FORMAT (" FORCE(P) =" $ )
      WRITE (*,120)
      READ (*,*) ETIMESI
  120 FORMAT (" E*I(EI) =" $ )
      WRITE (*,125)
      READ (*,*) DOMAIN
  125 FORMAT (" LENGTH OF DOMAIN (L) =" $ )
      WRITE (*,130)
      READ (*,*) NE
  130 FORMAT (" NUMBER OF ELEMENTS(NE) =" $ )
      WRITE (*,140)
      READ (*,*) IBTYPE(1)
  140 FORMAT (" KIND OF BOUNDARY CONDITION AT X=0(1,2, OR 3) =" $ )
      WRITE (*,150)
      READ (*,*) BV(1)
  150 FORMAT (" BOUNDARY VALUE AT X=0 =" $ )
      WRITE (*,160)
      READ (*,*) IBTYPE(2)
  160 FORMAT (" BOUNDARY CONDITION AT X=L(1,2, OR 3) =" $ )
      WRITE (*,170)
      READ (*,*) BV(2)
  170 FORMAT (" BOUNDARY VALUE AT X=0 =" $ )
C
C------- NODAL NUMBER ASSIGNMENT AND NODAL COORDINATE COMPUTATION
      DO I = 1 , NE
      EI(I) = ETIMESI
      DO J = 1 , ND
      NODE = (I - 1)*(ND-1) + J
      NODEX(I,J) = NODE
      END DO
      END DO
      NNODE = NE * ( ND-1 ) + 1
      DX = DOMAIN / ( NNODE - 1 )
      DO I = 1 , NNODE
      X(I) = ( I - 1 ) * DX
      END DO
C------- INQUIRE OF INPUT FILE
      FSTATUS = 'NEW'
      INQUIRE ( FILE=INPFILE, EXIST=YES )
      IF ( YES ) FSTATUS = 'OLD'
C------- WRITING DATA INTO INPUT FILE
      OPEN ( 1,FILE=INPFILE, STATUS=FSTATUS)
      WRITE(1,*) P
      WRITE(1,*) NE
      DO I = 1 , NE
      WRITE(1,*) I, (NODEX(I,J),J=1,ND), EI(I)
      END DO
      DO I = 1 , NNODE
      WRITE(1,*) I, X(I)
      END DO
      WRITE(1,*) IBTYPE(1), BV(1)
      WRITE(1,*) IBTYPE(2), BV(2)
      CLOSE (1)
      STOP
      END