umvarma / pynastran

Automatically exported from code.google.com/p/pynastran
1 stars 0 forks source link

BDF parser fails if CaseControlDeck contains SET command with more than 100 commas in argument #100

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Attached file contains first lines from big BDF file. pyNastranGUI fails to 
load this file with following messages in console:

D:\pyNastranGUI>pyNastranGUI.exe
isEdges =  False
main builder
addGeometry
addAltGeometry
launching gui
fname =  D:\lin\analyza_lin.bdf
cant delete geo
DEBUG:   fname=bdf.pyc                   lineNo=438    ---starting BDF.readBDF 
of D:\lin\analyza_lin.bdf---
DEBUG:   fname=bdf.pyc                   lineNo=444    *BDF.readBDF
DEBUG:   fname=bdf.pyc                   lineNo=507    line[1]*= |'SOL 101'|
DEBUG:   fname=bdf.pyc                   lineNo=507    line[2]*= |'CEND'|
DEBUG:   fname=bdf.pyc                   lineNo=636    found the end of the 
case control deck!
huhh...

What is the expected output? What do you see instead?
It should not fail :-)

What steps will reproduce the problem?
1. Try to load BDF with attached CaseControlDeck.

What version of the product are you using?
pyNastranGUI.zip from May 25 2012

On what operating system?
Windows XP x32

Please provide any additional information below.
IMHO problem is in artificial limitation inside 
pyNastran/bdf/caseControlDeck.py, function _read(). There is condition: if 
i>100: sys.exit("huhh..."). Attached file has 494 commas in SET = 2.

Original issue reported on code.google.com by space...@centrum.cz on 6 Aug 2012 at 8:56

Attachments:

GoogleCodeExporter commented 9 years ago
It is an artificial limitation to prevent infinite looping.  I'll bump it a bit 
higher.  The new version should be out sometime this week.  The huhh... message 
should be clearer.

Original comment by mesheb82 on 6 Aug 2012 at 4:39

GoogleCodeExporter commented 9 years ago
The new artificial limitation will set the maximum number of case control lines 
to 10,000.  Hopefully that's enough :)

Original comment by mesheb82 on 6 Aug 2012 at 10:58

GoogleCodeExporter commented 9 years ago
Thanks for the fix! I have some nitpicks about it, please don't take it 
personally :-)

I looked into MSC Nastran 2012 Quick Reference Guide and I can't find any 
limitation regarding case control deck maximal length. Where this information 
comes from?

Generally, I don't see a reason why is necessary to artificially limit number 
of lines in CaseControlDeck. Method _read(self, lines) contains cycle "while i 
< len(lines)" and variable "i" is incremented in each iteration in any case.

Because "i" is only incremented, _read() method has to finish in finite time 
(in any case, even with invalid input).

IMHO it would be better to completely remove this limitation, because it avoids 
surprises in future.

I can send a patch, if you want to not spent time with this amendment.

Original comment by space...@centrum.cz on 7 Aug 2012 at 8:01

GoogleCodeExporter commented 9 years ago
Thanks for your patience!

Original comment by space...@centrum.cz on 7 Aug 2012 at 8:01

GoogleCodeExporter commented 9 years ago
I do my best at not adding artificial restrictions, but it's there because of 
the way INCLUDE files are supported.  Specifically, what happens when you find 
a bunch of blank lines at the end of a file because you're looking for another 
line with text on it.  It needs to break out of the loop at some point and 
admittedly 100 was too low (It can actually have more than 100 lines if you use 
INCLUDE files).  I figure 10,000 was more than enough for every model that a 
user would ever make.

That part of the code isn't the highest priority because it works in all the 
cases I've run, but that said, if you'd like to work on a patch, I'd be more 
than happy to add it as well as explain the code.  I'd suggest reading the 
latex developer guide in the dev version to help familiarize yourself with the 
approach of that part of the code.

Also, I'm glad you're nitpicking b/c it means people want to use the software 
:)  Nitpick away!

Original comment by mesheb82 on 7 Aug 2012 at 8:21

GoogleCodeExporter commented 9 years ago
Hello,

I tried version r1084 and now it works. I still didn't have time to look into 
developer guide, sorry.

Original comment by space...@centrum.cz on 13 Sep 2012 at 7:39

GoogleCodeExporter commented 9 years ago

Original comment by mesheb82 on 23 Oct 2012 at 11:55