ftnlf

Check-in [7098e49cb7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Test modified array.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | multi
Files: files | file ages | folders
SHA1:7098e49cb73847344104ef5520daa58792b44479
User & Date: vadim 2018-05-06 21:10:27
Context
2018-05-07
08:29
Loadable Fortran extensions. Leaf check-in: e31927db4e user: vadim tags: multi
2018-05-06
21:10
Test modified array. check-in: 7098e49cb7 user: vadim tags: multi
21:07
Fix and test luafunc* check-in: e32558ae06 user: vadim tags: multi
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test.f90.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
program test
    ! Mockup for ftnlf
    use ftnlf
    implicit none
    
    logical :: r
    real(8) :: fval
    real(8) :: fvals(10), arr_m(0), arr_o(10)
    
    ! Initialize
    r = ftnlf_init('testdb.lua')
    if (.not. r) stop 99

    ! Simplified iface
    r = luafun('', 'tbl1', 'val1', [1.d0,-3.5d0], fval)
................................................................................
    r = luafunc('tblq', 'v2', [1.d0,-1.7d0], fval)
    write (*,'(L2,1X,1PE11.4)') r, fval

    r = luafunc('tblq', 'val1', [1.d0,-1.7d0], fval)
    write (*,'(L2,1X,1PE11.4)') r, fval

    ! Generic iface, array I/O

    r = luafuna('', 'tbl1', 'valN', [1.d0,-3.5d0], fvals(1:2), &
        & [1.1d0, 1.2d0, 1.3d0, 1.4d0], arr_m, arr_o)
    write (*,'(L2,5(1X,1PE11.4))') r, fvals(1:2), arr_o(1:3)

    ! Finalize
    call ftnlf_done()
    write (0,'(A)') 'Done.'

end program test







|







 







>


|






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
program test
    ! Mockup for ftnlf
    use ftnlf
    implicit none
    
    logical :: r
    real(8) :: fval
    real(8) :: fvals(10), arr_m(1), arr_o(10)
    
    ! Initialize
    r = ftnlf_init('testdb.lua')
    if (.not. r) stop 99

    ! Simplified iface
    r = luafun('', 'tbl1', 'val1', [1.d0,-3.5d0], fval)
................................................................................
    r = luafunc('tblq', 'v2', [1.d0,-1.7d0], fval)
    write (*,'(L2,1X,1PE11.4)') r, fval

    r = luafunc('tblq', 'val1', [1.d0,-1.7d0], fval)
    write (*,'(L2,1X,1PE11.4)') r, fval

    ! Generic iface, array I/O
    arr_m(1) = -0.9d0
    r = luafuna('', 'tbl1', 'valN', [1.d0,-3.5d0], fvals(1:2), &
        & [1.1d0, 1.2d0, 1.3d0, 1.4d0], arr_m, arr_o)
    write (*,'(L2,6(1X,1PE11.4))') r, fvals(1:2), arr_m(1:1), arr_o(1:3)

    ! Finalize
    call ftnlf_done()
    write (0,'(A)') 'Done.'

end program test

Changes to testdb.lua.

4
5
6
7
8
9
10

11
12
13
14
15
16
17
tbl1 = { val1 = 17.4e-1,
v2 = function(x,y) return (x/y) end,
v3 = iii,
valN = function(x,y,ai,am,ao)
ao[1] = (x+y)*ai[1]
ao[2] = (x*y)/ai[2]
ao[3] = math.atan2(y*ai[3],x*ai[4])

return x-y, x+y
end
}

dir1 = {
   tbl1 = { v5 = function(x,y) return x-y end },
   tbl2 = { v6 = FXC.interp({-10,1,10,70}), v7 = -29.3e-4},







>







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
tbl1 = { val1 = 17.4e-1,
v2 = function(x,y) return (x/y) end,
v3 = iii,
valN = function(x,y,ai,am,ao)
ao[1] = (x+y)*ai[1]
ao[2] = (x*y)/ai[2]
ao[3] = math.atan2(y*ai[3],x*ai[4])
am[1] = am[1]*(-10.)
return x-y, x+y
end
}

dir1 = {
   tbl1 = { v5 = function(x,y) return x-y end },
   tbl2 = { v6 = FXC.interp({-10,1,10,70}), v7 = -29.3e-4},