GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 93.5% 101 / 0 / 108
Functions: 93.3% 28 / 0 / 30
Branches: 50.3% 80 / 0 / 159

src/model/SurfacePropertyExposedFoundationPerimeter.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 <vector>
7 #include "Surface.hpp"
8 #include "Surface_Impl.hpp"
9 #include "SurfacePropertyExposedFoundationPerimeter.hpp"
10 #include "SurfacePropertyExposedFoundationPerimeter_Impl.hpp"
11 #include "ModelExtensibleGroup.hpp"
12 #include "Model.hpp"
13 #include "Model_Impl.hpp"
14
15 #include <utilities/idd/IddEnums.hxx>
16 #include <utilities/idd/OS_SurfaceProperty_ExposedFoundationPerimeter_FieldEnums.hxx>
17
18 #include "../utilities/core/Assert.hpp"
19 #include "../utilities/core/DeprecatedHelpers.hpp"
20
21 namespace openstudio {
22 namespace model {
23
24 namespace detail {
25
26 14 SurfacePropertyExposedFoundationPerimeter_Impl::SurfacePropertyExposedFoundationPerimeter_Impl(const IdfObject& idfObject, Model_Impl* model,
27 14 bool keepHandle)
28 14 : ModelObject_Impl(idfObject, model, keepHandle) {
29
4/6
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 14 times.
✗ Branch 13 not taken.
14 OS_ASSERT(idfObject.iddObject().type() == SurfacePropertyExposedFoundationPerimeter::iddObjectType());
30 14 }
31
32 3 SurfacePropertyExposedFoundationPerimeter_Impl::SurfacePropertyExposedFoundationPerimeter_Impl(
33 3 const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
34 3 : ModelObject_Impl(other, model, keepHandle) {
35
4/6
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
3 OS_ASSERT(other.iddObject().type() == SurfacePropertyExposedFoundationPerimeter::iddObjectType());
36 3 }
37
38 4 SurfacePropertyExposedFoundationPerimeter_Impl::SurfacePropertyExposedFoundationPerimeter_Impl(
39 4 const SurfacePropertyExposedFoundationPerimeter_Impl& other, Model_Impl* model, bool keepHandle)
40 4 : ModelObject_Impl(other, model, keepHandle) {}
41
42 ✗ const std::vector<std::string>& SurfacePropertyExposedFoundationPerimeter_Impl::outputVariableNames() const {
43 ✗ static const std::vector<std::string> result;
44 ✗ return result;
45 }
46
47 ✗ IddObjectType SurfacePropertyExposedFoundationPerimeter_Impl::iddObjectType() const {
48 ✗ return SurfacePropertyExposedFoundationPerimeter::iddObjectType();
49 }
50
51 6 Surface SurfacePropertyExposedFoundationPerimeter_Impl::surface() const {
52
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<Surface> value = optionalSurface();
53
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
6 if (!value) {
54 ✗ LOG_AND_THROW(briefDescription() << " does not have an Surface attached.");
55 }
56
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 return value.get();
57 6 }
58
59 6 boost::optional<Surface> SurfacePropertyExposedFoundationPerimeter_Impl::optionalSurface() const {
60
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 return getObject<ModelObject>().getModelObjectTarget<Surface>(OS_SurfaceProperty_ExposedFoundationPerimeterFields::SurfaceName);
61 }
62
63 3 std::string SurfacePropertyExposedFoundationPerimeter_Impl::exposedPerimeterCalculationMethod() const {
64
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<std::string> value = getString(OS_SurfaceProperty_ExposedFoundationPerimeterFields::ExposedPerimeterCalculationMethod, true);
65
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
3 OS_ASSERT(value);
66
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
67 3 }
68
69 4 boost::optional<double> SurfacePropertyExposedFoundationPerimeter_Impl::totalExposedPerimeter() {
70 4 return getDouble(OS_SurfaceProperty_ExposedFoundationPerimeterFields::TotalExposedPerimeter, true);
71 }
72
73 4 double SurfacePropertyExposedFoundationPerimeter_Impl::exposedPerimeterFraction() const {
74
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_SurfaceProperty_ExposedFoundationPerimeterFields::ExposedPerimeterFraction, true);
75
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
76
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
77 }
78
79 3 bool SurfacePropertyExposedFoundationPerimeter_Impl::isExposedPerimeterFractionDefaulted() const {
80 3 return isEmpty(OS_SurfaceProperty_ExposedFoundationPerimeterFields::ExposedPerimeterFraction);
81 }
82
83 11 bool SurfacePropertyExposedFoundationPerimeter_Impl::setExposedPerimeterCalculationMethod(const std::string& exposedPerimeterCalculationMethod) {
84 bool result =
85 11 setString(OS_SurfaceProperty_ExposedFoundationPerimeterFields::ExposedPerimeterCalculationMethod, exposedPerimeterCalculationMethod);
86
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
11 OS_ASSERT(result);
87 11 return result;
88 }
89
90 9 bool SurfacePropertyExposedFoundationPerimeter_Impl::setTotalExposedPerimeter(double totalExposedPerimeter) {
91 9 bool result = setDouble(OS_SurfaceProperty_ExposedFoundationPerimeterFields::TotalExposedPerimeter, totalExposedPerimeter);
92
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 OS_ASSERT(result);
93 9 return result;
94 }
95
96 3 bool SurfacePropertyExposedFoundationPerimeter_Impl::setExposedPerimeterFraction(double exposedPerimeterFraction) {
97 3 bool result = setDouble(OS_SurfaceProperty_ExposedFoundationPerimeterFields::ExposedPerimeterFraction, exposedPerimeterFraction);
98
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 OS_ASSERT(result);
99 3 return result;
100 }
101
102 1 void SurfacePropertyExposedFoundationPerimeter_Impl::resetExposedPerimeterFraction() {
103
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_SurfaceProperty_ExposedFoundationPerimeterFields::ExposedPerimeterFraction, "");
104
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
105 1 }
106
107 2 bool SurfacePropertyExposedFoundationPerimeter_Impl::setParent(ParentObject& newParent) {
108 2 bool result = false;
109
110
10/22
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 2 times.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 2 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 2 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 2 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 2 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
4 if ((model() == newParent.model()) && newParent.optionalCast<Surface>()) {
111
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 result = setPointer(OS_SurfaceProperty_ExposedFoundationPerimeterFields::SurfaceName, newParent.handle());
112 }
113 2 return result;
114 }
115
116 6 boost::optional<ParentObject> SurfacePropertyExposedFoundationPerimeter_Impl::parent() const {
117
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 return getObject<ModelObject>().getModelObjectTarget<ParentObject>(OS_SurfaceProperty_ExposedFoundationPerimeterFields::SurfaceName);
118 }
119
120 } // namespace detail
121
122 11 SurfacePropertyExposedFoundationPerimeter::SurfacePropertyExposedFoundationPerimeter(Surface& surface,
123 std::string exposedPerimeterCalculationMethod,
124 11 double exposedPerimeter)
125
3/3
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
11 : ModelObject(SurfacePropertyExposedFoundationPerimeter::iddObjectType(), surface.model()) {
126
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 11 times.
✗ Branch 5 not taken.
11 OS_ASSERT(getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>());
127
128
2/3
✓ Branch 1 taken 11 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 11 times.
22 if (surface.surfacePropertyExposedFoundationPerimeter()) {
129 ✗ LOG_AND_THROW("Surface '" << surface.nameString() << "' already has an associated SurfacePropertyExposedFoundationPerimeter object");
130 }
131
132 11 bool ok = true;
133
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
11 OS_ASSERT(ok);
134
135
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 ok = setPointer(OS_SurfaceProperty_ExposedFoundationPerimeterFields::SurfaceName, surface.handle());
136
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
11 OS_ASSERT(ok);
137
138
1/1
✓ Branch 1 taken 11 times.
11 ok = setExposedPerimeterCalculationMethod(exposedPerimeterCalculationMethod);
139
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
11 OS_ASSERT(ok);
140
141
3/3
✓ Branch 1 taken 11 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 2 times.
11 if (exposedPerimeterCalculationMethod == "TotalExposedPerimeter") {
142
1/1
✓ Branch 1 taken 9 times.
9 ok = setTotalExposedPerimeter(exposedPerimeter);
143
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 3 not taken.
9 OS_ASSERT(ok);
144
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 } else if (exposedPerimeterCalculationMethod == "ExposedPerimeterFraction") {
145
1/1
✓ Branch 1 taken 2 times.
2 ok = setExposedPerimeterFraction(exposedPerimeter);
146
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
2 OS_ASSERT(ok);
147 }
148 11 }
149
150 18901 IddObjectType SurfacePropertyExposedFoundationPerimeter::iddObjectType() {
151
1/1
✓ Branch 1 taken 18901 times.
18901 return {IddObjectType::OS_SurfaceProperty_ExposedFoundationPerimeter};
152 }
153
154 3 std::string SurfacePropertyExposedFoundationPerimeter::surfaceName() const {
155
5/5
✓ 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.
12 DEPRECATED_AT_MSG(3, 7, 0, "Use surface.nameString instead.");
156
2/2
✓ Branch 3 taken 3 times.
✓ Branch 6 taken 3 times.
3 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->surface().nameString();
157 }
158
159 3 Surface SurfacePropertyExposedFoundationPerimeter::surface() const {
160
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->surface();
161 }
162
163 3 std::string SurfacePropertyExposedFoundationPerimeter::exposedPerimeterCalculationMethod() const {
164
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->exposedPerimeterCalculationMethod();
165 }
166
167 4 boost::optional<double> SurfacePropertyExposedFoundationPerimeter::totalExposedPerimeter() {
168
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->totalExposedPerimeter();
169 }
170
171 4 double SurfacePropertyExposedFoundationPerimeter::exposedPerimeterFraction() const {
172
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->exposedPerimeterFraction();
173 }
174
175 3 bool SurfacePropertyExposedFoundationPerimeter::isExposedPerimeterFractionDefaulted() const {
176
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->isExposedPerimeterFractionDefaulted();
177 }
178
179 11 bool SurfacePropertyExposedFoundationPerimeter::setExposedPerimeterCalculationMethod(const std::string& exposedPerimeterCalculationMethod) {
180
1/1
✓ Branch 3 taken 11 times.
11 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->setExposedPerimeterCalculationMethod(exposedPerimeterCalculationMethod);
181 }
182
183 9 bool SurfacePropertyExposedFoundationPerimeter::setTotalExposedPerimeter(double totalExposedPerimeter) {
184
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->setTotalExposedPerimeter(totalExposedPerimeter);
185 }
186
187 3 bool SurfacePropertyExposedFoundationPerimeter::setExposedPerimeterFraction(double exposedPerimeterFraction) {
188
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->setExposedPerimeterFraction(exposedPerimeterFraction);
189 }
190
191 1 void SurfacePropertyExposedFoundationPerimeter::resetExposedPerimeterFraction() {
192
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::SurfacePropertyExposedFoundationPerimeter_Impl>()->resetExposedPerimeterFraction();
193 1 }
194
195 /// @cond
196 17 SurfacePropertyExposedFoundationPerimeter::SurfacePropertyExposedFoundationPerimeter(
197 17 std::shared_ptr<detail::SurfacePropertyExposedFoundationPerimeter_Impl> impl)
198
1/1
✓ Branch 3 taken 17 times.
17 : ModelObject(std::move(impl)) {}
199 /// @endcond
200
201 } // namespace model
202 } // namespace openstudio
203