CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   C++ or Fortran (https://www.cfd-online.com/Forums/main/7632-c-fortran.html)

CFD Dude June 4, 2004 01:36

C++ or Fortran
 
Which is better for CFD codes...C++ or Fortran?


matej June 4, 2004 02:43

Re: C++ or Fortran
 
not an issue nowadays. Most big CFD packages rewrote already its new releases to c++ but keeping fortran user interface for costumers over the age of 25 - happy with fortran, writting notes on old punch cards.

it's only about the convinience and what is easier for you to use.

matej

ZZ June 4, 2004 10:01

Re: C++ or Fortran
 
For FORmula TRANslation use Fortran, for interface C++.

Jim_Park June 4, 2004 10:42

Re: C++ or Fortran
 
Search the archieves for cfd-online. This is debated every few months. Perhaps matej's answer captures a lot of the truth?

But a LOT of high-quality math routines are written in Fortran, documented, and widely tested. To reveal my age, let me say I don't know anything about C++ libraries.


another cfd dude June 4, 2004 10:54

Re: C++ or Fortran
 
I think Matej's answer captures all of the truth. Pick whatever language you're most proficient in.

I can recall one discussion in this forum where people said they were writing codes in java and visual basic. Hey, whatever floats your boat, there's no "right" answer...

Jarmo Monttinen June 4, 2004 15:10

Re: C++ or Fortran
 
I also agree with Matej. You will have enough "fun" writing and debugging the code, no point of creating more "fun" by trying to learn a new language while doing that. If at some point you want to make you code look fancy (graphics interface etc), then use C++ for that part like ZZ suggested.

-- Jarmo

cjtune June 5, 2004 00:09

Re: C++ or Fortran
 
I've also been 'shopping' for a coding language I can put all of my attention to rather than be confused/frustrated by the gamut of choices available.

Even between the FORTRANs, there's the issue of using F77 for performance, and F90 for data and code structure abstraction. F90 compilers also don't seem to optimise code as well as those for F77 (yet).

I think there has been comparisons between the performance of FORTRAN and C++ and it can be shown, IF properly implemented (avoiding the 'side-effects' of object-oriented abstraction like the unintended creation of temporary storage objects), C++ can equal or beat F77, but otherwise, F77 could be several times faster.

See:

http://www.osl.iu.edu/~tveldhui/pape.../drdobbs2.html

"Numerical methods and software tools in industrial mathematics", (Eds.) Morten Dæhlen, Aslak Tveito. Birkhäuser, 1997.

I think the main selling point of C++ 'for engineering and scientific applications' proponents is that it makes long-term code maintenance and reuse much easier, not that it has the potential of taking the crown from FORTRAN in terms of performance. But then again, C++ is not the easiest of languages to learn and master. We all love MS Windows, right?.



All times are GMT -4. The time now is 10:22.