/[ascend]/trunk/pygtk/dimensions.h
ViewVC logotype

Contents of /trunk/pygtk/dimensions.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download) (as text)
Mon Apr 24 02:23:08 2006 UTC (18 years, 1 month ago) by johnpye
File MIME type: text/x-chdr
File size: 2060 byte(s)
Removed 'interface' directory in trunk/pygtk/interface (moved everything up a level)
Made corresponding changes to SCons* and spec files.
1 #ifndef ASCXX_DIMENSIONS_H
2 #define ASCXX_DIMENSIONS_H
3
4 #include <string>
5
6 #include "units.h"
7 #include "config.h"
8
9 extern "C"{
10 #include <utilities/ascConfig.h>
11 #include <compiler/fractions.h>
12 #include <compiler/compiler.h>
13 #include <compiler/dimen.h>
14 }
15
16 /**
17 A mapping of dimensions to units
18 */
19 /*
20 map<Dimensions,UnitsM> defaultUnits
21 multimaps<Dimensions,UnitsM> allUnits
22 */
23
24 /**
25 A 'dimensions object'. This is a wrapper to the 'dim_type' in ASCEND.
26 This object allows querying to find suitable units for outputting
27 or inputting data from/for a given type.
28 */
29 class Dimensions{
30 private:
31 const dim_type *d;
32 public:
33 static const unsigned MAX_DIMS = NUM_DIMENS;
34 static const std::string BASEUNITS[MAX_DIMS];
35
36 /// Return the string name of fundamental unit for the i-th dimension of measurement.
37 static const std::string getBaseUnit(const unsigned &i);
38
39 /// Construct a Dimension object fro mthe ASCEND internal data type
40 Dimensions(const dim_type *d);
41
42 /// Copy constructor
43 Dimensions(const Dimensions &);
44
45 /// Default constructor, required to keep std::vector happy
46 Dimensions();
47
48 /// Return the ASCEND internal datatype
49 const dim_type *getInternalType() const;
50
51 // Comparison operators
52 const bool operator<(const Dimensions &) const;
53 const bool operator==(const Dimensions &) const;
54 const bool operator!=(const Dimensions &) const;
55
56 /// Get default units for the given dimension
57 // const UnitsM getDefaultUnits() const; # DEFINED IN PYTHON
58
59 /// Get the user's preferred units for the given dimension
60 //const UnitsM getUserUnits() const; # DEFINED IN PYTHON
61
62 /// Test for a dimensionless Dimension object
63 const bool isDimensionless() const;
64
65 /// Test for a wildcard ('don't care') Dimension object
66 const bool isWild() const;
67
68 /// Get the numerator part of the index in the i-th dimension (eg for Area, with i={length}, return 2)
69 const FRACPART getFractionNumerator(const unsigned &i) const;
70
71 /// Get the denominator part of the index in the i-th dimension
72 const FRACPART getFractionDenominator(const unsigned &i) const;
73 };
74
75 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22