rwesson / NEAT

Empirical analysis of ionised nebulae, with uncertainty propagation
GNU General Public License v3.0
9 stars 5 forks source link

Some fixes #20

Closed bwduncan closed 12 years ago

bwduncan commented 12 years ago

Hi,

These patches tidy up a lot of compiler warnings and invalid memory accesses.

The first patch simply converts tabs to spaces and removes whitespace at the end of lines. This makes me happier.

The second patch initialises some variables before they are used. It also removes some variables which were unused. This silences some compiler warnings and therefore makes it easy to see important warnings! Compiling with -Wall should be more palatable and should be the default.

The third patch just removes some empty DO loops. There is almost certainly no performance impact.

The fourth patch rewrites the makefile to compile using the standard make variable names FC, LD and FFLAGS and to compile each source file to an object file so that compiling the project is quicker if you only change a few files.

The last patch is the most important. It fixes a couple of bugs. Firstly, where the number of lines being read from the input file was overestimated by one. This meant that the last entry in the array contained junk and the number of lines reported was one more than actually existed in the file. Secondly, the DO loop to find the max nlevs and ntemps was not properly initialised and therefore wasn't guaranteed to work.

Hope you find these useful.

Bruce

rwesson commented 12 years ago

This is awesome - thanks very much! Previously when I tried compiling with -O3 I got segmentation faults. These patches fix that and it runs about 3x faster. A very nice improvement. Thanks again!

rwesson commented 11 years ago

https://github.com/rwesson/NEAT/commit/16c0a14bafa1d9e9eb083970ead2c829a592c9ca