c
c * 27-node brick (triquadratic interpolation)
c * http://sp81.msi.umn.edu:999/fluent/fidap/help/theory/th04.htm
c
      program grintbx1
c
      dimension F(27),G(27)

      do i=1,27
        F(i)=1
      end do
c
 10   write(*,*)'Enter Location -1<(r,s,t)<+1:'
      read(*,*)r,s,t
c
      G(1) =-r*s*t*(1.0-r)*(1.0-s)*(1.0-t)/8.0
      G(2) = s*t*(1.0-r*r)*(1.0-s)*(1.0-t)/4.0
      G(3) = r*s*t*(1.0+r)*(1.0-s)*(1.0-t)/8.0
      G(4) = r*t*(1.0-r)*(1.0-s*s)*(1.0-t)/4.0
      G(5) =-t*(1.0-r*r)*(1.0-s*s)*(1.0-t)/2.0
      G(6) =-r*t*(1.0+r)*(1.0-s*s)*(1.0-t)/4.0
      G(7) = r*s*t*(1.0-r)*(1.0+s)*(1.0-t)/8.0
      G(8) =-s*t*(1.0-r*r)*(1.0+s)*(1.0-t)/4.0
      G(9) =-r*s*t*(1.0+r)*(1.0+s)*(1.0-t)/8.0
      G(10)= r*s*(1.0-r)*(1.0-s)*(1.0-t*t)/4.0
      G(11)=-s*(1.0-r*r)*(1.0-s)*(1.0-t*t)/2.0
      G(12)=-r*s*(1.0+r)*(1.0-s)*(1.0-t*t)/4.0
      G(13)=-r*(1.0-r)*(1.0-s*s)*(1.0-t*t)/2.0
      G(14)= (1.0-r*r)*(1.0-s*s)*(1.0-t*t)
      G(15)= r*(1.0+r)*(1.0-s*s)*(1.0-t*t)/2.0
      G(16)=-r*s*(1.0-r)*(1.0+s)*(1.0-t*t)/4.0
      G(17)= s*(1.0-r*r)*(1.0+s)*(1.0-t*t)/2.0
      G(18)= r*s*(1.0+r)*(1.0+s)*(1.0-t*t)/4.0
      G(19)= r*s*t*(1.0-r)*(1.0-s)*(1.0+t)/8.0
      G(20)=-s*t*(1.0-r*r)*(1.0-s)*(1.0+t)/4.0
      G(21)=-r*s*t*(1.0+r)*(1.0-s)*(1.0+t)/8.0
      G(22)=-r*t*(1.0-r)*(1.0-s*s)*(1.0+t)/4.0
      G(23)= t*(1.0-r*r)*(1.0-s*s)*(1.0+t)/2.0
      G(24)= r*t*(1.0+r)*(1.0-s*s)*(1.0+t)/4.0
      G(25)=-r*s*t*(1.0-r)*(1.0+s)*(1.0+t)/8.0
      G(26)= s*t*(1.0-r*r)*(1.0+s)*(1.0+t)/4.0
      G(27)= r*s*t*(1.0+r)*(1.0+s)*(1.0+t)/8.0
c
      Frst=0.0
      do i=1,27
        write(*,*)G(i)
        write(1,*)G(i)
        Frst=Frst+G(i)*F(i)
      end do
c
      write(*,*)'Frst=',Frst
      write(1,*)'Frst=',Frst
      goto 10
c
      stop
      end

