src/model/DefaultConstructionSet.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 "DefaultConstructionSet.hpp" | ||
| 7 | #include "DefaultConstructionSet_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Model.hpp" | ||
| 10 | #include "Model_Impl.hpp" | ||
| 11 | #include "PlanarSurface.hpp" | ||
| 12 | #include "PlanarSurface_Impl.hpp" | ||
| 13 | #include "ConstructionBase.hpp" | ||
| 14 | #include "ConstructionBase_Impl.hpp" | ||
| 15 | #include "DefaultSubSurfaceConstructions.hpp" | ||
| 16 | #include "DefaultSubSurfaceConstructions_Impl.hpp" | ||
| 17 | #include "DefaultSurfaceConstructions.hpp" | ||
| 18 | #include "DefaultSurfaceConstructions_Impl.hpp" | ||
| 19 | #include "Surface.hpp" | ||
| 20 | #include "Surface_Impl.hpp" | ||
| 21 | #include "SubSurface.hpp" | ||
| 22 | #include "SubSurface_Impl.hpp" | ||
| 23 | #include "InteriorPartitionSurface.hpp" | ||
| 24 | #include "InteriorPartitionSurface_Impl.hpp" | ||
| 25 | #include "InteriorPartitionSurfaceGroup.hpp" | ||
| 26 | #include "InteriorPartitionSurfaceGroup_Impl.hpp" | ||
| 27 | #include "ShadingSurface.hpp" | ||
| 28 | #include "ShadingSurface_Impl.hpp" | ||
| 29 | #include "ShadingSurfaceGroup.hpp" | ||
| 30 | #include "ShadingSurfaceGroup_Impl.hpp" | ||
| 31 | #include "Building.hpp" | ||
| 32 | #include "Building_Impl.hpp" | ||
| 33 | #include "BuildingStory.hpp" | ||
| 34 | #include "BuildingStory_Impl.hpp" | ||
| 35 | #include "Space.hpp" | ||
| 36 | #include "Space_Impl.hpp" | ||
| 37 | #include "SpaceType.hpp" | ||
| 38 | #include "SpaceType_Impl.hpp" | ||
| 39 | |||
| 40 | #include <utilities/idd/OS_DefaultConstructionSet_FieldEnums.hxx> | ||
| 41 | #include <utilities/idd/IddEnums.hxx> | ||
| 42 | |||
| 43 | #include "../utilities/core/Assert.hpp" | ||
| 44 | #include "../utilities/core/Logger.hpp" | ||
| 45 | |||
| 46 | #include <bitset> | ||
| 47 | #include <iterator> | ||
| 48 | #include <map> | ||
| 49 | #include <set> | ||
| 50 | #include <string> | ||
| 51 | #include <string_view> | ||
| 52 | #include <type_traits> | ||
| 53 | #include <utility> | ||
| 54 | #include <vector> | ||
| 55 | |||
| 56 | using openstudio::istringEqual; | ||
| 57 | |||
| 58 | namespace openstudio { | ||
| 59 | namespace model { | ||
| 60 | |||
| 61 | namespace detail { | ||
| 62 | |||
| 63 | 417 | DefaultConstructionSet_Impl::DefaultConstructionSet_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 64 | 417 | : ResourceObject_Impl(idfObject, model, keepHandle) { | |
| 65 |
4/6✓ Branch 1 taken 417 times.
✓ Branch 4 taken 417 times.
✓ Branch 7 taken 417 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 417 times.
✗ Branch 13 not taken.
|
417 | OS_ASSERT(idfObject.iddObject().type() == DefaultConstructionSet::iddObjectType()); |
| 66 | 417 | } | |
| 67 | |||
| 68 | 78 | DefaultConstructionSet_Impl::DefaultConstructionSet_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 69 | 78 | bool keepHandle) | |
| 70 | 78 | : ResourceObject_Impl(other, model, keepHandle) { | |
| 71 |
4/6✓ Branch 1 taken 78 times.
✓ Branch 4 taken 78 times.
✓ Branch 7 taken 78 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 78 times.
✗ Branch 13 not taken.
|
78 | OS_ASSERT(other.iddObject().type() == DefaultConstructionSet::iddObjectType()); |
| 72 | 78 | } | |
| 73 | |||
| 74 | 275 | DefaultConstructionSet_Impl::DefaultConstructionSet_Impl(const DefaultConstructionSet_Impl& other, Model_Impl* model, bool keepHandle) | |
| 75 | 275 | : ResourceObject_Impl(other, model, keepHandle) {} | |
| 76 | |||
| 77 | 1 | const std::vector<std::string>& DefaultConstructionSet_Impl::outputVariableNames() const { | |
| 78 |
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; |
| 79 | 1 | return result; | |
| 80 | } | ||
| 81 | |||
| 82 | 1 | IddObjectType DefaultConstructionSet_Impl::iddObjectType() const { | |
| 83 | 1 | return DefaultConstructionSet::iddObjectType(); | |
| 84 | } | ||
| 85 | |||
| 86 | 9499 | boost::optional<DefaultSurfaceConstructions> DefaultConstructionSet_Impl::defaultExteriorSurfaceConstructions() const { | |
| 87 |
1/1✓ Branch 1 taken 9499 times.
|
18998 | return getObject<ModelObject>().getModelObjectTarget<DefaultSurfaceConstructions>( |
| 88 |
1/1✓ Branch 1 taken 9499 times.
|
18998 | OS_DefaultConstructionSetFields::DefaultExteriorSurfaceConstructionsName); |
| 89 | } | ||
| 90 | |||
| 91 | 9530 | boost::optional<DefaultSurfaceConstructions> DefaultConstructionSet_Impl::defaultInteriorSurfaceConstructions() const { | |
| 92 |
1/1✓ Branch 1 taken 9530 times.
|
19060 | return getObject<ModelObject>().getModelObjectTarget<DefaultSurfaceConstructions>( |
| 93 |
1/1✓ Branch 1 taken 9530 times.
|
19060 | OS_DefaultConstructionSetFields::DefaultInteriorSurfaceConstructionsName); |
| 94 | } | ||
| 95 | |||
| 96 | 3182 | boost::optional<DefaultSurfaceConstructions> DefaultConstructionSet_Impl::defaultGroundContactSurfaceConstructions() const { | |
| 97 |
1/1✓ Branch 1 taken 3182 times.
|
6364 | return getObject<ModelObject>().getModelObjectTarget<DefaultSurfaceConstructions>( |
| 98 |
1/1✓ Branch 1 taken 3182 times.
|
6364 | OS_DefaultConstructionSetFields::DefaultGroundContactSurfaceConstructionsName); |
| 99 | } | ||
| 100 | |||
| 101 | 1845 | boost::optional<DefaultSubSurfaceConstructions> DefaultConstructionSet_Impl::defaultExteriorSubSurfaceConstructions() const { | |
| 102 |
1/1✓ Branch 1 taken 1845 times.
|
3690 | return getObject<ModelObject>().getModelObjectTarget<DefaultSubSurfaceConstructions>( |
| 103 |
1/1✓ Branch 1 taken 1845 times.
|
3690 | OS_DefaultConstructionSetFields::DefaultExteriorSubSurfaceConstructionsName); |
| 104 | } | ||
| 105 | |||
| 106 | 539 | boost::optional<DefaultSubSurfaceConstructions> DefaultConstructionSet_Impl::defaultInteriorSubSurfaceConstructions() const { | |
| 107 |
1/1✓ Branch 1 taken 539 times.
|
1078 | return getObject<ModelObject>().getModelObjectTarget<DefaultSubSurfaceConstructions>( |
| 108 |
1/1✓ Branch 1 taken 539 times.
|
1078 | OS_DefaultConstructionSetFields::DefaultInteriorSubSurfaceConstructionsName); |
| 109 | } | ||
| 110 | |||
| 111 | 580 | boost::optional<ConstructionBase> DefaultConstructionSet_Impl::interiorPartitionConstruction() const { | |
| 112 |
2/2✓ Branch 1 taken 580 times.
✓ Branch 4 taken 580 times.
|
580 | return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultConstructionSetFields::InteriorPartitionConstructionName); |
| 113 | } | ||
| 114 | |||
| 115 | 1125 | boost::optional<ConstructionBase> DefaultConstructionSet_Impl::spaceShadingConstruction() const { | |
| 116 |
2/2✓ Branch 1 taken 1125 times.
✓ Branch 4 taken 1125 times.
|
1125 | return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultConstructionSetFields::SpaceShadingConstructionName); |
| 117 | } | ||
| 118 | |||
| 119 | 436 | boost::optional<ConstructionBase> DefaultConstructionSet_Impl::buildingShadingConstruction() const { | |
| 120 |
2/2✓ Branch 1 taken 436 times.
✓ Branch 4 taken 436 times.
|
436 | return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultConstructionSetFields::BuildingShadingConstructionName); |
| 121 | } | ||
| 122 | |||
| 123 | 436 | boost::optional<ConstructionBase> DefaultConstructionSet_Impl::siteShadingConstruction() const { | |
| 124 |
2/2✓ Branch 1 taken 436 times.
✓ Branch 4 taken 436 times.
|
436 | return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultConstructionSetFields::SiteShadingConstructionName); |
| 125 | } | ||
| 126 | |||
| 127 | 311 | bool DefaultConstructionSet_Impl::setDefaultExteriorSurfaceConstructions(const DefaultSurfaceConstructions& defaultSurfaceConstructions) { | |
| 128 |
2/2✓ Branch 1 taken 311 times.
✓ Branch 4 taken 311 times.
|
311 | return setPointer(OS_DefaultConstructionSetFields::DefaultExteriorSurfaceConstructionsName, defaultSurfaceConstructions.handle()); |
| 129 | } | ||
| 130 | |||
| 131 | 1 | void DefaultConstructionSet_Impl::resetDefaultExteriorSurfaceConstructions() { | |
| 132 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | setString(OS_DefaultConstructionSetFields::DefaultExteriorSurfaceConstructionsName, ""); |
| 133 | 1 | } | |
| 134 | |||
| 135 | 196 | bool DefaultConstructionSet_Impl::setDefaultInteriorSurfaceConstructions(const DefaultSurfaceConstructions& defaultSurfaceConstructions) { | |
| 136 |
2/2✓ Branch 1 taken 196 times.
✓ Branch 4 taken 196 times.
|
196 | return setPointer(OS_DefaultConstructionSetFields::DefaultInteriorSurfaceConstructionsName, defaultSurfaceConstructions.handle()); |
| 137 | } | ||
| 138 | |||
| 139 | 1 | void DefaultConstructionSet_Impl::resetDefaultInteriorSurfaceConstructions() { | |
| 140 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | setString(OS_DefaultConstructionSetFields::DefaultInteriorSurfaceConstructionsName, ""); |
| 141 | 1 | } | |
| 142 | |||
| 143 | 180 | bool DefaultConstructionSet_Impl::setDefaultGroundContactSurfaceConstructions(const DefaultSurfaceConstructions& defaultSurfaceConstructions) { | |
| 144 |
2/2✓ Branch 1 taken 180 times.
✓ Branch 4 taken 180 times.
|
180 | return setPointer(OS_DefaultConstructionSetFields::DefaultGroundContactSurfaceConstructionsName, defaultSurfaceConstructions.handle()); |
| 145 | } | ||
| 146 | |||
| 147 | 1 | void DefaultConstructionSet_Impl::resetDefaultGroundContactSurfaceConstructions() { | |
| 148 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | setString(OS_DefaultConstructionSetFields::DefaultGroundContactSurfaceConstructionsName, ""); |
| 149 | 1 | } | |
| 150 | |||
| 151 | bool | ||
| 152 | 190 | DefaultConstructionSet_Impl::setDefaultExteriorSubSurfaceConstructions(const DefaultSubSurfaceConstructions& defaultSubSurfaceConstructions) { | |
| 153 |
2/2✓ Branch 1 taken 190 times.
✓ Branch 4 taken 190 times.
|
190 | return setPointer(OS_DefaultConstructionSetFields::DefaultExteriorSubSurfaceConstructionsName, defaultSubSurfaceConstructions.handle()); |
| 154 | } | ||
| 155 | |||
| 156 | 1 | void DefaultConstructionSet_Impl::resetDefaultExteriorSubSurfaceConstructions() { | |
| 157 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | setString(OS_DefaultConstructionSetFields::DefaultExteriorSubSurfaceConstructionsName, ""); |
| 158 | 1 | } | |
| 159 | |||
| 160 | bool | ||
| 161 | 173 | DefaultConstructionSet_Impl::setDefaultInteriorSubSurfaceConstructions(const DefaultSubSurfaceConstructions& defaultSubSurfaceConstructions) { | |
| 162 |
2/2✓ Branch 1 taken 173 times.
✓ Branch 4 taken 173 times.
|
173 | return setPointer(OS_DefaultConstructionSetFields::DefaultInteriorSubSurfaceConstructionsName, defaultSubSurfaceConstructions.handle()); |
| 163 | } | ||
| 164 | |||
| 165 | 1 | void DefaultConstructionSet_Impl::resetDefaultInteriorSubSurfaceConstructions() { | |
| 166 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | setString(OS_DefaultConstructionSetFields::DefaultInteriorSubSurfaceConstructionsName, ""); |
| 167 | 1 | } | |
| 168 | |||
| 169 | 181 | bool DefaultConstructionSet_Impl::setInteriorPartitionConstruction(const ConstructionBase& construction) { | |
| 170 |
2/2✓ Branch 1 taken 181 times.
✓ Branch 4 taken 181 times.
|
181 | return setPointer(OS_DefaultConstructionSetFields::InteriorPartitionConstructionName, construction.handle()); |
| 171 | } | ||
| 172 | |||
| 173 | 2 | void DefaultConstructionSet_Impl::resetInteriorPartitionConstruction() { | |
| 174 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | setString(OS_DefaultConstructionSetFields::InteriorPartitionConstructionName, ""); |
| 175 | 2 | } | |
| 176 | |||
| 177 | 13 | bool DefaultConstructionSet_Impl::setSpaceShadingConstruction(const ConstructionBase& construction) { | |
| 178 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | return setPointer(OS_DefaultConstructionSetFields::SpaceShadingConstructionName, construction.handle()); |
| 179 | } | ||
| 180 | |||
| 181 | 2 | void DefaultConstructionSet_Impl::resetSpaceShadingConstruction() { | |
| 182 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | setString(OS_DefaultConstructionSetFields::SpaceShadingConstructionName, ""); |
| 183 | 2 | } | |
| 184 | |||
| 185 | 5 | bool DefaultConstructionSet_Impl::setBuildingShadingConstruction(const ConstructionBase& construction) { | |
| 186 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | return setPointer(OS_DefaultConstructionSetFields::BuildingShadingConstructionName, construction.handle()); |
| 187 | } | ||
| 188 | |||
| 189 | 2 | void DefaultConstructionSet_Impl::resetBuildingShadingConstruction() { | |
| 190 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | setString(OS_DefaultConstructionSetFields::BuildingShadingConstructionName, ""); |
| 191 | 2 | } | |
| 192 | |||
| 193 | 5 | bool DefaultConstructionSet_Impl::setSiteShadingConstruction(const ConstructionBase& construction) { | |
| 194 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | return setPointer(OS_DefaultConstructionSetFields::SiteShadingConstructionName, construction.handle()); |
| 195 | } | ||
| 196 | |||
| 197 | 2 | void DefaultConstructionSet_Impl::resetSiteShadingConstruction() { | |
| 198 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | setString(OS_DefaultConstructionSetFields::SiteShadingConstructionName, ""); |
| 199 | 2 | } | |
| 200 | |||
| 201 | 23301 | boost::optional<ConstructionBase> DefaultConstructionSet_Impl::getDefaultConstruction(const PlanarSurface& planarSurface) const { | |
| 202 | 23301 | boost::optional<ConstructionBase> result; | |
| 203 |
3/3✓ Branch 1 taken 23301 times.
✓ Branch 4 taken 20770 times.
✓ Branch 5 taken 2531 times.
|
46602 | if (planarSurface.optionalCast<Surface>()) { |
| 204 | |||
| 205 | 20770 | boost::optional<DefaultSurfaceConstructions> defaultSurfaceConstructions; | |
| 206 |
2/2✓ Branch 1 taken 20770 times.
✓ Branch 4 taken 20770 times.
|
20770 | std::string outsideBoundaryCondition = planarSurface.cast<Surface>().outsideBoundaryCondition(); |
| 207 |
4/4✓ Branch 1 taken 20770 times.
✓ Branch 4 taken 20770 times.
✓ Branch 7 taken 8899 times.
✓ Branch 8 taken 11871 times.
|
41540 | if (istringEqual("Outdoors", outsideBoundaryCondition)) { |
| 208 |
1/1✓ Branch 1 taken 8899 times.
|
8899 | defaultSurfaceConstructions = this->defaultExteriorSurfaceConstructions(); |
| 209 |
10/21✓ Branch 1 taken 11871 times.
✓ Branch 4 taken 9117 times.
✓ Branch 7 taken 9117 times.
✓ Branch 9 taken 9117 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 9117 times.
✓ Branch 13 taken 2754 times.
✓ Branch 14 taken 11871 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 11871 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 2754 times.
✓ Branch 20 taken 9117 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
|
53847 | } else if (istringEqual("Ground", outsideBoundaryCondition) || istringEqual("GroundSlabPreprocessorAverage", outsideBoundaryCondition) |
| 210 |
7/12✓ Branch 1 taken 9117 times.
✓ Branch 4 taken 9117 times.
✓ Branch 6 taken 9117 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 9117 times.
✓ Branch 10 taken 2754 times.
✓ Branch 11 taken 9117 times.
✓ Branch 12 taken 2754 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
30105 | || istringEqual("GroundSlabPreprocessorCore", outsideBoundaryCondition) |
| 211 |
7/12✓ Branch 1 taken 9117 times.
✓ Branch 4 taken 9117 times.
✓ Branch 6 taken 9117 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 9117 times.
✓ Branch 10 taken 2754 times.
✓ Branch 11 taken 9117 times.
✓ Branch 12 taken 2754 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
30105 | || istringEqual("GroundSlabPreprocessorPerimeter", outsideBoundaryCondition) |
| 212 |
7/12✓ Branch 1 taken 9117 times.
✓ Branch 4 taken 9117 times.
✓ Branch 6 taken 9117 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 9117 times.
✓ Branch 10 taken 2754 times.
✓ Branch 11 taken 9117 times.
✓ Branch 12 taken 2754 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
30105 | || istringEqual("GroundBasementPreprocessorAverageWall", outsideBoundaryCondition) |
| 213 |
7/12✓ Branch 1 taken 9117 times.
✓ Branch 4 taken 9117 times.
✓ Branch 6 taken 9117 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 9117 times.
✓ Branch 10 taken 2754 times.
✓ Branch 11 taken 9117 times.
✓ Branch 12 taken 2754 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
30105 | || istringEqual("GroundBasementPreprocessorAverageFloor", outsideBoundaryCondition) |
| 214 |
7/12✓ Branch 1 taken 9117 times.
✓ Branch 4 taken 9117 times.
✓ Branch 6 taken 9117 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 9117 times.
✓ Branch 10 taken 2754 times.
✓ Branch 11 taken 9117 times.
✓ Branch 12 taken 2754 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
30105 | || istringEqual("GroundBasementPreprocessorUpperWall", outsideBoundaryCondition) |
| 215 |
12/17✓ Branch 1 taken 11871 times.
✓ Branch 3 taken 9117 times.
✓ Branch 4 taken 2754 times.
✓ Branch 6 taken 9117 times.
✓ Branch 9 taken 9117 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 9117 times.
✓ Branch 13 taken 9117 times.
✓ Branch 14 taken 2754 times.
✓ Branch 16 taken 9117 times.
✓ Branch 17 taken 2754 times.
✓ Branch 18 taken 9117 times.
✓ Branch 19 taken 2754 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
41976 | || istringEqual("GroundBasementPreprocessorLowerWall", outsideBoundaryCondition)) { |
| 216 |
1/1✓ Branch 1 taken 2754 times.
|
2754 | defaultSurfaceConstructions = this->defaultGroundContactSurfaceConstructions(); |
| 217 |
4/4✓ Branch 1 taken 9117 times.
✓ Branch 4 taken 9117 times.
✓ Branch 7 taken 9087 times.
✓ Branch 8 taken 30 times.
|
18234 | } else if (istringEqual("Surface", outsideBoundaryCondition)) { |
| 218 |
1/1✓ Branch 1 taken 9087 times.
|
9087 | defaultSurfaceConstructions = this->defaultInteriorSurfaceConstructions(); |
| 219 |
4/4✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 18 times.
✓ Branch 8 taken 12 times.
|
60 | } else if (istringEqual("Adiabatic", outsideBoundaryCondition)) { |
| 220 | // Adiabatic is special - doesn't has multiple choices by orientation - so return directly | ||
| 221 |
1/1✓ Branch 1 taken 18 times.
|
18 | result = this->adiabaticSurfaceConstruction(); |
| 222 | 18 | return result; | |
| 223 | } else { | ||
| 224 | //GroundFCfactorMethod | ||
| 225 | //OtherSideCoefficients | ||
| 226 | //OtherSideConditionsModel | ||
| 227 | } | ||
| 228 | |||
| 229 |
2/2✓ Branch 0 taken 20319 times.
✓ Branch 1 taken 433 times.
|
20752 | if (defaultSurfaceConstructions) { |
| 230 |
2/2✓ Branch 1 taken 20319 times.
✓ Branch 4 taken 20319 times.
|
20319 | std::string surfaceType = planarSurface.cast<Surface>().surfaceType(); |
| 231 |
4/4✓ Branch 1 taken 20319 times.
✓ Branch 4 taken 20319 times.
✓ Branch 7 taken 3404 times.
✓ Branch 8 taken 16915 times.
|
40638 | if (istringEqual("Floor", surfaceType)) { |
| 232 |
2/2✓ Branch 1 taken 3404 times.
✓ Branch 4 taken 3404 times.
|
3404 | result = defaultSurfaceConstructions->floorConstruction(); |
| 233 |
4/4✓ Branch 1 taken 16915 times.
✓ Branch 4 taken 16915 times.
✓ Branch 7 taken 14097 times.
✓ Branch 8 taken 2818 times.
|
33830 | } else if (istringEqual("Wall", surfaceType)) { |
| 234 |
2/2✓ Branch 1 taken 14097 times.
✓ Branch 4 taken 14097 times.
|
14097 | result = defaultSurfaceConstructions->wallConstruction(); |
| 235 |
3/4✓ Branch 1 taken 2818 times.
✓ Branch 4 taken 2818 times.
✓ Branch 7 taken 2818 times.
✗ Branch 8 not taken.
|
5636 | } else if (istringEqual("RoofCeiling", surfaceType)) { |
| 236 |
2/2✓ Branch 1 taken 2818 times.
✓ Branch 4 taken 2818 times.
|
2818 | result = defaultSurfaceConstructions->roofCeilingConstruction(); |
| 237 | } | ||
| 238 | 20319 | } | |
| 239 | |||
| 240 |
7/7✓ Branch 1 taken 20752 times.
✓ Branch 2 taken 18 times.
✓ Branch 4 taken 20752 times.
✓ Branch 5 taken 18 times.
✓ Branch 7 taken 2531 times.
✓ Branch 10 taken 1528 times.
✓ Branch 11 taken 1003 times.
|
25850 | } else if (planarSurface.optionalCast<SubSurface>()) { |
| 241 | |||
| 242 | 1528 | boost::optional<DefaultSubSurfaceConstructions> defaultSubSurfaceConstructions; | |
| 243 |
2/2✓ Branch 1 taken 1528 times.
✓ Branch 4 taken 1528 times.
|
1528 | boost::optional<Surface> surface = planarSurface.cast<SubSurface>().surface(); |
| 244 |
1/2✓ Branch 0 taken 1528 times.
✗ Branch 1 not taken.
|
1528 | if (surface) { |
| 245 |
2/2✓ Branch 1 taken 1528 times.
✓ Branch 4 taken 1528 times.
|
1528 | std::string outsideBoundaryCondition = surface->outsideBoundaryCondition(); |
| 246 |
4/4✓ Branch 1 taken 1528 times.
✓ Branch 4 taken 1528 times.
✓ Branch 7 taken 1412 times.
✓ Branch 8 taken 116 times.
|
3056 | if (istringEqual("Outdoors", outsideBoundaryCondition)) { |
| 247 |
1/1✓ Branch 1 taken 1412 times.
|
1412 | defaultSubSurfaceConstructions = this->defaultExteriorSubSurfaceConstructions(); |
| 248 |
3/4✓ Branch 1 taken 116 times.
✓ Branch 4 taken 116 times.
✓ Branch 7 taken 116 times.
✗ Branch 8 not taken.
|
232 | } else if (istringEqual("Surface", outsideBoundaryCondition)) { |
| 249 |
1/1✓ Branch 1 taken 116 times.
|
116 | defaultSubSurfaceConstructions = this->defaultInteriorSubSurfaceConstructions(); |
| 250 | } else { | ||
| 251 | //Adiabatic | ||
| 252 | //Ground | ||
| 253 | //GroundFCfactorMethod | ||
| 254 | //OtherSideCoefficients | ||
| 255 | //OtherSideConditionsModel | ||
| 256 | //GroundSlabPreprocessorAverage | ||
| 257 | //GroundSlabPreprocessorCore | ||
| 258 | //GroundSlabPreprocessorPerimeter | ||
| 259 | //GroundBasementPreprocessorAverageWall | ||
| 260 | //GroundBasementPreprocessorAverageFloor | ||
| 261 | //GroundBasementPreprocessorUpperWall | ||
| 262 | //GroundBasementPreprocessorLowerWall | ||
| 263 | } | ||
| 264 | 1528 | } | |
| 265 | |||
| 266 |
2/2✓ Branch 0 taken 1518 times.
✓ Branch 1 taken 10 times.
|
1528 | if (defaultSubSurfaceConstructions) { |
| 267 | |||
| 268 |
2/2✓ Branch 1 taken 1518 times.
✓ Branch 4 taken 1518 times.
|
1518 | std::string subSurfaceType = planarSurface.cast<SubSurface>().subSurfaceType(); |
| 269 |
4/4✓ Branch 1 taken 1518 times.
✓ Branch 4 taken 1518 times.
✓ Branch 7 taken 1327 times.
✓ Branch 8 taken 191 times.
|
3036 | if (istringEqual("FixedWindow", subSurfaceType)) { |
| 270 |
2/2✓ Branch 1 taken 1327 times.
✓ Branch 4 taken 1327 times.
|
1327 | result = defaultSubSurfaceConstructions->fixedWindowConstruction(); |
| 271 |
4/4✓ Branch 1 taken 191 times.
✓ Branch 4 taken 191 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 189 times.
|
382 | } else if (istringEqual("OperableWindow", subSurfaceType)) { |
| 272 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | result = defaultSubSurfaceConstructions->operableWindowConstruction(); |
| 273 |
4/4✓ Branch 1 taken 189 times.
✓ Branch 4 taken 189 times.
✓ Branch 7 taken 177 times.
✓ Branch 8 taken 12 times.
|
378 | } else if (istringEqual("Door", subSurfaceType)) { |
| 274 |
2/2✓ Branch 1 taken 177 times.
✓ Branch 4 taken 177 times.
|
177 | result = defaultSubSurfaceConstructions->doorConstruction(); |
| 275 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 10 times.
|
24 | } else if (istringEqual("GlassDoor", subSurfaceType)) { |
| 276 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | result = defaultSubSurfaceConstructions->glassDoorConstruction(); |
| 277 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 8 times.
|
20 | } else if (istringEqual("OverheadDoor", subSurfaceType)) { |
| 278 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | result = defaultSubSurfaceConstructions->overheadDoorConstruction(); |
| 279 |
3/4✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
|
16 | } else if (istringEqual("Skylight", subSurfaceType)) { |
| 280 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | result = defaultSubSurfaceConstructions->skylightConstruction(); |
| 281 | ✗ | } else if (istringEqual("TubularDaylightDome", subSurfaceType)) { | |
| 282 | ✗ | result = defaultSubSurfaceConstructions->tubularDaylightDomeConstruction(); | |
| 283 | ✗ | } else if (istringEqual("TubularDaylightDiffuser", subSurfaceType)) { | |
| 284 | ✗ | result = defaultSubSurfaceConstructions->tubularDaylightDiffuserConstruction(); | |
| 285 | } | ||
| 286 | 1518 | } | |
| 287 | |||
| 288 |
3/3✓ Branch 3 taken 1003 times.
✓ Branch 6 taken 122 times.
✓ Branch 7 taken 881 times.
|
3534 | } else if (planarSurface.optionalCast<InteriorPartitionSurface>()) { |
| 289 | |||
| 290 |
1/1✓ Branch 1 taken 122 times.
|
122 | result = this->interiorPartitionConstruction(); |
| 291 | |||
| 292 |
2/3✓ Branch 1 taken 881 times.
✓ Branch 4 taken 881 times.
✗ Branch 5 not taken.
|
1762 | } else if (planarSurface.optionalCast<ShadingSurface>()) { |
| 293 | |||
| 294 |
2/2✓ Branch 1 taken 881 times.
✓ Branch 4 taken 881 times.
|
881 | boost::optional<ShadingSurfaceGroup> shadingSurfaceGroup = planarSurface.cast<ShadingSurface>().shadingSurfaceGroup(); |
| 295 |
1/2✓ Branch 0 taken 881 times.
✗ Branch 1 not taken.
|
881 | if (shadingSurfaceGroup) { |
| 296 |
2/2✓ Branch 1 taken 881 times.
✓ Branch 4 taken 881 times.
|
881 | std::string shadingSurfaceType = shadingSurfaceGroup->shadingSurfaceType(); |
| 297 |
4/4✓ Branch 1 taken 881 times.
✓ Branch 4 taken 881 times.
✓ Branch 7 taken 753 times.
✓ Branch 8 taken 128 times.
|
1762 | if (istringEqual("Space", shadingSurfaceType)) { |
| 298 |
1/1✓ Branch 1 taken 753 times.
|
753 | result = this->spaceShadingConstruction(); |
| 299 |
4/4✓ Branch 1 taken 128 times.
✓ Branch 4 taken 128 times.
✓ Branch 7 taken 64 times.
✓ Branch 8 taken 64 times.
|
256 | } else if (istringEqual("Building", shadingSurfaceType)) { |
| 300 |
1/1✓ Branch 1 taken 64 times.
|
64 | result = this->buildingShadingConstruction(); |
| 301 |
3/4✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
✗ Branch 8 not taken.
|
128 | } else if (istringEqual("Site", shadingSurfaceType)) { |
| 302 |
1/1✓ Branch 1 taken 64 times.
|
64 | result = this->siteShadingConstruction(); |
| 303 | } | ||
| 304 | 881 | } | |
| 305 | |||
| 306 | 881 | } else { | |
| 307 | ✗ | LOG_AND_THROW("Unknown planar surface: " << planarSurface.briefDescription()); | |
| 308 | } | ||
| 309 | |||
| 310 | 23283 | return result; | |
| 311 | ✗ | } | |
| 312 | |||
| 313 | 48 | void DefaultConstructionSet_Impl::merge(const DefaultConstructionSet& other) { | |
| 314 | 48 | boost::optional<DefaultSurfaceConstructions> thisSurfaceConstructions; | |
| 315 | 48 | boost::optional<DefaultSurfaceConstructions> otherSurfaceConstructions; | |
| 316 | 48 | boost::optional<DefaultSubSurfaceConstructions> thisSubSurfaceConstructions; | |
| 317 | 48 | boost::optional<DefaultSubSurfaceConstructions> otherSubSurfaceConstructions; | |
| 318 | |||
| 319 |
1/1✓ Branch 1 taken 48 times.
|
48 | otherSurfaceConstructions = other.defaultExteriorSurfaceConstructions(); |
| 320 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 4 times.
|
48 | if (otherSurfaceConstructions) { |
| 321 |
1/1✓ Branch 1 taken 44 times.
|
44 | thisSurfaceConstructions = this->defaultExteriorSurfaceConstructions(); |
| 322 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 2 taken 36 times.
|
44 | if (!thisSurfaceConstructions) { |
| 323 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | this->setDefaultExteriorSurfaceConstructions(*otherSurfaceConstructions); |
| 324 | } else { | ||
| 325 |
6/7✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
✓ Branch 7 taken 36 times.
✓ Branch 10 taken 36 times.
✓ Branch 13 taken 36 times.
✓ Branch 15 taken 36 times.
✗ Branch 16 not taken.
|
36 | if (thisSurfaceConstructions->handle() == otherSurfaceConstructions->handle()) { |
| 326 | // no op | ||
| 327 | } else { | ||
| 328 |
4/4✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
✓ Branch 6 taken 23 times.
✓ Branch 7 taken 13 times.
|
36 | if (thisSurfaceConstructions->numSources() > 1) { |
| 329 |
5/5✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
✓ Branch 10 taken 23 times.
✓ Branch 13 taken 23 times.
|
23 | thisSurfaceConstructions = thisSurfaceConstructions->clone(this->model()).cast<DefaultSurfaceConstructions>(); |
| 330 |
2/2✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
|
23 | this->setDefaultExteriorSurfaceConstructions(*thisSurfaceConstructions); |
| 331 | } | ||
| 332 |
3/3✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
✓ Branch 7 taken 36 times.
|
36 | thisSurfaceConstructions->merge(*otherSurfaceConstructions); |
| 333 | } | ||
| 334 | } | ||
| 335 | } | ||
| 336 | |||
| 337 |
1/1✓ Branch 1 taken 48 times.
|
48 | otherSurfaceConstructions = other.defaultInteriorSurfaceConstructions(); |
| 338 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 36 times.
|
48 | if (otherSurfaceConstructions) { |
| 339 |
1/1✓ Branch 1 taken 12 times.
|
12 | thisSurfaceConstructions = this->defaultInteriorSurfaceConstructions(); |
| 340 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 2 taken 1 time.
|
12 | if (!thisSurfaceConstructions) { |
| 341 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | this->setDefaultInteriorSurfaceConstructions(*otherSurfaceConstructions); |
| 342 | } else { | ||
| 343 |
6/7✓ 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 15 taken 1 time.
✗ Branch 16 not taken.
|
1 | if (thisSurfaceConstructions->handle() == otherSurfaceConstructions->handle()) { |
| 344 | // no op | ||
| 345 | } else { | ||
| 346 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
|
1 | if (thisSurfaceConstructions->numSources() > 1) { |
| 347 | ✗ | thisSurfaceConstructions = thisSurfaceConstructions->clone(this->model()).cast<DefaultSurfaceConstructions>(); | |
| 348 | ✗ | this->setDefaultInteriorSurfaceConstructions(*thisSurfaceConstructions); | |
| 349 | } | ||
| 350 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | thisSurfaceConstructions->merge(*otherSurfaceConstructions); |
| 351 | } | ||
| 352 | } | ||
| 353 | } | ||
| 354 | |||
| 355 |
1/1✓ Branch 1 taken 48 times.
|
48 | otherSurfaceConstructions = other.defaultGroundContactSurfaceConstructions(); |
| 356 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 46 times.
|
48 | if (otherSurfaceConstructions) { |
| 357 |
1/1✓ Branch 1 taken 2 times.
|
2 | thisSurfaceConstructions = this->defaultGroundContactSurfaceConstructions(); |
| 358 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | if (!thisSurfaceConstructions) { |
| 359 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | this->setDefaultGroundContactSurfaceConstructions(*otherSurfaceConstructions); |
| 360 | } else { | ||
| 361 | ✗ | if (thisSurfaceConstructions->handle() == otherSurfaceConstructions->handle()) { | |
| 362 | // no op | ||
| 363 | } else { | ||
| 364 | ✗ | if (thisSurfaceConstructions->numSources() > 1) { | |
| 365 | ✗ | thisSurfaceConstructions = thisSurfaceConstructions->clone(this->model()).cast<DefaultSurfaceConstructions>(); | |
| 366 | ✗ | this->setDefaultGroundContactSurfaceConstructions(*thisSurfaceConstructions); | |
| 367 | } | ||
| 368 | ✗ | thisSurfaceConstructions->merge(*otherSurfaceConstructions); | |
| 369 | } | ||
| 370 | } | ||
| 371 | } | ||
| 372 | |||
| 373 |
1/1✓ Branch 1 taken 48 times.
|
48 | otherSubSurfaceConstructions = other.defaultExteriorSubSurfaceConstructions(); |
| 374 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 43 times.
|
48 | if (otherSubSurfaceConstructions) { |
| 375 |
1/1✓ Branch 1 taken 5 times.
|
5 | thisSubSurfaceConstructions = this->defaultExteriorSubSurfaceConstructions(); |
| 376 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!thisSubSurfaceConstructions) { |
| 377 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | this->setDefaultExteriorSubSurfaceConstructions(*otherSubSurfaceConstructions); |
| 378 | } else { | ||
| 379 | ✗ | if (thisSubSurfaceConstructions->handle() == otherSubSurfaceConstructions->handle()) { | |
| 380 | // no op | ||
| 381 | } else { | ||
| 382 | ✗ | if (thisSubSurfaceConstructions->numSources() > 1) { | |
| 383 | ✗ | thisSubSurfaceConstructions = thisSubSurfaceConstructions->clone(this->model()).cast<DefaultSubSurfaceConstructions>(); | |
| 384 | ✗ | this->setDefaultExteriorSubSurfaceConstructions(*thisSubSurfaceConstructions); | |
| 385 | } | ||
| 386 | ✗ | thisSubSurfaceConstructions->merge(*otherSubSurfaceConstructions); | |
| 387 | } | ||
| 388 | } | ||
| 389 | } | ||
| 390 | |||
| 391 |
1/1✓ Branch 1 taken 48 times.
|
48 | otherSubSurfaceConstructions = other.defaultInteriorSubSurfaceConstructions(); |
| 392 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if (otherSubSurfaceConstructions) { |
| 393 | ✗ | thisSubSurfaceConstructions = this->defaultInteriorSubSurfaceConstructions(); | |
| 394 | ✗ | if (!thisSubSurfaceConstructions) { | |
| 395 | ✗ | this->setDefaultInteriorSubSurfaceConstructions(*otherSubSurfaceConstructions); | |
| 396 | } else { | ||
| 397 | ✗ | if (thisSubSurfaceConstructions->handle() == otherSubSurfaceConstructions->handle()) { | |
| 398 | // no op | ||
| 399 | } else { | ||
| 400 | ✗ | if (thisSubSurfaceConstructions->numSources() > 1) { | |
| 401 | ✗ | thisSubSurfaceConstructions = thisSubSurfaceConstructions->clone(this->model()).cast<DefaultSubSurfaceConstructions>(); | |
| 402 | ✗ | this->setDefaultInteriorSubSurfaceConstructions(*thisSubSurfaceConstructions); | |
| 403 | } | ||
| 404 | ✗ | thisSubSurfaceConstructions->merge(*otherSubSurfaceConstructions); | |
| 405 | } | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 409 | 48 | boost::optional<ConstructionBase> construction; | |
| 410 | |||
| 411 |
3/3✓ Branch 1 taken 48 times.
✓ Branch 5 taken 43 times.
✓ Branch 6 taken 5 times.
|
48 | if (!(this->interiorPartitionConstruction())) { |
| 412 |
1/1✓ Branch 1 taken 43 times.
|
43 | construction = other.interiorPartitionConstruction(); |
| 413 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 41 times.
|
43 | if (construction) { |
| 414 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | this->setInteriorPartitionConstruction(*construction); |
| 415 | } | ||
| 416 | } | ||
| 417 | |||
| 418 |
2/3✓ Branch 1 taken 48 times.
✓ Branch 5 taken 48 times.
✗ Branch 6 not taken.
|
48 | if (!(this->spaceShadingConstruction())) { |
| 419 |
1/1✓ Branch 1 taken 48 times.
|
48 | construction = other.spaceShadingConstruction(); |
| 420 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 42 times.
|
48 | if (construction) { |
| 421 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | this->setSpaceShadingConstruction(*construction); |
| 422 | } | ||
| 423 | } | ||
| 424 | |||
| 425 |
2/3✓ Branch 1 taken 48 times.
✓ Branch 5 taken 48 times.
✗ Branch 6 not taken.
|
48 | if (!(this->buildingShadingConstruction())) { |
| 426 |
1/1✓ Branch 1 taken 48 times.
|
48 | construction = other.buildingShadingConstruction(); |
| 427 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 46 times.
|
48 | if (construction) { |
| 428 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | this->setBuildingShadingConstruction(*construction); |
| 429 | } | ||
| 430 | } | ||
| 431 | |||
| 432 |
2/3✓ Branch 1 taken 48 times.
✓ Branch 5 taken 48 times.
✗ Branch 6 not taken.
|
48 | if (!(this->siteShadingConstruction())) { |
| 433 |
1/1✓ Branch 1 taken 48 times.
|
48 | construction = other.siteShadingConstruction(); |
| 434 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 46 times.
|
48 | if (construction) { |
| 435 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | this->setSiteShadingConstruction(*construction); |
| 436 | } | ||
| 437 | } | ||
| 438 | |||
| 439 |
3/3✓ Branch 1 taken 48 times.
✓ Branch 5 taken 47 times.
✓ Branch 6 taken 1 time.
|
48 | if (!(this->adiabaticSurfaceConstruction())) { |
| 440 |
1/1✓ Branch 1 taken 47 times.
|
47 | construction = other.adiabaticSurfaceConstruction(); |
| 441 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 40 times.
|
47 | if (construction) { |
| 442 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | this->setAdiabaticSurfaceConstruction(*construction); |
| 443 | } | ||
| 444 | } | ||
| 445 | 48 | } | |
| 446 | |||
| 447 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::defaultExteriorSurfaceConstructionsAsModelObject() const { | |
| 448 | ✗ | OptionalModelObject result; | |
| 449 | ✗ | OptionalDefaultSurfaceConstructions intermediate = defaultExteriorSurfaceConstructions(); | |
| 450 | ✗ | if (intermediate) { | |
| 451 | ✗ | result = *intermediate; | |
| 452 | } | ||
| 453 | ✗ | return result; | |
| 454 | ✗ | } | |
| 455 | |||
| 456 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::defaultInteriorSurfaceConstructionsAsModelObject() const { | |
| 457 | ✗ | OptionalModelObject result; | |
| 458 | ✗ | OptionalDefaultSurfaceConstructions intermediate = defaultInteriorSurfaceConstructions(); | |
| 459 | ✗ | if (intermediate) { | |
| 460 | ✗ | result = *intermediate; | |
| 461 | } | ||
| 462 | ✗ | return result; | |
| 463 | ✗ | } | |
| 464 | |||
| 465 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::defaultGroundContactSurfaceConstructionsAsModelObject() const { | |
| 466 | ✗ | OptionalModelObject result; | |
| 467 | ✗ | OptionalDefaultSurfaceConstructions intermediate = defaultGroundContactSurfaceConstructions(); | |
| 468 | ✗ | if (intermediate) { | |
| 469 | ✗ | result = *intermediate; | |
| 470 | } | ||
| 471 | ✗ | return result; | |
| 472 | ✗ | } | |
| 473 | |||
| 474 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::defaultExteriorSubSurfaceConstructionsAsModelObject() const { | |
| 475 | ✗ | OptionalModelObject result; | |
| 476 | ✗ | OptionalDefaultSubSurfaceConstructions intermediate = defaultExteriorSubSurfaceConstructions(); | |
| 477 | ✗ | if (intermediate) { | |
| 478 | ✗ | result = *intermediate; | |
| 479 | } | ||
| 480 | ✗ | return result; | |
| 481 | ✗ | } | |
| 482 | |||
| 483 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::defaultInteriorSubSurfaceConstructionsAsModelObject() const { | |
| 484 | ✗ | OptionalModelObject result; | |
| 485 | ✗ | OptionalDefaultSubSurfaceConstructions intermediate = defaultInteriorSubSurfaceConstructions(); | |
| 486 | ✗ | if (intermediate) { | |
| 487 | ✗ | result = *intermediate; | |
| 488 | } | ||
| 489 | ✗ | return result; | |
| 490 | ✗ | } | |
| 491 | |||
| 492 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::interiorPartitionConstructionAsModelObject() const { | |
| 493 | ✗ | OptionalModelObject result; | |
| 494 | ✗ | OptionalConstructionBase intermediate = interiorPartitionConstruction(); | |
| 495 | ✗ | if (intermediate) { | |
| 496 | ✗ | result = *intermediate; | |
| 497 | } | ||
| 498 | ✗ | return result; | |
| 499 | ✗ | } | |
| 500 | |||
| 501 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::spaceShadingConstructionAsModelObject() const { | |
| 502 | ✗ | OptionalModelObject result; | |
| 503 | ✗ | OptionalConstructionBase intermediate = spaceShadingConstruction(); | |
| 504 | ✗ | if (intermediate) { | |
| 505 | ✗ | result = *intermediate; | |
| 506 | } | ||
| 507 | ✗ | return result; | |
| 508 | ✗ | } | |
| 509 | |||
| 510 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::buildingShadingConstructionAsModelObject() const { | |
| 511 | ✗ | OptionalModelObject result; | |
| 512 | ✗ | OptionalConstructionBase intermediate = buildingShadingConstruction(); | |
| 513 | ✗ | if (intermediate) { | |
| 514 | ✗ | result = *intermediate; | |
| 515 | } | ||
| 516 | ✗ | return result; | |
| 517 | ✗ | } | |
| 518 | |||
| 519 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::siteShadingConstructionAsModelObject() const { | |
| 520 | ✗ | OptionalModelObject result; | |
| 521 | ✗ | OptionalConstructionBase intermediate = siteShadingConstruction(); | |
| 522 | ✗ | if (intermediate) { | |
| 523 | ✗ | result = *intermediate; | |
| 524 | } | ||
| 525 | ✗ | return result; | |
| 526 | ✗ | } | |
| 527 | |||
| 528 | ✗ | bool DefaultConstructionSet_Impl::setDefaultExteriorSurfaceConstructionsAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 529 | ✗ | if (modelObject) { | |
| 530 | ✗ | OptionalDefaultSurfaceConstructions intermediate = modelObject->optionalCast<DefaultSurfaceConstructions>(); | |
| 531 | ✗ | if (intermediate) { | |
| 532 | ✗ | return setDefaultExteriorSurfaceConstructions(*intermediate); | |
| 533 | } else { | ||
| 534 | ✗ | return false; | |
| 535 | } | ||
| 536 | ✗ | } else { | |
| 537 | ✗ | resetDefaultExteriorSurfaceConstructions(); | |
| 538 | } | ||
| 539 | ✗ | return true; | |
| 540 | } | ||
| 541 | |||
| 542 | ✗ | bool DefaultConstructionSet_Impl::setDefaultInteriorSurfaceConstructionsAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 543 | ✗ | if (modelObject) { | |
| 544 | ✗ | OptionalDefaultSurfaceConstructions intermediate = modelObject->optionalCast<DefaultSurfaceConstructions>(); | |
| 545 | ✗ | if (intermediate) { | |
| 546 | ✗ | return setDefaultInteriorSurfaceConstructions(*intermediate); | |
| 547 | } else { | ||
| 548 | ✗ | return false; | |
| 549 | } | ||
| 550 | ✗ | } else { | |
| 551 | ✗ | resetDefaultInteriorSurfaceConstructions(); | |
| 552 | } | ||
| 553 | ✗ | return true; | |
| 554 | } | ||
| 555 | |||
| 556 | ✗ | bool DefaultConstructionSet_Impl::setDefaultGroundContactSurfaceConstructionsAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 557 | ✗ | if (modelObject) { | |
| 558 | ✗ | OptionalDefaultSurfaceConstructions intermediate = modelObject->optionalCast<DefaultSurfaceConstructions>(); | |
| 559 | ✗ | if (intermediate) { | |
| 560 | ✗ | return setDefaultGroundContactSurfaceConstructions(*intermediate); | |
| 561 | } else { | ||
| 562 | ✗ | return false; | |
| 563 | } | ||
| 564 | ✗ | } else { | |
| 565 | ✗ | resetDefaultGroundContactSurfaceConstructions(); | |
| 566 | } | ||
| 567 | ✗ | return true; | |
| 568 | } | ||
| 569 | |||
| 570 | ✗ | bool DefaultConstructionSet_Impl::setDefaultExteriorSubSurfaceConstructionsAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 571 | ✗ | if (modelObject) { | |
| 572 | ✗ | OptionalDefaultSubSurfaceConstructions intermediate = modelObject->optionalCast<DefaultSubSurfaceConstructions>(); | |
| 573 | ✗ | if (intermediate) { | |
| 574 | ✗ | return setDefaultExteriorSubSurfaceConstructions(*intermediate); | |
| 575 | } else { | ||
| 576 | ✗ | return false; | |
| 577 | } | ||
| 578 | ✗ | } else { | |
| 579 | ✗ | resetDefaultExteriorSubSurfaceConstructions(); | |
| 580 | } | ||
| 581 | ✗ | return true; | |
| 582 | } | ||
| 583 | |||
| 584 | ✗ | bool DefaultConstructionSet_Impl::setDefaultInteriorSubSurfaceConstructionsAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 585 | ✗ | if (modelObject) { | |
| 586 | ✗ | OptionalDefaultSubSurfaceConstructions intermediate = modelObject->optionalCast<DefaultSubSurfaceConstructions>(); | |
| 587 | ✗ | if (intermediate) { | |
| 588 | ✗ | return setDefaultInteriorSubSurfaceConstructions(*intermediate); | |
| 589 | } else { | ||
| 590 | ✗ | return false; | |
| 591 | } | ||
| 592 | ✗ | } else { | |
| 593 | ✗ | resetDefaultInteriorSubSurfaceConstructions(); | |
| 594 | } | ||
| 595 | ✗ | return true; | |
| 596 | } | ||
| 597 | |||
| 598 | ✗ | bool DefaultConstructionSet_Impl::setInteriorPartitionConstructionAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 599 | ✗ | if (modelObject) { | |
| 600 | ✗ | OptionalConstructionBase intermediate = modelObject->optionalCast<ConstructionBase>(); | |
| 601 | ✗ | if (intermediate) { | |
| 602 | ✗ | return setInteriorPartitionConstruction(*intermediate); | |
| 603 | } else { | ||
| 604 | ✗ | return false; | |
| 605 | } | ||
| 606 | ✗ | } else { | |
| 607 | ✗ | resetInteriorPartitionConstruction(); | |
| 608 | } | ||
| 609 | ✗ | return true; | |
| 610 | } | ||
| 611 | |||
| 612 | ✗ | bool DefaultConstructionSet_Impl::setSpaceShadingConstructionAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 613 | ✗ | if (modelObject) { | |
| 614 | ✗ | OptionalConstructionBase intermediate = modelObject->optionalCast<ConstructionBase>(); | |
| 615 | ✗ | if (intermediate) { | |
| 616 | ✗ | return setSpaceShadingConstruction(*intermediate); | |
| 617 | } else { | ||
| 618 | ✗ | return false; | |
| 619 | } | ||
| 620 | ✗ | } else { | |
| 621 | ✗ | resetSpaceShadingConstruction(); | |
| 622 | } | ||
| 623 | ✗ | return true; | |
| 624 | } | ||
| 625 | |||
| 626 | ✗ | bool DefaultConstructionSet_Impl::setBuildingShadingConstructionAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 627 | ✗ | if (modelObject) { | |
| 628 | ✗ | OptionalConstructionBase intermediate = modelObject->optionalCast<ConstructionBase>(); | |
| 629 | ✗ | if (intermediate) { | |
| 630 | ✗ | return setBuildingShadingConstruction(*intermediate); | |
| 631 | } else { | ||
| 632 | ✗ | return false; | |
| 633 | } | ||
| 634 | ✗ | } else { | |
| 635 | ✗ | resetBuildingShadingConstruction(); | |
| 636 | } | ||
| 637 | ✗ | return true; | |
| 638 | } | ||
| 639 | |||
| 640 | ✗ | bool DefaultConstructionSet_Impl::setSiteShadingConstructionAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 641 | ✗ | if (modelObject) { | |
| 642 | ✗ | OptionalConstructionBase intermediate = modelObject->optionalCast<ConstructionBase>(); | |
| 643 | ✗ | if (intermediate) { | |
| 644 | ✗ | return setSiteShadingConstruction(*intermediate); | |
| 645 | } else { | ||
| 646 | ✗ | return false; | |
| 647 | } | ||
| 648 | ✗ | } else { | |
| 649 | ✗ | resetSiteShadingConstruction(); | |
| 650 | } | ||
| 651 | ✗ | return true; | |
| 652 | } | ||
| 653 | |||
| 654 | // Adiabatic Surface Construction Methods | ||
| 655 | 485 | boost::optional<ConstructionBase> DefaultConstructionSet_Impl::adiabaticSurfaceConstruction() const { | |
| 656 |
2/2✓ Branch 1 taken 485 times.
✓ Branch 4 taken 485 times.
|
485 | return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultConstructionSetFields::AdiabaticSurfaceConstructionName); |
| 657 | } | ||
| 658 | |||
| 659 | 31 | bool DefaultConstructionSet_Impl::setAdiabaticSurfaceConstruction(const ConstructionBase& construction) { | |
| 660 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | return setPointer(OS_DefaultConstructionSetFields::AdiabaticSurfaceConstructionName, construction.handle()); |
| 661 | } | ||
| 662 | |||
| 663 | 2 | void DefaultConstructionSet_Impl::resetAdiabaticSurfaceConstruction() { | |
| 664 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | setString(OS_DefaultConstructionSetFields::AdiabaticSurfaceConstructionName, ""); |
| 665 | 2 | } | |
| 666 | |||
| 667 | ✗ | boost::optional<ModelObject> DefaultConstructionSet_Impl::adiabaticSurfaceConstructionAsModelObject() const { | |
| 668 | ✗ | OptionalModelObject result; | |
| 669 | ✗ | OptionalConstructionBase intermediate = adiabaticSurfaceConstruction(); | |
| 670 | ✗ | if (intermediate) { | |
| 671 | ✗ | result = *intermediate; | |
| 672 | } | ||
| 673 | ✗ | return result; | |
| 674 | ✗ | } | |
| 675 | |||
| 676 | ✗ | bool DefaultConstructionSet_Impl::setAdiabaticSurfaceConstructionAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 677 | ✗ | if (modelObject) { | |
| 678 | ✗ | OptionalConstructionBase intermediate = modelObject->optionalCast<ConstructionBase>(); | |
| 679 | ✗ | if (intermediate) { | |
| 680 | ✗ | return setAdiabaticSurfaceConstruction(*intermediate); | |
| 681 | } else { | ||
| 682 | ✗ | return false; | |
| 683 | } | ||
| 684 | ✗ | } else { | |
| 685 | ✗ | resetAdiabaticSurfaceConstruction(); | |
| 686 | } | ||
| 687 | ✗ | return true; | |
| 688 | } | ||
| 689 | |||
| 690 | } // namespace detail | ||
| 691 | |||
| 692 | 338 | DefaultConstructionSet::DefaultConstructionSet(const Model& model) : ResourceObject(DefaultConstructionSet::iddObjectType(), model) { | |
| 693 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 338 times.
✗ Branch 5 not taken.
|
338 | OS_ASSERT(getImpl<detail::DefaultConstructionSet_Impl>()); |
| 694 | 338 | } | |
| 695 | |||
| 696 | 10077 | IddObjectType DefaultConstructionSet::iddObjectType() { | |
| 697 |
1/1✓ Branch 1 taken 10077 times.
|
10077 | IddObjectType result(IddObjectType::OS_DefaultConstructionSet); |
| 698 | 10077 | return result; | |
| 699 | } | ||
| 700 | |||
| 701 | 556 | boost::optional<DefaultSurfaceConstructions> DefaultConstructionSet::defaultExteriorSurfaceConstructions() const { | |
| 702 |
1/1✓ Branch 3 taken 556 times.
|
556 | return getImpl<detail::DefaultConstructionSet_Impl>()->defaultExteriorSurfaceConstructions(); |
| 703 | } | ||
| 704 | |||
| 705 | 431 | boost::optional<DefaultSurfaceConstructions> DefaultConstructionSet::defaultInteriorSurfaceConstructions() const { | |
| 706 |
1/1✓ Branch 3 taken 431 times.
|
431 | return getImpl<detail::DefaultConstructionSet_Impl>()->defaultInteriorSurfaceConstructions(); |
| 707 | } | ||
| 708 | |||
| 709 | 426 | boost::optional<DefaultSurfaceConstructions> DefaultConstructionSet::defaultGroundContactSurfaceConstructions() const { | |
| 710 |
1/1✓ Branch 3 taken 426 times.
|
426 | return getImpl<detail::DefaultConstructionSet_Impl>()->defaultGroundContactSurfaceConstructions(); |
| 711 | } | ||
| 712 | |||
| 713 | 428 | boost::optional<DefaultSubSurfaceConstructions> DefaultConstructionSet::defaultExteriorSubSurfaceConstructions() const { | |
| 714 |
1/1✓ Branch 3 taken 428 times.
|
428 | return getImpl<detail::DefaultConstructionSet_Impl>()->defaultExteriorSubSurfaceConstructions(); |
| 715 | } | ||
| 716 | |||
| 717 | 423 | boost::optional<DefaultSubSurfaceConstructions> DefaultConstructionSet::defaultInteriorSubSurfaceConstructions() const { | |
| 718 |
1/1✓ Branch 3 taken 423 times.
|
423 | return getImpl<detail::DefaultConstructionSet_Impl>()->defaultInteriorSubSurfaceConstructions(); |
| 719 | } | ||
| 720 | |||
| 721 | 410 | boost::optional<ConstructionBase> DefaultConstructionSet::interiorPartitionConstruction() const { | |
| 722 |
1/1✓ Branch 3 taken 410 times.
|
410 | return getImpl<detail::DefaultConstructionSet_Impl>()->interiorPartitionConstruction(); |
| 723 | } | ||
| 724 | |||
| 725 | 324 | boost::optional<ConstructionBase> DefaultConstructionSet::spaceShadingConstruction() const { | |
| 726 |
1/1✓ Branch 3 taken 324 times.
|
324 | return getImpl<detail::DefaultConstructionSet_Impl>()->spaceShadingConstruction(); |
| 727 | } | ||
| 728 | |||
| 729 | 324 | boost::optional<ConstructionBase> DefaultConstructionSet::buildingShadingConstruction() const { | |
| 730 |
1/1✓ Branch 3 taken 324 times.
|
324 | return getImpl<detail::DefaultConstructionSet_Impl>()->buildingShadingConstruction(); |
| 731 | } | ||
| 732 | |||
| 733 | 324 | boost::optional<ConstructionBase> DefaultConstructionSet::siteShadingConstruction() const { | |
| 734 |
1/1✓ Branch 3 taken 324 times.
|
324 | return getImpl<detail::DefaultConstructionSet_Impl>()->siteShadingConstruction(); |
| 735 | } | ||
| 736 | |||
| 737 | 280 | bool DefaultConstructionSet::setDefaultExteriorSurfaceConstructions(const DefaultSurfaceConstructions& defaultSurfaceConstructions) { | |
| 738 |
1/1✓ Branch 3 taken 280 times.
|
280 | return getImpl<detail::DefaultConstructionSet_Impl>()->setDefaultExteriorSurfaceConstructions(defaultSurfaceConstructions); |
| 739 | } | ||
| 740 | |||
| 741 | 1 | void DefaultConstructionSet::resetDefaultExteriorSurfaceConstructions() { | |
| 742 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::DefaultConstructionSet_Impl>()->resetDefaultExteriorSurfaceConstructions(); |
| 743 | 1 | } | |
| 744 | |||
| 745 | 185 | bool DefaultConstructionSet::setDefaultInteriorSurfaceConstructions(const DefaultSurfaceConstructions& defaultSurfaceConstructions) { | |
| 746 |
1/1✓ Branch 3 taken 185 times.
|
185 | return getImpl<detail::DefaultConstructionSet_Impl>()->setDefaultInteriorSurfaceConstructions(defaultSurfaceConstructions); |
| 747 | } | ||
| 748 | |||
| 749 | 1 | void DefaultConstructionSet::resetDefaultInteriorSurfaceConstructions() { | |
| 750 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::DefaultConstructionSet_Impl>()->resetDefaultInteriorSurfaceConstructions(); |
| 751 | 1 | } | |
| 752 | |||
| 753 | 178 | bool DefaultConstructionSet::setDefaultGroundContactSurfaceConstructions(const DefaultSurfaceConstructions& defaultSurfaceConstructions) { | |
| 754 |
1/1✓ Branch 3 taken 178 times.
|
178 | return getImpl<detail::DefaultConstructionSet_Impl>()->setDefaultGroundContactSurfaceConstructions(defaultSurfaceConstructions); |
| 755 | } | ||
| 756 | |||
| 757 | 1 | void DefaultConstructionSet::resetDefaultGroundContactSurfaceConstructions() { | |
| 758 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::DefaultConstructionSet_Impl>()->resetDefaultGroundContactSurfaceConstructions(); |
| 759 | 1 | } | |
| 760 | |||
| 761 | 185 | bool DefaultConstructionSet::setDefaultExteriorSubSurfaceConstructions(const DefaultSubSurfaceConstructions& defaultSubSurfaceConstructions) { | |
| 762 |
1/1✓ Branch 3 taken 185 times.
|
185 | return getImpl<detail::DefaultConstructionSet_Impl>()->setDefaultExteriorSubSurfaceConstructions(defaultSubSurfaceConstructions); |
| 763 | } | ||
| 764 | |||
| 765 | 1 | void DefaultConstructionSet::resetDefaultExteriorSubSurfaceConstructions() { | |
| 766 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::DefaultConstructionSet_Impl>()->resetDefaultExteriorSubSurfaceConstructions(); |
| 767 | 1 | } | |
| 768 | |||
| 769 | 173 | bool DefaultConstructionSet::setDefaultInteriorSubSurfaceConstructions(const DefaultSubSurfaceConstructions& defaultSubSurfaceConstructions) { | |
| 770 |
1/1✓ Branch 3 taken 173 times.
|
173 | return getImpl<detail::DefaultConstructionSet_Impl>()->setDefaultInteriorSubSurfaceConstructions(defaultSubSurfaceConstructions); |
| 771 | } | ||
| 772 | |||
| 773 | 1 | void DefaultConstructionSet::resetDefaultInteriorSubSurfaceConstructions() { | |
| 774 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::DefaultConstructionSet_Impl>()->resetDefaultInteriorSubSurfaceConstructions(); |
| 775 | 1 | } | |
| 776 | |||
| 777 | 179 | bool DefaultConstructionSet::setInteriorPartitionConstruction(const ConstructionBase& construction) { | |
| 778 |
1/1✓ Branch 3 taken 179 times.
|
179 | return getImpl<detail::DefaultConstructionSet_Impl>()->setInteriorPartitionConstruction(construction); |
| 779 | } | ||
| 780 | |||
| 781 | 2 | void DefaultConstructionSet::resetInteriorPartitionConstruction() { | |
| 782 |
1/1✓ Branch 3 taken 2 times.
|
2 | getImpl<detail::DefaultConstructionSet_Impl>()->resetInteriorPartitionConstruction(); |
| 783 | 2 | } | |
| 784 | |||
| 785 | 7 | bool DefaultConstructionSet::setSpaceShadingConstruction(const ConstructionBase& construction) { | |
| 786 |
1/1✓ Branch 3 taken 7 times.
|
7 | return getImpl<detail::DefaultConstructionSet_Impl>()->setSpaceShadingConstruction(construction); |
| 787 | } | ||
| 788 | |||
| 789 | 2 | void DefaultConstructionSet::resetSpaceShadingConstruction() { | |
| 790 |
1/1✓ Branch 3 taken 2 times.
|
2 | getImpl<detail::DefaultConstructionSet_Impl>()->resetSpaceShadingConstruction(); |
| 791 | 2 | } | |
| 792 | |||
| 793 | 3 | bool DefaultConstructionSet::setBuildingShadingConstruction(const ConstructionBase& construction) { | |
| 794 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::DefaultConstructionSet_Impl>()->setBuildingShadingConstruction(construction); |
| 795 | } | ||
| 796 | |||
| 797 | 2 | void DefaultConstructionSet::resetBuildingShadingConstruction() { | |
| 798 |
1/1✓ Branch 3 taken 2 times.
|
2 | getImpl<detail::DefaultConstructionSet_Impl>()->resetBuildingShadingConstruction(); |
| 799 | 2 | } | |
| 800 | |||
| 801 | 3 | bool DefaultConstructionSet::setSiteShadingConstruction(const ConstructionBase& construction) { | |
| 802 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::DefaultConstructionSet_Impl>()->setSiteShadingConstruction(construction); |
| 803 | } | ||
| 804 | |||
| 805 | 2 | void DefaultConstructionSet::resetSiteShadingConstruction() { | |
| 806 |
1/1✓ Branch 3 taken 2 times.
|
2 | getImpl<detail::DefaultConstructionSet_Impl>()->resetSiteShadingConstruction(); |
| 807 | 2 | } | |
| 808 | |||
| 809 | 23301 | boost::optional<ConstructionBase> DefaultConstructionSet::getDefaultConstruction(const PlanarSurface& planarSurface) const { | |
| 810 |
1/1✓ Branch 3 taken 23301 times.
|
23301 | return getImpl<detail::DefaultConstructionSet_Impl>()->getDefaultConstruction(planarSurface); |
| 811 | } | ||
| 812 | |||
| 813 | 48 | void DefaultConstructionSet::merge(const DefaultConstructionSet& other) { | |
| 814 |
1/1✓ Branch 3 taken 48 times.
|
48 | getImpl<detail::DefaultConstructionSet_Impl>()->merge(other); |
| 815 | 48 | } | |
| 816 | |||
| 817 | // Helpers for DefaultConstructionSet::collapseToSpaceAndBuilding | ||
| 818 | namespace { | ||
| 819 | |||
| 820 | constexpr auto collapseLogChannel = "openstudio.model.DefaultConstructionSet"; | ||
| 821 | |||
| 822 | // Set to false once shading constructions are hard-assigned before collapsing: E+ has no shading slot, so a set that only | ||
| 823 | // contributes shading constructions shouldn't keep a level in the chain | ||
| 824 | constexpr bool countShadingSlots = true; | ||
| 825 | |||
| 826 | // 3 surface categories x 3 types, 2 sub-surface categories x 8 types, interior partition, [space, building, site shading], adiabatic | ||
| 827 | constexpr size_t nSlots = (3 * 3) + (2 * 8) + 1 + (countShadingSlots ? 3 : 0) + 1; | ||
| 828 | |||
| 829 | using SlotMask = std::bitset<nSlots>; | ||
| 830 | |||
| 831 | 267 | SlotMask filledSlots(const DefaultConstructionSet& dcs) { | |
| 832 | 267 | SlotMask mask; | |
| 833 | 267 | size_t i = 0; | |
| 834 | |||
| 835 | 1068 | for (const auto& d_ : | |
| 836 |
5/9✓ Branch 1 taken 267 times.
✓ Branch 4 taken 267 times.
✓ Branch 7 taken 267 times.
✓ Branch 11 taken 801 times.
✓ Branch 12 taken 267 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2136 | {dcs.defaultExteriorSurfaceConstructions(), dcs.defaultInteriorSurfaceConstructions(), dcs.defaultGroundContactSurfaceConstructions()}) { |
| 837 |
2/2✓ Branch 0 taken 443 times.
✓ Branch 1 taken 358 times.
|
801 | if (d_) { |
| 838 |
2/2✓ Branch 1 taken 443 times.
✓ Branch 4 taken 443 times.
|
443 | mask[i] = d_->floorConstruction().has_value(); |
| 839 |
2/2✓ Branch 1 taken 443 times.
✓ Branch 4 taken 443 times.
|
443 | mask[i + 1] = d_->wallConstruction().has_value(); |
| 840 |
2/2✓ Branch 1 taken 443 times.
✓ Branch 4 taken 443 times.
|
443 | mask[i + 2] = d_->roofCeilingConstruction().has_value(); |
| 841 | } | ||
| 842 | 801 | i += 3; | |
| 843 | 1068 | } | |
| 844 | |||
| 845 |
4/8✓ Branch 1 taken 267 times.
✓ Branch 4 taken 267 times.
✓ Branch 9 taken 534 times.
✓ Branch 10 taken 267 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1335 | for (const auto& d_ : {dcs.defaultExteriorSubSurfaceConstructions(), dcs.defaultInteriorSubSurfaceConstructions()}) { |
| 846 |
2/2✓ Branch 0 taken 211 times.
✓ Branch 1 taken 323 times.
|
534 | if (d_) { |
| 847 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
211 | mask[i] = d_->fixedWindowConstruction().has_value(); |
| 848 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
211 | mask[i + 1] = d_->operableWindowConstruction().has_value(); |
| 849 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
211 | mask[i + 2] = d_->doorConstruction().has_value(); |
| 850 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
211 | mask[i + 3] = d_->glassDoorConstruction().has_value(); |
| 851 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
211 | mask[i + 4] = d_->overheadDoorConstruction().has_value(); |
| 852 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
211 | mask[i + 5] = d_->skylightConstruction().has_value(); |
| 853 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
211 | mask[i + 6] = d_->tubularDaylightDomeConstruction().has_value(); |
| 854 |
2/2✓ Branch 1 taken 211 times.
✓ Branch 4 taken 211 times.
|
211 | mask[i + 7] = d_->tubularDaylightDiffuserConstruction().has_value(); |
| 855 | } | ||
| 856 | 534 | i += 8; | |
| 857 | 801 | } | |
| 858 | |||
| 859 |
1/1✓ Branch 1 taken 267 times.
|
267 | mask[i++] = dcs.interiorPartitionConstruction().has_value(); |
| 860 | if constexpr (countShadingSlots) { | ||
| 861 |
1/1✓ Branch 1 taken 267 times.
|
267 | mask[i++] = dcs.spaceShadingConstruction().has_value(); |
| 862 |
1/1✓ Branch 1 taken 267 times.
|
267 | mask[i++] = dcs.buildingShadingConstruction().has_value(); |
| 863 |
1/1✓ Branch 1 taken 267 times.
|
267 | mask[i++] = dcs.siteShadingConstruction().has_value(); |
| 864 | } | ||
| 865 |
1/1✓ Branch 1 taken 267 times.
|
267 | mask[i++] = dcs.adiabaticSurfaceConstruction().has_value(); |
| 866 | |||
| 867 | 267 | return mask; | |
| 868 | } | ||
| 869 | |||
| 870 | struct ChainItem | ||
| 871 | { | ||
| 872 | DefaultConstructionSet dcs; | ||
| 873 | Handle ownerHandle; // the Space, SpaceType, BuildingStory, or Building that points at dcs | ||
| 874 | std::string owner; // e.g. "SpaceType Office", used for the merged set name and logging | ||
| 875 | }; | ||
| 876 | |||
| 877 | template <typename T> | ||
| 878 | 267 | constexpr std::string_view ownerKind() { | |
| 879 | if constexpr (std::is_same_v<T, Space>) { | ||
| 880 | 48 | return "Space"; | |
| 881 | } else if constexpr (std::is_same_v<T, SpaceType>) { | ||
| 882 | 113 | return "SpaceType"; | |
| 883 | } else if constexpr (std::is_same_v<T, BuildingStory>) { | ||
| 884 | 32 | return "BuildingStory"; | |
| 885 | } else { | ||
| 886 | static_assert(std::is_same_v<T, Building>, "Only Space, SpaceType, BuildingStory and Building own a DefaultConstructionSet"); | ||
| 887 | 74 | return "Building"; | |
| 888 | } | ||
| 889 | } | ||
| 890 | |||
| 891 | /// Append the owner's DefaultConstructionSet, if any, to the chain | ||
| 892 | template <typename T> | ||
| 893 | 1547 | void push(std::vector<ChainItem>& chain, const T& owner) { | |
| 894 |
12/12void openstudio::model::(anonymous namespace)::push<openstudio::model::Building>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, openstudio::model::Building const&):
✓ Branch 1 taken 171 times.
✓ Branch 3 taken 74 times.
✓ Branch 4 taken 97 times.
void openstudio::model::(anonymous namespace)::push<openstudio::model::BuildingStory>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, openstudio::model::BuildingStory const&):
✓ Branch 1 taken 258 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 226 times.
void openstudio::model::(anonymous namespace)::push<openstudio::model::Space>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, openstudio::model::Space const&):
✓ Branch 1 taken 763 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 715 times.
void openstudio::model::(anonymous namespace)::push<openstudio::model::SpaceType>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, openstudio::model::SpaceType const&):
✓ Branch 1 taken 355 times.
✓ Branch 3 taken 113 times.
✓ Branch 4 taken 242 times.
|
3361 | if (auto dcs_ = owner.defaultConstructionSet()) { |
| 895 |
8/8void openstudio::model::(anonymous namespace)::push<openstudio::model::Building>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, openstudio::model::Building const&):
✓ Branch 1 taken 74 times.
✓ Branch 5 taken 74 times.
void openstudio::model::(anonymous namespace)::push<openstudio::model::BuildingStory>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, openstudio::model::BuildingStory const&):
✓ Branch 1 taken 32 times.
✓ Branch 5 taken 32 times.
void openstudio::model::(anonymous namespace)::push<openstudio::model::Space>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, openstudio::model::Space const&):
✓ Branch 1 taken 48 times.
✓ Branch 5 taken 48 times.
void openstudio::model::(anonymous namespace)::push<openstudio::model::SpaceType>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, openstudio::model::SpaceType const&):
✓ Branch 1 taken 113 times.
✓ Branch 5 taken 113 times.
|
1335 | chain.push_back({*dcs_, owner.handle(), std::string{ownerKind<T>()} + " " + owner.nameString()}); |
| 896 | } | ||
| 897 | 2615 | } | |
| 898 | |||
| 899 | template <typename T> | ||
| 900 | 1207 | void push(std::vector<ChainItem>& chain, const boost::optional<T>& owner_) { | |
| 901 |
4/4void openstudio::model::(anonymous namespace)::push<openstudio::model::BuildingStory>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, boost::optional<openstudio::model::BuildingStory> const&):
✓ Branch 0 taken 258 times.
✓ Branch 1 taken 505 times.
void openstudio::model::(anonymous namespace)::push<openstudio::model::SpaceType>(std::vector<openstudio::model::(anonymous namespace)::ChainItem, std::allocator<openstudio::model::(anonymous namespace)::ChainItem> >&, boost::optional<openstudio::model::SpaceType> const&):
✓ Branch 0 taken 355 times.
✓ Branch 1 taken 89 times.
|
1207 | if (owner_) { |
| 902 | 613 | push(chain, *owner_); | |
| 903 | } | ||
| 904 | 1207 | } | |
| 905 | |||
| 906 | /// DefaultConstructionSet handle -> its directUseCount() | ||
| 907 | using UseCounts = std::map<Handle, unsigned>; | ||
| 908 | |||
| 909 | class Resolver | ||
| 910 | { | ||
| 911 | public: | ||
| 912 | 1124 | Resolver(Model model, const UseCounts& useCountsBefore) : m_model(std::move(model)), m_useCountsBefore(useCountsBefore) {} | |
| 913 | |||
| 914 | /// Prunes the chain, then returns: none if empty, the single remaining set, or the merged set for these owners. If the | ||
| 915 | /// first remaining set belongs to inPlaceOwner and nobody else uses it, the lower levels are merged into it in place instead | ||
| 916 | 934 | boost::optional<DefaultConstructionSet> resolve(const std::string& groupName, std::vector<ChainItem> chain, | |
| 917 | const Handle& inPlaceOwner = Handle()) { | ||
| 918 |
1/1✓ Branch 1 taken 934 times.
|
934 | prune(groupName, chain); |
| 919 | |||
| 920 |
2/2✓ Branch 1 taken 738 times.
✓ Branch 2 taken 196 times.
|
934 | if (chain.empty()) { |
| 921 | 738 | return boost::none; | |
| 922 | } | ||
| 923 |
2/2✓ Branch 1 taken 154 times.
✓ Branch 2 taken 42 times.
|
196 | if (chain.size() == 1) { |
| 924 |
1/1✓ Branch 2 taken 154 times.
|
154 | return chain.front().dcs; |
| 925 | } | ||
| 926 | |||
| 927 | // The owner's own set (Space or Building), used by nobody else: merge the lower levels into it in place. | ||
| 928 | // Only valid when the owner is a Space or the Building: each stands for itself alone, so a use count of 1 really | ||
| 929 | // means a single user. A SpaceType or BuildingStory is only an intermediate level that fans out to all its Spaces (and | ||
| 930 | // the Building's SpaceType to the Building), so a count of 1 there could hide many Spaces, which is why inPlaceOwner is | ||
| 931 | // only ever a Space or the Building. | ||
| 932 | // The use count is the one from before the call: counts drop as owners get pointed to merged clones, which would make the | ||
| 933 | // outcome depend on the order the Spaces are processed in (2 Spaces sharing a set: the first one gets a clone, the second | ||
| 934 | // one would then merge in place) | ||
| 935 | 42 | auto& front = chain.front(); | |
| 936 |
9/9✓ Branch 1 taken 42 times.
✓ Branch 3 taken 27 times.
✓ Branch 4 taken 15 times.
✓ Branch 6 taken 27 times.
✓ Branch 9 taken 27 times.
✓ Branch 11 taken 14 times.
✓ Branch 12 taken 13 times.
✓ Branch 13 taken 14 times.
✓ Branch 14 taken 28 times.
|
42 | if (front.ownerHandle == inPlaceOwner && m_useCountsBefore.at(front.dcs.handle()) == 1) { |
| 937 |
2/2✓ Branch 4 taken 16 times.
✓ Branch 5 taken 14 times.
|
44 | for (auto it = std::next(chain.cbegin()); it != chain.cend(); ++it) { |
| 938 |
1/1✓ Branch 2 taken 16 times.
|
16 | front.dcs.merge(it->dcs); |
| 939 | } | ||
| 940 |
9/9✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
✓ Branch 13 taken 14 times.
✓ Branch 16 taken 14 times.
✓ Branch 20 taken 14 times.
✓ Branch 23 taken 14 times.
✓ Branch 26 taken 14 times.
|
42 | LOG_FREE(Info, collapseLogChannel, groupName << ": merged lower levels into '" << front.dcs.nameString() << "' in place"); |
| 941 |
1/1✓ Branch 1 taken 14 times.
|
14 | return front.dcs; |
| 942 | } | ||
| 943 | |||
| 944 | 28 | std::vector<Handle> key; | |
| 945 |
1/1✓ Branch 2 taken 28 times.
|
28 | key.reserve(chain.size()); |
| 946 |
2/2✓ Branch 5 taken 60 times.
✓ Branch 6 taken 28 times.
|
88 | for (const auto& item : chain) { |
| 947 |
1/1✓ Branch 1 taken 60 times.
|
60 | key.push_back(item.ownerHandle); |
| 948 | } | ||
| 949 |
3/3✓ Branch 1 taken 28 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 26 times.
|
28 | if (auto it = m_byOwners.find(key); it != m_byOwners.end()) { |
| 950 |
1/1✓ Branch 2 taken 2 times.
|
2 | return it->second; |
| 951 | } | ||
| 952 | |||
| 953 | // Miss: create it. The clone still points at the original Default(Sub)SurfaceConstructions; merge() only clones one of | ||
| 954 | // those when it has to fill it from another partial one, so sub-object cloning is already minimal. | ||
| 955 |
3/3✓ Branch 2 taken 26 times.
✓ Branch 5 taken 26 times.
✓ Branch 8 taken 26 times.
|
26 | auto merged = chain.front().dcs.clone(m_model).cast<DefaultConstructionSet>(); |
| 956 |
1/1✓ Branch 2 taken 26 times.
|
26 | std::string name = chain.front().owner; |
| 957 |
2/2✓ Branch 3 taken 30 times.
✓ Branch 4 taken 26 times.
|
82 | for (auto it = std::next(chain.cbegin()); it != chain.cend(); ++it) { |
| 958 |
1/1✓ Branch 2 taken 30 times.
|
30 | merged.merge(it->dcs); |
| 959 |
2/2✓ Branch 2 taken 30 times.
✓ Branch 5 taken 30 times.
|
30 | name += " @ " + it->owner; |
| 960 | } | ||
| 961 |
1/1✓ Branch 1 taken 26 times.
|
26 | merged.setName(name); |
| 962 |
9/9✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 13 taken 26 times.
✓ Branch 16 taken 26 times.
✓ Branch 20 taken 26 times.
✓ Branch 23 taken 26 times.
✓ Branch 26 taken 26 times.
|
78 | LOG_FREE(Info, collapseLogChannel, groupName << ": created merged DefaultConstructionSet '" << merged.nameString() << "'"); |
| 963 | |||
| 964 |
1/1✓ Branch 2 taken 26 times.
|
26 | m_byOwners.emplace(std::move(key), merged); |
| 965 |
1/1✓ Branch 1 taken 26 times.
|
26 | m_created.push_back(merged); |
| 966 |
1/1✓ Branch 1 taken 26 times.
|
26 | return merged; |
| 967 | 28 | } | |
| 968 | |||
| 969 | 1124 | std::vector<DefaultConstructionSet> created() const { | |
| 970 | 1124 | return m_created; | |
| 971 | } | ||
| 972 | |||
| 973 | private: | ||
| 974 | /// Drops every set that fills no slot left empty by the sets kept above it | ||
| 975 | 934 | static void prune(const std::string& groupName, std::vector<ChainItem>& chain) { | |
| 976 | 934 | SlotMask covered; | |
| 977 | 934 | std::vector<ChainItem> kept; | |
| 978 |
1/1✓ Branch 2 taken 934 times.
|
934 | kept.reserve(chain.size()); |
| 979 |
2/2✓ Branch 5 taken 267 times.
✓ Branch 6 taken 934 times.
|
1201 | for (auto& item : chain) { |
| 980 |
1/1✓ Branch 1 taken 267 times.
|
267 | const SlotMask filled = filledSlots(item.dcs); |
| 981 |
2/2✓ Branch 3 taken 23 times.
✓ Branch 4 taken 244 times.
|
267 | if ((filled & ~covered).none()) { |
| 982 |
11/11✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
✓ Branch 10 taken 23 times.
✓ Branch 13 taken 23 times.
✓ Branch 16 taken 23 times.
✓ Branch 19 taken 23 times.
✓ Branch 22 taken 23 times.
✓ Branch 26 taken 23 times.
✓ Branch 29 taken 23 times.
✓ Branch 32 taken 23 times.
|
69 | LOG_FREE(Trace, collapseLogChannel, |
| 983 | groupName << ": ignoring " << item.owner << "'s DefaultConstructionSet '" << item.dcs.nameString() | ||
| 984 | << "', every slot it fills is already filled higher up"); | ||
| 985 | 23 | continue; | |
| 986 | 23 | } | |
| 987 | 244 | covered |= filled; | |
| 988 |
1/1✓ Branch 2 taken 244 times.
|
244 | kept.push_back(std::move(item)); |
| 989 | } | ||
| 990 | 934 | chain = std::move(kept); | |
| 991 | 934 | } | |
| 992 | |||
| 993 | Model m_model; | ||
| 994 | const UseCounts& m_useCountsBefore; | ||
| 995 | std::map<std::vector<Handle>, DefaultConstructionSet> m_byOwners; | ||
| 996 | std::vector<DefaultConstructionSet> m_created; | ||
| 997 | }; | ||
| 998 | |||
| 999 | /// Building group: Building (search distance 4), then Building SpaceType (5), collapsed onto the Building. Returns the created sets | ||
| 1000 | 953 | std::vector<DefaultConstructionSet> collapseToBuilding(Model& model, const UseCounts& useCountsBefore) { | |
| 1001 | // model.building(), not getUniqueModelObject, so we don't instantiate a Building | ||
| 1002 |
1/1✓ Branch 1 taken 953 times.
|
953 | auto building_ = model.building(); |
| 1003 |
2/2✓ Branch 1 taken 782 times.
✓ Branch 2 taken 171 times.
|
953 | if (!building_) { |
| 1004 | 782 | return {}; | |
| 1005 | } | ||
| 1006 | |||
| 1007 |
2/2✓ Branch 1 taken 171 times.
✓ Branch 4 taken 171 times.
|
171 | Resolver resolver(model, useCountsBefore); |
| 1008 | 171 | std::vector<ChainItem> chain; | |
| 1009 |
2/2✓ Branch 1 taken 171 times.
✓ Branch 4 taken 171 times.
|
171 | push(chain, *building_); |
| 1010 |
3/3✓ Branch 1 taken 171 times.
✓ Branch 4 taken 171 times.
✓ Branch 7 taken 171 times.
|
171 | push(chain, building_->spaceType()); |
| 1011 |
6/6✓ Branch 1 taken 171 times.
✓ Branch 4 taken 171 times.
✓ Branch 9 taken 171 times.
✓ Branch 12 taken 171 times.
✓ Branch 17 taken 76 times.
✓ Branch 18 taken 95 times.
|
684 | if (auto dcs_ = resolver.resolve("Building", std::move(chain), building_->handle())) { |
| 1012 |
3/3✓ Branch 1 taken 76 times.
✓ Branch 4 taken 76 times.
✓ Branch 7 taken 76 times.
|
76 | building_->setDefaultConstructionSet(*dcs_); |
| 1013 | } else { | ||
| 1014 |
2/2✓ Branch 1 taken 95 times.
✓ Branch 4 taken 95 times.
|
95 | building_->resetDefaultConstructionSet(); |
| 1015 | 171 | } | |
| 1016 | |||
| 1017 |
1/1✓ Branch 1 taken 171 times.
|
171 | return resolver.created(); |
| 1018 | 953 | } | |
| 1019 | |||
| 1020 | /// Space group, per Space: Space (1), then its SpaceType if explicit (2), then its BuildingStory (3), collapsed onto the Space. | ||
| 1021 | /// Returns the created sets | ||
| 1022 | 953 | std::vector<DefaultConstructionSet> collapseToSpaces(Model& model, const UseCounts& useCountsBefore) { | |
| 1023 |
2/2✓ Branch 1 taken 953 times.
✓ Branch 4 taken 953 times.
|
953 | Resolver resolver(model, useCountsBefore); |
| 1024 | |||
| 1025 |
3/3✓ Branch 1 taken 953 times.
✓ Branch 8 taken 763 times.
✓ Branch 9 taken 953 times.
|
1716 | for (auto& space : model.getConcreteModelObjects<Space>()) { |
| 1026 |
3/3✓ Branch 1 taken 763 times.
✓ Branch 4 taken 763 times.
✓ Branch 7 taken 763 times.
|
763 | const std::string groupName = "Space '" + space.nameString() + "'"; |
| 1027 | 763 | std::vector<ChainItem> chain; | |
| 1028 |
1/1✓ Branch 1 taken 763 times.
|
763 | push(chain, space); |
| 1029 |
3/3✓ Branch 1 taken 763 times.
✓ Branch 3 taken 273 times.
✓ Branch 4 taken 490 times.
|
763 | if (!space.isSpaceTypeDefaulted()) { // defaulted == Building's SpaceType, which is in the Building group |
| 1030 |
2/2✓ Branch 1 taken 273 times.
✓ Branch 4 taken 273 times.
|
273 | push(chain, space.spaceType()); |
| 1031 | } | ||
| 1032 |
2/2✓ Branch 1 taken 763 times.
✓ Branch 4 taken 763 times.
|
763 | push(chain, space.buildingStory()); |
| 1033 | |||
| 1034 |
4/4✓ Branch 1 taken 763 times.
✓ Branch 6 taken 763 times.
✓ Branch 10 taken 120 times.
✓ Branch 11 taken 643 times.
|
1526 | if (auto dcs_ = resolver.resolve(groupName, std::move(chain), space.handle())) { |
| 1035 |
2/2✓ Branch 1 taken 120 times.
✓ Branch 4 taken 120 times.
|
120 | space.setDefaultConstructionSet(*dcs_); // no-op when it's the Space's own |
| 1036 | } else { | ||
| 1037 |
1/1✓ Branch 1 taken 643 times.
|
643 | space.resetDefaultConstructionSet(); // no set in the group, or only empty ones |
| 1038 | 763 | } | |
| 1039 | 1716 | } | |
| 1040 | |||
| 1041 |
1/1✓ Branch 1 taken 953 times.
|
1906 | return resolver.created(); |
| 1042 | 953 | } | |
| 1043 | |||
| 1044 | } // namespace | ||
| 1045 | |||
| 1046 | // OS inheritance order (cf Space_Impl::getDefaultConstructionWithSearchDistance): | ||
| 1047 | // | ||
| 1048 | // Space -> SpaceType (explicit only) -> BuildingStory -> Building -> Building SpaceType | ||
| 1049 | // \__________________ ___________________________/ \_______________ _____________/ | ||
| 1050 | // V V | ||
| 1051 | // Space Group Building Group | ||
| 1052 | // | ||
| 1053 | // Each group only reads its own levels' sets (the Space group never reads the Building's), and SpaceType / BuildingStory sets | ||
| 1054 | // are only reset at the very end (if purging), so assigning as we go is safe. Original sets are only mutated when merged into | ||
| 1055 | // in place: a Space's or the Building's own set, with no other user. | ||
| 1056 | // | ||
| 1057 | // Collapsing preserves every surface's construction, but not its search distance: what came from a SpaceType / BuildingStory | ||
| 1058 | // (2, 3) now comes from the Space (1), and what came from the Building's SpaceType (5) now comes from the Building (4). | ||
| 1059 | // Purging or not makes no difference to either: a collapsed set's slots are the union of its group's slots, so a slot that | ||
| 1060 | // falls through the Space's set also falls through its SpaceType's and BuildingStory's, and is never found there. | ||
| 1061 | 953 | std::vector<DefaultConstructionSet> DefaultConstructionSet::collapseToSpaceAndBuilding(Model& model, bool purge) { | |
| 1062 | |||
| 1063 | // Use counts before the call: they decide what may be merged into in place, and what a purge may remove (sets in use before) | ||
| 1064 | 953 | UseCounts useCountsBefore; | |
| 1065 | 953 | std::vector<DefaultConstructionSet> usedBefore; | |
| 1066 |
3/3✓ Branch 1 taken 953 times.
✓ Branch 8 taken 200 times.
✓ Branch 9 taken 953 times.
|
1153 | for (auto& dcs : model.getConcreteModelObjects<DefaultConstructionSet>()) { |
| 1067 |
1/1✓ Branch 1 taken 200 times.
|
200 | const unsigned useCount = dcs.directUseCount(); |
| 1068 |
2/2✓ Branch 1 taken 200 times.
✓ Branch 4 taken 200 times.
|
200 | useCountsBefore.emplace(dcs.handle(), useCount); |
| 1069 |
4/4✓ Branch 0 taken 24 times.
✓ Branch 1 taken 176 times.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 1 time.
|
200 | if (purge && useCount > 0) { |
| 1070 |
1/1✓ Branch 2 taken 23 times.
|
23 | usedBefore.push_back(std::move(dcs)); |
| 1071 | } | ||
| 1072 | 953 | } | |
| 1073 | |||
| 1074 |
1/1✓ Branch 1 taken 953 times.
|
953 | std::vector<DefaultConstructionSet> created = collapseToBuilding(model, useCountsBefore); |
| 1075 |
1/1✓ Branch 1 taken 953 times.
|
953 | const std::vector<DefaultConstructionSet> spaceCreated = collapseToSpaces(model, useCountsBefore); |
| 1076 |
1/1✓ Branch 5 taken 953 times.
|
953 | created.insert(created.end(), spaceCreated.begin(), spaceCreated.end()); |
| 1077 | |||
| 1078 |
2/2✓ Branch 0 taken 945 times.
✓ Branch 1 taken 8 times.
|
953 | if (!purge) { |
| 1079 | 945 | return created; | |
| 1080 | } | ||
| 1081 | |||
| 1082 | // Purge: | ||
| 1083 | |||
| 1084 | // 1. Drop the intermediate levels so the model looks like E+: sets only on Spaces and the Building (includes the Building's SpaceType) | ||
| 1085 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 8 taken 11 times.
✓ Branch 9 taken 8 times.
|
19 | for (auto& spaceType : model.getConcreteModelObjects<SpaceType>()) { |
| 1086 |
1/1✓ Branch 1 taken 11 times.
|
11 | spaceType.resetDefaultConstructionSet(); |
| 1087 | 8 | } | |
| 1088 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 8 times.
|
12 | for (auto& story : model.getConcreteModelObjects<BuildingStory>()) { |
| 1089 |
1/1✓ Branch 1 taken 4 times.
|
4 | story.resetDefaultConstructionSet(); |
| 1090 | 8 | } | |
| 1091 | |||
| 1092 | // 2. Remove the sets this left unused, but capture their sub-objects to see if they are orphaned after | ||
| 1093 | |||
| 1094 | // A set, since two removed sets can share a sub-object | ||
| 1095 | 8 | std::set<ResourceObject> subObjects; | |
| 1096 |
2/2✓ Branch 5 taken 23 times.
✓ Branch 6 taken 8 times.
|
31 | for (auto& dcs : usedBefore) { |
| 1097 |
3/3✓ Branch 1 taken 23 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 12 times.
|
23 | if (dcs.directUseCount() > 0) { |
| 1098 | 11 | continue; | |
| 1099 | } | ||
| 1100 | 84 | for (const auto& d_ : | |
| 1101 |
5/9✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 11 taken 36 times.
✓ Branch 12 taken 12 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
96 | {dcs.defaultExteriorSurfaceConstructions(), dcs.defaultInteriorSurfaceConstructions(), dcs.defaultGroundContactSurfaceConstructions()}) { |
| 1102 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 21 times.
|
36 | if (d_) { |
| 1103 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | subObjects.insert(*d_); |
| 1104 | } | ||
| 1105 | 48 | } | |
| 1106 |
4/8✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 9 taken 24 times.
✓ Branch 10 taken 12 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
60 | for (const auto& d_ : {dcs.defaultExteriorSubSurfaceConstructions(), dcs.defaultInteriorSubSurfaceConstructions()}) { |
| 1107 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 21 times.
|
24 | if (d_) { |
| 1108 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | subObjects.insert(*d_); |
| 1109 | } | ||
| 1110 | 36 | } | |
| 1111 |
8/8✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
✓ Branch 13 taken 12 times.
✓ Branch 17 taken 12 times.
✓ Branch 20 taken 12 times.
✓ Branch 23 taken 12 times.
|
36 | LOG_FREE(Trace, collapseLogChannel, "Removing DefaultConstructionSet '" << dcs.nameString() << "', no longer used"); |
| 1112 |
1/1✓ Branch 1 taken 12 times.
|
12 | dcs.remove(); |
| 1113 | } | ||
| 1114 | |||
| 1115 | // 3. Remove the sub-objects that are no longer used | ||
| 1116 | |||
| 1117 | // Copy (cheap handle wrapper): set elements are const, and remove() isn't | ||
| 1118 |
3/3✓ Branch 4 taken 18 times.
✓ Branch 8 taken 18 times.
✓ Branch 9 taken 8 times.
|
26 | for (auto subObject : subObjects) { // NOLINT(performance-for-range-copy) |
| 1119 |
3/3✓ Branch 1 taken 18 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 8 times.
|
18 | if (subObject.directUseCount() == 0) { |
| 1120 |
1/1✓ Branch 1 taken 10 times.
|
10 | subObject.remove(); |
| 1121 | } | ||
| 1122 | 18 | } | |
| 1123 | |||
| 1124 | 8 | return created; | |
| 1125 | 953 | } | |
| 1126 | |||
| 1127 | 419 | boost::optional<ConstructionBase> DefaultConstructionSet::adiabaticSurfaceConstruction() const { | |
| 1128 |
1/1✓ Branch 3 taken 419 times.
|
419 | return getImpl<detail::DefaultConstructionSet_Impl>()->adiabaticSurfaceConstruction(); |
| 1129 | } | ||
| 1130 | |||
| 1131 | 24 | bool DefaultConstructionSet::setAdiabaticSurfaceConstruction(const ConstructionBase& construction) { | |
| 1132 |
1/1✓ Branch 3 taken 24 times.
|
24 | return getImpl<detail::DefaultConstructionSet_Impl>()->setAdiabaticSurfaceConstruction(construction); |
| 1133 | } | ||
| 1134 | |||
| 1135 | 2 | void DefaultConstructionSet::resetAdiabaticSurfaceConstruction() { | |
| 1136 |
1/1✓ Branch 3 taken 2 times.
|
2 | getImpl<detail::DefaultConstructionSet_Impl>()->resetAdiabaticSurfaceConstruction(); |
| 1137 | 2 | } | |
| 1138 | |||
| 1139 | /// @cond | ||
| 1140 |
1/1✓ Branch 3 taken 24971 times.
|
24971 | DefaultConstructionSet::DefaultConstructionSet(std::shared_ptr<detail::DefaultConstructionSet_Impl> impl) : ResourceObject(std::move(impl)) {} |
| 1141 | /// @endcond | ||
| 1142 | |||
| 1143 | } // namespace model | ||
| 1144 | } // namespace openstudio | ||
| 1145 |