src/model/TableMultiVariableLookup_Impl.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #ifndef MODEL_TABLEMULTIVARIABLELOOKUP_IMPL_HPP | ||
| 7 | #define MODEL_TABLEMULTIVARIABLELOOKUP_IMPL_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "Curve_Impl.hpp" | ||
| 11 | #include "TableMultiVariableLookup.hpp" | ||
| 12 | |||
| 13 | namespace openstudio { | ||
| 14 | namespace model { | ||
| 15 | |||
| 16 | // Foward declaration | ||
| 17 | class TableMultiVariableLookupPoint; | ||
| 18 | |||
| 19 | namespace detail { | ||
| 20 | |||
| 21 | /** TableMultiVariableLookup_Impl is a Curve_Impl that is the implementation class for TableMultiVariableLookup.*/ | ||
| 22 | class MODEL_API TableMultiVariableLookup_Impl : public Curve_Impl | ||
| 23 | { | ||
| 24 | public: | ||
| 25 | /** @name Constructors and Destructors */ | ||
| 26 | //@{ | ||
| 27 | |||
| 28 | TableMultiVariableLookup_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); | ||
| 29 | |||
| 30 | TableMultiVariableLookup_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); | ||
| 31 | |||
| 32 | TableMultiVariableLookup_Impl(const TableMultiVariableLookup_Impl& other, Model_Impl* model, bool keepHandle); | ||
| 33 | |||
| 34 | 13 | virtual ~TableMultiVariableLookup_Impl() override = default; | |
| 35 | |||
| 36 | //@} | ||
| 37 | /** @name Virtual Methods */ | ||
| 38 | //@{ | ||
| 39 | |||
| 40 | virtual const std::vector<std::string>& outputVariableNames() const override; | ||
| 41 | |||
| 42 | virtual IddObjectType iddObjectType() const override; | ||
| 43 | |||
| 44 | //@} | ||
| 45 | /** @name Getters */ | ||
| 46 | //@{ | ||
| 47 | |||
| 48 | std::string interpolationMethod() const; | ||
| 49 | |||
| 50 | bool isInterpolationMethodDefaulted() const; | ||
| 51 | |||
| 52 | int numberofInterpolationPoints() const; | ||
| 53 | |||
| 54 | bool isNumberofInterpolationPointsDefaulted() const; | ||
| 55 | |||
| 56 | boost::optional<std::string> curveType() const; | ||
| 57 | |||
| 58 | std::string tableDataFormat() const; | ||
| 59 | |||
| 60 | bool isTableDataFormatDefaulted() const; | ||
| 61 | |||
| 62 | boost::optional<std::string> externalFileName() const; | ||
| 63 | |||
| 64 | std::string x1SortOrder() const; | ||
| 65 | |||
| 66 | bool isX1SortOrderDefaulted() const; | ||
| 67 | |||
| 68 | std::string x2SortOrder() const; | ||
| 69 | |||
| 70 | bool isX2SortOrderDefaulted() const; | ||
| 71 | |||
| 72 | boost::optional<double> normalizationReference() const; | ||
| 73 | |||
| 74 | boost::optional<double> minimumValueofX1() const; | ||
| 75 | |||
| 76 | boost::optional<double> maximumValueofX1() const; | ||
| 77 | |||
| 78 | boost::optional<double> minimumValueofX2() const; | ||
| 79 | |||
| 80 | boost::optional<double> maximumValueofX2() const; | ||
| 81 | |||
| 82 | boost::optional<double> minimumValueofX3() const; | ||
| 83 | |||
| 84 | boost::optional<double> maximumValueofX3() const; | ||
| 85 | |||
| 86 | boost::optional<double> minimumValueofX4() const; | ||
| 87 | |||
| 88 | boost::optional<double> maximumValueofX4() const; | ||
| 89 | |||
| 90 | boost::optional<double> minimumValueofX5() const; | ||
| 91 | |||
| 92 | boost::optional<double> maximumValueofX5() const; | ||
| 93 | |||
| 94 | boost::optional<double> minimumTableOutput() const; | ||
| 95 | |||
| 96 | boost::optional<double> maximumTableOutput() const; | ||
| 97 | |||
| 98 | std::string inputUnitTypeforX1() const; | ||
| 99 | |||
| 100 | bool isInputUnitTypeforX1Defaulted() const; | ||
| 101 | |||
| 102 | std::string inputUnitTypeforX2() const; | ||
| 103 | |||
| 104 | bool isInputUnitTypeforX2Defaulted() const; | ||
| 105 | |||
| 106 | std::string inputUnitTypeforX3() const; | ||
| 107 | |||
| 108 | bool isInputUnitTypeforX3Defaulted() const; | ||
| 109 | |||
| 110 | std::string inputUnitTypeforX4() const; | ||
| 111 | |||
| 112 | bool isInputUnitTypeforX4Defaulted() const; | ||
| 113 | |||
| 114 | std::string inputUnitTypeforX5() const; | ||
| 115 | |||
| 116 | bool isInputUnitTypeforX5Defaulted() const; | ||
| 117 | |||
| 118 | std::string outputUnitType() const; | ||
| 119 | |||
| 120 | bool isOutputUnitTypeDefaulted() const; | ||
| 121 | |||
| 122 | int numberofIndependentVariables() const; | ||
| 123 | |||
| 124 | /** Print a fixed-width table of the points, precision is the number of decimals */ | ||
| 125 | std::string printTable(unsigned int precision) const; | ||
| 126 | |||
| 127 | //@} | ||
| 128 | /** @name Setters */ | ||
| 129 | //@{ | ||
| 130 | |||
| 131 | bool setInterpolationMethod(const std::string& interpolationMethod); | ||
| 132 | |||
| 133 | void resetInterpolationMethod(); | ||
| 134 | |||
| 135 | bool setNumberofInterpolationPoints(int numberofInterpolationPoints); | ||
| 136 | |||
| 137 | void resetNumberofInterpolationPoints(); | ||
| 138 | |||
| 139 | bool setCurveType(boost::optional<std::string> curveType); | ||
| 140 | |||
| 141 | void resetCurveType(); | ||
| 142 | |||
| 143 | bool setTableDataFormat(const std::string& tableDataFormat); | ||
| 144 | |||
| 145 | void resetTableDataFormat(); | ||
| 146 | |||
| 147 | bool setExternalFileName(boost::optional<std::string> externalFileName); | ||
| 148 | |||
| 149 | void resetExternalFileName(); | ||
| 150 | |||
| 151 | bool setX1SortOrder(const std::string& x1SortOrder); | ||
| 152 | |||
| 153 | void resetX1SortOrder(); | ||
| 154 | |||
| 155 | bool setX2SortOrder(const std::string& x2SortOrder); | ||
| 156 | |||
| 157 | void resetX2SortOrder(); | ||
| 158 | |||
| 159 | bool setNormalizationReference(boost::optional<double> normalizationReference); | ||
| 160 | |||
| 161 | void resetNormalizationReference(); | ||
| 162 | |||
| 163 | bool setMinimumValueofX1(boost::optional<double> minimumValueofX1); | ||
| 164 | |||
| 165 | void resetMinimumValueofX1(); | ||
| 166 | |||
| 167 | bool setMaximumValueofX1(boost::optional<double> maximumValueofX1); | ||
| 168 | |||
| 169 | void resetMaximumValueofX1(); | ||
| 170 | |||
| 171 | bool setMinimumValueofX2(boost::optional<double> minimumValueofX2); | ||
| 172 | |||
| 173 | void resetMinimumValueofX2(); | ||
| 174 | |||
| 175 | bool setMaximumValueofX2(boost::optional<double> maximumValueofX2); | ||
| 176 | |||
| 177 | void resetMaximumValueofX2(); | ||
| 178 | |||
| 179 | bool setMinimumValueofX3(boost::optional<double> minimumValueofX3); | ||
| 180 | |||
| 181 | void resetMinimumValueofX3(); | ||
| 182 | |||
| 183 | bool setMaximumValueofX3(boost::optional<double> maximumValueofX3); | ||
| 184 | |||
| 185 | void resetMaximumValueofX3(); | ||
| 186 | |||
| 187 | bool setMinimumValueofX4(boost::optional<double> minimumValueofX4); | ||
| 188 | |||
| 189 | void resetMinimumValueofX4(); | ||
| 190 | |||
| 191 | bool setMaximumValueofX4(boost::optional<double> maximumValueofX4); | ||
| 192 | |||
| 193 | void resetMaximumValueofX4(); | ||
| 194 | |||
| 195 | bool setMinimumValueofX5(boost::optional<double> minimumValueofX5); | ||
| 196 | |||
| 197 | void resetMinimumValueofX5(); | ||
| 198 | |||
| 199 | bool setMaximumValueofX5(boost::optional<double> maximumValueofX5); | ||
| 200 | |||
| 201 | void resetMaximumValueofX5(); | ||
| 202 | |||
| 203 | bool setMinimumTableOutput(boost::optional<double> minimumTableOutput); | ||
| 204 | |||
| 205 | void resetMinimumTableOutput(); | ||
| 206 | |||
| 207 | bool setMaximumTableOutput(boost::optional<double> maximumTableOutput); | ||
| 208 | |||
| 209 | void resetMaximumTableOutput(); | ||
| 210 | |||
| 211 | bool setInputUnitTypeforX1(const std::string& inputUnitTypeforX1); | ||
| 212 | |||
| 213 | void resetInputUnitTypeforX1(); | ||
| 214 | |||
| 215 | bool setInputUnitTypeforX2(const std::string& inputUnitTypeforX2); | ||
| 216 | |||
| 217 | void resetInputUnitTypeforX2(); | ||
| 218 | |||
| 219 | bool setInputUnitTypeforX3(const std::string& inputUnitTypeforX3); | ||
| 220 | |||
| 221 | void resetInputUnitTypeforX3(); | ||
| 222 | |||
| 223 | bool setInputUnitTypeforX4(const std::string& inputUnitTypeforX4); | ||
| 224 | |||
| 225 | void resetInputUnitTypeforX4(); | ||
| 226 | |||
| 227 | bool setInputUnitTypeforX5(const std::string& inputUnitTypeforX5); | ||
| 228 | |||
| 229 | void resetInputUnitTypeforX5(); | ||
| 230 | |||
| 231 | bool setOutputUnitType(const std::string& outputUnitType); | ||
| 232 | |||
| 233 | void resetOutputUnitType(); | ||
| 234 | |||
| 235 | bool setNumberofIndependentVariables(int numberofIndependentVariables); | ||
| 236 | |||
| 237 | //@} | ||
| 238 | /** @name Other */ | ||
| 239 | //@{ | ||
| 240 | |||
| 241 | int numVariables() const override; | ||
| 242 | |||
| 243 | /** Return all of the x values for independent variable i | ||
| 244 | * in ascending order. | ||
| 245 | * | ||
| 246 | * The independent variables are indexed from 0. | ||
| 247 | */ | ||
| 248 | std::vector<double> xValues(int xIndex) const; | ||
| 249 | |||
| 250 | /** Return the y value corresponding to xValues. | ||
| 251 | * If no value then return boost::none | ||
| 252 | */ | ||
| 253 | boost::optional<double> yValue(const std::vector<double>& xValues) const; | ||
| 254 | |||
| 255 | double evaluate(const std::vector<double>& x) const override; | ||
| 256 | |||
| 257 | // Primary way to add a point | ||
| 258 | bool addPoint(const TableMultiVariableLookupPoint& point); | ||
| 259 | |||
| 260 | // Convenience functions | ||
| 261 | bool addPoint(const std::vector<double>& t_xValues, double t_yValue); | ||
| 262 | bool addPoint(double x1, double yValue); | ||
| 263 | bool addPoint(double x1, double x2, double yValue); | ||
| 264 | bool addPoint(double x1, double x2, double x3, double yValue); | ||
| 265 | bool addPoint(double x1, double x2, double x3, double x4, double yValue); | ||
| 266 | bool addPoint(double x1, double x2, double x3, double x4, double x5, double yValue); | ||
| 267 | |||
| 268 | // Directly set the points from a vector, will delete any existing points | ||
| 269 | bool setPoints(const std::vector<TableMultiVariableLookupPoint>& points); | ||
| 270 | |||
| 271 | std::vector<TableMultiVariableLookupPoint> points() const; | ||
| 272 | |||
| 273 | static bool xValuesEqual(const std::vector<double>& a, const std::vector<double>& b); | ||
| 274 | |||
| 275 | //@} | ||
| 276 | protected: | ||
| 277 | private: | ||
| 278 | − | REGISTER_LOGGER("openstudio.model.TableMultiVariableLookup"); | |
| 279 | }; | ||
| 280 | |||
| 281 | } // namespace detail | ||
| 282 | |||
| 283 | } // namespace model | ||
| 284 | } // namespace openstudio | ||
| 285 | |||
| 286 | #endif // MODEL_TABLEMULTIVARIABLELOOKUP_IMPL_HPP | ||
| 287 |