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

Contents of /trunk/pygtk/dimensions.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1699 - (show annotations) (download) (as text)
Sat Jan 5 02:49:48 2008 UTC (12 years, 6 months ago) by jpye
File MIME type: text/x-chdr
File size: 2055 byte(s)
Added operator< to SymChar class (C++).
Added toString method to Dimensions class (C++).
Fixed close-button behaviour in Solver Reporter dialog (Python).
Added Library::getUnits to get list of all units of measurement in use (C++).
Added Library::getRealAtomTypes to get list of all real atomic types (C++).
Removed duplicated class definition for Dimensions in ascpy.i (C++).
Added __str__ to Python wrapping of Dimensions type.
Started working on populating data fields in UnitsDialog (Python).
Default constructor for Dimensions object now creates 'wildcard' dimension.
Cleared contents of library.i (should delete it actually).
Added Type::isFundamental (C++).
Tidied find.h formatting, #includes.

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/dimen.h>
12 }
13
14 /**
15 A mapping of dimensions to units
16 */
17 /*
18 map<Dimensions,UnitsM> defaultUnits
19 multimaps<Dimensions,UnitsM> allUnits
20 */
21
22 /**
23 A 'dimensions object'. This is a wrapper to the 'dim_type' in ASCEND.
24 This object allows querying to find suitable units for outputting
25 or inputting data from/for a given type.
26 */
27 class Dimensions{
28 private:
29 const dim_type *d;
30 public:
31 static const unsigned MAX_DIMS = NUM_DIMENS;
32 static const std::string BASEUNITS[MAX_DIMS];
33
34 /// Return the string name of fundamental unit for the i-th dimension of measurement.
35 static const std::string getBaseUnit(const unsigned &i);
36
37 /// Construct a Dimension object fro mthe ASCEND internal data type
38 Dimensions(const dim_type *d);
39
40 /// Copy constructor
41 Dimensions(const Dimensions &);
42
43 /// Default constructor, required to keep std::vector happy
44 Dimensions();
45
46 /// Return the ASCEND internal datatype
47 const dim_type *getInternalType() const;
48
49 const std::string toString() 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 #ifndef SWIG
69 /// Get the numerator part of the index in the i-th dimension (eg for Area, with i={length}, return 2)
70 const FRACPART getFractionNumerator(const unsigned &i) const;
71
72 /// Get the denominator part of the index in the i-th dimension
73 const FRACPART getFractionDenominator(const unsigned &i) const;
74 #endif
75 };
76
77 #endif

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