ZW)
Example(s) of the use of the stand-alone DESL-related
extra command.
| Problem 1 |
|---|
Extract values of CA and NPR from SIF file.
Correct CA = f(NPR).
Replace old and new values of CA onto SIF file.
User Code : "cafix.for" (on PC)
subroutine user (void)
real npr
c
c Access the values of variables "NPR" and "CA"
c
call sget (1,'npr',npr)
call sget (1,'ca',ca)
c
c Restore the original value of "CA" as "OLDCA"
c
call sput (1,'oldca',ca)
c
c Calculate and apply the increment to CA
c
cainc=-npr*.000734
ca=ca+cainc
c
c (over)Store the new value of "CA"
c
call sput (1,'ca',ca)
return
end
Use of User Code
f90 cafix.for extra.obj
cafix.exe is produced.
cafix.exe can be used in a manner like :
cafix -f runs2_34.sif -n newrunsto read the SIF file runs2_34.sif and create the new SIF file newruns.
| Problem 2 |
|---|
Extract values of the pressure coefficients CP1, CP2, CP3, CP4 from SIF file.
Use map file to correspond CP1 to XCP101, CP2 to XCP102, CP3 to XCP103, CP4 to XCP104.
Compute an average of these pressure coefficients.
Replace new average value of CPAVG onto SIF file.
User Code : "cpavg.for" (on PC)
subroutine user (void)
dimension cp(4),ncp(4)
character ncp*8
c
c Initialize the array of CP names
c
do 1 i=1,4
1 ncp(i)=' '
c
ncp(1)='cp1'
c
c Access the 4 values of variables "CP1" through "CP4"
c
c (Map file will cause the corresponding variables "XCP101",
c "XCP102", "XCP103" and "XCP104" to be searched for on
c the SIF file)
c
call sget (4,ncp,cp)
c
c Initialize the CP average variable
c
cpavg=0.
c
do 2 i=1,4
2 cpavg=(cpavg*(i-1)+cp(i))/i
c
c Store the value of "CPAVG"
c
call sput (1,'cpavg',cpavg)
return
end
Map file : map455
* * Internal Name External Name * cp1 xcp101 cp2 xcp102 cp3 xcp103 cp4 xcp104
Use of User Code
f90 cpavg.for extra.obj
cpavg.exe is produced.
cpavg.exe can be used in a manner like :
cpavg -f pressure.111 -n newcps -m map455to read the SIF file pressure.111 and create the new SIF file newcps using the map file map455.
| Problem 3 |
|---|
Locate and access information from the setup file
Extract appropriate information from the SIF file
act on the pulled SIF information
Replace ... later in the code
User Code : "gbangles.f" (on Unix)
subroutine user (void)
c
c Include the following common blocks, etc to gain access
c to the integer variable "inam". This variable is a flag
c which the program can use to determine WHEN it is supposed
c to reinterpret the setup file via the "acget" calls
c
c ============================================
common /sn/ key,name(100000),mapnam(20000)
common /sv/ n,data(200000),inam,nmap,map(20000)
character key*4,name*8,mapnam*8
c ============================================
c
c
character dummy*8,dumnam*8,anglen*8
dimension dumnam(2),dumval(2),angle(20),anglen(20),result(3,3)
c
c
c
c *** Only look through setup file IF time to do so ****
c
if(inam.ne.0) then
c
c Structure of the information on the setup file looks like :
c
c ngb 3
c psis yaw
c thetas pitch
c phis roll
c
c Where, after the first line, each line contains
c either and angle variable name AND the transformation axis name
c
c
c Look through the setup file to see if "ngb" is present
c (ngb defines the number of gravity to balance angles
c which are to be used)
c
call acget (0,'ngb',xngb)
c
c If "ngb" found, assume can also find the accompanying
c associated angle definition information ...
c
ngb=0
if(xngb.ne.0.) then
lxngb=xngb
call acget (lxngb+1,dummy,xgb)
ngb=ifix(xgb)
c
c Loop through ngb non-comment lines of the setup file to
c interpret pairs of fields (each pair = angle name, axis name)
c
do 500 k=1,ngb
index=lxngb+k*2
c
c Pull : (1) angle name, (2) axis name
c
call acget (index, dumnam(1),dumval(1))
call acget (index+1,dumnam(2),dumval(2))
c
c Set axis code =f(axis name). Assume YAW.
c
irot(k)=-1
if(dumnam(2).eq.'PITCH') irot(k)= 0
if(dumnam(2).eq.'ROLL') irot(k)= 1
anglen(k)=dumnam(1)
500 continue
endif
endif
c
c
c
c **** DO the following for EACH SIF record read ****
c
c Extract the current values of the GB rotation angles ...
c
do 501 k=1,ngb
c
c Set retrieved angle to 0.0 if NOT FOUND !
c
call sget (1,anglen(k),angle(k))
if(angle(k).eq.-999.) angle(k=0.
501 continue
c
c Do desired euler rotations
c
call euler (ngb,angle,irot,result)
c
c Further code wold most likely replace add to read SIF record
c to be later written as new SIF file's record
c
return
end
Setup file : setup56
*
* Setup file : setup56
*
* "ngb" number_gravity-to-balance_angles
*
* angle_name1 axis_name1
*
* angle_name2 axis_name2
*
* angle_nameN axis_nameN
*
*
ngb 3
psis yaw
thetas pitch
phis roll
*
Use of User Code
f77 -o glangles gbangles.f extra.o 2>comperr
gbangles is produced.
gbangles can be used in a manner like :
gbangles -f test56 -n newsif -s setup56to read the SIF file test56 and create the new SIF file newsif using the setup file setup56.
| Problem 4 |
|---|
Extract values of ngb from setup file and do something special
at the end of processing for each SIF file.
User Code : "last.for" (on PC)
subroutine user (void)
c
c ============================================
common /sn/ key,name(100000),mapnam(20000)
common /sv/ n,data(200000),inam,nmap,map(20000)
character key*4,name*8,mapnam*8
c ============================================
c
c Set up storage for all data seen, for later use ...
c
dimension dx(1000)
data ndx/0/
c
c "void" branches :
c
c If "-last" on command line then this user subroutine
c is called one more time at the end of each file's processing :
c
c void < 0 ..... After file processed, no data records
c void = 0 ..... Normal inter-file processing; set void in this
c subroutine for return
c void = 1 ..... At end of file that is NOT the last file. >0 records
c void = 2 ..... At end of file that IS the last file. >0 records
c
c
c ========================================================
if(void.lt.0.) then
c ========================================================
c
c File processed failed to yield any data ...
c
write(*,'('' No data, void = '',f6.0)') void
c
c ========================================================
else if(void.eq.0.) then
c ========================================================
c
c Normal SIF DATA record processing ... all sgets/sputs here !
c
c If need to do setup file processing, need /common/ with "inam"
c and do the "acgets" here ...
c
c setup
c ngb 4
c .
c .
c .
c
if(inam.eq.1) then
xngb = -1000.
call acget (0,'ngb',v1loc)
if(v1loc.ne.-999.) then
iv1=v1loc+1
call acget (iv1,'dum',xngb)
endif
write (*,'('' ngb = '',f5.0)') xngb
endif
c
c Access the file, record counter ...
c
call sget (1,'filcount',fc)
call sget (1,'reccount',rc)
ifc=fc
irc=rc
write(*,'('' fc = '',i4,'', rc = '',i4)') ifc,irc
ndx=ndx+1
c
c yank values of "ALPW" and save ...
c
call sget (1,'alpw',dx(ndx))
c
c ========================================================
else if(void.gt.0.) then
c ========================================================
c
c Last time ... for this file ...
c
if(void.eq.2.) then
c
c In fact, last time for LAST file (void=2) ... print values stored ...
c
c Process stored info ...
c
open (33,file='dum.fil',status='unknown',form='formatted')
rewind 33
do 10 i=1,ndx
write(33,'('' dx('',i3,'') = '',g12.5)') i,dx(i)
10 continue
close(33)
endif
c
c ========================================================
endif
c ========================================================
return
end
Setup file : last.set
* setup set1 c setvx 20 ngb 3 setup set2 c setvx 10 ngb 40 *
Use of User Code
f90 last.for extra.obj
last.exe is produced.
last.exe can be used in a manner like :
last -f r1000 r11 r12 -e -last -s last.set set2 >doutto read the SIF files r10 r11 r12 and accumulate the values of "alpw" in an array then write the contents of the "dx" array, which is the collection of values of "alpw", to a file named "dum.fil".
| Problem 5 |
|---|
Use arbitrary input passed in on the command line.
User Code : "arb.for" (on PC)
subroutine user (void)
c
c ============================================
common /sn/ key,name(100000),mapnam(20000)
common /sv/ n,data(200000),inam,nmap,map(20000)
character key*4,name*8,mapnam*8
c ============================================
c
if(inam.eq.1) then
call acget (0,'xrt',dumval)
if(dumval.ne.-999.) then
vrt=0
else
loc=dumval+1.
call acget (loc,'dum',vrt)
endif
endif
c
if(vrt.gt.12.6) then
temp1=100.
else
temp1=200.
endif
call sput (1,'xtemp1',temp1)
c
return
end
Use of User Code
f90 arb.for extra.obj
arb.exe is produced.
arb.exe can be used in a manner like :
arb -f r10 -e -x xrt 12.6 3.45 alpha >doutto read the SIF file r10 and store the arbitrary input that is specified as "xrt 12.6 3.45 alpha" in arrays that can be accessed by the user's code. The three arrays that are used to store the contents of the information passed in as the arguments are :
narb() .... holds string item types
varb() .... holds value items
karb() .... count of number of characters in string items or
is 0 for value type items
Each of the "nxarg" items in the list of items that are arguments to
the "-x" option are determined to be a string or a value and is stored
as per the above rules.
|
30 Research Drive Hampton, VA 23666 Voice: (757) 865-1400 Toll Free: (800) 288-3998 FAX: (757) 865-8177 |