forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The future of Fortran
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Mon Nov 02, 2009 9:08 am    Post subject: The future of Fortran Reply with quote

In many cases it is still a question which program language to use for future developments. Recently I discovered a decision matrix form 2003 (I think). At the time the programer responsible for an essential program retired. The code was partly in very old Fortran and not well documented. The code was analysed (unfortunatlely without success) and the outcome was a decision to develop the software from scratch. However, the question was which language. At the time I was not in the department where this was done. At first I did not know whether I should start such a decision matrix in the forum or only present the final outcome. I finally decided to present the result.

The decision matrix has two sections, one for the present and one for the future. It is important to mention that the software is used for the design of electrical machines, i.e. only numerical calculations. Criteria for the matrix were defined as follows:
Code:
Present                        Priority  Weight  Java  C++  Fortran
-------------------------------------------------------------------
Integrating Fortran programes  1         7       7     7    7
Modularer programming          2         6       6     6    6
Automatic documentation        3         5       5     0    0
Interfaces (ex. XML)           4         4       4     4    0
Architecture                   5         3       3     0    0
Complex numbers                6         2       0     0    2
Object orientated programing   7         1       1     1    0

Future               
------
Availability of programmers    1         20      20    20   0
Availability of compilers      2         15      15    15   0
Readability                    3         10      10    10   10
Operarting system independancy 4         5       5     0    0

Total                                    78      76    63   25

In my opinion very important aspects like the availability of numerical libraries and even the cost of porting code were not taken into account. Furthermore, the outcome of that meeting was that I might be porting a few thousand of lines! I would like to take action on the above matrix. And of course I hope to get some support here Very Happy
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Wed Nov 04, 2009 9:51 am    Post subject: Reply with quote

As mentioned the in the opening of this topic: The software we speak about is intended for numerics. Furthermore, a few colleagues cannot understand this result. The group who did this definitely had some blinkers. It is on hand that they wanted a specific result. Anyway, I have some interessting couter-arguments:

Compiler availability: There are several Fortran compilers available, i.e. Absoft, Intel, Silverfrost, PGI and PathScale.

Numerical applications: If we want to convert Fahrenheit to Celsius a Fortran and JAVA program would look something like this:
Code:
         program celsius_table
         implicit none
         real ::  Fahrenheit, Celsius
         write(*,*) 'Programm zur Umrechnung von Temperaturangaben von'
         write(*,*) 'Fahrenheit nach Grad Celsius'
         write(*,*) '---------------------------------------------------'
         write(*,*) 'Bitte geben die den Temperaturwert in Fahrenheit an'

         read(*,*)Fahrenheit
                 Celsius = (5.0/9.0) * (Fahrenheit-32.0)

         write(*,*) 'Temperaturwert in Grad Celsius: ', Celsius

         end program celsius_table
Code:
Programm 2.1 Temperatur.java
// Temperatur.java
//
// Transforms Fahrenheit to Celsius
import java.awt.*;
import java.applet.Applet;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Temperatur extends Applet
{
  // variables for the problem
  double fahrenheit, celsius;
  // objects for the graphical user interface
  Label inputPrompt, outputPrompt1, outputPrompt2;
  TextField input, output;
 
  // setup the graphical user interface components
  // and initialize labels and text fields
  public void init() {
    // define labels and textfields
    inputPrompt = new Label("Geben Sie eine Temperatur "
         + "in Fahrenheit an und dr¨ucken Sie Return.");
    outputPrompt1 = new Label("Die Temperatur in "
         + "Celsius betr¨agt");
    outputPrompt2 = new Label(" Grad.");
    input = new TextField(10);
    input.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        calculateTemperature();
      }
    }); // action will be on input field
    output = new TextField(10);
    output.setEditable(false);
    // disable editing in output field
    // add labels and textfields to the applet
    add(inputPrompt);
    add(input);
    add(outputPrompt1);
    add(output);
    add(outputPrompt2);
  }

  // process user’s action on the input text field
  public void calculateTemperature() {
    // get input number
    fahrenheit = Double.parseDouble(input.getText());
    // calculate celsius and round it to 1/100 degrees
    celsius = 5.0 / 9 * (fahrenheit - 32);
    // use Math class for round
    celsius = Math.round(celsius * 100);
    celsius = celsius / 100.0;
    // show result in textfield output
    output.setText(Double.toString(celsius));
  }
}

Interfaces: It is no problem to parse for example XML files.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Nov 05, 2009 3:21 am    Post subject: Reply with quote

Two points I could make on this and other similar posts on this subject.
1) There should be some qualification of your discussion, based on the complexity of the numerical calculations involved. Fortran is more suited to more complex calculations or where previously developed and proven numerical algorithms are available.
2) your selection of language should also consider the user interface. From the example you have posted, Visual Basic and FTN95 Clearwin+ are two other classes of solution that could be differentiated from what you have presented.

I was interested in your decision matrix, with the relative weightings to the items listed and the other points that could have been included, such as availability of proven algorithms, accuracy of coding and error identification. Judging by the nominations, Fortran was not the answer wanted, as no compiler, programmers or suitable operating system exist.

Good luck with that committee
Back to top
View user's profile Send private message
TheFaber



Joined: 05 Nov 2009
Posts: 1

PostPosted: Wed Nov 11, 2009 3:00 pm    Post subject: Re: Reply with quote

JohnCampbell wrote:
Two points I could make on this and other similar posts on this subject.
1) There should be some qualification of your discussion, based on the complexity of the numerical calculations involved. Fortran is more suited to more complex calculations or where previously developed and proven numerical algorithms are available.

Hello John,
I am not sure whether Fortran is more suitable for mathematical calculations. Because of the wide availybility and acceptance of Java, there are many libraries available, also a fine one for complex calculations: Commons Math: http://commons.apache.org/math/
JohnCampbell wrote:

2) your selection of language should also consider the user interface. From the example you have posted, Visual Basic and FTN95 Clearwin+ are two other classes of solution that could be differentiated from what you have presented.

One important information is missing: Does the chosen language have to be integrated into an existing system or infrastructure?
JohnCampbell wrote:

I was interested in your decision matrix, with the relative weightings to the items listed and the other points that could have been included, such as availability of proven algorithms, accuracy of coding and error identification. Judging by the nominations, Fortran was not the answer wanted, as no compiler, programmers or suitable operating system exist.

Good luck with that committee

It is known that Fortran compilers do exist and Intel keeps on developping. Missing programmers indeed is a problem as nowadays you find lots of Java and .NET developpers, but Fortran is in an outsider role.
BTW Java offers good information and tools (in most cases only used to find memory leaks) in case of error handling.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2816
Location: South Pole, Antarctica

PostPosted: Thu Nov 12, 2009 5:43 am    Post subject: Reply with quote

Completely off-topic - how this Java F to C conversion program looks like ? I mean graphically or GUI-wise. Is it nice looking, convenient to use? Can someone publish the image? For comparison i show how F to C and as a bonus to K (do you also need electon-volts?) looks in Clearwin+, with the same overall text size. It automatically as you type converts everything into everything and for human body temperature range you even do not have to type anything



Text is below
Code:

! Dan R Right 2009. Reference on author is not required. Use at your own risk
module Funct
 real*8 Rel_Temp01, Temp_Fahrenheit, Temp_Celsius, Temp_Kelvin   
 real*8 TempHumanMin, TempHumanMax
 contains
integer function update_Slider ()
 Temp_Fahrenheit = TempHumanMin + (TempHumanMax-TempHumanMin) * Rel_Temp01
 Temp_Celsius    = (Temp_Fahrenheit-32)*5./9.
 Temp_Kelvin     = Temp_Celsius + 273.
 update_Slider   = 1
end function
integer function update_F ()
 Rel_Temp01      = (Temp_Fahrenheit-TempHumanMin )/(TempHumanMax-TempHumanMin)
 Temp_Celsius    = (Temp_Fahrenheit-32)*5./9.   
 Temp_Kelvin     = Temp_Celsius + 273.
 update_F        = 1
end function
integer function update_C ()
 Temp_Fahrenheit = 32 + Temp_Celsius * 9./5.
 Temp_Kelvin     = Temp_Celsius + 273.
 Rel_Temp01      = (Temp_Fahrenheit-TempHumanMin )/(TempHumanMax-TempHumanMin)
 update_C        = 1
end function
integer function update_K ()
 Temp_Celsius    = Temp_Kelvin - 273.
 Temp_Fahrenheit = 32 + Temp_Celsius * 9./5. + 273.
 Rel_Temp01      = (Temp_Fahrenheit-TempHumanMin )/(TempHumanMax-TempHumanMin)
 update_K        = 1
end function
end module funct

Program F_to_C_to_K
use clrwin
use funct
 TempHumanMin    = 90;    TempHumanMax = 110
 Temp_Fahrenheit = 98
 Temp_Celsius    = 36.6
 Temp_Kelvin     = Temp_Celsius + 273.

 i=winio@('%sy[3d_raised]%ww[casts_shadow]&')
 i=winio@('%ca[Fahrenheit to Celsius to Kelvin]&')
 i=WINIO@('%wp[BkGrTurb01]&')
 i=winio@('%bg[grey]&')
 i=winio@('%cn Type your input in any field or use slider%ff&')
 i=winio@('%2.1ob&')
   i=winio@('%^9sl[vertical ]%ff&', Rel_Temp01, 0.0D0, 1.0D0, update_Slider)
 i=winio@('%cb&')
   i=winio@('%fn[Times new Roman]%ts%tc[blue]%bf%cn F= &
     &%fl%^8rf%sf%ff&', 2.d0, -1.d36, 1.d36, Temp_Fahrenheit, update_F)
   i=winio@('%fn[Times new Roman]%ts%tc[red]%bf%cn C= &
     &%fl%^8rf%sf%ff&', 2.0d0, -1.d36, 1.d36, Temp_Celsius, update_C)
   i=winio@('%fn[Times new Roman]%ts%tc[green]%bf%cn K= &
     &%fl%^8rf%sf%ff&', 2.0d0, -1.d36, 1.d36, Temp_Kelvin, update_K)
 i=winio@('%cb&')
 i=winio@('%ac[esc]&','exit')
 i=winio@('%nl%ff%cn%3`bt[OK]')
   end
Resources
BkGrTurb01 bitmap  BkGrTurb01.bmp


Last edited by DanRRight on Thu Feb 04, 2010 11:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Sun Dec 13, 2009 4:55 pm    Post subject: Reply with quote

I am familiar with the Fortran standards committee. As far as I know this committee is independant of compiler developers. This is of course a very good point! Once the new standard is available, the compiler developers can start developing.

Which of the other available languages are "organized" like this? If one looks at C++: One get Microsoft C++ and for example Borland C++. Each of them develops a C++ compiler for what they believe is C++. And if you try some program that was developed with a Microsoft compiler it will in most cases not work the first time with a Borland compiler (I recently experienced this once again). Furthermore, if some guys do not like a programming language, they start to develop a new one. Was this not the case with Java which developed form C++? Instead of expanding C++ some guys developed Java. And when comes the next generation that does not like Java and then make something new from this?

Is a language committee not a valueble argument to consider for a language to have a future? I once heard a saying: In 3000 there will be many programming languages, one of them will be Fortran.
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Thu Dec 31, 2009 10:36 am    Post subject: Reply with quote

Hi DanRRight;

I have seen some cool stuff that were done using Clearwin! This makes Fortran again a very interesting programing language for my application.

In a recent thread (http://forums.silverfrost.com/viewtopic.php?t=1519) I tried to plot a finite element mesh using Clearwin. I soon realized that one need a little bit more. Especially the transformation from the real-world-axis to the window-axis. This might not be that difficult. However, some example to get me going would be helpful.

You seem to be very fit in Clearwin. At present I have some (quick and dirty) solution using simpleplot. Can you perhaps provide an equivalent example using Clearwin? This would be great! And good for the future Very Happy
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2816
Location: South Pole, Antarctica

PostPosted: Fri Jan 01, 2010 3:12 am    Post subject: Reply with quote

Just use OpenGL, you will be stunned by what you'll get. I can send you nice and easy example if i'll find it. BTW, I have sent a year or two ago such and some other snippet examples to Silverfrosts Andrew when he asked here for user examples contributions . Did not heard since that how this idea was evolving
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Tue Jan 12, 2010 4:51 pm    Post subject: Reply with quote

From a recent discussion I noticed a very important aspect not taken into account in the points mentioned in the firts entry (this thread).

It is common practice to keep the Fortran code (in its DOS-box mode) and then combine it with some GUI in another programming language. Using ClearWin directly saves of huge amount of time: It takes quite a while to define a working interface between the GUI and the program. The effort to prepare the in- and output files is often underestimated. Therefore, why not spent the time in some ClearWin+ development!

The advantage of doing everything in one language is that the variables are all in memory on execution and no interfaces is required. And in most scientific applications the user has to input his model data and calculate.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2816
Location: South Pole, Antarctica

PostPosted: Sat Jan 16, 2010 12:10 am    Post subject: Reply with quote

Quote:
...Therefore, why not spent the time in some ClearWin+ development!


Indeed...I just guess in what shortest amount of lines in any language anyone can produce this small window which has to include the following features below. And for you, jjgermis, guess, how many lines it will take in Clearwin?

Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2816
Location: South Pole, Antarctica

PostPosted: Wed Jan 20, 2010 5:39 pm    Post subject: Reply with quote

OK, i see no answer on my last last question too.
The answer is 1 (one) single line of fortran code. We do not count END statement and resources of course, they can be used for many windows. Here is the whole code:
Code:
i=winio@('%ww%mi[i]%ca[win]%wp[a]%mn[File[Exit]]%th%dd%il%cn%`bg[yellow]%?7rd[index]%ff%nl%cn%^bm[e]%ff','exit',1,1,0,10,j,'exit')
end
resources
a bitmap a.bmp
e bitmap e.bmp
i icon   i.ico


Here a.bmp - window background, e.bmp - Exit button, i.ico - icon .

All of them are optional and can be substituted by Clearwin defaults
and the resources not used at all. The code then becomes even smaller, compile it ftn95 file.f95 /lgo or ftn95 file.f95 /link and see all for yourselves

Code:

i=winio@('%ww%ca[win]%mn[File[Exit]]%th%dd%il%cn%`bg[yellow]%?7rd[index]%ff%nl%cn%bt[Exit]%ff','exit',1,1,0,10,j)
end


Last edited by DanRRight on Thu Feb 04, 2010 11:33 pm; edited 6 times in total
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2816
Location: South Pole, Antarctica

PostPosted: Wed Jan 20, 2010 5:46 pm    Post subject: Reply with quote

With this respect it's ridiculous how sounds Polyhedron "advertisement" of Clearwin+

http://polyhedron.com/clearwin

"Salford Clearwin+ is very concise, 'Hello World' requires only 4 lines of Fortran code..."

And amazing nobody ever fixed that in a dozen of years Sad
Yes, this is how Salford always advertised itself from its day one. This is truly amazing.
Back to top
View user's profile Send private message
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Wed Jan 20, 2010 6:59 pm    Post subject: Reply with quote

The code doesn't give an Exit button as claimed, but it does compile and link and run and produce a UI similar to the illustration.

I was surprised to find that a PROGRAM statement was not required (I knew STOP was optional). I was also surprised (at first) to find that the compiler didn't complain about i and j not being declared, which would have taken another line Very Happy

I take issue with not counting resource statements as lines just because they can be re-used. They might only count once, but they count.

Obviously I take your point - whether it's 1 line (being charitable) or 7 (being strict; even I don't count comment lines), it's still very impressive. OTOH, we have C available if we want to go in for obfuscated code, don't we. One-line programs are not playing the FORTRAN game at all Wink

If I was going to be really pernickety I might question whether a proprietary extension to a standard-conforming compiler counts as a language. Isn't that a little like claiming that there's something special about the Geordie dialect because it's the only "language" in which "Why-aye" requires just one line of code? N.B. this analogy may be less than transparent to you and other Transpondians Wink Wink Wink

Andy
Back to top
View user's profile Send private message Send e-mail
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Wed Jan 20, 2010 9:43 pm    Post subject: Reply with quote

Andy, the exit button is provided by the bitmap e.bmp

Also I have written fortran code for over thirty years without ever declaring i and j to be integers! Is it wrong to use the defaults i.j.k.l.m.n for integers and the rest for reals?
Back to top
View user's profile Send private message Visit poster's website
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Wed Jan 20, 2010 11:10 pm    Post subject: Reply with quote

Dan, I never would have guess that it is possible in one line of code. This is all new to me (Clearwin+) and I enjoy testing your examples!

We also have code where i,j,k,l,m and n are not declared as integers. Is'nt this the implicit way of declaring variables. However, when I use something like Understand4Fortran to analyse the code, it is given as integer. I assume that implicit none was introduced at a later stage.

Yes, I agree that the marketing at Silverfrost can be better. During 2000 I started using FTN95. At that time I by accident discovered the ClearWin manuals in some cupboard. It looked quite impressive. However, it was presented in some style that was not convincing. Neither could I find information in the internet. If I would have started using it then I would have been much better off today!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group