src/model/ComfortViewFactorAngles.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 "ComfortViewFactorAngles.hpp" | ||
| 7 | #include "ComfortViewFactorAngles_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Surface.hpp" | ||
| 10 | #include "Surface_Impl.hpp" | ||
| 11 | #include "SubSurface.hpp" | ||
| 12 | #include "SubSurface_Impl.hpp" | ||
| 13 | #include "InternalMass.hpp" | ||
| 14 | #include "InternalMass_Impl.hpp" | ||
| 15 | #include "PlanarSurface.hpp" | ||
| 16 | #include "Space.hpp" | ||
| 17 | #include "ThermalZone.hpp" | ||
| 18 | #include "Model.hpp" | ||
| 19 | #include "Model_Impl.hpp" | ||
| 20 | |||
| 21 | #include "ModelExtensibleGroup.hpp" | ||
| 22 | |||
| 23 | #include <utilities/idd/IddEnums.hxx> | ||
| 24 | #include <utilities/idd/OS_ComfortViewFactorAngles_FieldEnums.hxx> | ||
| 25 | |||
| 26 | #include "../utilities/core/Assert.hpp" | ||
| 27 | |||
| 28 | namespace openstudio { | ||
| 29 | namespace model { | ||
| 30 | |||
| 31 | namespace { | ||
| 32 | // Resolves the Space that owns a valid EnergyPlus heat-transfer surface target. | ||
| 33 | 43 | boost::optional<Space> spaceForSurface(const ModelObject& surface) { | |
| 34 |
3/3✓ Branch 1 taken 43 times.
✓ Branch 3 taken 39 times.
✓ Branch 4 taken 4 times.
|
86 | if (auto planarSurface = surface.optionalCast<PlanarSurface>()) { |
| 35 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
39 | return planarSurface->space(); |
| 36 | 43 | } | |
| 37 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (auto internalMass = surface.optionalCast<InternalMass>()) { |
| 38 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | return internalMass->space(); |
| 39 | 4 | } | |
| 40 | ✗ | return boost::none; | |
| 41 | } | ||
| 42 | |||
| 43 | } // namespace | ||
| 44 | |||
| 45 | 67 | AngleFactor::AngleFactor(const ModelObject& surface, double angleFactor) : m_surface(surface), m_angleFactor(angleFactor) { | |
| 46 |
1/1✓ Branch 1 taken 67 times.
|
67 | const IddObjectType surfaceIddType = surface.iddObjectType(); |
| 47 |
4/4✓ Branch 1 taken 67 times.
✓ Branch 5 taken 16 times.
✓ Branch 8 taken 7 times.
✓ Branch 9 taken 9 times.
|
83 | if ((surfaceIddType != IddObjectType::OS_Surface) && (surfaceIddType != IddObjectType::OS_SubSurface) |
| 48 |
7/7✓ Branch 0 taken 16 times.
✓ Branch 1 taken 51 times.
✓ Branch 3 taken 7 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 6 times.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 66 times.
|
83 | && (surfaceIddType != IddObjectType::OS_InternalMass)) { |
| 49 |
17/17✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
✓ Branch 34 taken 1 time.
✓ Branch 37 taken 1 time.
✓ Branch 40 taken 1 time.
✓ Branch 43 taken 1 time.
✓ Branch 46 taken 1 time.
✓ Branch 50 taken 1 time.
✓ Branch 53 taken 1 time.
|
1 | LOG_AND_THROW("surface can be only of type Surface, SubSurface or InternalMass, not " << surfaceIddType.value()); |
| 50 | } | ||
| 51 |
4/4✓ Branch 0 taken 64 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 63 times.
|
66 | if (!((m_angleFactor >= 0.0) && (m_angleFactor <= 1.0))) { |
| 52 |
13/13✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 19 taken 3 times.
✓ Branch 22 taken 3 times.
✓ Branch 25 taken 3 times.
✓ Branch 28 taken 3 times.
✓ Branch 31 taken 3 times.
✓ Branch 34 taken 3 times.
✓ Branch 38 taken 3 times.
✓ Branch 41 taken 3 times.
|
3 | LOG_AND_THROW("Angle Factor must be between 0 and 1."); |
| 53 | } | ||
| 54 | 67 | } | |
| 55 | |||
| 56 | 60 | ModelObject AngleFactor::surface() const { | |
| 57 | 60 | return m_surface; | |
| 58 | } | ||
| 59 | |||
| 60 | 59 | double AngleFactor::angleFactor() const { | |
| 61 | 59 | return m_angleFactor; | |
| 62 | } | ||
| 63 | |||
| 64 | 1 | bool AngleFactor::operator!=(const AngleFactor& other) const { | |
| 65 | 1 | return !operator==(other); | |
| 66 | } | ||
| 67 | |||
| 68 | 4 | std::ostream& operator<<(std::ostream& out, const openstudio::model::AngleFactor& angleFactor) { | |
| 69 |
7/7✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
✓ Branch 8 taken 4 times.
✓ Branch 11 taken 4 times.
✓ Branch 14 taken 4 times.
✓ Branch 17 taken 4 times.
✓ Branch 20 taken 4 times.
|
4 | out << "(surface='" << angleFactor.surface().nameString() << "', angle factor=" << angleFactor.angleFactor() << ")"; |
| 70 | 4 | return out; | |
| 71 | } | ||
| 72 | |||
| 73 | namespace detail { | ||
| 74 | 13 | ComfortViewFactorAngles_Impl::ComfortViewFactorAngles_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 75 | 13 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 76 |
4/6✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 13 times.
✗ Branch 13 not taken.
|
13 | OS_ASSERT(idfObject.iddObject().type() == ComfortViewFactorAngles::iddObjectType()); |
| 77 | 13 | } | |
| 78 | |||
| 79 | ✗ | ComfortViewFactorAngles_Impl::ComfortViewFactorAngles_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 80 | ✗ | bool keepHandle) | |
| 81 | ✗ | : ModelObject_Impl(other, model, keepHandle) {} | |
| 82 | |||
| 83 | 8 | ComfortViewFactorAngles_Impl::ComfortViewFactorAngles_Impl(const ComfortViewFactorAngles_Impl& other, Model_Impl* model, bool keepHandle) | |
| 84 | 8 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 85 | |||
| 86 | ✗ | const std::vector<std::string>& ComfortViewFactorAngles_Impl::outputVariableNames() const { | |
| 87 | ✗ | static const std::vector<std::string> result; | |
| 88 | ✗ | return result; | |
| 89 | } | ||
| 90 | |||
| 91 | ✗ | IddObjectType ComfortViewFactorAngles_Impl::iddObjectType() const { | |
| 92 | ✗ | return ComfortViewFactorAngles::iddObjectType(); | |
| 93 | } | ||
| 94 | |||
| 95 | 34 | std::vector<AngleFactor> ComfortViewFactorAngles_Impl::angleFactors() const { | |
| 96 | 34 | std::vector<AngleFactor> result; | |
| 97 |
3/3✓ Branch 1 taken 64 times.
✓ Branch 3 taken 30 times.
✓ Branch 4 taken 34 times.
|
64 | for (unsigned i = 0; i < numberofAngleFactors(); ++i) { |
| 98 |
2/3✓ Branch 1 taken 30 times.
✓ Branch 3 taken 30 times.
✗ Branch 4 not taken.
|
60 | if (auto angleFactor = getAngleFactor(i)) { |
| 99 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | result.push_back(*angleFactor); |
| 100 | 30 | } | |
| 101 | } | ||
| 102 | 34 | return result; | |
| 103 | ✗ | } | |
| 104 | |||
| 105 | 203 | unsigned int ComfortViewFactorAngles_Impl::numberofAngleFactors() const { | |
| 106 | 203 | return numExtensibleGroups(); | |
| 107 | } | ||
| 108 | |||
| 109 | 27 | boost::optional<unsigned> ComfortViewFactorAngles_Impl::angleFactorIndex(const ModelObject& surface) const { | |
| 110 |
3/3✓ Branch 1 taken 44 times.
✓ Branch 3 taken 22 times.
✓ Branch 4 taken 22 times.
|
44 | for (unsigned i = 0; i < numberofAngleFactors(); ++i) { |
| 111 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | auto group = getExtensibleGroup(i).cast<ModelExtensibleGroup>(); |
| 112 |
1/1✓ Branch 1 taken 22 times.
|
22 | auto existingSurface = group.getModelObjectTarget<ModelObject>(OS_ComfortViewFactorAnglesExtensibleFields::SurfaceName); |
| 113 |
9/10✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 22 times.
✓ Branch 6 taken 22 times.
✓ Branch 9 taken 22 times.
✓ Branch 12 taken 22 times.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 17 times.
✓ Branch 16 taken 5 times.
✓ Branch 17 taken 17 times.
|
22 | if (existingSurface && (existingSurface->handle() == surface.handle())) { |
| 114 |
1/1✓ Branch 1 taken 5 times.
|
5 | return i; |
| 115 | } | ||
| 116 | 27 | } | |
| 117 | 22 | return boost::none; | |
| 118 | } | ||
| 119 | |||
| 120 | 35 | boost::optional<AngleFactor> ComfortViewFactorAngles_Impl::getAngleFactor(unsigned groupIndex) const { | |
| 121 |
3/3✓ Branch 1 taken 35 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 34 times.
|
35 | if (groupIndex >= numberofAngleFactors()) { |
| 122 |
13/13✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 32 taken 1 time.
✓ Branch 35 taken 1 time.
✓ Branch 38 taken 1 time.
|
1 | LOG(Error, "Asked to get Angle Factor with index " << groupIndex << ", but " << briefDescription() << " has just " << numberofAngleFactors() |
| 123 | << " angle factors."); | ||
| 124 | 1 | return boost::none; | |
| 125 | } | ||
| 126 | |||
| 127 |
2/2✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
|
34 | auto group = getExtensibleGroup(groupIndex).cast<ModelExtensibleGroup>(); |
| 128 |
1/1✓ Branch 1 taken 34 times.
|
34 | auto surface = group.getModelObjectTarget<ModelObject>(OS_ComfortViewFactorAnglesExtensibleFields::SurfaceName); |
| 129 |
1/1✓ Branch 1 taken 34 times.
|
34 | auto angleFactor = group.getDouble(OS_ComfortViewFactorAnglesExtensibleFields::AngleFactor); |
| 130 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
|
34 | if (!surface) { |
| 131 | ✗ | LOG(Error, "Could not retrieve Surface Name for extensible group " << group.groupIndex() << "."); | |
| 132 | } | ||
| 133 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
|
34 | if (!angleFactor) { |
| 134 | ✗ | LOG(Error, "Could not retrieve Angle Factor for extensible group " << group.groupIndex() << "."); | |
| 135 | } | ||
| 136 |
3/6✓ Branch 1 taken 34 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 34 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 34 times.
|
34 | if (!surface || !angleFactor) { |
| 137 | ✗ | return boost::none; | |
| 138 | } | ||
| 139 |
4/4✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
✓ Branch 7 taken 34 times.
✓ Branch 10 taken 34 times.
|
34 | return AngleFactor(*surface, *angleFactor); |
| 140 | 34 | } | |
| 141 | |||
| 142 | 27 | bool ComfortViewFactorAngles_Impl::addAngleFactor(const AngleFactor& angleFactor) { | |
| 143 | 27 | bool result = false; | |
| 144 | |||
| 145 |
1/1✓ Branch 1 taken 27 times.
|
27 | ModelObject surface = angleFactor.surface(); |
| 146 |
5/5✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
✓ Branch 7 taken 27 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 26 times.
|
27 | if (surface.model() != model()) { |
| 147 |
8/8✓ 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 17 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
|
1 | LOG(Error, "Cannot add a Surface from another Model to " << briefDescription() << "."); |
| 148 | 1 | return result; | |
| 149 | } | ||
| 150 | |||
| 151 |
1/1✓ Branch 1 taken 26 times.
|
26 | boost::optional<Space> space = spaceForSurface(surface); |
| 152 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 23 times.
|
26 | if (!space) { |
| 153 |
11/11✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
✓ Branch 19 taken 3 times.
✓ Branch 22 taken 3 times.
✓ Branch 27 taken 3 times.
✓ Branch 30 taken 3 times.
✓ Branch 33 taken 3 times.
|
3 | LOG(Error, "Cannot add " << surface.briefDescription() << " to " << briefDescription() << " because it is not assigned to a Space."); |
| 154 | 3 | return result; | |
| 155 | } | ||
| 156 | |||
| 157 |
2/2✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
|
23 | boost::optional<ThermalZone> thermalZone = space->thermalZone(); |
| 158 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
|
23 | if (!thermalZone) { |
| 159 | ✗ | LOG(Error, "Cannot add " << surface.briefDescription() << " to " << briefDescription() | |
| 160 | << " because it is not assigned to any ThermalZone."); | ||
| 161 | ✗ | return result; | |
| 162 | } | ||
| 163 | |||
| 164 |
3/3✓ Branch 1 taken 23 times.
✓ Branch 8 taken 17 times.
✓ Branch 9 taken 22 times.
|
39 | for (const auto& existingAngleFactor : angleFactors()) { |
| 165 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
17 | const auto existingSpace = spaceForSurface(existingAngleFactor.surface()); |
| 166 |
3/4✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 17 times.
✓ Branch 6 taken 17 times.
|
17 | const auto existingThermalZone = existingSpace ? existingSpace->thermalZone() : boost::none; |
| 167 |
10/11✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
✓ Branch 13 taken 17 times.
✓ Branch 16 taken 17 times.
✓ Branch 18 taken 1 time.
✓ Branch 19 taken 16 times.
✓ Branch 20 taken 1 time.
✓ Branch 21 taken 16 times.
|
17 | if (!existingThermalZone || (existingThermalZone->handle() != thermalZone->handle())) { |
| 168 |
21/26✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 31 taken 1 time.
✓ Branch 34 taken 1 time.
✓ Branch 37 taken 1 time.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 time.
✓ Branch 43 taken 1 time.
✗ Branch 46 not taken.
✓ Branch 49 taken 1 time.
✓ Branch 52 taken 1 time.
✗ Branch 55 not taken.
✓ Branch 56 taken 1 time.
✓ Branch 61 taken 1 time.
✓ Branch 64 taken 1 time.
✓ Branch 67 taken 1 time.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
|
2 | LOG(Error, "Cannot add " << surface.briefDescription() << " to " << briefDescription() << " because it is assigned to ThermalZone '" |
| 169 | << thermalZone->nameString() | ||
| 170 | << "' instead of '" | ||
| 171 | << (existingThermalZone ? existingThermalZone->nameString() : "an unassigned ThermalZone") << "'."); | ||
| 172 | 1 | return result; | |
| 173 | } | ||
| 174 | 41 | } | |
| 175 | |||
| 176 |
1/1✓ Branch 1 taken 22 times.
|
22 | boost::optional<unsigned> existingIndex = angleFactorIndex(surface); |
| 177 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 21 times.
|
22 | if (existingIndex) { |
| 178 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<AngleFactor> existingAngleFactor = getAngleFactor(existingIndex.get()); |
| 179 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(existingAngleFactor); |
| 180 |
13/13✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 28 taken 1 time.
✓ Branch 32 taken 1 time.
✓ Branch 35 taken 1 time.
✓ Branch 38 taken 1 time.
|
1 | LOG(Warn, "For " << briefDescription() << ", AngleFactor already exists, will be modified in place from " << existingAngleFactor.get() |
| 181 | << " to " << angleFactor << "."); | ||
| 182 | 1 | } | |
| 183 | |||
| 184 |
1/1✓ Branch 1 taken 22 times.
|
22 | double sum = angleFactor.angleFactor(); |
| 185 |
3/3✓ Branch 1 taken 38 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 22 times.
|
38 | for (unsigned i = 0; i < numberofAngleFactors(); ++i) { |
| 186 |
6/7✓ Branch 0 taken 1 time.
✓ Branch 1 taken 15 times.
✓ Branch 3 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 15 times.
|
16 | if (existingIndex && (i == *existingIndex)) { |
| 187 | 1 | continue; | |
| 188 | } | ||
| 189 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | auto group = getExtensibleGroup(i).cast<ModelExtensibleGroup>(); |
| 190 |
1/1✓ Branch 1 taken 15 times.
|
15 | auto existingValue = group.getDouble(OS_ComfortViewFactorAnglesExtensibleFields::AngleFactor); |
| 191 |
1/1✓ Branch 1 taken 15 times.
|
15 | sum += existingValue.get(); |
| 192 | 15 | } | |
| 193 | |||
| 194 | 22 | constexpr double tolerance = 0.000001; | |
| 195 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 21 times.
|
22 | if (sum > 1.0 + tolerance) { |
| 196 |
10/10✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
✓ Branch 29 taken 1 time.
|
1 | LOG(Error, "Cannot add an AngleFactor to " << briefDescription() << " because the Angle Factors would sum to " << sum |
| 197 | << ", which is greater than 1."); | ||
| 198 | 1 | return result; | |
| 199 | } | ||
| 200 | |||
| 201 | 21 | std::vector<std::string> temp; | |
| 202 |
2/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
2 | ModelExtensibleGroup group = (existingIndex ? getExtensibleGroup(existingIndex.get()).cast<ModelExtensibleGroup>() |
| 203 |
9/11✓ Branch 0 taken 1 time.
✓ Branch 1 taken 20 times.
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 20 times.
✓ Branch 9 taken 20 times.
✓ Branch 11 taken 20 times.
✓ Branch 12 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 15 taken 20 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
22 | : pushExtensibleGroup(temp, false).cast<ModelExtensibleGroup>()); |
| 204 | |||
| 205 |
3/5✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 21 times.
✗ Branch 9 not taken.
|
21 | OS_ASSERT(group.setPointer(OS_ComfortViewFactorAnglesExtensibleFields::SurfaceName, surface.handle(), false)); |
| 206 | |||
| 207 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | bool angleFactorSet = group.setDouble(OS_ComfortViewFactorAnglesExtensibleFields::AngleFactor, angleFactor.angleFactor()); |
| 208 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (angleFactorSet) { |
| 209 | 21 | result = true; | |
| 210 | } else { | ||
| 211 | ✗ | if (!existingIndex) { | |
| 212 | ✗ | getObject<ModelObject>().eraseExtensibleGroup(group.groupIndex()); | |
| 213 | } | ||
| 214 | } | ||
| 215 | |||
| 216 | 21 | return result; | |
| 217 | 27 | } | |
| 218 | |||
| 219 | 23 | bool ComfortViewFactorAngles_Impl::addAngleFactor(const ModelObject& surface, double angleFactor) { | |
| 220 |
2/2✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
|
23 | return addAngleFactor(AngleFactor(surface, angleFactor)); |
| 221 | } | ||
| 222 | |||
| 223 | 2 | bool ComfortViewFactorAngles_Impl::addAngleFactors(const std::vector<AngleFactor>& angleFactors) { | |
| 224 | 2 | bool result = true; | |
| 225 |
2/2✓ Branch 5 taken 4 times.
✓ Branch 6 taken 2 times.
|
6 | for (const auto& angleFactor : angleFactors) { |
| 226 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
|
4 | if (!addAngleFactor(angleFactor)) { |
| 227 | 1 | result = false; | |
| 228 |
10/10✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
✓ Branch 29 taken 1 time.
|
1 | LOG(Error, "Could not add AngleFactor " << angleFactor << " to " << briefDescription() << ". Continuing with others."); |
| 229 | } | ||
| 230 | } | ||
| 231 | 2 | return result; | |
| 232 | } | ||
| 233 | |||
| 234 | 5 | bool ComfortViewFactorAngles_Impl::removeAngleFactor(unsigned groupIndex) { | |
| 235 | 5 | bool result = false; | |
| 236 | |||
| 237 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (groupIndex < numberofAngleFactors()) { |
| 238 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | getObject<ModelObject>().eraseExtensibleGroup(groupIndex); |
| 239 | 5 | result = true; | |
| 240 | } | ||
| 241 | |||
| 242 | 5 | return result; | |
| 243 | } | ||
| 244 | |||
| 245 | 1 | void ComfortViewFactorAngles_Impl::removeAllAngleFactors() { | |
| 246 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | getObject<ModelObject>().clearExtensibleGroups(); |
| 247 | 1 | } | |
| 248 | |||
| 249 | } // namespace detail | ||
| 250 | |||
| 251 | 13 | ComfortViewFactorAngles::ComfortViewFactorAngles(const Model& model) : ModelObject(ComfortViewFactorAngles::iddObjectType(), model) { | |
| 252 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
✗ Branch 5 not taken.
|
13 | OS_ASSERT(getImpl<detail::ComfortViewFactorAngles_Impl>()); |
| 253 | 13 | } | |
| 254 | |||
| 255 | 7755 | IddObjectType ComfortViewFactorAngles::iddObjectType() { | |
| 256 |
1/1✓ Branch 1 taken 7755 times.
|
7755 | return IddObjectType::OS_ComfortViewFactorAngles; |
| 257 | } | ||
| 258 | |||
| 259 | 11 | std::vector<AngleFactor> ComfortViewFactorAngles::angleFactors() const { | |
| 260 |
1/1✓ Branch 3 taken 11 times.
|
11 | return getImpl<detail::ComfortViewFactorAngles_Impl>()->angleFactors(); |
| 261 | } | ||
| 262 | |||
| 263 | 16 | unsigned int ComfortViewFactorAngles::numberofAngleFactors() const { | |
| 264 |
1/1✓ Branch 3 taken 16 times.
|
16 | return getImpl<detail::ComfortViewFactorAngles_Impl>()->numberofAngleFactors(); |
| 265 | } | ||
| 266 | |||
| 267 | 5 | boost::optional<unsigned> ComfortViewFactorAngles::angleFactorIndex(const ModelObject& surface) const { | |
| 268 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ComfortViewFactorAngles_Impl>()->angleFactorIndex(surface); |
| 269 | } | ||
| 270 | |||
| 271 | 4 | boost::optional<AngleFactor> ComfortViewFactorAngles::getAngleFactor(unsigned groupIndex) const { | |
| 272 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ComfortViewFactorAngles_Impl>()->getAngleFactor(groupIndex); |
| 273 | } | ||
| 274 | |||
| 275 | ✗ | bool ComfortViewFactorAngles::addAngleFactor(const AngleFactor& angleFactor) { | |
| 276 | ✗ | return getImpl<detail::ComfortViewFactorAngles_Impl>()->addAngleFactor(angleFactor); | |
| 277 | } | ||
| 278 | |||
| 279 | 23 | bool ComfortViewFactorAngles::addAngleFactor(const ModelObject& surface, double angleFactor) { | |
| 280 |
1/1✓ Branch 3 taken 23 times.
|
23 | return getImpl<detail::ComfortViewFactorAngles_Impl>()->addAngleFactor(surface, angleFactor); |
| 281 | } | ||
| 282 | |||
| 283 | 2 | bool ComfortViewFactorAngles::addAngleFactors(const std::vector<AngleFactor>& angleFactors) { | |
| 284 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::ComfortViewFactorAngles_Impl>()->addAngleFactors(angleFactors); |
| 285 | } | ||
| 286 | |||
| 287 | 5 | void ComfortViewFactorAngles::removeAngleFactor(int groupIndex) { | |
| 288 |
1/1✓ Branch 3 taken 5 times.
|
5 | getImpl<detail::ComfortViewFactorAngles_Impl>()->removeAngleFactor(groupIndex); |
| 289 | 5 | } | |
| 290 | |||
| 291 | 1 | void ComfortViewFactorAngles::removeAllAngleFactors() { | |
| 292 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ComfortViewFactorAngles_Impl>()->removeAllAngleFactors(); |
| 293 | 1 | } | |
| 294 | |||
| 295 |
1/1✓ Branch 3 taken 24 times.
|
24 | ComfortViewFactorAngles::ComfortViewFactorAngles(std::shared_ptr<detail::ComfortViewFactorAngles_Impl> impl) : ModelObject(std::move(impl)) {} |
| 296 | |||
| 297 | } // namespace model | ||
| 298 | } // namespace openstudio | ||
| 299 |