EPANET  3.0
EPANET Development Project
units.h
Go to the documentation of this file.
1 /* EPANET 3
2  *
3  * Copyright (c) 2016 Open Water Analytics
4  * Licensed under the terms of the MIT License (see the LICENSE file for details).
5  *
6  */
7 
10 
11 #ifndef UNITS_H_
12 #define UNITS_H_
13 
14 #include "Core/options.h"
15 
16 #include <string>
17 
20 
21 class Units
22 {
23  public:
24 
25  enum Quantity {
26  DIAMETER,
27  LENGTH,
28  VOLUME,
29  POWER,
30  PRESSURE,
31  FLOW,
32  VELOCITY,
33  HEADLOSS,
34  CONCEN,
35  MAX_QUANTITIES
36  };
37 
38  Units();
39  ~Units() {}
40 
41  void setUnits(Options& options);
42  double factor(Quantity quantity);
43  std::string name(Quantity quantity);
44 
45  private:
46 
47  double factors[MAX_QUANTITIES];
48  std::string names[MAX_QUANTITIES];
49 
50  int setFlowFactor(const int flowUnits);
51  void setPressureFactor(const int unitSystem, Options& options);
52  void setOtherFactors(int unitSystem);
53 };
54 
55 //-----------------------------------------------------------------------------
56 // Inline Functions
57 //-----------------------------------------------------------------------------
58 inline double Units::factor(Quantity quantity) {return factors[quantity];}
59 
60 inline std::string Units::name(Quantity quantity) {return names[quantity];}
61 
62 #endif
User-supplied options for analyzing a pipe network.
Definition: options.h:23
Defines units conversion factors for network quantities.
Definition: units.h:21
Describes the Options class.