source: trunk/test/src/RpLibraryF_test.f @ 84

Last change on this file since 84 was 84, checked in by dkearney, 18 years ago
  1. added "install" target to make file for copying files over to /opt/rappture
  2. added targets for python to build and install the units module
  3. added fortran stub functions for library and units.

RpLibraryF_test.f compiles, just with warnings, because i'm still working on it.

File size: 3.2 KB
Line 
1c ----------------------------------------------------------------------
2c  TEST: Fortran Rappture Library Test Source.
3c
4c  Simple tests of the Rappture Library Fortran Bindings
5c
6c ======================================================================
7c  AUTHOR:  Derrick Kearney, Purdue University
8c  Copyright (c) 2005
9c  Purdue Research Foundation, West Lafayette, IN
10c ======================================================================
11      SUBROUTINE  test_element(lib,path)
12        integer rp_lib_element_obj
13        integer retVal, lib
14        character*100 typ, comp, id, path
15
16        print *,"TESTING ELEMENT: path = ",path
17
18        retVal = rp_lib_element_obj(lib, path)
19
20        print *,"dict key = ",retVal
21
22        ! what happens when you get details for lib?
23        call rp_lib_node_comp(retVal,comp)
24        call rp_lib_node_type(retVal,typ)
25        call rp_lib_node_id(retVal,id)
26
27        print *,"comp = ",comp
28        print *,"type = ",typ
29        print *,"id = ",id
30      END SUBROUTINE  test_element
31
32      SUBROUTINE  test_get_str(lib,path)
33        integer lib
34        character*100 path, retText
35
36        print *,"TESTING GET: path = ",path
37
38        call rp_lib_get(lib, path, retText)
39
40        print *,"retText = ",retText
41      END SUBROUTINE  test_get_str
42
43      SUBROUTINE  test_get_dbl(lib,path)
44        integer lib
45        double precision rslt, rp_lib_get_double
46        character*100 path, retText
47
48        print *,"TESTING GET: path = ",path
49
50        rslt = rp_lib_get_double(lib, path)
51
52        print *,"rslt = ",rslt
53      END SUBROUTINE  test_get_dbl
54
55      program rplib_f_tests
56        IMPLICIT NONE
57
58        integer rp_lib, rp_units_convert_dbl, rp_units_add_presets
59        integer rp_lib_element_obj
60
61        integer driver, ok
62        double precision T, Ef, kT, Emin, Emax, dE, f, E
63        CHARACTER*100 inFile, strVal, path
64        character*40 xy
65
66        call getarg(1,inFile)
67        driver = rp_lib(inFile)
68        ! print *,"dict key = ",driver
69
70        ok = rp_units_add_presets("all")
71
72        ! TESTING ELEMENT
73        !call test_element(driver, "input.number(min)")
74        path = "input.number(min)"
75        call test_element(driver, path)
76        !call rp_lib_get(driver, path, strVal)
77        !print *,"strVal = ",strVal
78
79        ! TESTING GET STRING
80        path = "input.number(min).current"
81        call test_get_str(driver, path)
82
83        ! TESTING GET DOUBLE
84        path = "input.number(min).current"
85        call test_get_dbl(driver, path)
86
87
88        call rp_result(driver)
89      end program rplib_f_tests
90
91!        call rp_lib_get(driver,
92!     +        "input.number(min).current", strVal)
93!        ok = rp_units_convert_dbl(strVal,"K",T)
94!
95!        call rp_lib_get(driver,
96!     +        "input.number(Ef).current", strVal)
97!        ok = rp_units_convert_dbl(strVal,"K",Ef)
98!
99!        kT = 8.61734e-5 * T
100!        Emin = Ef - 10*kT
101!        Emax = Ef + 10*kT
102!
103!        dE = 0.005*(Emax - Emin)
104!
105!        do 10 E=Emin,Emax,dE
106!          f = 1.0/(1.0+exp((E-Ef)/kT))
107!          write(xy,'(E20.12,F13.9,A)') f, E, char(10)
108!          call rp_lib_put_str(driver,
109!     +        "output.curve(f12).component.xy", xy, 1)
110! 10     continue
111!
112!      end program rplib_f_tests
Note: See TracBrowser for help on using the repository browser.