src/model/TableMultiVariableLookup.cpp
| 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 | #if defined(_MSC_VER) | ||
| 7 | # pragma warning(push) | ||
| 8 | # pragma warning(disable : 4996) | ||
| 9 | #elif (defined(__GNUC__)) | ||
| 10 | # pragma GCC diagnostic push | ||
| 11 | # pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #include "TableMultiVariableLookup.hpp" | ||
| 15 | #include "TableMultiVariableLookup_Impl.hpp" | ||
| 16 | |||
| 17 | #include "../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 18 | #include <utilities/idd/IddFactory.hxx> | ||
| 19 | |||
| 20 | #include <utilities/idd/OS_Table_MultiVariableLookup_FieldEnums.hxx> | ||
| 21 | #include <utilities/idd/IddEnums.hxx> | ||
| 22 | |||
| 23 | #include "../utilities/units/Unit.hpp" | ||
| 24 | |||
| 25 | #include "../utilities/math/FloatCompare.hpp" | ||
| 26 | |||
| 27 | #include "../utilities/core/Assert.hpp" | ||
| 28 | #include "../utilities/core/DeprecatedHelpers.hpp" | ||
| 29 | |||
| 30 | #include <algorithm> | ||
| 31 | #include <iomanip> | ||
| 32 | |||
| 33 | namespace openstudio { | ||
| 34 | namespace model { | ||
| 35 | |||
| 36 | 1764 | TableMultiVariableLookupPoint::TableMultiVariableLookupPoint(const std::vector<double>& x, double y) : m_x(x), m_y(y){}; | |
| 37 | |||
| 38 |
1/1✓ Branch 1 taken 1 time.
|
3 | TableMultiVariableLookupPoint::TableMultiVariableLookupPoint(double x1, double yValue) : m_x(std::vector<double>{x1}), m_y(yValue){}; |
| 39 | |||
| 40 |
1/1✓ Branch 1 taken 1 time.
|
3 | TableMultiVariableLookupPoint::TableMultiVariableLookupPoint(double x1, double x2, double yValue) : m_x(std::vector<double>{x1, x2}), m_y(yValue){}; |
| 41 | ✗ | TableMultiVariableLookupPoint::TableMultiVariableLookupPoint(double x1, double x2, double x3, double yValue) | |
| 42 | ✗ | : m_x(std::vector<double>{x1, x2, x3}), m_y(yValue){}; | |
| 43 | ✗ | TableMultiVariableLookupPoint::TableMultiVariableLookupPoint(double x1, double x2, double x3, double x4, double yValue) | |
| 44 | ✗ | : m_x(std::vector<double>{x1, x2, x3, x4}), m_y(yValue){}; | |
| 45 | ✗ | TableMultiVariableLookupPoint::TableMultiVariableLookupPoint(double x1, double x2, double x3, double x4, double x5, double yValue) | |
| 46 | ✗ | : m_x(std::vector<double>{x1, x2, x3, x4, x5}), m_y(yValue){}; | |
| 47 | |||
| 48 | 1933 | std::vector<double> TableMultiVariableLookupPoint::x() const { | |
| 49 | 1933 | return m_x; | |
| 50 | } | ||
| 51 | |||
| 52 | 58 | double TableMultiVariableLookupPoint::y() const { | |
| 53 | 58 | return m_y; | |
| 54 | } | ||
| 55 | |||
| 56 | 245 | bool TableMultiVariableLookupPoint::operator<(const TableMultiVariableLookupPoint& other) const { | |
| 57 | 245 | auto n = m_x.size(); | |
| 58 |
1/1✓ Branch 1 taken 245 times.
|
245 | auto other_x = other.x(); |
| 59 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
|
245 | if (n != other_x.size()) { |
| 60 | ✗ | LOG_FREE_AND_THROW("TableMultiVariableLookupPoint", "Cannot compare points of different size " << n << " and " << other_x.size()); | |
| 61 | } | ||
| 62 | |||
| 63 |
1/2✓ Branch 0 taken 450 times.
✗ Branch 1 not taken.
|
450 | for (size_t i = 0; i < n; ++i) { |
| 64 |
2/2✓ Branch 2 taken 114 times.
✓ Branch 3 taken 336 times.
|
450 | if (m_x[i] < other_x[i]) { |
| 65 | 114 | return true; | |
| 66 |
2/2✓ Branch 2 taken 131 times.
✓ Branch 3 taken 205 times.
|
336 | } else if (m_x[i] > other_x[i]) { |
| 67 | 131 | return false; | |
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | ✗ | return false; | |
| 72 | 245 | } | |
| 73 | |||
| 74 | ✗ | std::ostream& operator<<(std::ostream& out, const openstudio::model::TableMultiVariableLookupPoint& point) { | |
| 75 | ✗ | std::vector<double> xValues = point.x(); | |
| 76 | ✗ | std::stringstream ss_left; | |
| 77 | ✗ | std::stringstream ss_right; | |
| 78 | ✗ | int i = 1; | |
| 79 | ✗ | ss_left << "("; | |
| 80 | ✗ | ss_right << "("; | |
| 81 | |||
| 82 | ✗ | for (const double& x : xValues) { | |
| 83 | ✗ | ss_left << "x" << i << ", "; | |
| 84 | ✗ | ss_right << x << ", "; | |
| 85 | ✗ | ++i; | |
| 86 | } | ||
| 87 | |||
| 88 | ✗ | ss_left << "y)"; | |
| 89 | ✗ | ss_right << point.y() << ")"; | |
| 90 | |||
| 91 | ✗ | out << ss_left.str() << " = " << ss_right.str(); | |
| 92 | ✗ | return out; | |
| 93 | ✗ | } | |
| 94 | |||
| 95 | namespace detail { | ||
| 96 | |||
| 97 | 1362 | bool TableMultiVariableLookup_Impl::xValuesEqual(const std::vector<double>& a, const std::vector<double>& b) { | |
| 98 | 1362 | bool result = true; | |
| 99 | |||
| 100 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 1362 times.
|
1362 | if (a.size() != b.size()) { |
| 101 | ✗ | result = false; | |
| 102 | } else { | ||
| 103 |
5/6✓ Branch 6 taken 3532 times.
✓ Branch 7 taken 1362 times.
✓ Branch 10 taken 3532 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3532 times.
✓ Branch 13 taken 1362 times.
|
4894 | for (auto it1 = a.begin(), it2 = b.begin(); it1 != a.end() && it2 != b.end(); ++it1, ++it2) { |
| 104 |
2/2✓ Branch 4 taken 2539 times.
✓ Branch 5 taken 993 times.
|
3532 | if (!equal(*it1, *it2)) { |
| 105 | 2539 | result = false; | |
| 106 | } | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | 1362 | return result; | |
| 111 | } | ||
| 112 | |||
| 113 | 11 | TableMultiVariableLookup_Impl::TableMultiVariableLookup_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 114 | 11 | : Curve_Impl(idfObject, model, keepHandle) { | |
| 115 |
4/6✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 11 times.
✗ Branch 13 not taken.
|
11 | OS_ASSERT(idfObject.iddObject().type() == TableMultiVariableLookup::iddObjectType()); |
| 116 | 11 | } | |
| 117 | |||
| 118 | ✗ | TableMultiVariableLookup_Impl::TableMultiVariableLookup_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 119 | ✗ | bool keepHandle) | |
| 120 | ✗ | : Curve_Impl(other, model, keepHandle) { | |
| 121 | ✗ | OS_ASSERT(other.iddObject().type() == TableMultiVariableLookup::iddObjectType()); | |
| 122 | ✗ | } | |
| 123 | |||
| 124 | 3 | TableMultiVariableLookup_Impl::TableMultiVariableLookup_Impl(const TableMultiVariableLookup_Impl& other, Model_Impl* model, bool keepHandle) | |
| 125 | 3 | : Curve_Impl(other, model, keepHandle) {} | |
| 126 | |||
| 127 | ✗ | const std::vector<std::string>& TableMultiVariableLookup_Impl::outputVariableNames() const { | |
| 128 | ✗ | static const std::vector<std::string> result; | |
| 129 | ✗ | return result; | |
| 130 | } | ||
| 131 | |||
| 132 | ✗ | IddObjectType TableMultiVariableLookup_Impl::iddObjectType() const { | |
| 133 | ✗ | return TableMultiVariableLookup::iddObjectType(); | |
| 134 | } | ||
| 135 | |||
| 136 | 3 | std::string TableMultiVariableLookup_Impl::interpolationMethod() const { | |
| 137 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::InterpolationMethod, true); |
| 138 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 139 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | return value.get(); |
| 140 | 3 | } | |
| 141 | |||
| 142 | ✗ | bool TableMultiVariableLookup_Impl::isInterpolationMethodDefaulted() const { | |
| 143 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::InterpolationMethod); | |
| 144 | } | ||
| 145 | |||
| 146 | ✗ | int TableMultiVariableLookup_Impl::numberofInterpolationPoints() const { | |
| 147 | ✗ | boost::optional<int> value = getInt(OS_Table_MultiVariableLookupFields::NumberofInterpolationPoints, true); | |
| 148 | ✗ | OS_ASSERT(value); | |
| 149 | ✗ | return value.get(); | |
| 150 | } | ||
| 151 | |||
| 152 | ✗ | bool TableMultiVariableLookup_Impl::isNumberofInterpolationPointsDefaulted() const { | |
| 153 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::NumberofInterpolationPoints); | |
| 154 | } | ||
| 155 | |||
| 156 | ✗ | boost::optional<std::string> TableMultiVariableLookup_Impl::curveType() const { | |
| 157 | ✗ | return getString(OS_Table_MultiVariableLookupFields::CurveType, true); | |
| 158 | } | ||
| 159 | |||
| 160 | ✗ | std::string TableMultiVariableLookup_Impl::tableDataFormat() const { | |
| 161 | ✗ | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::TableDataFormat, true); | |
| 162 | ✗ | OS_ASSERT(value); | |
| 163 | ✗ | return value.get(); | |
| 164 | ✗ | } | |
| 165 | |||
| 166 | ✗ | bool TableMultiVariableLookup_Impl::isTableDataFormatDefaulted() const { | |
| 167 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::TableDataFormat); | |
| 168 | } | ||
| 169 | |||
| 170 | ✗ | boost::optional<std::string> TableMultiVariableLookup_Impl::externalFileName() const { | |
| 171 | ✗ | return getString(OS_Table_MultiVariableLookupFields::ExternalFileName, true); | |
| 172 | } | ||
| 173 | |||
| 174 | ✗ | std::string TableMultiVariableLookup_Impl::x1SortOrder() const { | |
| 175 | ✗ | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::X1SortOrder, true); | |
| 176 | ✗ | OS_ASSERT(value); | |
| 177 | ✗ | return value.get(); | |
| 178 | ✗ | } | |
| 179 | |||
| 180 | ✗ | bool TableMultiVariableLookup_Impl::isX1SortOrderDefaulted() const { | |
| 181 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::X1SortOrder); | |
| 182 | } | ||
| 183 | |||
| 184 | ✗ | std::string TableMultiVariableLookup_Impl::x2SortOrder() const { | |
| 185 | ✗ | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::X2SortOrder, true); | |
| 186 | ✗ | OS_ASSERT(value); | |
| 187 | ✗ | return value.get(); | |
| 188 | ✗ | } | |
| 189 | |||
| 190 | ✗ | bool TableMultiVariableLookup_Impl::isX2SortOrderDefaulted() const { | |
| 191 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::X2SortOrder); | |
| 192 | } | ||
| 193 | |||
| 194 | 3 | boost::optional<double> TableMultiVariableLookup_Impl::normalizationReference() const { | |
| 195 | 3 | return getDouble(OS_Table_MultiVariableLookupFields::NormalizationReference, true); | |
| 196 | } | ||
| 197 | |||
| 198 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::minimumValueofX1() const { | |
| 199 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX1, true); | |
| 200 | } | ||
| 201 | |||
| 202 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::maximumValueofX1() const { | |
| 203 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX1, true); | |
| 204 | } | ||
| 205 | |||
| 206 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::minimumValueofX2() const { | |
| 207 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX2, true); | |
| 208 | } | ||
| 209 | |||
| 210 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::maximumValueofX2() const { | |
| 211 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX2, true); | |
| 212 | } | ||
| 213 | |||
| 214 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::minimumValueofX3() const { | |
| 215 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX3, true); | |
| 216 | } | ||
| 217 | |||
| 218 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::maximumValueofX3() const { | |
| 219 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX3, true); | |
| 220 | } | ||
| 221 | |||
| 222 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::minimumValueofX4() const { | |
| 223 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX4, true); | |
| 224 | } | ||
| 225 | |||
| 226 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::maximumValueofX4() const { | |
| 227 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX4, true); | |
| 228 | } | ||
| 229 | |||
| 230 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::minimumValueofX5() const { | |
| 231 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX5, true); | |
| 232 | } | ||
| 233 | |||
| 234 | ✗ | boost::optional<double> TableMultiVariableLookup_Impl::maximumValueofX5() const { | |
| 235 | ✗ | return getDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX5, true); | |
| 236 | } | ||
| 237 | |||
| 238 | 3 | boost::optional<double> TableMultiVariableLookup_Impl::minimumTableOutput() const { | |
| 239 | 3 | return getDouble(OS_Table_MultiVariableLookupFields::MinimumTableOutput, true); | |
| 240 | } | ||
| 241 | |||
| 242 | 3 | boost::optional<double> TableMultiVariableLookup_Impl::maximumTableOutput() const { | |
| 243 | 3 | return getDouble(OS_Table_MultiVariableLookupFields::MaximumTableOutput, true); | |
| 244 | } | ||
| 245 | |||
| 246 | 3 | std::string TableMultiVariableLookup_Impl::inputUnitTypeforX1() const { | |
| 247 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX1, true); |
| 248 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 249 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | return value.get(); |
| 250 | 3 | } | |
| 251 | |||
| 252 | ✗ | bool TableMultiVariableLookup_Impl::isInputUnitTypeforX1Defaulted() const { | |
| 253 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::InputUnitTypeforX1); | |
| 254 | } | ||
| 255 | |||
| 256 | 1 | std::string TableMultiVariableLookup_Impl::inputUnitTypeforX2() const { | |
| 257 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX2, true); |
| 258 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(value); |
| 259 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | return value.get(); |
| 260 | 1 | } | |
| 261 | |||
| 262 | ✗ | bool TableMultiVariableLookup_Impl::isInputUnitTypeforX2Defaulted() const { | |
| 263 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::InputUnitTypeforX2); | |
| 264 | } | ||
| 265 | |||
| 266 | 1 | std::string TableMultiVariableLookup_Impl::inputUnitTypeforX3() const { | |
| 267 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX3, true); |
| 268 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(value); |
| 269 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | return value.get(); |
| 270 | 1 | } | |
| 271 | |||
| 272 | ✗ | bool TableMultiVariableLookup_Impl::isInputUnitTypeforX3Defaulted() const { | |
| 273 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::InputUnitTypeforX3); | |
| 274 | } | ||
| 275 | |||
| 276 | ✗ | std::string TableMultiVariableLookup_Impl::inputUnitTypeforX4() const { | |
| 277 | ✗ | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX4, true); | |
| 278 | ✗ | OS_ASSERT(value); | |
| 279 | ✗ | return value.get(); | |
| 280 | ✗ | } | |
| 281 | |||
| 282 | ✗ | bool TableMultiVariableLookup_Impl::isInputUnitTypeforX4Defaulted() const { | |
| 283 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::InputUnitTypeforX4); | |
| 284 | } | ||
| 285 | |||
| 286 | ✗ | std::string TableMultiVariableLookup_Impl::inputUnitTypeforX5() const { | |
| 287 | ✗ | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX5, true); | |
| 288 | ✗ | OS_ASSERT(value); | |
| 289 | ✗ | return value.get(); | |
| 290 | ✗ | } | |
| 291 | |||
| 292 | ✗ | bool TableMultiVariableLookup_Impl::isInputUnitTypeforX5Defaulted() const { | |
| 293 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::InputUnitTypeforX5); | |
| 294 | } | ||
| 295 | |||
| 296 | 3 | std::string TableMultiVariableLookup_Impl::outputUnitType() const { | |
| 297 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<std::string> value = getString(OS_Table_MultiVariableLookupFields::OutputUnitType, true); |
| 298 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(value); |
| 299 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | return value.get(); |
| 300 | 3 | } | |
| 301 | |||
| 302 | ✗ | bool TableMultiVariableLookup_Impl::isOutputUnitTypeDefaulted() const { | |
| 303 | ✗ | return isEmpty(OS_Table_MultiVariableLookupFields::OutputUnitType); | |
| 304 | } | ||
| 305 | |||
| 306 | 274 | int TableMultiVariableLookup_Impl::numberofIndependentVariables() const { | |
| 307 |
1/1✓ Branch 1 taken 274 times.
|
274 | boost::optional<int> value = getInt(OS_Table_MultiVariableLookupFields::NumberofIndependentVariables, true); |
| 308 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 274 times.
✗ Branch 4 not taken.
|
274 | OS_ASSERT(value); |
| 309 |
1/1✓ Branch 1 taken 274 times.
|
548 | return value.get(); |
| 310 | } | ||
| 311 | |||
| 312 | ✗ | bool TableMultiVariableLookup_Impl::setInterpolationMethod(const std::string& interpolationMethod) { | |
| 313 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InterpolationMethod, interpolationMethod); | |
| 314 | ✗ | return result; | |
| 315 | } | ||
| 316 | |||
| 317 | ✗ | void TableMultiVariableLookup_Impl::resetInterpolationMethod() { | |
| 318 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InterpolationMethod, ""); | |
| 319 | ✗ | OS_ASSERT(result); | |
| 320 | ✗ | } | |
| 321 | |||
| 322 | ✗ | bool TableMultiVariableLookup_Impl::setNumberofInterpolationPoints(int numberofInterpolationPoints) { | |
| 323 | ✗ | bool result = setInt(OS_Table_MultiVariableLookupFields::NumberofInterpolationPoints, numberofInterpolationPoints); | |
| 324 | ✗ | return result; | |
| 325 | } | ||
| 326 | |||
| 327 | ✗ | void TableMultiVariableLookup_Impl::resetNumberofInterpolationPoints() { | |
| 328 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::NumberofInterpolationPoints, ""); | |
| 329 | ✗ | OS_ASSERT(result); | |
| 330 | ✗ | } | |
| 331 | |||
| 332 | ✗ | bool TableMultiVariableLookup_Impl::setCurveType(boost::optional<std::string> curveType) { | |
| 333 | ✗ | bool result(false); | |
| 334 | ✗ | if (curveType) { | |
| 335 | ✗ | result = setString(OS_Table_MultiVariableLookupFields::CurveType, curveType.get()); | |
| 336 | } else { | ||
| 337 | ✗ | resetCurveType(); | |
| 338 | ✗ | result = true; | |
| 339 | } | ||
| 340 | ✗ | return result; | |
| 341 | } | ||
| 342 | |||
| 343 | ✗ | void TableMultiVariableLookup_Impl::resetCurveType() { | |
| 344 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::CurveType, ""); | |
| 345 | ✗ | OS_ASSERT(result); | |
| 346 | ✗ | } | |
| 347 | |||
| 348 | ✗ | bool TableMultiVariableLookup_Impl::setTableDataFormat(const std::string& tableDataFormat) { | |
| 349 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::TableDataFormat, tableDataFormat); | |
| 350 | ✗ | return result; | |
| 351 | } | ||
| 352 | |||
| 353 | ✗ | void TableMultiVariableLookup_Impl::resetTableDataFormat() { | |
| 354 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::TableDataFormat, ""); | |
| 355 | ✗ | OS_ASSERT(result); | |
| 356 | ✗ | } | |
| 357 | |||
| 358 | ✗ | bool TableMultiVariableLookup_Impl::setExternalFileName(boost::optional<std::string> externalFileName) { | |
| 359 | ✗ | bool result(false); | |
| 360 | ✗ | if (externalFileName) { | |
| 361 | ✗ | result = setString(OS_Table_MultiVariableLookupFields::ExternalFileName, externalFileName.get()); | |
| 362 | } else { | ||
| 363 | ✗ | resetExternalFileName(); | |
| 364 | ✗ | result = true; | |
| 365 | } | ||
| 366 | ✗ | OS_ASSERT(result); | |
| 367 | ✗ | return result; | |
| 368 | } | ||
| 369 | |||
| 370 | ✗ | void TableMultiVariableLookup_Impl::resetExternalFileName() { | |
| 371 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::ExternalFileName, ""); | |
| 372 | ✗ | OS_ASSERT(result); | |
| 373 | ✗ | } | |
| 374 | |||
| 375 | ✗ | bool TableMultiVariableLookup_Impl::setX1SortOrder(const std::string& x1SortOrder) { | |
| 376 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::X1SortOrder, x1SortOrder); | |
| 377 | ✗ | return result; | |
| 378 | } | ||
| 379 | |||
| 380 | ✗ | void TableMultiVariableLookup_Impl::resetX1SortOrder() { | |
| 381 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::X1SortOrder, ""); | |
| 382 | ✗ | OS_ASSERT(result); | |
| 383 | ✗ | } | |
| 384 | |||
| 385 | ✗ | bool TableMultiVariableLookup_Impl::setX2SortOrder(const std::string& x2SortOrder) { | |
| 386 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::X2SortOrder, x2SortOrder); | |
| 387 | ✗ | return result; | |
| 388 | } | ||
| 389 | |||
| 390 | ✗ | void TableMultiVariableLookup_Impl::resetX2SortOrder() { | |
| 391 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::X2SortOrder, ""); | |
| 392 | ✗ | OS_ASSERT(result); | |
| 393 | ✗ | } | |
| 394 | |||
| 395 | 1 | bool TableMultiVariableLookup_Impl::setNormalizationReference(boost::optional<double> normalizationReference) { | |
| 396 | 1 | bool result(false); | |
| 397 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (normalizationReference) { |
| 398 | 1 | result = setDouble(OS_Table_MultiVariableLookupFields::NormalizationReference, normalizationReference.get()); | |
| 399 | } else { | ||
| 400 | ✗ | resetNormalizationReference(); | |
| 401 | ✗ | result = true; | |
| 402 | } | ||
| 403 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 404 | 1 | return result; | |
| 405 | } | ||
| 406 | |||
| 407 | ✗ | void TableMultiVariableLookup_Impl::resetNormalizationReference() { | |
| 408 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::NormalizationReference, ""); | |
| 409 | ✗ | OS_ASSERT(result); | |
| 410 | ✗ | } | |
| 411 | |||
| 412 | ✗ | bool TableMultiVariableLookup_Impl::setMinimumValueofX1(boost::optional<double> minimumValueofX1) { | |
| 413 | ✗ | bool result(false); | |
| 414 | ✗ | if (minimumValueofX1) { | |
| 415 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX1, minimumValueofX1.get()); | |
| 416 | } else { | ||
| 417 | ✗ | resetMinimumValueofX1(); | |
| 418 | ✗ | result = true; | |
| 419 | } | ||
| 420 | ✗ | OS_ASSERT(result); | |
| 421 | ✗ | return result; | |
| 422 | } | ||
| 423 | |||
| 424 | ✗ | void TableMultiVariableLookup_Impl::resetMinimumValueofX1() { | |
| 425 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MinimumValueofX1, ""); | |
| 426 | ✗ | OS_ASSERT(result); | |
| 427 | ✗ | } | |
| 428 | |||
| 429 | ✗ | bool TableMultiVariableLookup_Impl::setMaximumValueofX1(boost::optional<double> maximumValueofX1) { | |
| 430 | ✗ | bool result(false); | |
| 431 | ✗ | if (maximumValueofX1) { | |
| 432 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX1, maximumValueofX1.get()); | |
| 433 | } else { | ||
| 434 | ✗ | resetMaximumValueofX1(); | |
| 435 | ✗ | result = true; | |
| 436 | } | ||
| 437 | ✗ | OS_ASSERT(result); | |
| 438 | ✗ | return result; | |
| 439 | } | ||
| 440 | |||
| 441 | ✗ | void TableMultiVariableLookup_Impl::resetMaximumValueofX1() { | |
| 442 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MaximumValueofX1, ""); | |
| 443 | ✗ | OS_ASSERT(result); | |
| 444 | ✗ | } | |
| 445 | |||
| 446 | ✗ | bool TableMultiVariableLookup_Impl::setMinimumValueofX2(boost::optional<double> minimumValueofX2) { | |
| 447 | ✗ | bool result(false); | |
| 448 | ✗ | if (minimumValueofX2) { | |
| 449 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX2, minimumValueofX2.get()); | |
| 450 | } else { | ||
| 451 | ✗ | resetMinimumValueofX2(); | |
| 452 | ✗ | result = true; | |
| 453 | } | ||
| 454 | ✗ | OS_ASSERT(result); | |
| 455 | ✗ | return result; | |
| 456 | } | ||
| 457 | |||
| 458 | ✗ | void TableMultiVariableLookup_Impl::resetMinimumValueofX2() { | |
| 459 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MinimumValueofX2, ""); | |
| 460 | ✗ | OS_ASSERT(result); | |
| 461 | ✗ | } | |
| 462 | |||
| 463 | ✗ | bool TableMultiVariableLookup_Impl::setMaximumValueofX2(boost::optional<double> maximumValueofX2) { | |
| 464 | ✗ | bool result(false); | |
| 465 | ✗ | if (maximumValueofX2) { | |
| 466 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX2, maximumValueofX2.get()); | |
| 467 | } else { | ||
| 468 | ✗ | resetMaximumValueofX2(); | |
| 469 | ✗ | result = true; | |
| 470 | } | ||
| 471 | ✗ | OS_ASSERT(result); | |
| 472 | ✗ | return result; | |
| 473 | } | ||
| 474 | |||
| 475 | ✗ | void TableMultiVariableLookup_Impl::resetMaximumValueofX2() { | |
| 476 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MaximumValueofX2, ""); | |
| 477 | ✗ | OS_ASSERT(result); | |
| 478 | ✗ | } | |
| 479 | |||
| 480 | ✗ | bool TableMultiVariableLookup_Impl::setMinimumValueofX3(boost::optional<double> minimumValueofX3) { | |
| 481 | ✗ | bool result(false); | |
| 482 | ✗ | if (minimumValueofX3) { | |
| 483 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX3, minimumValueofX3.get()); | |
| 484 | } else { | ||
| 485 | ✗ | resetMinimumValueofX3(); | |
| 486 | ✗ | result = true; | |
| 487 | } | ||
| 488 | ✗ | OS_ASSERT(result); | |
| 489 | ✗ | return result; | |
| 490 | } | ||
| 491 | |||
| 492 | ✗ | void TableMultiVariableLookup_Impl::resetMinimumValueofX3() { | |
| 493 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MinimumValueofX3, ""); | |
| 494 | ✗ | OS_ASSERT(result); | |
| 495 | ✗ | } | |
| 496 | |||
| 497 | ✗ | bool TableMultiVariableLookup_Impl::setMaximumValueofX3(boost::optional<double> maximumValueofX3) { | |
| 498 | ✗ | bool result(false); | |
| 499 | ✗ | if (maximumValueofX3) { | |
| 500 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX3, maximumValueofX3.get()); | |
| 501 | } else { | ||
| 502 | ✗ | resetMaximumValueofX3(); | |
| 503 | ✗ | result = true; | |
| 504 | } | ||
| 505 | ✗ | OS_ASSERT(result); | |
| 506 | ✗ | return result; | |
| 507 | } | ||
| 508 | |||
| 509 | ✗ | void TableMultiVariableLookup_Impl::resetMaximumValueofX3() { | |
| 510 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MaximumValueofX3, ""); | |
| 511 | ✗ | OS_ASSERT(result); | |
| 512 | ✗ | } | |
| 513 | |||
| 514 | ✗ | bool TableMultiVariableLookup_Impl::setMinimumValueofX4(boost::optional<double> minimumValueofX4) { | |
| 515 | ✗ | bool result(false); | |
| 516 | ✗ | if (minimumValueofX4) { | |
| 517 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX4, minimumValueofX4.get()); | |
| 518 | } else { | ||
| 519 | ✗ | resetMinimumValueofX4(); | |
| 520 | ✗ | result = true; | |
| 521 | } | ||
| 522 | ✗ | OS_ASSERT(result); | |
| 523 | ✗ | return result; | |
| 524 | } | ||
| 525 | |||
| 526 | ✗ | void TableMultiVariableLookup_Impl::resetMinimumValueofX4() { | |
| 527 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MinimumValueofX4, ""); | |
| 528 | ✗ | OS_ASSERT(result); | |
| 529 | ✗ | } | |
| 530 | |||
| 531 | ✗ | bool TableMultiVariableLookup_Impl::setMaximumValueofX4(boost::optional<double> maximumValueofX4) { | |
| 532 | ✗ | bool result(false); | |
| 533 | ✗ | if (maximumValueofX4) { | |
| 534 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX4, maximumValueofX4.get()); | |
| 535 | } else { | ||
| 536 | ✗ | resetMaximumValueofX4(); | |
| 537 | ✗ | result = true; | |
| 538 | } | ||
| 539 | ✗ | OS_ASSERT(result); | |
| 540 | ✗ | return result; | |
| 541 | } | ||
| 542 | |||
| 543 | ✗ | void TableMultiVariableLookup_Impl::resetMaximumValueofX4() { | |
| 544 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MaximumValueofX4, ""); | |
| 545 | ✗ | OS_ASSERT(result); | |
| 546 | ✗ | } | |
| 547 | |||
| 548 | ✗ | bool TableMultiVariableLookup_Impl::setMinimumValueofX5(boost::optional<double> minimumValueofX5) { | |
| 549 | ✗ | bool result(false); | |
| 550 | ✗ | if (minimumValueofX5) { | |
| 551 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MinimumValueofX5, minimumValueofX5.get()); | |
| 552 | } else { | ||
| 553 | ✗ | resetMinimumValueofX5(); | |
| 554 | ✗ | result = true; | |
| 555 | } | ||
| 556 | ✗ | OS_ASSERT(result); | |
| 557 | ✗ | return result; | |
| 558 | } | ||
| 559 | |||
| 560 | ✗ | void TableMultiVariableLookup_Impl::resetMinimumValueofX5() { | |
| 561 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MinimumValueofX5, ""); | |
| 562 | ✗ | OS_ASSERT(result); | |
| 563 | ✗ | } | |
| 564 | |||
| 565 | ✗ | bool TableMultiVariableLookup_Impl::setMaximumValueofX5(boost::optional<double> maximumValueofX5) { | |
| 566 | ✗ | bool result(false); | |
| 567 | ✗ | if (maximumValueofX5) { | |
| 568 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MaximumValueofX5, maximumValueofX5.get()); | |
| 569 | } else { | ||
| 570 | ✗ | resetMaximumValueofX5(); | |
| 571 | ✗ | result = true; | |
| 572 | } | ||
| 573 | ✗ | OS_ASSERT(result); | |
| 574 | ✗ | return result; | |
| 575 | } | ||
| 576 | |||
| 577 | ✗ | void TableMultiVariableLookup_Impl::resetMaximumValueofX5() { | |
| 578 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MaximumValueofX5, ""); | |
| 579 | ✗ | OS_ASSERT(result); | |
| 580 | ✗ | } | |
| 581 | |||
| 582 | ✗ | bool TableMultiVariableLookup_Impl::setMinimumTableOutput(boost::optional<double> minimumTableOutput) { | |
| 583 | ✗ | bool result(false); | |
| 584 | ✗ | if (minimumTableOutput) { | |
| 585 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MinimumTableOutput, minimumTableOutput.get()); | |
| 586 | } else { | ||
| 587 | ✗ | resetMinimumTableOutput(); | |
| 588 | ✗ | result = true; | |
| 589 | } | ||
| 590 | ✗ | OS_ASSERT(result); | |
| 591 | ✗ | return result; | |
| 592 | } | ||
| 593 | |||
| 594 | ✗ | void TableMultiVariableLookup_Impl::resetMinimumTableOutput() { | |
| 595 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MinimumTableOutput, ""); | |
| 596 | ✗ | OS_ASSERT(result); | |
| 597 | ✗ | } | |
| 598 | |||
| 599 | ✗ | bool TableMultiVariableLookup_Impl::setMaximumTableOutput(boost::optional<double> maximumTableOutput) { | |
| 600 | ✗ | bool result(false); | |
| 601 | ✗ | if (maximumTableOutput) { | |
| 602 | ✗ | result = setDouble(OS_Table_MultiVariableLookupFields::MaximumTableOutput, maximumTableOutput.get()); | |
| 603 | } else { | ||
| 604 | ✗ | resetMaximumTableOutput(); | |
| 605 | ✗ | result = true; | |
| 606 | } | ||
| 607 | ✗ | OS_ASSERT(result); | |
| 608 | ✗ | return result; | |
| 609 | } | ||
| 610 | |||
| 611 | ✗ | void TableMultiVariableLookup_Impl::resetMaximumTableOutput() { | |
| 612 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::MaximumTableOutput, ""); | |
| 613 | ✗ | OS_ASSERT(result); | |
| 614 | ✗ | } | |
| 615 | |||
| 616 | ✗ | bool TableMultiVariableLookup_Impl::setInputUnitTypeforX1(const std::string& inputUnitTypeforX1) { | |
| 617 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX1, inputUnitTypeforX1); | |
| 618 | ✗ | return result; | |
| 619 | } | ||
| 620 | |||
| 621 | ✗ | void TableMultiVariableLookup_Impl::resetInputUnitTypeforX1() { | |
| 622 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX1, ""); | |
| 623 | ✗ | OS_ASSERT(result); | |
| 624 | ✗ | } | |
| 625 | |||
| 626 | ✗ | bool TableMultiVariableLookup_Impl::setInputUnitTypeforX2(const std::string& inputUnitTypeforX2) { | |
| 627 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX2, inputUnitTypeforX2); | |
| 628 | ✗ | return result; | |
| 629 | } | ||
| 630 | |||
| 631 | ✗ | void TableMultiVariableLookup_Impl::resetInputUnitTypeforX2() { | |
| 632 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX2, ""); | |
| 633 | ✗ | OS_ASSERT(result); | |
| 634 | ✗ | } | |
| 635 | |||
| 636 | ✗ | bool TableMultiVariableLookup_Impl::setInputUnitTypeforX3(const std::string& inputUnitTypeforX3) { | |
| 637 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX3, inputUnitTypeforX3); | |
| 638 | ✗ | return result; | |
| 639 | } | ||
| 640 | |||
| 641 | ✗ | void TableMultiVariableLookup_Impl::resetInputUnitTypeforX3() { | |
| 642 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX3, ""); | |
| 643 | ✗ | OS_ASSERT(result); | |
| 644 | ✗ | } | |
| 645 | |||
| 646 | ✗ | bool TableMultiVariableLookup_Impl::setInputUnitTypeforX4(const std::string& inputUnitTypeforX4) { | |
| 647 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX4, inputUnitTypeforX4); | |
| 648 | ✗ | return result; | |
| 649 | } | ||
| 650 | |||
| 651 | ✗ | void TableMultiVariableLookup_Impl::resetInputUnitTypeforX4() { | |
| 652 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX4, ""); | |
| 653 | ✗ | OS_ASSERT(result); | |
| 654 | ✗ | } | |
| 655 | |||
| 656 | ✗ | bool TableMultiVariableLookup_Impl::setInputUnitTypeforX5(const std::string& inputUnitTypeforX5) { | |
| 657 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX5, inputUnitTypeforX5); | |
| 658 | ✗ | return result; | |
| 659 | } | ||
| 660 | |||
| 661 | ✗ | void TableMultiVariableLookup_Impl::resetInputUnitTypeforX5() { | |
| 662 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::InputUnitTypeforX5, ""); | |
| 663 | ✗ | OS_ASSERT(result); | |
| 664 | ✗ | } | |
| 665 | |||
| 666 | ✗ | bool TableMultiVariableLookup_Impl::setOutputUnitType(const std::string& outputUnitType) { | |
| 667 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::OutputUnitType, outputUnitType); | |
| 668 | ✗ | return result; | |
| 669 | } | ||
| 670 | |||
| 671 | ✗ | void TableMultiVariableLookup_Impl::resetOutputUnitType() { | |
| 672 | ✗ | bool result = setString(OS_Table_MultiVariableLookupFields::OutputUnitType, ""); | |
| 673 | ✗ | OS_ASSERT(result); | |
| 674 | ✗ | } | |
| 675 | |||
| 676 | 11 | bool TableMultiVariableLookup_Impl::setNumberofIndependentVariables(int numberofIndependentVariables) { | |
| 677 | // This object only accept between 1 and 5 independent variables | ||
| 678 | // This is enforced by the IDD \minimum and \maximum, so no need to explicitly check here: | ||
| 679 | // setInt will return false if outside that range | ||
| 680 | 11 | bool result = setInt(OS_Table_MultiVariableLookupFields::NumberofIndependentVariables, numberofIndependentVariables); | |
| 681 | |||
| 682 | 11 | return result; | |
| 683 | } | ||
| 684 | |||
| 685 | ✗ | int TableMultiVariableLookup_Impl::numVariables() const { | |
| 686 | ✗ | return numberofIndependentVariables(); | |
| 687 | } | ||
| 688 | |||
| 689 | ✗ | double TableMultiVariableLookup_Impl::evaluate(const std::vector<double>& /*x*/) const { | |
| 690 | ✗ | LOG(Warn, "Curve evaluation isn't implemented for TableMultiVariableLookup"); | |
| 691 | ✗ | return -9999.0; | |
| 692 | } | ||
| 693 | |||
| 694 | 117 | bool TableMultiVariableLookup_Impl::addPoint(const std::vector<double>& t_xValues, double t_yValue) { | |
| 695 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 117 times.
|
117 | if (t_xValues.size() != (unsigned)numberofIndependentVariables()) { |
| 696 | ✗ | return false; | |
| 697 |
3/3✓ Branch 1 taken 117 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 116 times.
|
234 | } else if (yValue(t_xValues)) { |
| 698 | 1 | return false; | |
| 699 | } else { | ||
| 700 |
2/2✓ Branch 4 taken 294 times.
✓ Branch 5 taken 116 times.
|
410 | for (auto it = t_xValues.begin(); it != t_xValues.end(); ++it) { |
| 701 |
2/2✓ Branch 1 taken 294 times.
✓ Branch 4 taken 294 times.
|
294 | IdfExtensibleGroup eg = getObject<model::TableMultiVariableLookup>().pushExtensibleGroup(); |
| 702 |
1/1✓ Branch 2 taken 294 times.
|
294 | eg.setDouble(0, *it); |
| 703 | 294 | } | |
| 704 | |||
| 705 |
2/2✓ Branch 1 taken 116 times.
✓ Branch 4 taken 116 times.
|
116 | IdfExtensibleGroup eg = getObject<model::TableMultiVariableLookup>().pushExtensibleGroup(); |
| 706 |
1/1✓ Branch 1 taken 116 times.
|
116 | eg.setDouble(0, t_yValue); |
| 707 | 116 | } | |
| 708 | |||
| 709 | 116 | return true; | |
| 710 | } | ||
| 711 | |||
| 712 | 140 | std::vector<TableMultiVariableLookupPoint> TableMultiVariableLookup_Impl::points() const { | |
| 713 | 140 | std::vector<TableMultiVariableLookupPoint> result; | |
| 714 | |||
| 715 |
1/1✓ Branch 1 taken 140 times.
|
140 | int t_numberofIndependentVariables = numberofIndependentVariables(); |
| 716 | |||
| 717 |
1/1✓ Branch 1 taken 140 times.
|
140 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 718 | 140 | int numberOfPoints = groups.size() / (t_numberofIndependentVariables + 1); | |
| 719 | |||
| 720 |
2/2✓ Branch 0 taken 1762 times.
✓ Branch 1 taken 140 times.
|
1902 | for (int iPoint = 0; iPoint != numberOfPoints; ++iPoint) { |
| 721 |
1/1✓ Branch 1 taken 1762 times.
|
1762 | std::vector<double> xValues(t_numberofIndependentVariables); |
| 722 |
2/2✓ Branch 0 taken 4456 times.
✓ Branch 1 taken 1762 times.
|
6218 | for (int i = 0; i != t_numberofIndependentVariables; ++i) { |
| 723 | 4456 | IdfExtensibleGroup g = groups[iPoint * (t_numberofIndependentVariables + 1) + i]; | |
| 724 |
1/1✓ Branch 1 taken 4456 times.
|
4456 | boost::optional<double> d = g.getDouble(OS_Table_MultiVariableLookupExtensibleFields::Data); |
| 725 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 4456 times.
✗ Branch 4 not taken.
|
4456 | OS_ASSERT(d); |
| 726 |
1/1✓ Branch 1 taken 4456 times.
|
4456 | xValues[i] = d.get(); |
| 727 | 4456 | } | |
| 728 | |||
| 729 | 1762 | IdfExtensibleGroup g = groups[iPoint * (t_numberofIndependentVariables + 1) + t_numberofIndependentVariables]; | |
| 730 |
1/1✓ Branch 1 taken 1762 times.
|
1762 | boost::optional<double> d = g.getDouble(OS_Table_MultiVariableLookupExtensibleFields::Data); |
| 731 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1762 times.
✗ Branch 4 not taken.
|
1762 | OS_ASSERT(d); |
| 732 |
1/1✓ Branch 1 taken 1762 times.
|
1762 | double yValue = d.get(); |
| 733 | |||
| 734 |
1/1✓ Branch 1 taken 1762 times.
|
1762 | TableMultiVariableLookupPoint point(xValues, yValue); |
| 735 |
1/1✓ Branch 1 taken 1762 times.
|
1762 | result.push_back(point); |
| 736 | 1762 | } | |
| 737 | |||
| 738 | 280 | return result; | |
| 739 | 140 | } | |
| 740 | |||
| 741 | // Helper function for printTable | ||
| 742 | ✗ | std::string centered(const std::string& original, int targetSize) { | |
| 743 | // assert( targetSize >= 0 ); | ||
| 744 | ✗ | int padding = targetSize - (int)(original.size()); | |
| 745 | ✗ | return padding > 0 ? std::string(padding / 2, ' ') + original + std::string(padding - (padding / 2), ' ') : original; | |
| 746 | } | ||
| 747 | |||
| 748 | // Helper function for printTable | ||
| 749 | ✗ | std::string centered(double val, int targetSize, unsigned int precision) { | |
| 750 | ✗ | std::stringstream ss; | |
| 751 | ✗ | ss << std::fixed << std::setprecision(precision) << val; | |
| 752 | ✗ | return centered(ss.str(), targetSize); | |
| 753 | ✗ | } | |
| 754 | |||
| 755 | // Print a table (for console output in particular) | ||
| 756 | ✗ | std::string TableMultiVariableLookup_Impl::printTable(unsigned int precision) const { | |
| 757 | ✗ | std::vector<TableMultiVariableLookupPoint> points = this->points(); | |
| 758 | ✗ | std::stringstream ss; | |
| 759 | ✗ | int size = points[0].x().size(); | |
| 760 | |||
| 761 | ✗ | ss << "|" << centered("n", 5) << "|"; | |
| 762 | ✗ | for (int i = 1; i <= size; ++i) { | |
| 763 | ✗ | std::stringstream tempss; | |
| 764 | ✗ | tempss << "x" << i; | |
| 765 | ✗ | ss << centered(tempss.str(), 15) << "|"; | |
| 766 | ✗ | } | |
| 767 | ✗ | ss << centered("y", 15) << "|"; | |
| 768 | ss << "\n" | ||
| 769 | ✗ | << "|-----+"; | |
| 770 | ✗ | for (int i = 1; i <= size; ++i) { | |
| 771 | ✗ | ss << std::string(15, '-') << "+"; | |
| 772 | } | ||
| 773 | ✗ | ss << std::string(15, '-') << "|\n"; | |
| 774 | |||
| 775 | ✗ | int i = 1; | |
| 776 | ✗ | for (const TableMultiVariableLookupPoint& pt : points) { | |
| 777 | ✗ | ss << "|" << centered(std::to_string(i), 5); | |
| 778 | ✗ | for (const double& x : pt.x()) { | |
| 779 | ✗ | ss << "|" << centered(x, 15, precision); | |
| 780 | ✗ | } | |
| 781 | ✗ | ss << "|" << centered(pt.y(), 15, precision) << "|\n"; | |
| 782 | ✗ | ++i; | |
| 783 | } | ||
| 784 | |||
| 785 | ✗ | return ss.str(); | |
| 786 | ✗ | } | |
| 787 | |||
| 788 | 11 | std::vector<double> TableMultiVariableLookup_Impl::xValues(int xIndex) const { | |
| 789 | 11 | std::vector<double> result; | |
| 790 | |||
| 791 |
2/3✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11 times.
|
11 | if (xIndex >= numberofIndependentVariables()) { |
| 792 | ✗ | return result; | |
| 793 | } | ||
| 794 | |||
| 795 |
1/1✓ Branch 1 taken 11 times.
|
11 | std::vector<TableMultiVariableLookupPoint> t_points = points(); |
| 796 |
2/2✓ Branch 5 taken 262 times.
✓ Branch 6 taken 11 times.
|
273 | for (const TableMultiVariableLookupPoint& pt : t_points) { |
| 797 |
1/1✓ Branch 1 taken 262 times.
|
262 | std::vector<double> xValues = pt.x(); |
| 798 |
1/1✓ Branch 2 taken 262 times.
|
262 | result.push_back(xValues[xIndex]); |
| 799 | 262 | } | |
| 800 | |||
| 801 |
1/1✓ Branch 3 taken 11 times.
|
11 | std::sort(result.begin(), result.end()); |
| 802 |
2/2✓ Branch 5 taken 11 times.
✓ Branch 9 taken 11 times.
|
11 | result.erase(std::unique(result.begin(), result.end()), result.end()); |
| 803 | |||
| 804 | 11 | return result; | |
| 805 | 11 | } | |
| 806 | |||
| 807 | 119 | boost::optional<double> TableMultiVariableLookup_Impl::yValue(const std::vector<double>& xValues) const { | |
| 808 | 119 | boost::optional<double> result; | |
| 809 | |||
| 810 |
1/1✓ Branch 1 taken 119 times.
|
119 | std::vector<TableMultiVariableLookupPoint> t_points = points(); |
| 811 |
2/2✓ Branch 5 taken 1362 times.
✓ Branch 6 taken 116 times.
|
1478 | for (const TableMultiVariableLookupPoint& pt : t_points) { |
| 812 |
1/1✓ Branch 1 taken 1362 times.
|
1362 | std::vector<double> t_c = pt.x(); |
| 813 |
3/3✓ Branch 1 taken 1362 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 1359 times.
|
1362 | if (xValuesEqual(t_c, xValues)) { |
| 814 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | result = pt.y(); |
| 815 | 3 | break; | |
| 816 | } | ||
| 817 | 1362 | } | |
| 818 | |||
| 819 | 119 | return result; | |
| 820 | 119 | } | |
| 821 | |||
| 822 | 2 | bool TableMultiVariableLookup_Impl::setPoints(const std::vector<TableMultiVariableLookupPoint>& points) { | |
| 823 | // We first check that ALL points have the right number of independent variables, before we do anything destructive such as clearing the points | ||
| 824 | 2 | int n_independent = numberofIndependentVariables(); | |
| 825 |
2/2✓ Branch 5 taken 7 times.
✓ Branch 6 taken 1 time.
|
8 | for (const TableMultiVariableLookupPoint& pt : points) { |
| 826 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 6 times.
|
7 | if (pt.x().size() != (unsigned)n_independent) { |
| 827 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
|
1 | LOG(Warn, |
| 828 | "Cannot set points because all points must have exactly " << n_independent << " independent variable(s), for " << briefDescription()); | ||
| 829 | 1 | return false; | |
| 830 | } | ||
| 831 | } | ||
| 832 | |||
| 833 | // Ok, now we clear | ||
| 834 |
1/1✓ Branch 1 taken 1 time.
|
1 | this->clearExtensibleGroups(); |
| 835 | |||
| 836 | // And we add all points | ||
| 837 | 1 | bool result = true; | |
| 838 |
2/2✓ Branch 4 taken 3 times.
✓ Branch 5 taken 1 time.
|
4 | for (const TableMultiVariableLookupPoint& pt : points) { |
| 839 |
1/1✓ Branch 1 taken 3 times.
|
3 | result &= addPoint(pt); |
| 840 | } | ||
| 841 | |||
| 842 | 1 | return result; | |
| 843 | } | ||
| 844 | |||
| 845 | 3 | bool TableMultiVariableLookup_Impl::addPoint(const TableMultiVariableLookupPoint& point) { | |
| 846 |
2/2✓ Branch 2 taken 3 times.
✓ Branch 5 taken 3 times.
|
3 | return addPoint(point.x(), point.y()); |
| 847 | } | ||
| 848 | |||
| 849 | 10 | bool TableMultiVariableLookup_Impl::addPoint(double x1, double yValue) { | |
| 850 |
1/1✓ Branch 1 taken 10 times.
|
10 | std::vector<double> xValues(1); |
| 851 | 10 | xValues[0] = x1; | |
| 852 |
1/1✓ Branch 1 taken 10 times.
|
20 | return addPoint(xValues, yValue); |
| 853 | 10 | } | |
| 854 | |||
| 855 | 32 | bool TableMultiVariableLookup_Impl::addPoint(double x1, double x2, double yValue) { | |
| 856 |
1/1✓ Branch 1 taken 32 times.
|
32 | std::vector<double> xValues(2); |
| 857 | 32 | xValues[0] = x1; | |
| 858 | 32 | xValues[1] = x2; | |
| 859 |
1/1✓ Branch 1 taken 32 times.
|
64 | return addPoint(xValues, yValue); |
| 860 | 32 | } | |
| 861 | |||
| 862 | 72 | bool TableMultiVariableLookup_Impl::addPoint(double x1, double x2, double x3, double yValue) { | |
| 863 |
1/1✓ Branch 1 taken 72 times.
|
72 | std::vector<double> xValues(3); |
| 864 | 72 | xValues[0] = x1; | |
| 865 | 72 | xValues[1] = x2; | |
| 866 | 72 | xValues[2] = x3; | |
| 867 |
1/1✓ Branch 1 taken 72 times.
|
144 | return addPoint(xValues, yValue); |
| 868 | 72 | } | |
| 869 | |||
| 870 | ✗ | bool TableMultiVariableLookup_Impl::addPoint(double x1, double x2, double x3, double x4, double yValue) { | |
| 871 | ✗ | std::vector<double> xValues(4); | |
| 872 | ✗ | xValues[0] = x1; | |
| 873 | ✗ | xValues[1] = x2; | |
| 874 | ✗ | xValues[2] = x3; | |
| 875 | ✗ | xValues[3] = x4; | |
| 876 | ✗ | return addPoint(xValues, yValue); | |
| 877 | ✗ | } | |
| 878 | |||
| 879 | ✗ | bool TableMultiVariableLookup_Impl::addPoint(double x1, double x2, double x3, double x4, double x5, double yValue) { | |
| 880 | ✗ | std::vector<double> xValues(5); | |
| 881 | ✗ | xValues[0] = x1; | |
| 882 | ✗ | xValues[1] = x2; | |
| 883 | ✗ | xValues[2] = x3; | |
| 884 | ✗ | xValues[3] = x4; | |
| 885 | ✗ | xValues[4] = x5; | |
| 886 | ✗ | return addPoint(xValues, yValue); | |
| 887 | ✗ | } | |
| 888 | |||
| 889 | } // namespace detail | ||
| 890 | |||
| 891 | 11 | TableMultiVariableLookup::TableMultiVariableLookup(const Model& model, int numberofIndependentVariables) | |
| 892 | 11 | : Curve(TableMultiVariableLookup::iddObjectType(), model) { | |
| 893 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 11 times.
✗ Branch 5 not taken.
|
11 | OS_ASSERT(getImpl<detail::TableMultiVariableLookup_Impl>()); |
| 894 | |||
| 895 |
5/5✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✓ Branch 10 taken 11 times.
✓ Branch 13 taken 11 times.
|
44 | DEPRECATED_AT_MSG(3, 5, 0, "TableMultiVariableLookup is deprecated. Use TableLookup instead."); |
| 896 | |||
| 897 | // Check if numberofIndependentVariables between 1 and 5 included, otherwise THROW | ||
| 898 |
1/1✓ Branch 3 taken 11 times.
|
11 | bool ok = getImpl<detail::TableMultiVariableLookup_Impl>()->setNumberofIndependentVariables(numberofIndependentVariables); |
| 899 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 9 times.
|
11 | if (!ok) { |
| 900 |
1/1✓ Branch 1 taken 2 times.
|
2 | remove(); |
| 901 |
13/13✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 19 taken 2 times.
✓ Branch 22 taken 2 times.
✓ Branch 25 taken 2 times.
✓ Branch 28 taken 2 times.
✓ Branch 31 taken 2 times.
✓ Branch 34 taken 2 times.
✓ Branch 38 taken 2 times.
✓ Branch 41 taken 2 times.
|
2 | LOG_AND_THROW("TableMultiVariableLookup only accepts between 1 and 5 independent variables (included)."); |
| 902 | } | ||
| 903 | 11 | } | |
| 904 | |||
| 905 | 7750 | IddObjectType TableMultiVariableLookup::iddObjectType() { | |
| 906 |
1/1✓ Branch 1 taken 7750 times.
|
7750 | return {IddObjectType::OS_Table_MultiVariableLookup}; |
| 907 | } | ||
| 908 | |||
| 909 | ✗ | std::vector<std::string> TableMultiVariableLookup::interpolationMethodValues() { | |
| 910 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::InterpolationMethod); | |
| 911 | } | ||
| 912 | |||
| 913 | ✗ | std::vector<std::string> TableMultiVariableLookup::curveTypeValues() { | |
| 914 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::CurveType); | |
| 915 | } | ||
| 916 | |||
| 917 | ✗ | std::vector<std::string> TableMultiVariableLookup::tableDataFormatValues() { | |
| 918 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::TableDataFormat); | |
| 919 | } | ||
| 920 | |||
| 921 | ✗ | std::vector<std::string> TableMultiVariableLookup::x1SortOrderValues() { | |
| 922 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::X1SortOrder); | |
| 923 | } | ||
| 924 | |||
| 925 | ✗ | std::vector<std::string> TableMultiVariableLookup::x2SortOrderValues() { | |
| 926 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::X2SortOrder); | |
| 927 | } | ||
| 928 | |||
| 929 | ✗ | std::vector<std::string> TableMultiVariableLookup::inputUnitTypeforX1Values() { | |
| 930 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::InputUnitTypeforX1); | |
| 931 | } | ||
| 932 | |||
| 933 | ✗ | std::vector<std::string> TableMultiVariableLookup::inputUnitTypeforX2Values() { | |
| 934 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::InputUnitTypeforX2); | |
| 935 | } | ||
| 936 | |||
| 937 | ✗ | std::vector<std::string> TableMultiVariableLookup::inputUnitTypeforX3Values() { | |
| 938 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::InputUnitTypeforX3); | |
| 939 | } | ||
| 940 | |||
| 941 | ✗ | std::vector<std::string> TableMultiVariableLookup::inputUnitTypeforX4Values() { | |
| 942 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::InputUnitTypeforX4); | |
| 943 | } | ||
| 944 | |||
| 945 | ✗ | std::vector<std::string> TableMultiVariableLookup::inputUnitTypeforX5Values() { | |
| 946 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::InputUnitTypeforX5); | |
| 947 | } | ||
| 948 | |||
| 949 | ✗ | std::vector<std::string> TableMultiVariableLookup::outputUnitTypeValues() { | |
| 950 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Table_MultiVariableLookupFields::OutputUnitType); | |
| 951 | } | ||
| 952 | |||
| 953 | 3 | std::string TableMultiVariableLookup::interpolationMethod() const { | |
| 954 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::TableMultiVariableLookup_Impl>()->interpolationMethod(); |
| 955 | } | ||
| 956 | |||
| 957 | ✗ | bool TableMultiVariableLookup::isInterpolationMethodDefaulted() const { | |
| 958 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isInterpolationMethodDefaulted(); | |
| 959 | } | ||
| 960 | |||
| 961 | ✗ | int TableMultiVariableLookup::numberofInterpolationPoints() const { | |
| 962 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->numberofInterpolationPoints(); | |
| 963 | } | ||
| 964 | |||
| 965 | ✗ | bool TableMultiVariableLookup::isNumberofInterpolationPointsDefaulted() const { | |
| 966 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isNumberofInterpolationPointsDefaulted(); | |
| 967 | } | ||
| 968 | |||
| 969 | ✗ | boost::optional<std::string> TableMultiVariableLookup::curveType() const { | |
| 970 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->curveType(); | |
| 971 | } | ||
| 972 | |||
| 973 | ✗ | std::string TableMultiVariableLookup::tableDataFormat() const { | |
| 974 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->tableDataFormat(); | |
| 975 | } | ||
| 976 | |||
| 977 | ✗ | bool TableMultiVariableLookup::isTableDataFormatDefaulted() const { | |
| 978 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isTableDataFormatDefaulted(); | |
| 979 | } | ||
| 980 | |||
| 981 | 3 | boost::optional<double> TableMultiVariableLookup::normalizationReference() const { | |
| 982 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::TableMultiVariableLookup_Impl>()->normalizationReference(); |
| 983 | } | ||
| 984 | |||
| 985 | ✗ | boost::optional<double> TableMultiVariableLookup::minimumValueofX1() const { | |
| 986 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->minimumValueofX1(); | |
| 987 | } | ||
| 988 | |||
| 989 | ✗ | boost::optional<double> TableMultiVariableLookup::maximumValueofX1() const { | |
| 990 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->maximumValueofX1(); | |
| 991 | } | ||
| 992 | |||
| 993 | ✗ | boost::optional<double> TableMultiVariableLookup::minimumValueofX2() const { | |
| 994 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->minimumValueofX2(); | |
| 995 | } | ||
| 996 | |||
| 997 | ✗ | boost::optional<double> TableMultiVariableLookup::maximumValueofX2() const { | |
| 998 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->maximumValueofX2(); | |
| 999 | } | ||
| 1000 | |||
| 1001 | ✗ | boost::optional<double> TableMultiVariableLookup::minimumValueofX3() const { | |
| 1002 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->minimumValueofX3(); | |
| 1003 | } | ||
| 1004 | |||
| 1005 | ✗ | boost::optional<double> TableMultiVariableLookup::maximumValueofX3() const { | |
| 1006 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->maximumValueofX3(); | |
| 1007 | } | ||
| 1008 | |||
| 1009 | ✗ | boost::optional<double> TableMultiVariableLookup::minimumValueofX4() const { | |
| 1010 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->minimumValueofX4(); | |
| 1011 | } | ||
| 1012 | |||
| 1013 | ✗ | boost::optional<double> TableMultiVariableLookup::maximumValueofX4() const { | |
| 1014 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->maximumValueofX4(); | |
| 1015 | } | ||
| 1016 | |||
| 1017 | ✗ | boost::optional<double> TableMultiVariableLookup::minimumValueofX5() const { | |
| 1018 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->minimumValueofX5(); | |
| 1019 | } | ||
| 1020 | |||
| 1021 | ✗ | boost::optional<double> TableMultiVariableLookup::maximumValueofX5() const { | |
| 1022 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->maximumValueofX5(); | |
| 1023 | } | ||
| 1024 | |||
| 1025 | 3 | boost::optional<double> TableMultiVariableLookup::minimumTableOutput() const { | |
| 1026 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::TableMultiVariableLookup_Impl>()->minimumTableOutput(); |
| 1027 | } | ||
| 1028 | |||
| 1029 | 3 | boost::optional<double> TableMultiVariableLookup::maximumTableOutput() const { | |
| 1030 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::TableMultiVariableLookup_Impl>()->maximumTableOutput(); |
| 1031 | } | ||
| 1032 | |||
| 1033 | 3 | std::string TableMultiVariableLookup::inputUnitTypeforX1() const { | |
| 1034 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::TableMultiVariableLookup_Impl>()->inputUnitTypeforX1(); |
| 1035 | } | ||
| 1036 | |||
| 1037 | ✗ | bool TableMultiVariableLookup::isInputUnitTypeforX1Defaulted() const { | |
| 1038 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isInputUnitTypeforX1Defaulted(); | |
| 1039 | } | ||
| 1040 | |||
| 1041 | 1 | std::string TableMultiVariableLookup::inputUnitTypeforX2() const { | |
| 1042 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::TableMultiVariableLookup_Impl>()->inputUnitTypeforX2(); |
| 1043 | } | ||
| 1044 | |||
| 1045 | ✗ | bool TableMultiVariableLookup::isInputUnitTypeforX2Defaulted() const { | |
| 1046 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isInputUnitTypeforX2Defaulted(); | |
| 1047 | } | ||
| 1048 | |||
| 1049 | 1 | std::string TableMultiVariableLookup::inputUnitTypeforX3() const { | |
| 1050 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::TableMultiVariableLookup_Impl>()->inputUnitTypeforX3(); |
| 1051 | } | ||
| 1052 | |||
| 1053 | ✗ | bool TableMultiVariableLookup::isInputUnitTypeforX3Defaulted() const { | |
| 1054 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isInputUnitTypeforX3Defaulted(); | |
| 1055 | } | ||
| 1056 | |||
| 1057 | ✗ | std::string TableMultiVariableLookup::inputUnitTypeforX4() const { | |
| 1058 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->inputUnitTypeforX4(); | |
| 1059 | } | ||
| 1060 | |||
| 1061 | ✗ | bool TableMultiVariableLookup::isInputUnitTypeforX4Defaulted() const { | |
| 1062 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isInputUnitTypeforX4Defaulted(); | |
| 1063 | } | ||
| 1064 | |||
| 1065 | ✗ | std::string TableMultiVariableLookup::inputUnitTypeforX5() const { | |
| 1066 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->inputUnitTypeforX5(); | |
| 1067 | } | ||
| 1068 | |||
| 1069 | ✗ | bool TableMultiVariableLookup::isInputUnitTypeforX5Defaulted() const { | |
| 1070 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isInputUnitTypeforX5Defaulted(); | |
| 1071 | } | ||
| 1072 | |||
| 1073 | 3 | std::string TableMultiVariableLookup::outputUnitType() const { | |
| 1074 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::TableMultiVariableLookup_Impl>()->outputUnitType(); |
| 1075 | } | ||
| 1076 | |||
| 1077 | ✗ | bool TableMultiVariableLookup::isOutputUnitTypeDefaulted() const { | |
| 1078 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->isOutputUnitTypeDefaulted(); | |
| 1079 | } | ||
| 1080 | |||
| 1081 | 4 | int TableMultiVariableLookup::numberofIndependentVariables() const { | |
| 1082 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::TableMultiVariableLookup_Impl>()->numberofIndependentVariables(); |
| 1083 | } | ||
| 1084 | |||
| 1085 | ✗ | bool TableMultiVariableLookup::setInterpolationMethod(const std::string& interpolationMethod) { | |
| 1086 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setInterpolationMethod(interpolationMethod); | |
| 1087 | } | ||
| 1088 | |||
| 1089 | ✗ | void TableMultiVariableLookup::resetInterpolationMethod() { | |
| 1090 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetInterpolationMethod(); | |
| 1091 | ✗ | } | |
| 1092 | |||
| 1093 | ✗ | bool TableMultiVariableLookup::setNumberofInterpolationPoints(int numberofInterpolationPoints) { | |
| 1094 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setNumberofInterpolationPoints(numberofInterpolationPoints); | |
| 1095 | } | ||
| 1096 | |||
| 1097 | ✗ | void TableMultiVariableLookup::resetNumberofInterpolationPoints() { | |
| 1098 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetNumberofInterpolationPoints(); | |
| 1099 | ✗ | } | |
| 1100 | |||
| 1101 | ✗ | bool TableMultiVariableLookup::setCurveType(const std::string& curveType) { | |
| 1102 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setCurveType(curveType); | |
| 1103 | } | ||
| 1104 | |||
| 1105 | ✗ | void TableMultiVariableLookup::resetCurveType() { | |
| 1106 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetCurveType(); | |
| 1107 | ✗ | } | |
| 1108 | |||
| 1109 | ✗ | bool TableMultiVariableLookup::setTableDataFormat(const std::string& tableDataFormat) { | |
| 1110 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setTableDataFormat(tableDataFormat); | |
| 1111 | } | ||
| 1112 | |||
| 1113 | ✗ | void TableMultiVariableLookup::resetTableDataFormat() { | |
| 1114 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetTableDataFormat(); | |
| 1115 | ✗ | } | |
| 1116 | |||
| 1117 | 1 | bool TableMultiVariableLookup::setNormalizationReference(double normalizationReference) { | |
| 1118 |
2/2✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | return getImpl<detail::TableMultiVariableLookup_Impl>()->setNormalizationReference(normalizationReference); |
| 1119 | } | ||
| 1120 | |||
| 1121 | ✗ | void TableMultiVariableLookup::resetNormalizationReference() { | |
| 1122 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetNormalizationReference(); | |
| 1123 | ✗ | } | |
| 1124 | |||
| 1125 | ✗ | bool TableMultiVariableLookup::setMinimumValueofX1(double minimumValueofX1) { | |
| 1126 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMinimumValueofX1(minimumValueofX1); | |
| 1127 | } | ||
| 1128 | |||
| 1129 | ✗ | void TableMultiVariableLookup::resetMinimumValueofX1() { | |
| 1130 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMinimumValueofX1(); | |
| 1131 | ✗ | } | |
| 1132 | |||
| 1133 | ✗ | bool TableMultiVariableLookup::setMaximumValueofX1(double maximumValueofX1) { | |
| 1134 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMaximumValueofX1(maximumValueofX1); | |
| 1135 | } | ||
| 1136 | |||
| 1137 | ✗ | void TableMultiVariableLookup::resetMaximumValueofX1() { | |
| 1138 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMaximumValueofX1(); | |
| 1139 | ✗ | } | |
| 1140 | |||
| 1141 | ✗ | bool TableMultiVariableLookup::setMinimumValueofX2(double minimumValueofX2) { | |
| 1142 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMinimumValueofX2(minimumValueofX2); | |
| 1143 | } | ||
| 1144 | |||
| 1145 | ✗ | void TableMultiVariableLookup::resetMinimumValueofX2() { | |
| 1146 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMinimumValueofX2(); | |
| 1147 | ✗ | } | |
| 1148 | |||
| 1149 | ✗ | bool TableMultiVariableLookup::setMaximumValueofX2(double maximumValueofX2) { | |
| 1150 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMaximumValueofX2(maximumValueofX2); | |
| 1151 | } | ||
| 1152 | |||
| 1153 | ✗ | void TableMultiVariableLookup::resetMaximumValueofX2() { | |
| 1154 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMaximumValueofX2(); | |
| 1155 | ✗ | } | |
| 1156 | |||
| 1157 | ✗ | bool TableMultiVariableLookup::setMinimumValueofX3(double minimumValueofX3) { | |
| 1158 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMinimumValueofX3(minimumValueofX3); | |
| 1159 | } | ||
| 1160 | |||
| 1161 | ✗ | void TableMultiVariableLookup::resetMinimumValueofX3() { | |
| 1162 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMinimumValueofX3(); | |
| 1163 | ✗ | } | |
| 1164 | |||
| 1165 | ✗ | bool TableMultiVariableLookup::setMaximumValueofX3(double maximumValueofX3) { | |
| 1166 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMaximumValueofX3(maximumValueofX3); | |
| 1167 | } | ||
| 1168 | |||
| 1169 | ✗ | void TableMultiVariableLookup::resetMaximumValueofX3() { | |
| 1170 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMaximumValueofX3(); | |
| 1171 | ✗ | } | |
| 1172 | |||
| 1173 | ✗ | bool TableMultiVariableLookup::setMinimumValueofX4(double minimumValueofX4) { | |
| 1174 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMinimumValueofX4(minimumValueofX4); | |
| 1175 | } | ||
| 1176 | |||
| 1177 | ✗ | void TableMultiVariableLookup::resetMinimumValueofX4() { | |
| 1178 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMinimumValueofX4(); | |
| 1179 | ✗ | } | |
| 1180 | |||
| 1181 | ✗ | bool TableMultiVariableLookup::setMaximumValueofX4(double maximumValueofX4) { | |
| 1182 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMaximumValueofX4(maximumValueofX4); | |
| 1183 | } | ||
| 1184 | |||
| 1185 | ✗ | void TableMultiVariableLookup::resetMaximumValueofX4() { | |
| 1186 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMaximumValueofX4(); | |
| 1187 | ✗ | } | |
| 1188 | |||
| 1189 | ✗ | bool TableMultiVariableLookup::setMinimumValueofX5(double minimumValueofX5) { | |
| 1190 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMinimumValueofX5(minimumValueofX5); | |
| 1191 | } | ||
| 1192 | |||
| 1193 | ✗ | void TableMultiVariableLookup::resetMinimumValueofX5() { | |
| 1194 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMinimumValueofX5(); | |
| 1195 | ✗ | } | |
| 1196 | |||
| 1197 | ✗ | bool TableMultiVariableLookup::setMaximumValueofX5(double maximumValueofX5) { | |
| 1198 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMaximumValueofX5(maximumValueofX5); | |
| 1199 | } | ||
| 1200 | |||
| 1201 | ✗ | void TableMultiVariableLookup::resetMaximumValueofX5() { | |
| 1202 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMaximumValueofX5(); | |
| 1203 | ✗ | } | |
| 1204 | |||
| 1205 | ✗ | bool TableMultiVariableLookup::setMinimumTableOutput(double minimumTableOutput) { | |
| 1206 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMinimumTableOutput(minimumTableOutput); | |
| 1207 | } | ||
| 1208 | |||
| 1209 | ✗ | void TableMultiVariableLookup::resetMinimumTableOutput() { | |
| 1210 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMinimumTableOutput(); | |
| 1211 | ✗ | } | |
| 1212 | |||
| 1213 | ✗ | bool TableMultiVariableLookup::setMaximumTableOutput(double maximumTableOutput) { | |
| 1214 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setMaximumTableOutput(maximumTableOutput); | |
| 1215 | } | ||
| 1216 | |||
| 1217 | ✗ | void TableMultiVariableLookup::resetMaximumTableOutput() { | |
| 1218 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetMaximumTableOutput(); | |
| 1219 | ✗ | } | |
| 1220 | |||
| 1221 | ✗ | bool TableMultiVariableLookup::setInputUnitTypeforX1(const std::string& inputUnitTypeforX1) { | |
| 1222 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setInputUnitTypeforX1(inputUnitTypeforX1); | |
| 1223 | } | ||
| 1224 | |||
| 1225 | ✗ | void TableMultiVariableLookup::resetInputUnitTypeforX1() { | |
| 1226 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetInputUnitTypeforX1(); | |
| 1227 | ✗ | } | |
| 1228 | |||
| 1229 | ✗ | bool TableMultiVariableLookup::setInputUnitTypeforX2(const std::string& inputUnitTypeforX2) { | |
| 1230 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setInputUnitTypeforX2(inputUnitTypeforX2); | |
| 1231 | } | ||
| 1232 | |||
| 1233 | ✗ | void TableMultiVariableLookup::resetInputUnitTypeforX2() { | |
| 1234 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetInputUnitTypeforX2(); | |
| 1235 | ✗ | } | |
| 1236 | |||
| 1237 | ✗ | bool TableMultiVariableLookup::setInputUnitTypeforX3(const std::string& inputUnitTypeforX3) { | |
| 1238 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setInputUnitTypeforX3(inputUnitTypeforX3); | |
| 1239 | } | ||
| 1240 | |||
| 1241 | ✗ | void TableMultiVariableLookup::resetInputUnitTypeforX3() { | |
| 1242 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetInputUnitTypeforX3(); | |
| 1243 | ✗ | } | |
| 1244 | |||
| 1245 | ✗ | bool TableMultiVariableLookup::setInputUnitTypeforX4(const std::string& inputUnitTypeforX4) { | |
| 1246 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setInputUnitTypeforX4(inputUnitTypeforX4); | |
| 1247 | } | ||
| 1248 | |||
| 1249 | ✗ | void TableMultiVariableLookup::resetInputUnitTypeforX4() { | |
| 1250 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetInputUnitTypeforX4(); | |
| 1251 | ✗ | } | |
| 1252 | |||
| 1253 | ✗ | bool TableMultiVariableLookup::setInputUnitTypeforX5(const std::string& inputUnitTypeforX5) { | |
| 1254 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setInputUnitTypeforX5(inputUnitTypeforX5); | |
| 1255 | } | ||
| 1256 | |||
| 1257 | ✗ | void TableMultiVariableLookup::resetInputUnitTypeforX5() { | |
| 1258 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetInputUnitTypeforX5(); | |
| 1259 | ✗ | } | |
| 1260 | |||
| 1261 | ✗ | bool TableMultiVariableLookup::setOutputUnitType(const std::string& outputUnitType) { | |
| 1262 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->setOutputUnitType(outputUnitType); | |
| 1263 | } | ||
| 1264 | |||
| 1265 | ✗ | void TableMultiVariableLookup::resetOutputUnitType() { | |
| 1266 | ✗ | getImpl<detail::TableMultiVariableLookup_Impl>()->resetOutputUnitType(); | |
| 1267 | ✗ | } | |
| 1268 | |||
| 1269 | // cppcheck-suppress [duplInheritedMember] this is overriden for documentation purposes | ||
| 1270 | ✗ | int TableMultiVariableLookup::numVariables() const { | |
| 1271 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->numVariables(); | |
| 1272 | } | ||
| 1273 | |||
| 1274 | // cppcheck-suppress [duplInheritedMember] this is overriden for documentation purposes | ||
| 1275 | ✗ | double TableMultiVariableLookup::evaluate(const std::vector<double>& x) const { | |
| 1276 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->evaluate(x); | |
| 1277 | } | ||
| 1278 | |||
| 1279 | ✗ | bool TableMultiVariableLookup::addPoint(const TableMultiVariableLookupPoint& point) { | |
| 1280 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->addPoint(point); | |
| 1281 | } | ||
| 1282 | |||
| 1283 | ✗ | bool TableMultiVariableLookup::addPoint(const std::vector<double>& xValues, double yValue) { | |
| 1284 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->addPoint(xValues, yValue); | |
| 1285 | } | ||
| 1286 | |||
| 1287 | 10 | bool TableMultiVariableLookup::addPoint(double x1, double yValue) { | |
| 1288 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::TableMultiVariableLookup_Impl>()->addPoint(x1, yValue); |
| 1289 | } | ||
| 1290 | |||
| 1291 | 32 | bool TableMultiVariableLookup::addPoint(double x1, double x2, double yValue) { | |
| 1292 |
1/1✓ Branch 3 taken 32 times.
|
32 | return getImpl<detail::TableMultiVariableLookup_Impl>()->addPoint(x1, x2, yValue); |
| 1293 | } | ||
| 1294 | |||
| 1295 | 72 | bool TableMultiVariableLookup::addPoint(double x1, double x2, double x3, double yValue) { | |
| 1296 |
1/1✓ Branch 3 taken 72 times.
|
72 | return getImpl<detail::TableMultiVariableLookup_Impl>()->addPoint(x1, x2, x3, yValue); |
| 1297 | } | ||
| 1298 | |||
| 1299 | ✗ | bool TableMultiVariableLookup::addPoint(double x1, double x2, double x3, double x4, double yValue) { | |
| 1300 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->addPoint(x1, x2, x3, x4, yValue); | |
| 1301 | } | ||
| 1302 | |||
| 1303 | ✗ | bool TableMultiVariableLookup::addPoint(double x1, double x2, double x3, double x4, double x5, double yValue) { | |
| 1304 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->addPoint(x1, x2, x3, x4, x5, yValue); | |
| 1305 | } | ||
| 1306 | |||
| 1307 | 2 | bool TableMultiVariableLookup::setPoints(const std::vector<TableMultiVariableLookupPoint>& points) { | |
| 1308 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::TableMultiVariableLookup_Impl>()->setPoints(points); |
| 1309 | } | ||
| 1310 | |||
| 1311 | 10 | std::vector<TableMultiVariableLookupPoint> TableMultiVariableLookup::points() const { | |
| 1312 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::TableMultiVariableLookup_Impl>()->points(); |
| 1313 | } | ||
| 1314 | |||
| 1315 | ✗ | std::string TableMultiVariableLookup::printTable(unsigned int precision) const { | |
| 1316 | ✗ | return getImpl<detail::TableMultiVariableLookup_Impl>()->printTable(precision); | |
| 1317 | } | ||
| 1318 | |||
| 1319 | 2 | boost::optional<double> TableMultiVariableLookup::yValue(const std::vector<double>& xValues) const { | |
| 1320 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::TableMultiVariableLookup_Impl>()->yValue(xValues); |
| 1321 | } | ||
| 1322 | |||
| 1323 | 11 | std::vector<double> TableMultiVariableLookup::xValues(int i) const { | |
| 1324 |
1/1✓ Branch 3 taken 11 times.
|
11 | return getImpl<detail::TableMultiVariableLookup_Impl>()->xValues(i); |
| 1325 | } | ||
| 1326 | |||
| 1327 | /// @cond | ||
| 1328 | 413 | TableMultiVariableLookup::TableMultiVariableLookup(std::shared_ptr<detail::TableMultiVariableLookup_Impl> impl) | |
| 1329 |
1/1✓ Branch 3 taken 413 times.
|
413 | : Curve(std::dynamic_pointer_cast<detail::Curve_Impl>(std::move(impl))) {} |
| 1330 | /// @endcond | ||
| 1331 | |||
| 1332 | } // namespace model | ||
| 1333 | } // namespace openstudio | ||
| 1334 | |||
| 1335 | #if defined(_MSC_VER) | ||
| 1336 | # pragma warning(pop) | ||
| 1337 | #elif (defined(__GNUC__)) | ||
| 1338 | # pragma GCC diagnostic pop | ||
| 1339 | #endif | ||
| 1340 |