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

Last change on this file since 83 was 83, checked in by dkearney, 18 years ago
  1. More cleaning of RpUnits and RpLibrary? code
  2. added rp_result code to c++/fortran/c code
  3. added rp_children, rp_lib_node[comp,type,id] for fortran code (need to test)
  4. adjusted convert function to recognize statements as follows:

convert("5J","neV")
convert("3.12075e+28neV","J")

  1. made joules a metric unit in RpUnits.cc
  2. tested examples/app-fermi/fortran/fermi.f with new rappture library.

added units conversion.

File size: 2.8 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      program rplib_f_tests
44        IMPLICIT NONE
45
46        integer rp_lib, rp_units_convert_dbl, rp_units_add_presets
47        integer rp_lib_element_obj
48
49        integer driver, ok
50        double precision T, Ef, kT, Emin, Emax, dE, f, E
51        CHARACTER*100 inFile, strVal, path
52        character*40 xy
53
54        call getarg(1,inFile)
55        driver = rp_lib(inFile)
56        ! print *,"dict key = ",driver
57
58        ok = rp_units_add_presets("all")
59
60        ! TESTING ELEMENT
61        !call test_element(driver, "input.number(min)")
62        path = "input.number(min)"
63        call test_element(driver, path)
64        !call rp_lib_get(driver, path, strVal)
65        !print *,"strVal = ",strVal
66
67        ! TESTING GET
68        path = "input.number(min).current"
69        call test_get_str(driver, path)
70
71
72        call rp_result(driver)
73      end program rplib_f_tests
74
75!        call rp_lib_get(driver,
76!     +        "input.number(min).current", strVal)
77!        ok = rp_units_convert_dbl(strVal,"K",T)
78!
79!        call rp_lib_get(driver,
80!     +        "input.number(Ef).current", strVal)
81!        ok = rp_units_convert_dbl(strVal,"K",Ef)
82!
83!        kT = 8.61734e-5 * T
84!        Emin = Ef - 10*kT
85!        Emax = Ef + 10*kT
86!
87!        dE = 0.005*(Emax - Emin)
88!
89!        do 10 E=Emin,Emax,dE
90!          f = 1.0/(1.0+exp((E-Ef)/kT))
91!          write(xy,'(E20.12,F13.9,A)') f, E, char(10)
92!          call rp_lib_put_str(driver,
93!     +        "output.curve(f12).component.xy", xy, 1)
94! 10     continue
95!
96!      end program rplib_f_tests
Note: See TracBrowser for help on using the repository browser.