summaryrefslogtreecommitdiff
path: root/src/Quantity/Quantity_Convert.cxx
blob: 3330505138b80513c2c36ff2f37ce99e23ecd73f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113

#include <Quantity_Convert.ixx>
#include <TCollection_AsciiString.hxx>
#include <Quantity_Array1OfCoefficient.hxx>

Standard_EXPORT Quantity_Array1OfCoefficient ConvertTable(1,68);
static Standard_CString theEnums[] = {      // En attendant la methode "Elements" de Standard_Type
"Quantity_MASS", 
"Quantity_PLANEANGLE", 
"Quantity_SOLIDANGLE", 
"Quantity_LENGTH", 
"Quantity_AREA", 
"Quantity_VOLUME", 
"Quantity_SPEED", 
"Quantity_VELOCITY", 
"Quantity_ACCELERATION", 
"Quantity_ANGULARVELOCITY", 
"Quantity_FREQUENCY", 
"Quantity_TEMPERATURE", 
"Quantity_AMOUNTOFSUBSTANCE", 
"Quantity_DENSITY", 
"Quantity_MASSFLOW", 
"Quantity_VOLUMEFLOW", 
"Quantity_CONSUMPTION", 
"Quantity_MOMENTUM", 
"Quantity_KINETICMOMENT", 
"Quantity_MOMENTOFINERTIA", 
"Quantity_FORCE", 
"Quantity_MOMENTOFAFORCE", 
"Quantity_TORQUE", 
"Quantity_WEIGHT", 
"Quantity_PRESSURE", 
"Quantity_VISCOSITY", 
"Quantity_KINEMATICVISCOSITY", 
"Quantity_ENERGY", 
"Quantity_WORK", 
"Quantity_POWER", 
"Quantity_SURFACETENSION", 
"Quantity_COEFFICIENTOFEXPANSION", 
"Quantity_THERMALCONDUCTIVITY", 
"Quantity_SPECIFICHEATCAPACITY", 
"Quantity_ENTROPY", 
"Quantity_ENTHALPY", 
"Quantity_LUMINOUSINTENSITY", 
"Quantity_LUMINOUSFLUX", 
"Quantity_LUMINANCE", 
"Quantity_ILLUMINANCE", 
"Quantity_LUMINOUSEXPOSITION", 
"Quantity_LUMINOUSEFFICACITY", 
"Quantity_ELECTRICCHARGE", 
"Quantity_ELECTRICCURRENT", 
"Quantity_ELECTRICFIELDSTRENGTH", 
"Quantity_ELECTRICPOTENTIAL", 
"Quantity_ELECTRICCAPACITANCE", 
"Quantity_MAGNETICFLUX", 
"Quantity_MAGNETICFLUXDENSITY", 
"Quantity_MAGNETICFIELDSTRENGTH", 
"Quantity_RELUCTANCE", 
"Quantity_RESISTANCE", 
"Quantity_INDUCTANCE", 
"Quantity_CAPACITANCE", 
"Quantity_IMPEDANCE", 
"Quantity_ADMITTANCE", 
"Quantity_RESISTIVITY", 
"Quantity_CONDUCTIVITY", 
"Quantity_MOLARMASS", 
"Quantity_MOLARVOLUME", 
"Quantity_CONCENTRATION", 
"Quantity_MOLARCONCENTRATION", 
"Quantity_MOLARITY", 
"Quantity_SOUNDINTENSITY", 
"Quantity_ACOUSTICINTENSITY", 
"Quantity_ACTIVITY", 
"Quantity_ABSORBEDDOSE", 
"Quantity_DOSEEQUIVALENT" };

//----------------------------------------------------------------------------
//  Create
//----------------------------------------------------------------------------
Quantity_Convert::Quantity_Convert () {
// ...On se fixe sur un nombre de grandeurs physiques egal a 68 (temporaire)
// ...Initialisation de la table de correspondance a 1 (Coefficient de conversion
// ...par defaut)
   for (Standard_Integer i = 1 ; i <= 68 ; i++) ConvertTable(i) = 1;
}


//----------------------------------------------------------------------------
//  IsPhysicalQuantity
//----------------------------------------------------------------------------
Standard_Boolean Quantity_Convert::IsPhysicalQuantity 
        (const TCollection_AsciiString& aTypeName, TCollection_AsciiString& anEnum) 
{
//     ... Fabriquer le nom de l'enumeration (Quantity_LENGTH par exemple).
   TCollection_AsciiString aPrefixe("Quantity_");
   anEnum = aTypeName;
   anEnum.UpperCase();
   anEnum.Prepend(aPrefixe);
// ... Rechercher si il existe existe une valeur d'enum correspondante a <aTypeName>
   Standard_Integer i = 1;
   Standard_Boolean Find = Standard_False; 
   while (i <= 68 && !Find) 
   {
      if (IsSimilar(anEnum.ToCString(),theEnums[i-1])) 
         Find = Standard_True;
      else 
         i++;
   }
   return Find; 

}