source: trunk/src/fortran/RpUnitsFStubs.h @ 1012

Last change on this file since 1012 was 568, checked in by dkearney, 18 years ago

reworking of the Rappture Units code.
Rappture Units no longer creates an object for each metric extension of every
metric unit. Now the metric prefixes are kept in the dictionary as unit objects,
and when a unit is parsed out of the string received from the user, the unit
is checked to see if it acccepts metric prefixes, if so, a search is done for
the prefix. This allows Rappture Units code to more easily tackle case insensitive
unit name searches. Eventually the prefixes will be removed as direct Rappture Units objects and be turned into (possibly a derived object) rappture units prefix objects.

The find function of the core Rappture Units code now accepts
a "hints" function pointer. The function pointer is executed by the dictionary when
the dictionary thinks it found a matching object. This allows the user of the
dictionary to insert different objects with the same key. For Rappture Units,
multiple units objects with the same key can be inserted into the dictionary.
This is important for units like "A" which could stand for angstroms or amperes.

Additionally, the "make metric" functions were removed because the idea of being a
metric unit has been reduced to a flag inside the Rappture Units object and some
newly added logic. The role of setting the metric flag has been added to the define()
function as an additional function input. The fortran and c code has been updated to
reflect the removal of the function. No updates were made to the define function in
the fortran and c code.

The units.test file was also updated with new tests. Old tests were updated, removing
derived units from the list of compatible units. When searching for micro-meters (um),
compatible units of (A,in,m) will be provided instead of (A,in,m,um).

File size: 3.4 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Fortran Rappture Units Stub Function Headers
4 *
5 * ======================================================================
6 *  AUTHOR:  Derrick Kearney, Purdue University
7 *  Copyright (c) 2004-2005  Purdue Research Foundation
8 *
9 *  See the file "license.terms" for information on usage and
10 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 * ======================================================================
12 */
13
14#ifndef _RpUNITS_F_STUBS_H
15#define _RpUNITS_F_STUBS_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21int rp_define_unit_        (char* unitName, int* basisName, int unitName_len);
22int rp_define_unit__       (char* unitName, int* basisName, int unitName_len);
23int RP_DEFINE_UNIT         (char* unitName, int* basisName, int unitName_len);
24
25int rp_find_               (char* searchName, int searchName_len);
26int rp_find__              (char* searchName, int searchName_len);
27int RP_FIND                (char* searchName, int searchName_len);
28
29int rp_get_units_          (int* unitRefVal, char* retText, int retText_len);
30int rp_get_units__         (int* unitRefVal, char* retText, int retText_len);
31int RP_GET_UNITS           (int* unitRefVal, char* retText, int retText_len);
32
33int rp_get_units_name_     (int* unitRefVal, char* retText, int retText_len);
34int rp_get_units_name__    (int* unitRefVal, char* retText, int retText_len);
35int RP_GET_UNITS_NAME      (int* unitRefVal, char* retText, int retText_len);
36
37int rp_get_exponent_       (int* unitRefVal, double* retExponent);
38int rp_get_exponent__      (int* unitRefVal, double* retExponent);
39int RP_GET_EXPONENT        (int* unitRefVal, double* retExponent);
40
41int rp_get_basis_          (int* unitRefVal);
42int rp_get_basis__         (int* unitRefVal);
43int RP_GET_BASIS           (int* unitRefVal);
44
45int rp_units_convert_dbl_  (char* fromVal,
46                            char* toUnitsName,
47                            double* convResult,
48                            int fromVal_len,
49                            int toUnitsName_len );
50int rp_units_convert_dbl__ (char* fromVal,
51                            char* toUnitsName,
52                            double* convResult,
53                            int fromVal_len,
54                            int toUnitsName_len );
55int RP_UNITS_CONVERT_DBL   (char* fromVal,
56                            char* toUnitsName,
57                            double* convResult,
58                            int fromVal_len,
59                            int toUnitsName_len );
60
61int rp_units_convert_str_  (char* fromVal,
62                            char* toUnitsName,
63                            char* retText,
64                            int fromVal_len,
65                            int toUnitsName_len,
66                            int retText_len     );
67int rp_units_convert_str__ (char* fromVal,
68                            char* toUnitsName,
69                            char* retText,
70                            int fromVal_len,
71                            int toUnitsName_len,
72                            int retText_len     );
73int RP_UNITS_CONVERT_STR   (char* fromVal,
74                            char* toUnitsName,
75                            char* retText,
76                            int fromVal_len,
77                            int toUnitsName_len,
78                            int retText_len     );
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif
Note: See TracBrowser for help on using the repository browser.