fortran95 or c for a new stellar evolution program?

E. Gaburov egaburov at science.uva.nl
Sun Nov 20 20:05:34 GMT 2005


Dear Bill,

It is quite an interesting idea to write 1d evolution code in  
"modern" language. I believe fortran 95 is more suitable for this  
purpose than vanilla C (which is fare from being a modern language).  
The bottom line is that f95 is way more superior in array handling  
and numerical calculating than C (which is designed for low-level  
system programming) and also allows compiler-level parallelization of  
the code which might be quite painstaking  task in C. Simple loops  
over array indices will instantly make code unreadable under C, so I  
vote for F95.

If there had been a choice of c++ vs f95, then perhaps I would vote  
for c++ because the code can be written in Object Oriented way which  
will make it more robust and more resistible against changes (i.e.  
changing one part will not brake the whole code), though it will  
require more work which will be payed of eventually. To the best of  
my knowledge f95 is still lag behing over c++ in its OOP skills,  
though developers in fact promised full OOP support in fortran 2000  
(or something like that).

Another point which I think is a right place to address is a data  
structure. I would like to propose discarding last century formats  
based on unreadable column data (which requires bunch of extra brain- 
memory to remember which column is what) in favour of human readable  
data structure. A good example is StarLab snapshop format. In the  
21st century we have sufficient amount of disk-space and  
computational resource to be able to store data in human readable  
formats and code-up intelligent parsers. Again this will require a  
bit more time but this will pay off after all.

> So perhaps the jump from fortran77 to fortran95 is about as bad as  
> the jump to c, and then the case for fortran95 seems much weaker.
I will be dare enough to disagree with this statement in the sense  
that amount of lines of code ported from F77 to C might even increase  
while from F77 to F95 will definitely decrease. And moreover if the  
code is written according to F95 standards then compiler-level  
optimization and parallelization are possible so that user will be  
able to take advantage of parallel hardware, if available.

> I can go either way on this choice, although my preference is c.
F95!

Cheers,
  Evghenii



More information about the stellar-discuss mailing list