XANSYS Message: 41273 [Go back to message list]
[bookmark on del.icio.us]
No rating yet
Rate item:

Subject: Re: [APDL] *vread with mixed character/number array
Author: John Swanson
Date: 2002-08-29 11:40:00

Good itea - it does.
John Swanson
Swanson Analysis Services, Inc.

> -----Original Message-----
> From: Fernand A. Thomassy [SMTP:fernand.thomassy@s...]
> Sent: Thursday, August 29, 2002 11:03 AM
> To: xansys@yahoogroups.com
> Subject: RE: [xansys] [APDL] *vread with mixed character/number array

> John,

> Maybe I missed this but I would suggest /INQUIRE,,LOC,, return a zero if
> the
> string is not found.

> Kind regards . . . Fern

> Fernand A. Thomassy, P.E.
> Principal Engineer
> Engine Design Section
> Southwest Research Institute
> mailto:fernand.thomassy@s...
> http://enginedesign.swri.org

> > -----Original Message-----
> > From: John Swanson [mailto:john.swanson@a...]
> > Sent: Wednesday, 28 August, 2002 5:57 PM
> > To: 'xansys@yahoogroups.com'
> > Subject: RE: [xansys] [APDL] *vread with mixed character/number array

> > Here is a documented version of the demonstration problem.

> > ***** demo of *vread, /inquire, and *sread enhancements *****
> jas

> > 1 /BATCH,list
> > 2
> > 3 *create,x,inp
> > 4 ! test input file
> > 5 !set 1
> > 6 1.0
> > 7 !
> > 8 2.0
> > 9 ! this is a blank line
> > 10 3.0
> > 11 !set 2
> > 12 11.0!comment allowed
> > 13 just text
> > 14 12.0
> > 15 !
> > 16 13.0
> > 17 *end
> > 18 *list,x,inp
> > 19
> > 20 /com
> > 21 /com ********** /INQUIRE addition of LOC for location
> > of string
> > in file
> > 22 /com /INQUIRE, Parameter, LABEL, Fname, Ext,
> > Directory,String32,nSkip
> > 23 /com LABEL = 'EXIST' - 0, file does not exist 1, exists
> > 24 /com 'DATE' - yyyymmdd.hhmmss
> > 25 /com 'SIZE' - size in MB
> > 26 /com 'WRITE' - 0, no permission 1,
> write
> > permission
> > 27 /com 'READ' - 0, no permission 1, read
> > permission
> > 28 /com 'EXEC' = 0, no permission
> > 1, execute
> > permission
> > 29 /com 'LINE' - Number of lines in
> > text file
> > 30 /com (NEW) 'LOC ' - Line number contining first
> > String32 after nSkip
> > 31
> > 32 C*** get the number of lines in the file
> > 33 /inquire,a,line,x,inp
> > 34 C*** get the location of the first 'set'
> > 35 /inquire,b,loc,x,inp,,set,0
> > 36 C*** get the location of the second 'set'
> > 37 /inquire,c,loc,x,inp,,set,b
> > 38
> > 39 /com
> > 40 /com *vread documentation change ***** (add nPer) *****
> > 41 /com 1 2 3 4 5 6 7
> > 8 9 10
> > 11
> > 42 /com *vread,ParR(1),file,ext,dir,{IJK|JKI|KIJ|etc},n1,n2,n3,
> > nskip, nPer
> > 43 /com (((ParR(i,j,k),k=1,n1),i=1,n2),j=1,n3) (for (KIJ)
> > 44 /com if nPer gt 0, then (NEW)
> > 45 /com nPer is the number of items to read per line
> > (consistant
> > with fmt)
> > 46 /com Blank lines are ignored
> > 47 /com ! is a comment character
> > 48 /com Invalid data (characters) in a numeric field
> > causes line
> > to be
> > 49 /com ignored
> > 50
> > 51 *dim,vect,,3
> > 52 C*** read in the data from set 1
> > 53 *vread,vect(1),x,inp,,IJK,3,,,b,1
> > 54 (f6.0)
> > 55 x=_return
> > 56 *stat,vect(1)
> > 57
> > 58 c*** read in the data from set 2
> > 59 *vread,vect(1),x,inp,,IJK,3,,,c,1
> > 60 (f6.0)
> > 61 x=_return
> > 62 *stat,vect(1)
> > 63
> > 64 /com
> > 65 /com *SREAD,StrArray,Fname,Fext,Fdir,[nchar],nSkip,nLines
> > 66 /com ***** *SREAD documentation change (add nSkip,nLines)

> > 67
> > 68 c*** get the data from nSkip+1 (b+1) for 8 lines into character
> > array a1
> > 69 *sread,a1,x,inp,,,b,8
> > 70 x=_return
> > 71 *stat,a1(1,1)
> > 72
> > 73 /eof

> > START CREATE BY COPY FROM INPUT TO x.inp

> > END FILE CREATE

> > LISTING OF THE DATA ON FILE x.inp
> > ! test input file
> > !set 1
> > 1.0
> > !
> > 2.0
> > ! this is a blank line
> > 3.0
> > !set 2
> > 11.0!comment allowed
> > just text
> > 12.0
> > !
> > 13.0

> > ********** /INQUIRE addition of LOC for location of string in file
> > /INQUIRE, Parameter, LABEL, Fname, Ext, Directory,String32,nSkip
> > LABEL = 'EXIST' - 0, file does not exist 1, exists
> > 'DATE' - yyyymmdd.hhmmss
> > 'SIZE' - size in MB
> > 'WRITE' - 0, no permission 1, write permission
> > 'READ' - 0, no permission 1, read permission
> > 'EXEC' = 0, no permission 1, execute permission
> > 'LINE' - Number of lines in text file
> > (NEW) 'LOC ' - Line number contining first String32
> > after nSkip

> > C*** get the number of lines in the file

> > PARAMETER A = 13.000000

> > C*** get the location of the first 'set'

> > PARAMETER B = 2.000000

> > C*** get the location of the second 'set'

> > PARAMETER C = 8.000000

> > *vread documentation change ***** (add nPer) *****
> > 1 2 3 4 5 6 7 8 9 10 11
> > *vread,ParR(1),file,ext,dir,{IJK|JKI|KIJ|etc},n1,n2,n3, nskip, nPer
> > (((ParR(i,j,k),k=1,n1),i=1,n2),j=1,n3) (for (KIJ)
> > if nPer gt 0, then (NEW)
> > nPer is the number of items to read per line (consistant with
> fmt)
> > Blank lines are ignored
> > ! is a comment character
> > Invalid data (characters) in a numeric field causes line to be
> > ignored

> > SET PARAMETER DIMENSIONS ON VECT TYPE=ARRA DIMENSIONS= 3
> > 1 1

> > C*** read in the data from set 1

> > VECTOR READ OPERATION *VREAD
> > VECT READ FROM FILE x.inp
> > VECTOR LENGTH= 3
> > LOOP DIRECTIONS=IJK COUNTS= 3 1 1
> > NUMBER OF LINES TO SKIP AT START OF FILE= 2
> > NUMBER OF FIELDS PER LINE= 1
> > FORMAT=(f6.0)

> > PARAMETER X = 7.000000

> > PARAMETER STATUS- VECT ( 7 PARAMETERS DEFINED)
> > (INCLUDING 2 INTERNAL PARAMETERS)

> > LOCATION VALUE
> > 1 1 1 1.00000000
> > 2 1 1 2.00000000
> > 3 1 1 3.00000000

> > c*** read in the data from set 2

> > VECTOR READ OPERATION *VREAD
> > VECT READ FROM FILE x.inp
> > VECTOR LENGTH= 3
> > LOOP DIRECTIONS=IJK COUNTS= 3 1 1
> > NUMBER OF LINES TO SKIP AT START OF FILE= 8
> > NUMBER OF FIELDS PER LINE= 1
> > FORMAT=(f6.0)

> > PARAMETER X = 13.00000

> > PARAMETER STATUS- VECT ( 7 PARAMETERS DEFINED)
> > (INCLUDING 2 INTERNAL PARAMETERS)

> > LOCATION VALUE
> > 1 1 1 11.0000000
> > 2 1 1 12.0000000
> > 3 1 1 13.0000000

> > *SREAD,StrArray,Fname,Fext,Fdir,[nchar],nSkip,nLines
> > ***** *SREAD documentation change (add nSkip,nLines) *****

> > c*** get the data from nSkip+1 (b+1) for 8 lines into character array
> a1

> > READ FILE INTO STRING ARRAY = A1
> > x.inp
> > SKIP FIRST 2 LINES
> > READ 8 LINES
> > Number of lines = 8

> > PARAMETER X = 10.00000

> > PARAMETER STATUS- A1 ( 8 PARAMETERS DEFINED)
> > (INCLUDING 2 INTERNAL PARAMETERS)
> > 28 1 1 1.0
> > 28 2 1 !
> > 28 3 1 2.0
> > 28 4 1 ! this is a blank line
> > 28 5 1 3.0
> > 28 6 1 !set 2
> > 28 7 1 11.0!comment allowed
> > 28 8 1 just text

> > ***** END OF INPUT ENCOUNTERED *****

Posts possibly associated with message #41273AuthorDateScore
40991[APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
40992Re: [APDL] *vread with mixed character/number array.Dave Conover2002/08/22 
40993Re: [APDL] *vread with mixed character/number array.Peter Frei2002/08/22 
40994Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
40995Re: [APDL] *vread with mixed character/number array.Ashok2002/08/22 
40996Re: [APDL] *vread with mixed character/number array.Gordon May2002/08/22 
40997Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/22 
40998Re: [APDL] *vread with mixed character/number array.Peter Frei2002/08/22 
40999Re: [APDL] *vread with mixed character/number array.Ian Prentice2002/08/22 
41002Re: [APDL] *vread with mixed character/number array.Don Shaffer2002/08/22 
41011Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
41013Re: [APDL] *vread with mixed character/number array.John Swanson2002/08/22 
41014Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/22 
41077Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/26 
41079Re: [APDL] *vread with mixed character/number array.John Swanson2002/08/26 
41080Re: [APDL] *vread with mixed character/number array.Ashok2002/08/26 
41083Re: [APDL] *vread with mixed character/number array.John Crawford2002/08/26 
41084Re: [APDL] *vread with mixed character/number array.Bob Weathers2002/08/26 
41086Re: [APDL] *vread with mixed character/number array.Ashok2002/08/26 
41093Re: [APDL] *vread with mixed character/number array.John Crawford2002/08/26 
41101Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/26 
41103Re: [APDL] *vread with mixed character/number array.Eric Miller2002/08/265
41106Re: [APDL] *vread with mixed character/number array.Fernand Thomassy2002/08/26 
41110Re: [APDL] *vread with mixed character/number array.Eric Miller2002/08/26 
41112Re: [APDL] *vread with mixed character/number array.Dan Bohlen2002/08/26 
41126Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/26 
41161Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/27 
41162Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/27 
41178Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/27 
41213Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/28 
41216Re: [APDL] *vread with mixed character/number arrayMartin Liddle2002/08/28 
41237Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/28 
41239Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/28 
41242Re: [APDL] *vread with mixed character/number arrayJoe Metrisin2002/08/28 
41271Re: [APDL] *vread with mixed character/number arrayFernand Thomassy2002/08/29 
41273Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/29