Tutorial by Examples: fortran

Fortran 2003 introduced language features which can guarantee interoperability between C and Fortran (and to more languages by using C as an intermediary). These features are mostly accessed through the intrinsic module iso_c_binding: use, intrinsic :: iso_c_binding The intrinsic keyword here en...
The bind attribute can also be applied to derived types: geese.h struct Goose { int flock; float buoyancy; } struct Goose goose_c; geese.f90 use, intrinsic :: iso_c_binding, only : c_int, c_float type, bind(C) :: goose_t integer(c_int) :: flock real(c_float) :: buoyancy e...
A complete Fortran program is made up from a number of distinct program units. Program units are: main program function or subroutine subprogram module or submodule block data program unit The main program and some procedure (function or subroutine) subprograms may be provided by a languag...
program typical_loop use omp_lib implicit none integer, parameter :: N = 1000000, kd = kind( 1.d0 ) real( kind = kd ) :: sum, tbegin, wtime integer :: i sum = 0 tbegin = omp_get_wtime() !$omp parallel do reduction( +: sum ) do i = 1, N sum = ...
sink("caraxis_fortran.f") cat(" c---------------------------------------------------------------- c Initialiser for parameter common block c---------------------------------------------------------------- subroutine init_fortran(daeparms) external daeparms ...

Page 1 of 1