diff options
author | Wojtek Kosior <kwojtus@protonmail.com> | 2019-06-01 12:26:42 +0200 |
---|---|---|
committer | Wojtek Kosior <kwojtus@protonmail.com> | 2019-06-01 12:26:42 +0200 |
commit | 411e388ebd94d6d6da9ba5536488badf8ed59c9f (patch) | |
tree | b9eaaf4559cd8469135a4dd2a489bdf49454f736 /src | |
parent | 94e4f02728e102d69a1a2378869c22519751fe47 (diff) | |
download | fortran-assignment2-411e388ebd94d6d6da9ba5536488badf8ed59c9f.tar.gz fortran-assignment2-411e388ebd94d6d6da9ba5536488badf8ed59c9f.zip |
allocate aligned memory using fftw
Diffstat (limited to 'src')
-rw-r--r-- | src/f1.f90 | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -11,14 +11,26 @@ PROGRAM test real(C_DOUBLE) :: t, & delta = (end - start) / real(npoints - 1, C_DOUBLE) - DO i = 0, npoints - 1 + type(C_PTR) :: p_in!, p_out, plan - t = i * delta + start + real(C_DOUBLE), pointer :: arr_in(:) +! complex(C_DOUBLE_COMPLEX), pointer :: out_arr(npoints) + + p_in = fftw_alloc_real(int(npoints, C_SIZE_T)) + + call c_f_pointer(p_in, arr_in, [npoints]) + + DO i = 1, npoints + + t = (i - 1) * delta + start + arr_in(i) = f1(t) - write(*,*) t, " ", f1(t) + write(*,*) t, " ", arr_in(i) END DO + call fftw_free(p_in) + CONTAINS PURE real(C_DOUBLE) FUNCTION f1(t) |