1!$Id:$
2      subroutine shap1d( xi, nel, shp )
3
4!      * * F E A P * * A Finite Element Analysis Program
5
6!....  Copyright (c) 1984-2017: Regents of the University of California
7!                               All rights reserved
8
9!-----[--.----+----.----+----.-----------------------------------------]
10!      Purpose: One dimensional shape functions and natural derivatives
11
12!      Inputs:
13!         xi        - Isoparametric coordinate: ( -1 < xi < 1 )
14!         nel       - Number of nodes / element   : ( 2 or 3 )
15
16!      Outputs:
17!         shp(2,3)  - Shape functions and spatial derivatives
18!                     (natural derivatives only)
19!         shp(1,i)  - Shape function spatial derivative: N_i,xi
20!                     (natural derivatives only)
21!         shp(2,i)  - Shape function                   : N_i
22!-----[--.----+----.----+----.-----------------------------------------]
23
24      implicit  none
25
26      integer   nel
27      real*8    xi, xi2
28
29      real*8    shp(2,nel)
30
31      save
32
33!     2-node shape functions and derivatives
34
35      if(nel.eq.2) then
36
37        shp(1,1) = -0.5d0
38        shp(1,2) =  0.5d0
39
40        shp(2,1) =  0.5d0 - 0.5d0*xi
41        shp(2,2) =  0.5d0 + 0.5d0*xi
42
43!     3-node shape functions and derivatives
44
45      elseif(nel.eq.3) then
46
47        xi2      =  xi*xi
48
49        shp(1,1) =  xi - 0.5d0
50        shp(1,2) =  xi + 0.5d0
51        shp(1,3) = -xi - xi
52
53        shp(2,1) =  0.5d0*(xi2 - xi)
54        shp(2,2) =  0.5d0*(xi2 + xi)
55        shp(2,3) =  1.0d0 - xi2
56
57      endif
58
59      end
60