00001 00009 #ifndef BS_RATE_CONTROL_TYPE_H_ 00010 #define BS_RATE_CONTROL_TYPE_H_ 00011 00012 namespace blue_sky 00013 { 00014 namespace wells 00015 { 00016 00021 enum rate_control_type 00022 { 00023 null_control, 00024 bhp_control, 00025 rate_control, 00026 liquid_rate_control, 00027 oil_rate_control, 00028 water_rate_control, 00029 gas_rate_control, 00030 }; 00031 00038 rate_control_type 00039 rate_control_cast (int i); 00040 00049 rate_control_type 00050 rate_control_cast (const std::string &str); 00051 00057 bool 00058 is_bhp_control (rate_control_type type); 00059 00066 bool 00067 is_rate_control (rate_control_type type); 00068 00069 inline rate_control_type 00070 rate_control_cast (int i) 00071 { 00072 if (i <= null_control && i > gas_rate_control) 00073 { 00074 BS_ASSERT (false && "UNSUPPORTED VALUE") (i); 00075 return null_control; 00076 } 00077 00078 return static_cast <rate_control_type> (i); 00079 } 00080 inline rate_control_type 00081 rate_control_cast (const std::string &str) 00082 { 00083 if (str == "BHP") 00084 return bhp_control; 00085 else if (str == "RATE") 00086 return rate_control; 00087 else if (str == "LRAT") 00088 return liquid_rate_control; 00089 else if (str == "ORAT") 00090 return oil_rate_control; 00091 else if (str == "WRAT") 00092 return water_rate_control; 00093 else if (str == "GRAT") 00094 return gas_rate_control; 00095 else if (str == "RESV") 00096 { 00097 BS_ASSERT (false && "Unsupported rate_control type") (str); 00098 return null_control; 00099 } 00100 else if (str == "") 00101 return null_control; 00102 else 00103 { 00104 BS_ASSERT (false && "Unsuported rate_control type") (str); 00105 throw bs_exception ("rate_control_cast", "Unsupported rate_control type"); 00106 } 00107 } 00108 00109 inline bool 00110 is_bhp_control (rate_control_type type) 00111 { 00112 return type == bhp_control; 00113 } 00114 inline bool 00115 is_rate_control (rate_control_type type) 00116 { 00117 return type != bhp_control && type != null_control; 00118 } 00119 00120 00121 } // namespace wells 00122 } // namespce blue_sky 00123 00124 00125 #endif // #ifndef BS_RATE_CONTROL_TYPE_ 00126