aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-06-01 12:08:17 +0200
committerWojtek Kosior <kwojtus@protonmail.com>2019-06-01 12:08:17 +0200
commit94e4f02728e102d69a1a2378869c22519751fe47 (patch)
tree4ab4d2d70c38e4d2d435d67dcc0084d6b4a43826 /src
parenta55947a66ae92422f29f73679f9c1fe84c0778ee (diff)
downloadfortran-assignment2-94e4f02728e102d69a1a2378869c22519751fe47.tar.gz
fortran-assignment2-94e4f02728e102d69a1a2378869c22519751fe47.zip
move: text.f90 → src/f1.f90
Diffstat (limited to 'src')
-rw-r--r--src/f1.f9032
1 files changed, 32 insertions, 0 deletions
diff --git a/src/f1.f90 b/src/f1.f90
new file mode 100644
index 0000000..38f360f
--- /dev/null
+++ b/src/f1.f90
@@ -0,0 +1,32 @@
+PROGRAM test
+
+ use, intrinsic :: iso_c_binding
+ IMPLICIT none
+
+ INCLUDE 'fftw3.f03'
+
+ integer, parameter :: npoints = 1024
+ real(C_DOUBLE), parameter :: start = 0, end = 1
+ integer :: i
+ real(C_DOUBLE) :: t, &
+ delta = (end - start) / real(npoints - 1, C_DOUBLE)
+
+ DO i = 0, npoints - 1
+
+ t = i * delta + start
+
+ write(*,*) t, " ", f1(t)
+
+ END DO
+
+CONTAINS
+
+ PURE real(C_DOUBLE) FUNCTION f1(t)
+ real(C_DOUBLE), intent(in) :: t
+ real(C_DOUBLE), parameter :: pi = acos(-1.0)
+
+ f1 = sin(2 * pi * t * 200) + 2 * sin(2 * pi * t * 400)
+
+ END FUNCTION f1
+
+END PROGRAM test