src/model/ShadowCalculation.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 | #include "ShadowCalculation.hpp" | ||
| 7 | #include "ShadowCalculation_Impl.hpp" | ||
| 8 | #include "SimulationControl.hpp" | ||
| 9 | #include "SimulationControl_Impl.hpp" | ||
| 10 | #include "Model.hpp" | ||
| 11 | #include "Model_Impl.hpp" | ||
| 12 | #include "ThermalZone.hpp" | ||
| 13 | #include "ThermalZone_Impl.hpp" | ||
| 14 | #include "ModelObject.hpp" | ||
| 15 | #include "ModelObjectList.hpp" | ||
| 16 | #include "ModelObjectList_Impl.hpp" | ||
| 17 | #include "ModelExtensibleGroup.hpp" | ||
| 18 | |||
| 19 | #include "../utilities/core/Assert.hpp" | ||
| 20 | |||
| 21 | #include <utilities/idd/IddFactory.hxx> | ||
| 22 | |||
| 23 | #include <utilities/idd/OS_ShadowCalculation_FieldEnums.hxx> | ||
| 24 | #include <utilities/idd/IddEnums.hxx> | ||
| 25 | |||
| 26 | namespace openstudio { | ||
| 27 | namespace model { | ||
| 28 | |||
| 29 | namespace detail { | ||
| 30 | |||
| 31 | 326 | ShadowCalculation_Impl::ShadowCalculation_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 32 | 326 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 33 |
4/6✓ Branch 1 taken 326 times.
✓ Branch 4 taken 326 times.
✓ Branch 7 taken 326 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 326 times.
✗ Branch 13 not taken.
|
326 | OS_ASSERT(idfObject.iddObject().type() == ShadowCalculation::iddObjectType()); |
| 34 | 326 | } | |
| 35 | |||
| 36 | 61 | ShadowCalculation_Impl::ShadowCalculation_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 37 | 61 | : ModelObject_Impl(other, model, keepHandle) { | |
| 38 |
4/6✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 61 times.
✗ Branch 13 not taken.
|
61 | OS_ASSERT(other.iddObject().type() == ShadowCalculation::iddObjectType()); |
| 39 | 61 | } | |
| 40 | |||
| 41 | 125 | ShadowCalculation_Impl::ShadowCalculation_Impl(const ShadowCalculation_Impl& other, Model_Impl* model, bool keepHandle) | |
| 42 | 125 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 43 | |||
| 44 | // return the parent object in the hierarchy | ||
| 45 | 1 | boost::optional<ParentObject> ShadowCalculation_Impl::parent() const { | |
| 46 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | boost::optional<ParentObject> result(model().getUniqueModelObject<SimulationControl>()); |
| 47 | 1 | return result; | |
| 48 | } | ||
| 49 | |||
| 50 | // set the parent, child may have to call methods on the parent | ||
| 51 | ✗ | bool ShadowCalculation_Impl::setParent(ParentObject& newParent) { | |
| 52 | ✗ | if (newParent.optionalCast<SimulationControl>() && (newParent.model() == model())) { | |
| 53 | ✗ | return true; | |
| 54 | } | ||
| 55 | ✗ | return false; | |
| 56 | } | ||
| 57 | |||
| 58 | // Get all output variable names that could be associated with this object. | ||
| 59 | 1 | const std::vector<std::string>& ShadowCalculation_Impl::outputVariableNames() const { | |
| 60 |
2/4✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | static const std::vector<std::string> result; |
| 61 | 1 | return result; | |
| 62 | } | ||
| 63 | |||
| 64 | 1 | IddObjectType ShadowCalculation_Impl::iddObjectType() const { | |
| 65 | 1 | return ShadowCalculation::iddObjectType(); | |
| 66 | } | ||
| 67 | |||
| 68 | 58 | std::string ShadowCalculation_Impl::shadingCalculationMethod() const { | |
| 69 |
1/1✓ Branch 1 taken 58 times.
|
58 | boost::optional<std::string> value = getString(OS_ShadowCalculationFields::ShadingCalculationMethod, true); |
| 70 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 4 not taken.
|
58 | OS_ASSERT(value); |
| 71 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
116 | return value.get(); |
| 72 | 58 | } | |
| 73 | |||
| 74 | 58 | std::string ShadowCalculation_Impl::shadingCalculationUpdateFrequencyMethod() const { | |
| 75 |
1/1✓ Branch 1 taken 58 times.
|
58 | boost::optional<std::string> value = getString(OS_ShadowCalculationFields::ShadingCalculationUpdateFrequencyMethod, true); |
| 76 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 4 not taken.
|
58 | OS_ASSERT(value); |
| 77 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
116 | return value.get(); |
| 78 | 58 | } | |
| 79 | |||
| 80 | 4 | bool ShadowCalculation_Impl::isShadingCalculationUpdateFrequencyMethodDefaulted() const { | |
| 81 | 4 | return isEmpty(OS_ShadowCalculationFields::ShadingCalculationUpdateFrequencyMethod); | |
| 82 | } | ||
| 83 | |||
| 84 | 57 | int ShadowCalculation_Impl::shadingCalculationUpdateFrequency() const { | |
| 85 |
1/1✓ Branch 1 taken 57 times.
|
57 | boost::optional<int> value = getInt(OS_ShadowCalculationFields::ShadingCalculationUpdateFrequency, true); |
| 86 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 57 times.
✗ Branch 4 not taken.
|
57 | OS_ASSERT(value); |
| 87 |
1/1✓ Branch 1 taken 57 times.
|
114 | return value.get(); |
| 88 | } | ||
| 89 | |||
| 90 | 2 | bool ShadowCalculation_Impl::isShadingCalculationUpdateFrequencyDefaulted() const { | |
| 91 | 2 | return isEmpty(OS_ShadowCalculationFields::ShadingCalculationUpdateFrequency); | |
| 92 | } | ||
| 93 | |||
| 94 | 57 | int ShadowCalculation_Impl::maximumFiguresInShadowOverlapCalculations() const { | |
| 95 |
1/1✓ Branch 1 taken 57 times.
|
57 | boost::optional<int> value = getInt(OS_ShadowCalculationFields::MaximumFiguresinShadowOverlapCalculations, true); |
| 96 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 57 times.
✗ Branch 4 not taken.
|
57 | OS_ASSERT(value); |
| 97 |
1/1✓ Branch 1 taken 57 times.
|
114 | return value.get(); |
| 98 | } | ||
| 99 | |||
| 100 | 2 | bool ShadowCalculation_Impl::isMaximumFiguresInShadowOverlapCalculationsDefaulted() const { | |
| 101 | 2 | return isEmpty(OS_ShadowCalculationFields::MaximumFiguresinShadowOverlapCalculations); | |
| 102 | } | ||
| 103 | |||
| 104 | 58 | std::string ShadowCalculation_Impl::polygonClippingAlgorithm() const { | |
| 105 |
1/1✓ Branch 1 taken 58 times.
|
58 | boost::optional<std::string> value = getString(OS_ShadowCalculationFields::PolygonClippingAlgorithm, true); |
| 106 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 4 not taken.
|
58 | OS_ASSERT(value); |
| 107 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
116 | return value.get(); |
| 108 | 58 | } | |
| 109 | |||
| 110 | 57 | int ShadowCalculation_Impl::pixelCountingResolution() const { | |
| 111 |
1/1✓ Branch 1 taken 57 times.
|
57 | boost::optional<int> value = getInt(OS_ShadowCalculationFields::PixelCountingResolution, true); |
| 112 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 57 times.
✗ Branch 4 not taken.
|
57 | OS_ASSERT(value); |
| 113 |
1/1✓ Branch 1 taken 57 times.
|
114 | return value.get(); |
| 114 | } | ||
| 115 | |||
| 116 | 58 | std::string ShadowCalculation_Impl::skyDiffuseModelingAlgorithm() const { | |
| 117 |
1/1✓ Branch 1 taken 58 times.
|
58 | boost::optional<std::string> value = getString(OS_ShadowCalculationFields::SkyDiffuseModelingAlgorithm, true); |
| 118 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 58 times.
✗ Branch 4 not taken.
|
58 | OS_ASSERT(value); |
| 119 |
2/2✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
|
116 | return value.get(); |
| 120 | 58 | } | |
| 121 | |||
| 122 | 60 | bool ShadowCalculation_Impl::outputExternalShadingCalculationResults() const { | |
| 123 | 60 | return getBooleanFieldValue(OS_ShadowCalculationFields::OutputExternalShadingCalculationResults); | |
| 124 | } | ||
| 125 | |||
| 126 | 60 | bool ShadowCalculation_Impl::disableSelfShadingWithinShadingZoneGroups() const { | |
| 127 | 60 | return getBooleanFieldValue(OS_ShadowCalculationFields::DisableSelfShadingWithinShadingZoneGroups); | |
| 128 | } | ||
| 129 | |||
| 130 | 60 | bool ShadowCalculation_Impl::disableSelfShadingFromShadingZoneGroupstoOtherZones() const { | |
| 131 | 60 | return getBooleanFieldValue(OS_ShadowCalculationFields::DisableSelfShadingFromShadingZoneGroupstoOtherZones); | |
| 132 | } | ||
| 133 | |||
| 134 | 273 | bool ShadowCalculation_Impl::setShadingCalculationMethod(const std::string& shadingCalculationMethod) { | |
| 135 | 273 | bool result = setString(OS_ShadowCalculationFields::ShadingCalculationMethod, shadingCalculationMethod); | |
| 136 | 273 | return result; | |
| 137 | } | ||
| 138 | |||
| 139 | 9 | bool ShadowCalculation_Impl::setShadingCalculationUpdateFrequencyMethod(const std::string& shadingCalculationUpdateFrequencyMethod) { | |
| 140 | 9 | bool result = setString(OS_ShadowCalculationFields::ShadingCalculationUpdateFrequencyMethod, shadingCalculationUpdateFrequencyMethod); | |
| 141 | 9 | return result; | |
| 142 | } | ||
| 143 | |||
| 144 | 2 | void ShadowCalculation_Impl::resetShadingCalculationUpdateFrequencyMethod() { | |
| 145 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | bool result = setString(OS_ShadowCalculationFields::ShadingCalculationUpdateFrequencyMethod, ""); |
| 146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | OS_ASSERT(result); |
| 147 | 2 | } | |
| 148 | |||
| 149 | 272 | bool ShadowCalculation_Impl::setShadingCalculationUpdateFrequency(int shadingCalculationUpdateFrequency) { | |
| 150 | 272 | bool result = setInt(OS_ShadowCalculationFields::ShadingCalculationUpdateFrequency, shadingCalculationUpdateFrequency); | |
| 151 | 272 | return result; | |
| 152 | } | ||
| 153 | |||
| 154 | 1 | void ShadowCalculation_Impl::resetShadingCalculationUpdateFrequency() { | |
| 155 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ShadowCalculationFields::ShadingCalculationUpdateFrequency, ""); |
| 156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 157 | 1 | } | |
| 158 | |||
| 159 | 271 | bool ShadowCalculation_Impl::setMaximumFiguresInShadowOverlapCalculations(int maximumFiguresInShadowOverlapCalculations) { | |
| 160 | 271 | bool result = setInt(OS_ShadowCalculationFields::MaximumFiguresinShadowOverlapCalculations, maximumFiguresInShadowOverlapCalculations); | |
| 161 | 271 | return result; | |
| 162 | } | ||
| 163 | |||
| 164 | 1 | void ShadowCalculation_Impl::resetMaximumFiguresInShadowOverlapCalculations() { | |
| 165 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ShadowCalculationFields::MaximumFiguresinShadowOverlapCalculations, ""); |
| 166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 167 | 1 | } | |
| 168 | |||
| 169 | 5 | bool ShadowCalculation_Impl::setPolygonClippingAlgorithm(const std::string& polygonClippingAlgorithm) { | |
| 170 | 5 | bool result = setString(OS_ShadowCalculationFields::PolygonClippingAlgorithm, polygonClippingAlgorithm); | |
| 171 | 5 | return result; | |
| 172 | } | ||
| 173 | |||
| 174 | 1 | void ShadowCalculation_Impl::resetPolygonClippingAlgorithm() { | |
| 175 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ShadowCalculationFields::PolygonClippingAlgorithm, ""); |
| 176 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 177 | 1 | } | |
| 178 | |||
| 179 | 268 | bool ShadowCalculation_Impl::setPixelCountingResolution(int pixelCountingResolution) { | |
| 180 | 268 | bool result = setInt(OS_ShadowCalculationFields::PixelCountingResolution, pixelCountingResolution); | |
| 181 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268 times.
|
268 | OS_ASSERT(result); |
| 182 | 268 | return result; | |
| 183 | } | ||
| 184 | |||
| 185 | 5 | bool ShadowCalculation_Impl::setSkyDiffuseModelingAlgorithm(const std::string& skyDiffuseModelingAlgorithm) { | |
| 186 | 5 | bool result = setString(OS_ShadowCalculationFields::SkyDiffuseModelingAlgorithm, skyDiffuseModelingAlgorithm); | |
| 187 | 5 | return result; | |
| 188 | } | ||
| 189 | |||
| 190 | 1 | void ShadowCalculation_Impl::resetSkyDiffuseModelingAlgorithm() { | |
| 191 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ShadowCalculationFields::SkyDiffuseModelingAlgorithm, ""); |
| 192 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 193 | 1 | } | |
| 194 | |||
| 195 | 274 | bool ShadowCalculation_Impl::setOutputExternalShadingCalculationResults(bool outputExternalShadingCalculationResults) { | |
| 196 | 274 | return setBooleanFieldValue(OS_ShadowCalculationFields::OutputExternalShadingCalculationResults, outputExternalShadingCalculationResults); | |
| 197 | } | ||
| 198 | |||
| 199 | 274 | bool ShadowCalculation_Impl::setDisableSelfShadingWithinShadingZoneGroups(bool disableSelfShadingWithinShadingZoneGroups) { | |
| 200 | 274 | return setBooleanFieldValue(OS_ShadowCalculationFields::DisableSelfShadingWithinShadingZoneGroups, disableSelfShadingWithinShadingZoneGroups); | |
| 201 | } | ||
| 202 | |||
| 203 | 274 | bool ShadowCalculation_Impl::setDisableSelfShadingFromShadingZoneGroupstoOtherZones(bool disableSelfShadingFromShadingZoneGroupstoOtherZones) { | |
| 204 | 274 | return setBooleanFieldValue(OS_ShadowCalculationFields::DisableSelfShadingFromShadingZoneGroupstoOtherZones, | |
| 205 | 274 | disableSelfShadingFromShadingZoneGroupstoOtherZones); | |
| 206 | } | ||
| 207 | |||
| 208 | 80 | unsigned int ShadowCalculation_Impl::numberofShadingZoneGroups() const { | |
| 209 | 80 | return numExtensibleGroups(); | |
| 210 | } | ||
| 211 | |||
| 212 | 14 | boost::optional<ModelObjectList> ShadowCalculation_Impl::getShadingZoneGroupModelObjectList(unsigned groupIndex) const { | |
| 213 | |||
| 214 | 14 | boost::optional<ModelObjectList> result; | |
| 215 | |||
| 216 |
3/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 13 times.
|
14 | if (groupIndex >= numberofShadingZoneGroups()) { |
| 217 |
10/10✓ 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 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
|
1 | LOG(Error, "Asked to get Shading Zone Group with index " << groupIndex << ", but ShadowCalculation has just " << numberofShadingZoneGroups() |
| 218 | << " Shading Zone Groups."); | ||
| 219 | 1 | return result; | |
| 220 | } | ||
| 221 | |||
| 222 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | auto group = getExtensibleGroup(groupIndex).cast<ModelExtensibleGroup>(); |
| 223 | |||
| 224 |
1/1✓ Branch 1 taken 13 times.
|
13 | boost::optional<ModelObjectList> mo_list = group.getModelObjectTarget<ModelObjectList>(OS_ShadowCalculationExtensibleFields::ShadingZoneGroup); |
| 225 | |||
| 226 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (mo_list) { |
| 227 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | result = mo_list.get(); |
| 228 | } else { | ||
| 229 | ✗ | LOG_AND_THROW("ShadowCalculation does not appear to have a ModelObjectList for Shading Zone Group " << groupIndex); | |
| 230 | } | ||
| 231 | |||
| 232 | 13 | return result; | |
| 233 | 13 | } | |
| 234 | |||
| 235 | 12 | std::vector<ThermalZone> ShadowCalculation_Impl::getShadingZoneGroup(unsigned groupIndex) const { | |
| 236 | |||
| 237 | 12 | std::vector<ThermalZone> result; | |
| 238 | |||
| 239 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (auto _mo_list = getShadingZoneGroupModelObjectList(groupIndex)) { |
| 240 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 11 taken 18 times.
✓ Branch 12 taken 12 times.
|
30 | for (const ModelObject& mo : _mo_list->modelObjects()) { |
| 241 |
1/1✓ Branch 1 taken 18 times.
|
18 | boost::optional<ThermalZone> thermalZone = mo.optionalCast<ThermalZone>(); |
| 242 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if (thermalZone) { |
| 243 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | result.push_back(thermalZone.get()); |
| 244 | } else { | ||
| 245 | ✗ | LOG_AND_THROW(briefDescription() << " appears to have non ThermalZone objects in the Shading Zone Group " << groupIndex); | |
| 246 | } | ||
| 247 | 30 | } | |
| 248 | 12 | } | |
| 249 | |||
| 250 | 12 | return result; | |
| 251 | ✗ | } | |
| 252 | |||
| 253 | 9 | bool ShadowCalculation_Impl::addShadingZoneGroup(const std::vector<ThermalZone>& thermalZones) { | |
| 254 | |||
| 255 | 9 | bool ok = false; | |
| 256 | |||
| 257 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | ModelObjectList shadingZoneGroupList = ModelObjectList(this->model()); |
| 258 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | shadingZoneGroupList.setName("ShadowCalculation Shading Zone Group"); |
| 259 | |||
| 260 |
2/2✓ Branch 5 taken 14 times.
✓ Branch 6 taken 9 times.
|
23 | for (const auto& tz : thermalZones) { |
| 261 |
1/1✓ Branch 1 taken 14 times.
|
14 | bool ok = shadingZoneGroupList.addModelObject(tz); |
| 262 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if (!ok) { |
| 263 | ✗ | LOG(Warn, "Failed to add " << tz.briefDescription() << " to " << shadingZoneGroupList.nameString() << ". Continuing"); | |
| 264 | } | ||
| 265 | } | ||
| 266 | |||
| 267 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
|
9 | auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); |
| 268 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | ok = eg.setPointer(OS_ShadowCalculationExtensibleFields::ShadingZoneGroup, shadingZoneGroupList.handle()); |
| 269 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 3 not taken.
|
9 | OS_ASSERT(ok); |
| 270 | |||
| 271 | 9 | return true; | |
| 272 | 9 | } | |
| 273 | |||
| 274 | 2 | bool ShadowCalculation_Impl::removeShadingZoneGroup(unsigned groupIndex) { | |
| 275 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
4 | if (auto _mo_list = getShadingZoneGroupModelObjectList(groupIndex)) { |
| 276 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _mo_list->removeAllModelObjects(); |
| 277 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _mo_list->remove(); |
| 278 | // ModelObjectList will remove any object it has, so have to clear it first | ||
| 279 |
1/1✓ Branch 1 taken 1 time.
|
1 | eraseExtensibleGroup(groupIndex); |
| 280 | 1 | return true; | |
| 281 | 2 | } | |
| 282 | |||
| 283 | 1 | return false; | |
| 284 | } | ||
| 285 | |||
| 286 | 1 | void ShadowCalculation_Impl::removeAllShadingZoneGroups() { | |
| 287 | |||
| 288 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 1 time.
|
3 | for (const auto& eg : extensibleGroups()) { |
| 289 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto group = eg.cast<ModelExtensibleGroup>(); |
| 290 | 2 | if (boost::optional<ModelObjectList> _mo_list = | |
| 291 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | group.getModelObjectTarget<ModelObjectList>(OS_ShadowCalculationExtensibleFields::ShadingZoneGroup)) { |
| 292 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | _mo_list->removeAllModelObjects(); |
| 293 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | _mo_list->remove(); |
| 294 | 2 | } | |
| 295 | 3 | } | |
| 296 | |||
| 297 |
1/1✓ Branch 1 taken 1 time.
|
1 | clearExtensibleGroups(); |
| 298 | |||
| 299 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | OS_ASSERT(numberofShadingZoneGroups() == 0u); |
| 300 | 1 | } | |
| 301 | |||
| 302 | } // namespace detail | ||
| 303 | |||
| 304 | /// constructor | ||
| 305 | 264 | ShadowCalculation::ShadowCalculation(const Model& model) : ModelObject(ShadowCalculation::iddObjectType(), model) { | |
| 306 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 264 times.
✗ Branch 5 not taken.
|
264 | OS_ASSERT(getImpl<detail::ShadowCalculation_Impl>()); |
| 307 | |||
| 308 |
2/2✓ Branch 1 taken 264 times.
✓ Branch 4 taken 264 times.
|
264 | bool ok = setShadingCalculationMethod("PolygonClipping"); |
| 309 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 3 not taken.
|
264 | OS_ASSERT(ok); |
| 310 | |||
| 311 | // ok = setShadingCalculationUpdateFrequencyMethod("Periodic"); | ||
| 312 | // OS_ASSERT(ok); | ||
| 313 | |||
| 314 | // These two are prexisting, and with default, but they were already hardcoded before | ||
| 315 |
1/1✓ Branch 1 taken 264 times.
|
264 | ok = setShadingCalculationUpdateFrequency(20); |
| 316 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 3 not taken.
|
264 | OS_ASSERT(ok); |
| 317 |
1/1✓ Branch 1 taken 264 times.
|
264 | ok = setMaximumFiguresInShadowOverlapCalculations(15000); |
| 318 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 3 not taken.
|
264 | OS_ASSERT(ok); |
| 319 | |||
| 320 | // ok = setPolygonClippingAlgorithm("SutherlandHodgman"); | ||
| 321 | // OS_ASSERT(ok); | ||
| 322 |
1/1✓ Branch 1 taken 264 times.
|
264 | ok = setPixelCountingResolution(512); |
| 323 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 3 not taken.
|
264 | OS_ASSERT(ok); |
| 324 | // ok = setSkyDiffuseModelingAlgorithm("SimpleSkyDiffuseModeling"); | ||
| 325 | // OS_ASSERT(ok); | ||
| 326 |
1/1✓ Branch 1 taken 264 times.
|
264 | ok = setOutputExternalShadingCalculationResults(false); |
| 327 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 3 not taken.
|
264 | OS_ASSERT(ok); |
| 328 |
1/1✓ Branch 1 taken 264 times.
|
264 | ok = setDisableSelfShadingWithinShadingZoneGroups(false); |
| 329 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 3 not taken.
|
264 | OS_ASSERT(ok); |
| 330 |
1/1✓ Branch 1 taken 264 times.
|
264 | ok = setDisableSelfShadingFromShadingZoneGroupstoOtherZones(false); |
| 331 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 3 not taken.
|
264 | OS_ASSERT(ok); |
| 332 | 264 | } | |
| 333 | |||
| 334 | // constructor | ||
| 335 |
1/1✓ Branch 3 taken 125 times.
|
125 | ShadowCalculation::ShadowCalculation(std::shared_ptr<detail::ShadowCalculation_Impl> impl) : ModelObject(std::move(impl)) {} |
| 336 | |||
| 337 | 9554 | IddObjectType ShadowCalculation::iddObjectType() { | |
| 338 |
1/1✓ Branch 1 taken 9554 times.
|
9554 | IddObjectType result(IddObjectType::OS_ShadowCalculation); |
| 339 | 9554 | return result; | |
| 340 | } | ||
| 341 | |||
| 342 | ✗ | std::vector<std::string> ShadowCalculation::shadingCalculationMethodValues() { | |
| 343 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ShadowCalculationFields::ShadingCalculationMethod); | |
| 344 | } | ||
| 345 | ✗ | std::vector<std::string> ShadowCalculation::validShadingCalculationMethodValues() { | |
| 346 | ✗ | return shadingCalculationMethodValues(); | |
| 347 | } | ||
| 348 | |||
| 349 | ✗ | std::vector<std::string> ShadowCalculation::shadingCalculationUpdateFrequencyMethodValues() { | |
| 350 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), | |
| 351 | ✗ | OS_ShadowCalculationFields::ShadingCalculationUpdateFrequencyMethod); | |
| 352 | } | ||
| 353 | ✗ | std::vector<std::string> ShadowCalculation::validShadingCalculationUpdateFrequencyMethodValues() { | |
| 354 | ✗ | return shadingCalculationUpdateFrequencyMethodValues(); | |
| 355 | } | ||
| 356 | |||
| 357 | ✗ | std::vector<std::string> ShadowCalculation::polygonClippingAlgorithmValues() { | |
| 358 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ShadowCalculationFields::PolygonClippingAlgorithm); | |
| 359 | } | ||
| 360 | ✗ | std::vector<std::string> ShadowCalculation::validPolygonClippingAlgorithmValues() { | |
| 361 | ✗ | return polygonClippingAlgorithmValues(); | |
| 362 | } | ||
| 363 | |||
| 364 | ✗ | std::vector<std::string> ShadowCalculation::skyDiffuseModelingAlgorithmValues() { | |
| 365 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ShadowCalculationFields::SkyDiffuseModelingAlgorithm); | |
| 366 | } | ||
| 367 | ✗ | std::vector<std::string> ShadowCalculation::validSkyDiffuseModelingAlgorithmValues() { | |
| 368 | ✗ | return skyDiffuseModelingAlgorithmValues(); | |
| 369 | } | ||
| 370 | |||
| 371 | 58 | std::string ShadowCalculation::shadingCalculationMethod() const { | |
| 372 |
1/1✓ Branch 3 taken 58 times.
|
58 | return getImpl<detail::ShadowCalculation_Impl>()->shadingCalculationMethod(); |
| 373 | } | ||
| 374 | |||
| 375 | 58 | std::string ShadowCalculation::shadingCalculationUpdateFrequencyMethod() const { | |
| 376 |
1/1✓ Branch 3 taken 58 times.
|
58 | return getImpl<detail::ShadowCalculation_Impl>()->shadingCalculationUpdateFrequencyMethod(); |
| 377 | } | ||
| 378 | |||
| 379 | 4 | bool ShadowCalculation::isShadingCalculationUpdateFrequencyMethodDefaulted() const { | |
| 380 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ShadowCalculation_Impl>()->isShadingCalculationUpdateFrequencyMethodDefaulted(); |
| 381 | } | ||
| 382 | |||
| 383 | 57 | int ShadowCalculation::shadingCalculationUpdateFrequency() const { | |
| 384 |
1/1✓ Branch 3 taken 57 times.
|
57 | return getImpl<detail::ShadowCalculation_Impl>()->shadingCalculationUpdateFrequency(); |
| 385 | } | ||
| 386 | |||
| 387 | 2 | bool ShadowCalculation::isShadingCalculationUpdateFrequencyDefaulted() const { | |
| 388 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::ShadowCalculation_Impl>()->isShadingCalculationUpdateFrequencyDefaulted(); |
| 389 | } | ||
| 390 | |||
| 391 | 57 | int ShadowCalculation::maximumFiguresInShadowOverlapCalculations() const { | |
| 392 |
1/1✓ Branch 3 taken 57 times.
|
57 | return getImpl<detail::ShadowCalculation_Impl>()->maximumFiguresInShadowOverlapCalculations(); |
| 393 | } | ||
| 394 | |||
| 395 | 2 | bool ShadowCalculation::isMaximumFiguresInShadowOverlapCalculationsDefaulted() const { | |
| 396 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::ShadowCalculation_Impl>()->isMaximumFiguresInShadowOverlapCalculationsDefaulted(); |
| 397 | } | ||
| 398 | |||
| 399 | 58 | std::string ShadowCalculation::polygonClippingAlgorithm() const { | |
| 400 |
1/1✓ Branch 3 taken 58 times.
|
58 | return getImpl<detail::ShadowCalculation_Impl>()->polygonClippingAlgorithm(); |
| 401 | } | ||
| 402 | |||
| 403 | 57 | int ShadowCalculation::pixelCountingResolution() const { | |
| 404 |
1/1✓ Branch 3 taken 57 times.
|
57 | return getImpl<detail::ShadowCalculation_Impl>()->pixelCountingResolution(); |
| 405 | } | ||
| 406 | |||
| 407 | 58 | std::string ShadowCalculation::skyDiffuseModelingAlgorithm() const { | |
| 408 |
1/1✓ Branch 3 taken 58 times.
|
58 | return getImpl<detail::ShadowCalculation_Impl>()->skyDiffuseModelingAlgorithm(); |
| 409 | } | ||
| 410 | |||
| 411 | 60 | bool ShadowCalculation::outputExternalShadingCalculationResults() const { | |
| 412 |
1/1✓ Branch 3 taken 60 times.
|
60 | return getImpl<detail::ShadowCalculation_Impl>()->outputExternalShadingCalculationResults(); |
| 413 | } | ||
| 414 | |||
| 415 | 60 | bool ShadowCalculation::disableSelfShadingWithinShadingZoneGroups() const { | |
| 416 |
1/1✓ Branch 3 taken 60 times.
|
60 | return getImpl<detail::ShadowCalculation_Impl>()->disableSelfShadingWithinShadingZoneGroups(); |
| 417 | } | ||
| 418 | 60 | bool ShadowCalculation::disableSelfShadingFromShadingZoneGroupstoOtherZones() const { | |
| 419 |
1/1✓ Branch 3 taken 60 times.
|
60 | return getImpl<detail::ShadowCalculation_Impl>()->disableSelfShadingFromShadingZoneGroupstoOtherZones(); |
| 420 | } | ||
| 421 | |||
| 422 | 273 | bool ShadowCalculation::setShadingCalculationMethod(const std::string& shadingCalculationMethod) { | |
| 423 |
1/1✓ Branch 3 taken 273 times.
|
273 | return getImpl<detail::ShadowCalculation_Impl>()->setShadingCalculationMethod(shadingCalculationMethod); |
| 424 | } | ||
| 425 | |||
| 426 | 9 | bool ShadowCalculation::setShadingCalculationUpdateFrequencyMethod(const std::string& shadingCalculationUpdateFrequencyMethod) { | |
| 427 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::ShadowCalculation_Impl>()->setShadingCalculationUpdateFrequencyMethod(shadingCalculationUpdateFrequencyMethod); |
| 428 | } | ||
| 429 | |||
| 430 | 2 | void ShadowCalculation::resetShadingCalculationUpdateFrequencyMethod() { | |
| 431 |
1/1✓ Branch 3 taken 2 times.
|
2 | getImpl<detail::ShadowCalculation_Impl>()->resetShadingCalculationUpdateFrequencyMethod(); |
| 432 | 2 | } | |
| 433 | |||
| 434 | 272 | bool ShadowCalculation::setShadingCalculationUpdateFrequency(int shadingCalculationUpdateFrequency) { | |
| 435 |
1/1✓ Branch 3 taken 272 times.
|
272 | return getImpl<detail::ShadowCalculation_Impl>()->setShadingCalculationUpdateFrequency(shadingCalculationUpdateFrequency); |
| 436 | } | ||
| 437 | |||
| 438 | 1 | void ShadowCalculation::resetShadingCalculationUpdateFrequency() { | |
| 439 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ShadowCalculation_Impl>()->resetShadingCalculationUpdateFrequency(); |
| 440 | 1 | } | |
| 441 | |||
| 442 | 271 | bool ShadowCalculation::setMaximumFiguresInShadowOverlapCalculations(int maximumFiguresInShadowOverlapCalculations) { | |
| 443 |
1/1✓ Branch 3 taken 271 times.
|
271 | return getImpl<detail::ShadowCalculation_Impl>()->setMaximumFiguresInShadowOverlapCalculations(maximumFiguresInShadowOverlapCalculations); |
| 444 | } | ||
| 445 | |||
| 446 | 1 | void ShadowCalculation::resetMaximumFiguresInShadowOverlapCalculations() { | |
| 447 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ShadowCalculation_Impl>()->resetMaximumFiguresInShadowOverlapCalculations(); |
| 448 | 1 | } | |
| 449 | |||
| 450 | 5 | bool ShadowCalculation::setPolygonClippingAlgorithm(const std::string& polygonClippingAlgorithm) { | |
| 451 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ShadowCalculation_Impl>()->setPolygonClippingAlgorithm(polygonClippingAlgorithm); |
| 452 | } | ||
| 453 | |||
| 454 | 1 | void ShadowCalculation::resetPolygonClippingAlgorithm() { | |
| 455 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ShadowCalculation_Impl>()->resetPolygonClippingAlgorithm(); |
| 456 | 1 | } | |
| 457 | |||
| 458 | 268 | bool ShadowCalculation::setPixelCountingResolution(int pixelCountingResolution) { | |
| 459 |
1/1✓ Branch 3 taken 268 times.
|
268 | return getImpl<detail::ShadowCalculation_Impl>()->setPixelCountingResolution(pixelCountingResolution); |
| 460 | } | ||
| 461 | |||
| 462 | 5 | bool ShadowCalculation::setSkyDiffuseModelingAlgorithm(const std::string& skyDiffuseModelingAlgorithm) { | |
| 463 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ShadowCalculation_Impl>()->setSkyDiffuseModelingAlgorithm(skyDiffuseModelingAlgorithm); |
| 464 | } | ||
| 465 | |||
| 466 | 1 | void ShadowCalculation::resetSkyDiffuseModelingAlgorithm() { | |
| 467 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ShadowCalculation_Impl>()->resetSkyDiffuseModelingAlgorithm(); |
| 468 | 1 | } | |
| 469 | |||
| 470 | 274 | bool ShadowCalculation::setOutputExternalShadingCalculationResults(bool outputExternalShadingCalculationResults) { | |
| 471 |
1/1✓ Branch 3 taken 274 times.
|
274 | return getImpl<detail::ShadowCalculation_Impl>()->setOutputExternalShadingCalculationResults(outputExternalShadingCalculationResults); |
| 472 | } | ||
| 473 | |||
| 474 | 274 | bool ShadowCalculation::setDisableSelfShadingWithinShadingZoneGroups(bool disableSelfShadingWithinShadingZoneGroups) { | |
| 475 |
1/1✓ Branch 3 taken 274 times.
|
274 | return getImpl<detail::ShadowCalculation_Impl>()->setDisableSelfShadingWithinShadingZoneGroups(disableSelfShadingWithinShadingZoneGroups); |
| 476 | } | ||
| 477 | |||
| 478 | 274 | bool ShadowCalculation::setDisableSelfShadingFromShadingZoneGroupstoOtherZones(bool disableSelfShadingFromShadingZoneGroupstoOtherZones) { | |
| 479 |
1/1✓ Branch 3 taken 274 times.
|
548 | return getImpl<detail::ShadowCalculation_Impl>()->setDisableSelfShadingFromShadingZoneGroupstoOtherZones( |
| 480 | 548 | disableSelfShadingFromShadingZoneGroupstoOtherZones); | |
| 481 | } | ||
| 482 | |||
| 483 | 64 | unsigned int ShadowCalculation::numberofShadingZoneGroups() const { | |
| 484 |
1/1✓ Branch 3 taken 64 times.
|
64 | return getImpl<detail::ShadowCalculation_Impl>()->numberofShadingZoneGroups(); |
| 485 | } | ||
| 486 | |||
| 487 | 12 | std::vector<ThermalZone> ShadowCalculation::getShadingZoneGroup(unsigned groupIndex) const { | |
| 488 |
1/1✓ Branch 3 taken 12 times.
|
12 | return getImpl<detail::ShadowCalculation_Impl>()->getShadingZoneGroup(groupIndex); |
| 489 | } | ||
| 490 | |||
| 491 | 9 | bool ShadowCalculation::addShadingZoneGroup(const std::vector<ThermalZone>& thermalZones) { | |
| 492 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::ShadowCalculation_Impl>()->addShadingZoneGroup(thermalZones); |
| 493 | } | ||
| 494 | 2 | bool ShadowCalculation::removeShadingZoneGroup(unsigned groupIndex) { | |
| 495 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::ShadowCalculation_Impl>()->removeShadingZoneGroup(groupIndex); |
| 496 | } | ||
| 497 | 1 | void ShadowCalculation::removeAllShadingZoneGroups() { | |
| 498 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ShadowCalculation_Impl>()->removeAllShadingZoneGroups(); |
| 499 | 1 | } | |
| 500 | |||
| 501 | } // namespace model | ||
| 502 | } // namespace openstudio | ||
| 503 |