Subject: Re: [APDL] *vread with mixed character/number array. Author: Ashok Date: 2002-08-26 09:30:00Getting the number of lines in a file and checking if a file exists or not are in /INQUIRE. Don't think I have ever seen this functionality in *GET
Ashok EACoE, Bangalore
"Crawford, John" wrote:
> JAS,
> I like everything you have mentioned here. I suppose there are about a > hundred other things that could be added, like replace all characters with > blanks when reading each line, and replace all numbers with blanks, and so > forth.
> I needed to do something a number of years ago where I had a macro that > issued a CDWRITE, then read the CDWRITE file into an array and did a search > for certain data. (I think I was after the associativity between nodes and > lines or something like that.) After reading the CDWRITE file into an array > the macro would loop along looking for a certain character string in each > row in the array, and then start reading the data until it hit another > character string. The problem at the time was that I couldn't *GET the > number of lines in the CDWRITE file, so to make sure the array would hold > most CDWRITE files I had to make the array really large. Your functionality > would have been perfect for what I wanted to do, which was locate a chunk of > data in a file that is bounded by known character strings, and read the > data. If this had existed at that time I wouldn't have needed to read the > CDWRITE file into an array and goof around with it.
> This leads me to ask for another enhancement to *VREAD. We already can tell > it to start reading at a certain line number. Could we also tell it to stop > reading at a certain line number? Using the *GET enhancements you are > suggesting, we could *GET the line numbers to start and stop on if we knew > the bounding character strings. I think this would be very useful.
> I have some vague memory that you enhanced *GET a while back to get the > number of lines in a file, as well as whether a file existed or not. I just > checked the documentation for *GET and didn't see these in there, but the > documentation for *GET is pretty long so I may have missed them. Are these > available or I am just hallucinating about this whole thing?
> One thing I noticed is that the *GET functions are no longer listed in a > separate area but are integrated into the appropriate *GET listings. This > is fine, but I'd also like to see a separate listing of *GET functions so I > can quickly see if what I want is available or not. Think you could nudge > the documentation folks to do this?
> It's nice to know that someone is carrying the APDL flag for us. Thanks.
> John Crawford > Honeywell Engines and Systems > Tempe, AZ
> -----Original Message----- > From: John Swanson [mailto:john.swanson@a...] > Sent: Monday, August 26, 2002 4:57 AM > To: 'xansys@yahoogroups.com' > Subject: RE: [xansys] Re: [APDL] *vread with mixed character/number > array.
> How about for the first pass: > 1. Ignore blank lines > 2. Ignore all characters from ! to end of line > a. If ! is in column 1, treat as blank line (ignore) > 3. Ignore lines which have invalid data in any numeric field > 4. Set _RETURN to the last read line number > This would occur it the number of items to be read per line is entered > in field 11 (the field after nskip).
> I am also looking for adding to the *GET,Par,FILE the > ability to find the next line in a file containing a (up to 32 char) > string. This might return the first 32 characters of the line > containing the string, and set _RETURN to the line which contains > the string. This would facilitate finding data in a file.
> A second phase might be to add a "include" set of characters > in field 12 and a "ignore" set of characters in field 13, where > include and ignore would be based on the character in column 1. > Is there anyone out there other than Bob who would be interested > in this?
> John Swanson > Swanson Analysis Services, Inc.
> -----Original Message----- > From: Joe Metrisin [mailto:jmetrisin@t...] > Sent: Monday, August 26, 2002 7:04 AM > To: 'xansys@yahoogroups.com' > Subject: [xansys] Re: [APDL] *vread with mixed character/number array.
> Hi John,
> I think as a general case, it would be nice if ANSYS could read a line up to > 128 characters and ignore lines with characters in columns that are supposed > to contain numbers.
> Bob Weathers suggestion is more general, and would fit my needs too if it > could be done.
> Regards,
> Joe Metrisin > Florida Turbine Technologies, Inc.
> Date: Thu, 22 Aug 2002 14:54:29 -0400 > From: John Swanson > Subject: RE: Re: [APDL] *vread with mixed character/number array.
> My immediate thought was "Nope, can't do that because ansys uses the > system read with the > user supplied format statement". However, the clever suggestions contained > here might offer some > hope, especially with the c formats. > Can someone help me understand better what is desired. Is it as simple > as ignoring any lines > which contain characters? Or do we need to ignore lines which contain > characters in columns which > are supposed to contain numbers? If we were to read the entire line as a > character string, then > decode it internally, what would the maximum line length be? Would a fixed > limit like 128 of 640 (slower) > be acceptable? > Comments, anyone? > John Swanson > Swanson Analysis Services, Inc.
> > -----Original Message----- > > From: Joe Metrisin [SMTP:jmetrisin@t...] > > Sent: Thursday, August 22, 2002 2:34 PM > > To: 'xansys@yahoogroups.com' > > Subject: [xansys] Re: [APDL] *vread with mixed character/number > > array.
> > Many thanks to Ashok, Gordon, Bob, and others for their clever > > workarounds. > > Since we are writing macros to automate repetitive procedures, it would be
> > nice if ANSYS had the ability to ignore characters during *VREAD. For now
> > we are stuck with slow workarounds, or additional processing outside of > > ANSYS.
> > Regards,
> > Joe Metrisin > > Florida Turbine Technologies, Inc.