src/model/DaylightingDeviceShelf.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 "DaylightingDeviceShelf.hpp" | ||
| 7 | #include "DaylightingDeviceShelf_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Model.hpp" | ||
| 10 | #include "Model_Impl.hpp" | ||
| 11 | #include "Space.hpp" | ||
| 12 | #include "Space_Impl.hpp" | ||
| 13 | #include "SubSurface.hpp" | ||
| 14 | #include "SubSurface_Impl.hpp" | ||
| 15 | #include "InteriorPartitionSurface.hpp" | ||
| 16 | #include "InteriorPartitionSurface_Impl.hpp" | ||
| 17 | #include "ShadingSurface.hpp" | ||
| 18 | #include "ShadingSurface_Impl.hpp" | ||
| 19 | |||
| 20 | #include <utilities/idd/OS_DaylightingDevice_Shelf_FieldEnums.hxx> | ||
| 21 | #include <utilities/idd/IddEnums.hxx> | ||
| 22 | |||
| 23 | #include "../utilities/core/Assert.hpp" | ||
| 24 | |||
| 25 | namespace openstudio { | ||
| 26 | namespace model { | ||
| 27 | |||
| 28 | namespace detail { | ||
| 29 | |||
| 30 | 7 | DaylightingDeviceShelf_Impl::DaylightingDeviceShelf_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 31 | 7 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 32 |
4/6✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 7 times.
✗ Branch 13 not taken.
|
7 | OS_ASSERT(idfObject.iddObject().type() == DaylightingDeviceShelf::iddObjectType()); |
| 33 | 7 | } | |
| 34 | |||
| 35 | ✗ | DaylightingDeviceShelf_Impl::DaylightingDeviceShelf_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 36 | ✗ | bool keepHandle) | |
| 37 | ✗ | : ModelObject_Impl(other, model, keepHandle) { | |
| 38 | ✗ | OS_ASSERT(other.iddObject().type() == DaylightingDeviceShelf::iddObjectType()); | |
| 39 | ✗ | } | |
| 40 | |||
| 41 | 1 | DaylightingDeviceShelf_Impl::DaylightingDeviceShelf_Impl(const DaylightingDeviceShelf_Impl& other, Model_Impl* model, bool keepHandle) | |
| 42 | 1 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 43 | |||
| 44 | ✗ | const std::vector<std::string>& DaylightingDeviceShelf_Impl::outputVariableNames() const { | |
| 45 | ✗ | static const std::vector<std::string> result; | |
| 46 | ✗ | return result; | |
| 47 | } | ||
| 48 | |||
| 49 | ✗ | IddObjectType DaylightingDeviceShelf_Impl::iddObjectType() const { | |
| 50 | ✗ | return DaylightingDeviceShelf::iddObjectType(); | |
| 51 | } | ||
| 52 | |||
| 53 | 4 | boost::optional<InteriorPartitionSurface> DaylightingDeviceShelf_Impl::insideShelf() const { | |
| 54 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | return getObject<DaylightingDeviceShelf>().getModelObjectTarget<InteriorPartitionSurface>(OS_DaylightingDevice_ShelfFields::InsideShelfName); |
| 55 | } | ||
| 56 | |||
| 57 | 3 | boost::optional<ShadingSurface> DaylightingDeviceShelf_Impl::outsideShelf() const { | |
| 58 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | return getObject<DaylightingDeviceShelf>().getModelObjectTarget<ShadingSurface>(OS_DaylightingDevice_ShelfFields::OutsideShelfName); |
| 59 | } | ||
| 60 | |||
| 61 | ✗ | boost::optional<double> DaylightingDeviceShelf_Impl::viewFactortoOutsideShelf() const { | |
| 62 | ✗ | return getDouble(OS_DaylightingDevice_ShelfFields::ViewFactortoOutsideShelf, true); | |
| 63 | } | ||
| 64 | |||
| 65 | 2 | bool DaylightingDeviceShelf_Impl::setInsideShelf(const InteriorPartitionSurface& insideShelf) { | |
| 66 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<Space> insideShelfSpace = insideShelf.space(); |
| 67 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if (!insideShelfSpace) { |
| 68 | ✗ | return false; | |
| 69 | } | ||
| 70 | |||
| 71 |
1/1✓ Branch 1 taken 2 times.
|
2 | SubSurface subSurface = this->subSurface(); |
| 72 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<Space> subSurfaceSpace = subSurface.space(); |
| 73 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if (!subSurfaceSpace) { |
| 74 | ✗ | return false; | |
| 75 | } | ||
| 76 | |||
| 77 |
6/7✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 2 times.
|
2 | if (insideShelfSpace->handle() != subSurfaceSpace->handle()) { |
| 78 | ✗ | return false; | |
| 79 | } | ||
| 80 | |||
| 81 | // DLM: check that this insideShelf is not used by any other daylighting light shelf? | ||
| 82 | |||
| 83 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | bool result = setPointer(OS_DaylightingDevice_ShelfFields::InsideShelfName, insideShelf.handle()); |
| 84 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
|
2 | OS_ASSERT(result); |
| 85 | 2 | return result; | |
| 86 | 2 | } | |
| 87 | |||
| 88 | ✗ | bool DaylightingDeviceShelf_Impl::setOutsideShelf(const ShadingSurface& outsideShelf) { | |
| 89 | ✗ | boost::optional<Space> outsideShelfSpace = outsideShelf.space(); | |
| 90 | ✗ | if (!outsideShelfSpace) { | |
| 91 | ✗ | return false; | |
| 92 | } | ||
| 93 | |||
| 94 | ✗ | SubSurface subSurface = this->subSurface(); | |
| 95 | ✗ | boost::optional<Space> subSurfaceSpace = subSurface.space(); | |
| 96 | ✗ | if (!subSurfaceSpace) { | |
| 97 | ✗ | return false; | |
| 98 | } | ||
| 99 | |||
| 100 | ✗ | if (outsideShelfSpace->handle() != subSurfaceSpace->handle()) { | |
| 101 | ✗ | return false; | |
| 102 | } | ||
| 103 | |||
| 104 | // DLM: check that this outsideShelf is not used by any other daylighting light shelf? | ||
| 105 | |||
| 106 | ✗ | bool result = setPointer(OS_DaylightingDevice_ShelfFields::OutsideShelfName, outsideShelf.handle()); | |
| 107 | ✗ | OS_ASSERT(result); | |
| 108 | ✗ | return result; | |
| 109 | ✗ | } | |
| 110 | |||
| 111 | ✗ | bool DaylightingDeviceShelf_Impl::setViewFactortoOutsideShelf(double viewFactortoOutsideShelf) { | |
| 112 | ✗ | bool result = setDouble(OS_DaylightingDevice_ShelfFields::ViewFactortoOutsideShelf, viewFactortoOutsideShelf); | |
| 113 | ✗ | return result; | |
| 114 | } | ||
| 115 | |||
| 116 | ✗ | void DaylightingDeviceShelf_Impl::resetViewFactortoOutsideShelf() { | |
| 117 | ✗ | bool result = setString(OS_DaylightingDevice_ShelfFields::ViewFactortoOutsideShelf, ""); | |
| 118 | ✗ | OS_ASSERT(result); | |
| 119 | ✗ | } | |
| 120 | |||
| 121 | 4 | SubSurface DaylightingDeviceShelf_Impl::subSurface() const { | |
| 122 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | OptionalSubSurface subSurface = getObject<ModelObject>().getModelObjectTarget<SubSurface>(OS_DaylightingDevice_ShelfFields::WindowName); |
| 123 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
|
4 | OS_ASSERT(subSurface); |
| 124 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
8 | return subSurface.get(); |
| 125 | 4 | } | |
| 126 | |||
| 127 | } // namespace detail | ||
| 128 | |||
| 129 | 7 | DaylightingDeviceShelf::DaylightingDeviceShelf(const SubSurface& subSurface) | |
| 130 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
|
7 | : ModelObject(DaylightingDeviceShelf::iddObjectType(), subSurface.model()) { |
| 131 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
✗ Branch 5 not taken.
|
7 | OS_ASSERT(getImpl<detail::DaylightingDeviceShelf_Impl>()); |
| 132 | |||
| 133 | 7 | bool subSurfaceOk = false; | |
| 134 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 1 time.
|
7 | if (subSurface.allowDaylightingDeviceShelf()) { |
| 135 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 1 time.
|
6 | if (!subSurface.daylightingDeviceShelf()) { |
| 136 | 5 | subSurfaceOk = true; | |
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5 times.
|
7 | if (!subSurfaceOk) { |
| 141 |
1/1✓ Branch 1 taken 2 times.
|
2 | this->remove(); |
| 142 |
21/21✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 20 taken 2 times.
✓ Branch 23 taken 2 times.
✓ Branch 26 taken 2 times.
✓ Branch 32 taken 2 times.
✓ Branch 35 taken 2 times.
✓ Branch 38 taken 2 times.
✓ Branch 41 taken 2 times.
✓ Branch 44 taken 2 times.
✓ Branch 47 taken 2 times.
✓ Branch 50 taken 2 times.
✓ Branch 53 taken 2 times.
✓ Branch 56 taken 2 times.
✓ Branch 59 taken 2 times.
✓ Branch 64 taken 2 times.
✓ Branch 67 taken 2 times.
|
2 | LOG_AND_THROW("Cannot create DaylightingDeviceShelf for SubSurface '" << subSurface.name().get() << "'"); |
| 143 | } | ||
| 144 | |||
| 145 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = setPointer(OS_DaylightingDevice_ShelfFields::WindowName, subSurface.handle()); |
| 146 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 147 | 7 | } | |
| 148 | |||
| 149 | 12151 | IddObjectType DaylightingDeviceShelf::iddObjectType() { | |
| 150 |
1/1✓ Branch 1 taken 12151 times.
|
12151 | IddObjectType result(IddObjectType::OS_DaylightingDevice_Shelf); |
| 151 | 12151 | return result; | |
| 152 | } | ||
| 153 | |||
| 154 | 4 | boost::optional<InteriorPartitionSurface> DaylightingDeviceShelf::insideShelf() const { | |
| 155 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::DaylightingDeviceShelf_Impl>()->insideShelf(); |
| 156 | } | ||
| 157 | |||
| 158 | 3 | boost::optional<ShadingSurface> DaylightingDeviceShelf::outsideShelf() const { | |
| 159 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::DaylightingDeviceShelf_Impl>()->outsideShelf(); |
| 160 | } | ||
| 161 | |||
| 162 | ✗ | boost::optional<double> DaylightingDeviceShelf::viewFactortoOutsideShelf() const { | |
| 163 | ✗ | return getImpl<detail::DaylightingDeviceShelf_Impl>()->viewFactortoOutsideShelf(); | |
| 164 | } | ||
| 165 | |||
| 166 | 2 | bool DaylightingDeviceShelf::setInsideShelf(const InteriorPartitionSurface& insideShelf) { | |
| 167 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::DaylightingDeviceShelf_Impl>()->setInsideShelf(insideShelf); |
| 168 | } | ||
| 169 | |||
| 170 | ✗ | bool DaylightingDeviceShelf::setOutsideShelf(const ShadingSurface& outsideShelf) { | |
| 171 | ✗ | return getImpl<detail::DaylightingDeviceShelf_Impl>()->setOutsideShelf(outsideShelf); | |
| 172 | } | ||
| 173 | |||
| 174 | ✗ | bool DaylightingDeviceShelf::setViewFactortoOutsideShelf(double viewFactortoOutsideShelf) { | |
| 175 | ✗ | return getImpl<detail::DaylightingDeviceShelf_Impl>()->setViewFactortoOutsideShelf(viewFactortoOutsideShelf); | |
| 176 | } | ||
| 177 | |||
| 178 | ✗ | void DaylightingDeviceShelf::resetViewFactortoOutsideShelf() { | |
| 179 | ✗ | getImpl<detail::DaylightingDeviceShelf_Impl>()->resetViewFactortoOutsideShelf(); | |
| 180 | ✗ | } | |
| 181 | |||
| 182 | 2 | SubSurface DaylightingDeviceShelf::subSurface() const { | |
| 183 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::DaylightingDeviceShelf_Impl>()->subSurface(); |
| 184 | } | ||
| 185 | |||
| 186 | /// @cond | ||
| 187 |
1/1✓ Branch 3 taken 44 times.
|
44 | DaylightingDeviceShelf::DaylightingDeviceShelf(std::shared_ptr<detail::DaylightingDeviceShelf_Impl> impl) : ModelObject(std::move(impl)) {} |
| 188 | /// @endcond | ||
| 189 | |||
| 190 | } // namespace model | ||
| 191 | } // namespace openstudio | ||
| 192 |