A example ualloc.f and example calls to ualloc are given below.
c * * F E A P * * A Finite Element Analysis Program
c.... Copyright (c) 1984-1998: Robert L. Taylor
c-----[--.----+----.----+----.-----------------------------------------]
c Purpose: Define, delete, or resize
a user dictionary entry.
c
Pointer defined for integer (single) and real
c
(double precision) arrays.
c
N.B. Currently limited to 200 names by dimension of
c
common blocks 'allotd','allotn','pointer','upointer'
c Inputs:
c num
- Entry number for array (see below)
c name
- Name of array (see
below)
c length
- Length of array defined: =0 for delete
c precis
- Precision of array: 1 = integers; 2 = reals
c Output:
c up(num)
- Pointer to first word of array in blank common
c-----[--.----+----.----+----.-----------------------------------------]
implicit none
include 'allotd.h'
logical usetmem
character name*(*)
integer i, num,length,precis
c Storage definitions for UALLOC variables
integer list
parameter (list = 2)
!
<--- Edit to increase list size
character names(list)*5
save
c Define and store names
data (names(i),i=1,list)/
&
'OANGL',
!
<--- Edit to add name
&
'PANGL'/
! <--- Edit to add name
c Short description of variables
c
'OANGL', ! 1: Orthotropic
angle with respect to x-axis !<--
Example comment
c
'PANGL', ! 2: Orthotropic
angle with respect to y-axis !<--
Example comment
c Do memory management operations
ualloc = usetmem(list,names,num,name,length,precis)
end
logical errck,ualloc
include 'upointer.h'
include 'comblk.h'
if(up(1).eq.0) then
!
<--- Example initial allocation of OANGL
as double precision length numel
errck = ualloc(1,'OANGL',numel,2)
if(.not.errck) write(*,*)
'UALLOC ERROR - OANGL'
endif
hr(up(1) + n - 1) = angle !<--- Example setting of the n^th element of OANGL
errck = ualloc(1,'OANGL',0,2) !<--- Example deletion of OANGL array (set size to zero)
if(up(2).eq.0) then
!
<--- Example initial allocation of PANGL
as integer length numel
errck = ualloc(2,'PANGL',numel,1)
if(.not.errck) write(*,*)
'UALLOC ERROR - PANGL'
endif
mr(up(2) + n - 1) = pset !<--- Example setting of the n^th element of PANGL
errck = ualloc(2,'PANGL',numel-50,1) !<--- Example resize of PANGL array (set a new length)