Fortran
This repsoitory contains simple programs written as I learn FORTRAN.
Contents
Programs
name | description | command tested | file dependencies | files output |
---|---|---|---|---|
hello.f |
hello world | write sleep |
||
fundem.f |
fundamental | read function |
||
ar.f |
array | subroutine |
f.f f2.f |
|
global.f |
global variable | include |
araydim.inc |
|
sys.f |
system | system |
||
subs.f |
subroutines | call |
f.f f2.f |
|
globsubs.f |
global variable subroutine | include call |
araydim.inc |
|
test_abs.f |
absolute value | abs real |
||
sign.f |
sign control | ss sp |
||
io.f |
input/output | inquire open |
svp.out |
|
timedate.f |
date and time | date_and_time |
||
pause.f |
pause | pause |
||
test_system_clock.f |
system clock | system_clock |
format.f set_format.f |
|
make_svp.f |
make svp | system_clock srand rand |
svp.in |
|
collatz.f |
Collatz sequence | format.f set_format.f |
||
collatz_loop.f |
Collatz delay records | format.f set_format.f |
collatz.txt |
|
collatz_glide.f |
Collatz glide calculation | format.f set_format.f |
||
huge.f |
largest integer | kind huge |
format.f set_format.f |
|
interrupt.f |
catch interrupt signal | common signal |
state |
|
extrema.f |
extrema | huge tiny |
||
getunit_test.f |
newunit replacement | inquire |
getunit.f |
|
fmt.f |
comma format | format.f set_format.f |
||
timer.f |
timer | system_clock common signal |
set_format.f |
|
units.f |
unit conversions | selected_real_kind |
||
basel.f |
basel problem | |||
test_pi.f |
pi | atan |
||
ask.f |
read to logical | index |
||
borwein.f |
pi iteration | |||
leibniz.f |
pi iteration | |||
wallis.f |
pi iteration |
Subroutines
name | description | command tested | file dependencies |
---|---|---|---|
f2.f |
dimension |
||
f.f |
dimension |
||
format.f |
format numerical input to string |
Functions
name | description |
---|---|
getunit.f |
newunit replacement |
Includes
name | description |
---|---|
araydim.inc |
array dimension |
set_format.f |
set integer size and display precision |
Installation
Prerequisites
Requies a compiler for Fortran, such as GNU Fortran. Use the following commands to install GFortran, etc, on Linux.
sudo apt update && sudo apt -y upgrade
sudo apt -y install git
sudo apt -y install make
sudo apt -y install gfortran
These commands have been collected in the script install_packages.sh
.
Cloning
Check out the folder from the repository with one of the following commands.
svn co https://github.com/jonlighthall/fortran.git/trunk/ ./fortran
(SVN)
git clone https://github.com/jonlighthall/fortran
(Git HTTPS)
git clone git@github.com:jonlighthall/fortran.git
(Git SSH)
Compiling
Compile the source files and create executables with commands such as the following.
gfortran -o hello.exe hello.f
Alternatively, these commands can be executed by using the make
command.
Execution
The compiled executables can be run using commands such as the following.
./hello.exe
Groups of executeables can be run in sequnece with the following commands.
make run
to run programs which do not require user input.
make run_man
to run programs which require user input.
make run_int
to run programs which require an interrupt signal to terminate.