perlquestion
ozgurp
Dear Monks,
I am an aeronautical engineer (structural) and I use a finite element analysis software called PATRAN/NASTRAN. After every analysis this software generates result files (text) with ".f06" extention. These files can be very large and many depending on the model that is being analysed.<p>
When this software is used to analyse composite elements, it creates results for FAILURE INDICES, and prints results for each element and each ply.<p>
I was using a perl program that was opening these files (280 MB) each and processing the files and extracting the information that I wanted in about an hour. The files were about 1.6 GB in size. Then someone found this FORTRAN program that does the same thing in about ten minutes.<p>
I just can not understand what it is doing so differently that it does the job much faster than my perl program does.<p>
<readmore>
my code is something like this:
<code>
open file
while(<FH>){
extract info,
print,
}
close FH;
</code>
and here is an example section from one one of the .f06 files:
<code>
11150505 STRAIN 1 1.0088 -12
0.0369
1 MARCH 10, 2003 MSC.NASTRAN 5/15/00 PAGE 8077
2011-ULTIMATE,_UP_BM,_-55,_MINP
0 SUBCOM 2011
F A I L U R E I N D I C E S F O R L A Y E R E D C O M P O S I T E E L E M E N T S ( Q U A D 4 )
ELEMENT FAILURE PLY FP=FAILURE INDEX FOR PLY FB=FAILURE INDEX FOR BONDING FAILURE INDEX FOR ELEMENT FLAG
ID THEORY ID (DIRECT STRESSES/STRAINS) (INTER-LAMINAR STRESSES) MAX OF FP,FB FOR ALL PLIES
2 0.0000 -2
0.0630
3 0.9486 -12
0.0914
4 0.0000 -2
0.1108
5 0.0172 -1
0.1108
6 0.0000 -2
0.0914
7 0.5449 -12
0.0630
8 0.0000 -2
0.0369
9 0.4847 -12
1.0088 ***
11150506 STRAIN 1 0.4050 -12
0.0339
2 0.0000 -2
0.0577
3 0.4086 -12
0.0831
4 0.4104 -12
0.1043
5 0.0000 -12
0.1179
6 0.4140 -12
0.1306
7 0.0000 -12
0.1374
8 0.0000 -12
0.1408
9 0.4195 -12
0.1408
10 0.0000 -12
0.1374
11 0.0000 -12
0.1306
12 0.4249 -12
0.1179
13 0.0000 -12
0.1043
14 0.4285 -12
0.0831
15 0.4303 -12
0.0577
16 0.0000 -12
0.0339
17 0.4340 -12
0.4340
1 MARCH 10, 2003 MSC.NASTRAN 5/15/00 PAGE 8078
2011-ULTIMATE,_UP_BM,_-55,_MINP
0 SUBCOM 2011
F A I L U R E I N D I C E S F O R L A Y E R E D C O M P O S I T E E L E M E N T S ( Q U A D 4 )
ELEMENT FAILURE PLY FP=FAILURE INDEX FOR PLY FB=FAILURE INDEX FOR BONDING FAILURE INDEX FOR ELEMENT FLAG
ID THEORY ID (DIRECT STRESSES/STRAINS) (INTER-LAMINAR STRESSES) MAX OF FP,FB FOR ALL PLIES
11150507 STRAIN 1 0.2949 -12
0.0455
2 0.0001 -12
0.0792
3 0.3250 -12
0.1133
4 0.3400 -12
0.1418
5 0.0000 -12
0.1610
6 0.3701 -12
0.1781
7 0.0000 -12
0.1877
8 0.0000 -12
0.1925
9 0.4152 -12
0.1925
10 0.0000 -2
0.1877
11 0.0000 -2
0.1781
12 0.4603 -12
0.1610
13 0.0000 -12
0.1418
14 0.4903 -12
0.1133
15 0.5054 -12
0.0792
16 0.0000 -12
0.0455
17 0.5354 -12
0.5354
11150508 STRAIN 1 0.2814 -2
0.0564
2 0.0001 -12
0.0981
3 0.2392 -2
0.1404
4 0.2181 -2
0.1757
5 0.0000 -12
0.1995
6 0.1759 -2
0.2207
7 0.0000 -12
0.2326
8 0.0000 -12
0.2386
1 MARCH 10, 2003 MSC.NASTRAN 5/15/00 PAGE 8079
2011-ULTIMATE,_UP_BM,_-55,_MINP
</code>
<p><small>20030524 Edit by [Corion]: Added READMORE tag</small></p>
</readmore>