PDA

View Full Version : simple introduction to Fortran



clariceoshea
6th October 2013, 02:32 AM
works under fedora 19

remember fortran statements start in column 7 while
column 6 is for continuation(for long lines)
using vi enter :set tabstop=7
thus a tab will take you to the right start column

enter file testdo.f using some editor I prefer vi


program test
do 666 i=0,1
do 666 j=0,1
do 666 k=0,1
do 666 l=0,1
Write(*,100) i,j,k,l
100 format(i2,i2,i2,i2)
666 end do
end

install compiler
switch to root
su - (enter root password)
yum install yumex
start yumex from
kickoff application launcher
administration
software installer yumex
select checkbox "all"
select 32 or 64 bit version of gcc-gfortran

i686 or X86_64 (check check box on the left)

select "apply"

ctrl-D to leave root
compile:
gfortran -o testdo testdo.f
execute: ./testdo

report directions not clear:C

ocratato
6th October 2013, 06:51 AM
Seems clear enough, but I would have used spaces since the tabs seemed to have been lost in the CODE block.

The last time I ran a Fortran program it was on one of these: http://en.wikipedia.org/wiki/CDC_6000_series :)

clariceoshea
8th October 2013, 02:20 AM
WOW! thanks for the link to the 6600

used the 6600 at UT Austin and it was a super hit with 6 or 7

peripheral processors that I am told was actually the work of one.

The 6600 kicked IBM axx!

I used the 6600 to seek periodic solutions to the elliptical restricted

problem of 3 Bodies. My students also had access to Fortran on an old IBM computer

forgot the name 4400 1040??? 4040 4010

what was the other super computer at the time now long gone..one model was actually water cooled

bingo..the Cray with Seymore Cray___???

I hate hitting spaces...one can do a set list to see the tabs but it makes a mess

I still have a Fortran program deqb to solve the equations for the elliptical restricted

problem of 3 Bodies.

clariceoshea
8th October 2013, 05:01 PM
just hit me the point you were trying to make

the tabs at statement beginning are not there for somebody trying to enter the code
so: enter tab to get to statement beginning or space over to statement beginning at column 7

also under vi enter
:set tabstop=7

http://www.stanford.edu/class/me200c/tutorial_77/17_format.html

DBelton
8th October 2013, 06:05 PM
In vi, if you want to make certain that the tab inserts spaces, then:



:set tabstop=7
:set expandtab


And if you have a file that has tab characters in it already that you wish to expand:



:set tabstop=7
:retab


This would insert 7 spaces for each tab character found

But, there are better ways to do indentation in vi.. Like autoindent, smartindent and cindent.

clariceoshea
9th October 2013, 07:05 PM
thanks

now anybody wanting to do Fedora Fortran will be starting quick

once in a while I see a job requirement for Fortran

pete_1967
9th October 2013, 09:55 PM
Why do it hard way when there's Fortran script for Vim: http://www.vim.org/scripts/script.php?script_id=2299 :)