GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 52.6% 111 / 0 / 211
Functions: 50.0% 29 / 0 / 58
Branches: 48.7% 76 / 0 / 156

src/model/InteriorPartitionSurface.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 "InteriorPartitionSurface.hpp"
7 #include "InteriorPartitionSurface_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "Model_Impl.hpp"
11 #include "Space.hpp"
12 #include "Space_Impl.hpp"
13 #include "InteriorPartitionSurfaceGroup.hpp"
14 #include "InteriorPartitionSurfaceGroup_Impl.hpp"
15 #include "ConstructionBase.hpp"
16 #include "ConstructionBase_Impl.hpp"
17 #include "DaylightingDeviceShelf.hpp"
18 #include "DaylightingDeviceShelf_Impl.hpp"
19
20 #include <utilities/idd/OS_InteriorPartitionSurface_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 219 InteriorPartitionSurface_Impl::InteriorPartitionSurface_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
31 219 : PlanarSurface_Impl(idfObject, model, keepHandle) {
32
4/6
✓ Branch 1 taken 219 times.
✓ Branch 4 taken 219 times.
✓ Branch 7 taken 219 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 219 times.
✗ Branch 13 not taken.
219 OS_ASSERT(idfObject.iddObject().type() == InteriorPartitionSurface::iddObjectType());
33 219 }
34
35 25 InteriorPartitionSurface_Impl::InteriorPartitionSurface_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model,
36 25 bool keepHandle)
37 25 : PlanarSurface_Impl(other, model, keepHandle) {
38
4/6
✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 25 times.
✗ Branch 13 not taken.
25 OS_ASSERT(other.iddObject().type() == InteriorPartitionSurface::iddObjectType());
39 25 }
40
41 72 InteriorPartitionSurface_Impl::InteriorPartitionSurface_Impl(const InteriorPartitionSurface_Impl& other, Model_Impl* model, bool keepHandle)
42 72 : PlanarSurface_Impl(other, model, keepHandle) {}
43
44 14 boost::optional<ParentObject> InteriorPartitionSurface_Impl::parent() const {
45 14 boost::optional<ParentObject> result;
46
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 result = this->interiorPartitionSurfaceGroup();
47 14 return result;
48 ✗ }
49
50 168 std::vector<ModelObject> InteriorPartitionSurface_Impl::children() const {
51 168 std::vector<ModelObject> result;
52
53 // solar collectors?
54
55 168 return result;
56 }
57
58 4 bool InteriorPartitionSurface_Impl::setParent(ParentObject& newParent) {
59 4 bool result = false;
60
1/1
✓ Branch 1 taken 4 times.
4 OptionalInteriorPartitionSurfaceGroup interiorPartitionSurfaceGroup = newParent.optionalCast<InteriorPartitionSurfaceGroup>();
61
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (interiorPartitionSurfaceGroup) {
62
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 result = this->setInteriorPartitionSurfaceGroup(*interiorPartitionSurfaceGroup);
63 }
64 4 return result;
65 4 }
66
67 1 const std::vector<std::string>& InteriorPartitionSurface_Impl::outputVariableNames() const {
68
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;
69 1 return result;
70 }
71
72 1 IddObjectType InteriorPartitionSurface_Impl::iddObjectType() const {
73 1 return InteriorPartitionSurface::iddObjectType();
74 }
75
76 340 boost::optional<std::pair<ConstructionBase, int>> InteriorPartitionSurface_Impl::constructionWithSearchDistance() const {
77 340 boost::optional<std::pair<ConstructionBase, int>> result;
78
79 boost::optional<ConstructionBase> construction =
80
2/2
✓ Branch 1 taken 340 times.
✓ Branch 4 taken 340 times.
340 getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_InteriorPartitionSurfaceFields::ConstructionName);
81
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 332 times.
340 if (construction) {
82
3/3
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
8 return std::make_pair(*construction, 0);
83 }
84
85
1/1
✓ Branch 1 taken 332 times.
332 boost::optional<InteriorPartitionSurfaceGroup> interiorPartitionSurfaceGroup = this->interiorPartitionSurfaceGroup();
86
2/2
✓ Branch 0 taken 331 times.
✓ Branch 1 taken 1 time.
332 if (interiorPartitionSurfaceGroup) {
87
2/2
✓ Branch 1 taken 331 times.
✓ Branch 4 taken 331 times.
331 boost::optional<Space> space = interiorPartitionSurfaceGroup->space();
88
1/2
✓ Branch 0 taken 331 times.
✗ Branch 1 not taken.
331 if (space) {
89
3/3
✓ Branch 1 taken 331 times.
✓ Branch 4 taken 331 times.
✓ Branch 7 taken 331 times.
331 result = space->getDefaultConstructionWithSearchDistance(this->getObject<InteriorPartitionSurface>());
90 }
91 331 }
92
93 332 return result;
94 340 }
95
96 ✗ bool InteriorPartitionSurface_Impl::isConstructionDefaulted() const {
97 ✗ return isEmpty(OS_InteriorPartitionSurfaceFields::ConstructionName);
98 }
99
100 4 bool InteriorPartitionSurface_Impl::setConstruction(const ConstructionBase& construction) {
101
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 return this->setPointer(OS_InteriorPartitionSurfaceFields::ConstructionName, construction.handle());
102 }
103
104 ✗ void InteriorPartitionSurface_Impl::resetConstruction() {
105 ✗ this->setString(OS_InteriorPartitionSurfaceFields::ConstructionName, "");
106 ✗ }
107
108 ✗ bool InteriorPartitionSurface_Impl::subtractFromGrossArea() const {
109 ✗ return false;
110 }
111
112 46 boost::optional<PlanarSurfaceGroup> InteriorPartitionSurface_Impl::planarSurfaceGroup() const {
113
2/2
✓ Branch 1 taken 46 times.
✓ Branch 4 taken 46 times.
46 return boost::optional<PlanarSurfaceGroup>(this->interiorPartitionSurfaceGroup());
114 }
115
116 10 boost::optional<Space> InteriorPartitionSurface_Impl::space() const {
117 10 boost::optional<Space> result;
118
1/1
✓ Branch 1 taken 10 times.
10 boost::optional<InteriorPartitionSurfaceGroup> interiorPartitionSurfaceGroup = this->interiorPartitionSurfaceGroup();
119
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 if (interiorPartitionSurfaceGroup) {
120
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 result = interiorPartitionSurfaceGroup->space();
121 }
122 20 return result;
123 10 }
124
125 162 bool InteriorPartitionSurface_Impl::converttoInternalMass() const {
126
1/1
✓ Branch 1 taken 162 times.
162 boost::optional<std::string> value = getString(OS_InteriorPartitionSurfaceFields::ConverttoInternalMass, true);
127
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 162 times.
✗ Branch 4 not taken.
162 OS_ASSERT(value);
128
3/3
✓ Branch 1 taken 162 times.
✓ Branch 4 taken 162 times.
✓ Branch 7 taken 162 times.
324 return openstudio::istringEqual(value.get(), "Yes");
129 162 }
130
131 ✗ bool InteriorPartitionSurface_Impl::isConverttoInternalMassDefaulted() const {
132 ✗ return isEmpty(OS_InteriorPartitionSurfaceFields::ConverttoInternalMass);
133 }
134
135 35 boost::optional<double> InteriorPartitionSurface_Impl::surfaceArea() const {
136 35 return getDouble(OS_InteriorPartitionSurfaceFields::SurfaceArea, true);
137 }
138
139 ✗ boost::optional<double> InteriorPartitionSurface_Impl::numberofVertices() const {
140 ✗ return getDouble(OS_InteriorPartitionSurfaceFields::NumberofVertices, true);
141 }
142
143 ✗ bool InteriorPartitionSurface_Impl::isNumberofVerticesDefaulted() const {
144 ✗ return isEmpty(OS_InteriorPartitionSurfaceFields::NumberofVertices);
145 }
146
147 1 bool InteriorPartitionSurface_Impl::isNumberofVerticesAutocalculated() const {
148 1 bool result = false;
149
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> value = getString(OS_InteriorPartitionSurfaceFields::NumberofVertices, true);
150
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (value) {
151
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 result = openstudio::istringEqual(value.get(), "Autocalculate");
152 }
153 1 return result;
154 1 }
155
156 ✗ bool InteriorPartitionSurface_Impl::setConverttoInternalMass(bool converttoInternalMass) {
157 ✗ bool result = false;
158 ✗ if (converttoInternalMass) {
159 ✗ result = setString(OS_InteriorPartitionSurfaceFields::ConverttoInternalMass, "Yes");
160 } else {
161 ✗ result = setString(OS_InteriorPartitionSurfaceFields::ConverttoInternalMass, "No");
162 }
163 ✗ OS_ASSERT(result);
164 ✗ return result;
165 }
166
167 ✗ void InteriorPartitionSurface_Impl::resetConverttoInternalMass() {
168 ✗ bool result = setString(OS_InteriorPartitionSurfaceFields::ConverttoInternalMass, "");
169 ✗ OS_ASSERT(result);
170 ✗ }
171
172 ✗ bool InteriorPartitionSurface_Impl::setSurfaceArea(boost::optional<double> surfaceArea) {
173 ✗ bool result = false;
174 ✗ if (surfaceArea) {
175 ✗ result = setDouble(OS_InteriorPartitionSurfaceFields::SurfaceArea, surfaceArea.get());
176 } else {
177 ✗ result = setString(OS_InteriorPartitionSurfaceFields::SurfaceArea, "");
178 }
179 ✗ return result;
180 }
181
182 ✗ bool InteriorPartitionSurface_Impl::setSurfaceArea(double surfaceArea) {
183 ✗ bool result = setDouble(OS_InteriorPartitionSurfaceFields::SurfaceArea, surfaceArea);
184 ✗ return result;
185 }
186
187 ✗ void InteriorPartitionSurface_Impl::resetSurfaceArea() {
188 ✗ bool result = setString(OS_InteriorPartitionSurfaceFields::SurfaceArea, "");
189 ✗ OS_ASSERT(result);
190 ✗ }
191
192 ✗ bool InteriorPartitionSurface_Impl::setNumberofVertices(boost::optional<double> numberofVertices) {
193 ✗ bool result = false;
194 ✗ if (numberofVertices) {
195 ✗ result = setDouble(OS_InteriorPartitionSurfaceFields::NumberofVertices, numberofVertices.get());
196 } else {
197 ✗ result = setString(OS_InteriorPartitionSurfaceFields::NumberofVertices, "");
198 }
199 ✗ return result;
200 }
201
202 ✗ bool InteriorPartitionSurface_Impl::setNumberofVertices(double numberofVertices) {
203 ✗ bool result = setDouble(OS_InteriorPartitionSurfaceFields::NumberofVertices, numberofVertices);
204 ✗ return result;
205 }
206
207 ✗ void InteriorPartitionSurface_Impl::resetNumberofVertices() {
208 ✗ bool result = setString(OS_InteriorPartitionSurfaceFields::NumberofVertices, "");
209 ✗ OS_ASSERT(result);
210 ✗ }
211
212 1 void InteriorPartitionSurface_Impl::autocalculateNumberofVertices() {
213
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_InteriorPartitionSurfaceFields::NumberofVertices, "Autocalculate");
214
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
215 1 }
216
217 449 boost::optional<InteriorPartitionSurfaceGroup> InteriorPartitionSurface_Impl::interiorPartitionSurfaceGroup() const {
218 449 boost::optional<InteriorPartitionSurfaceGroup> result;
219
1/1
✓ Branch 1 taken 449 times.
449 OptionalWorkspaceObject object = this->getTarget(OS_InteriorPartitionSurfaceFields::InteriorPartitionSurfaceGroupName);
220
2/2
✓ Branch 0 taken 446 times.
✓ Branch 1 taken 3 times.
449 if (object) {
221
2/2
✓ Branch 1 taken 446 times.
✓ Branch 4 taken 446 times.
446 result = object->optionalCast<InteriorPartitionSurfaceGroup>();
222 }
223 898 return result;
224 449 }
225
226 193 bool InteriorPartitionSurface_Impl::setInteriorPartitionSurfaceGroup(const InteriorPartitionSurfaceGroup& interiorPartitionSurfaceGroup) {
227
2/2
✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
193 return setPointer(OS_InteriorPartitionSurfaceFields::InteriorPartitionSurfaceGroupName, interiorPartitionSurfaceGroup.handle());
228 }
229
230 ✗ void InteriorPartitionSurface_Impl::resetInteriorPartitionSurfaceGroup() {
231 ✗ bool ok = setString(OS_InteriorPartitionSurfaceFields::InteriorPartitionSurfaceGroupName, "");
232 ✗ OS_ASSERT(ok);
233 ✗ }
234
235 162 boost::optional<DaylightingDeviceShelf> InteriorPartitionSurface_Impl::daylightingDeviceShelf() const {
236
2/2
✓ Branch 1 taken 162 times.
✓ Branch 4 taken 162 times.
162 std::vector<DaylightingDeviceShelf> sources = getObject<ModelObject>().getModelObjectSources<DaylightingDeviceShelf>();
237
2/2
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 7 times.
162 if (sources.empty()) {
238 155 return boost::none;
239 }
240
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
7 if (sources.size() > 1) {
241 ✗ LOG(Error, "InteriorPartitionSurface is referenced by more than one DaylightingDeviceShelf, returning first");
242 }
243
1/1
✓ Branch 2 taken 7 times.
7 return sources[0];
244 162 }
245
246 ✗ boost::optional<ModelObject> InteriorPartitionSurface_Impl::interiorPartitionSurfaceGroupAsModelObject() const {
247 ✗ OptionalModelObject result;
248 ✗ OptionalInteriorPartitionSurfaceGroup intermediate = interiorPartitionSurfaceGroup();
249 ✗ if (intermediate) {
250 ✗ result = *intermediate;
251 }
252 ✗ return result;
253 ✗ }
254
255 ✗ bool InteriorPartitionSurface_Impl::setInteriorPartitionSurfaceGroupAsModelObject(const boost::optional<ModelObject>& modelObject) {
256 ✗ if (modelObject) {
257 ✗ OptionalInteriorPartitionSurfaceGroup intermediate = modelObject->optionalCast<InteriorPartitionSurfaceGroup>();
258 ✗ if (intermediate) {
259 ✗ return setInteriorPartitionSurfaceGroup(*intermediate);
260 } else {
261 ✗ return false;
262 }
263 ✗ } else {
264 ✗ resetInteriorPartitionSurfaceGroup();
265 }
266 ✗ return true;
267 }
268
269 } // namespace detail
270
271 193 InteriorPartitionSurface::InteriorPartitionSurface(const std::vector<Point3d>& vertices, const Model& model)
272 193 : PlanarSurface(InteriorPartitionSurface::iddObjectType(), vertices, model) {
273
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 193 times.
✗ Branch 5 not taken.
193 OS_ASSERT(getImpl<detail::InteriorPartitionSurface_Impl>());
274 193 }
275
276 8518 IddObjectType InteriorPartitionSurface::iddObjectType() {
277
1/1
✓ Branch 1 taken 8518 times.
8518 IddObjectType result(IddObjectType::OS_InteriorPartitionSurface);
278 8518 return result;
279 }
280
281 162 bool InteriorPartitionSurface::converttoInternalMass() const {
282
1/1
✓ Branch 3 taken 162 times.
162 return getImpl<detail::InteriorPartitionSurface_Impl>()->converttoInternalMass();
283 }
284
285 ✗ bool InteriorPartitionSurface::isConverttoInternalMassDefaulted() const {
286 ✗ return getImpl<detail::InteriorPartitionSurface_Impl>()->isConverttoInternalMassDefaulted();
287 }
288
289 35 boost::optional<double> InteriorPartitionSurface::surfaceArea() const {
290
1/1
✓ Branch 3 taken 35 times.
35 return getImpl<detail::InteriorPartitionSurface_Impl>()->surfaceArea();
291 }
292
293 ✗ boost::optional<double> InteriorPartitionSurface::numberofVertices() const {
294 ✗ return getImpl<detail::InteriorPartitionSurface_Impl>()->numberofVertices();
295 }
296
297 ✗ bool InteriorPartitionSurface::isNumberofVerticesDefaulted() const {
298 ✗ return getImpl<detail::InteriorPartitionSurface_Impl>()->isNumberofVerticesDefaulted();
299 }
300
301 1 bool InteriorPartitionSurface::isNumberofVerticesAutocalculated() const {
302
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::InteriorPartitionSurface_Impl>()->isNumberofVerticesAutocalculated();
303 }
304
305 ✗ bool InteriorPartitionSurface::setConverttoInternalMass(bool converttoInternalMass) {
306 ✗ return getImpl<detail::InteriorPartitionSurface_Impl>()->setConverttoInternalMass(converttoInternalMass);
307 }
308
309 ✗ void InteriorPartitionSurface::resetConverttoInternalMass() {
310 ✗ getImpl<detail::InteriorPartitionSurface_Impl>()->resetConverttoInternalMass();
311 ✗ }
312
313 ✗ bool InteriorPartitionSurface::setSurfaceArea(boost::optional<double> surfaceArea) {
314 ✗ return getImpl<detail::InteriorPartitionSurface_Impl>()->setSurfaceArea(surfaceArea);
315 }
316
317 ✗ bool InteriorPartitionSurface::setSurfaceArea(double surfaceArea) {
318 ✗ return getImpl<detail::InteriorPartitionSurface_Impl>()->setSurfaceArea(surfaceArea);
319 }
320
321 ✗ void InteriorPartitionSurface::resetSurfaceArea() {
322 ✗ getImpl<detail::InteriorPartitionSurface_Impl>()->resetSurfaceArea();
323 ✗ }
324
325 ✗ bool InteriorPartitionSurface::setNumberofVertices(boost::optional<double> numberofVertices) {
326 ✗ return getImpl<detail::InteriorPartitionSurface_Impl>()->setNumberofVertices(numberofVertices);
327 }
328
329 ✗ bool InteriorPartitionSurface::setNumberofVertices(double numberofVertices) {
330 ✗ return getImpl<detail::InteriorPartitionSurface_Impl>()->setNumberofVertices(numberofVertices);
331 }
332
333 ✗ void InteriorPartitionSurface::resetNumberofVertices() {
334 ✗ getImpl<detail::InteriorPartitionSurface_Impl>()->resetNumberofVertices();
335 ✗ }
336
337 1 void InteriorPartitionSurface::autocalculateNumberofVertices() {
338
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::InteriorPartitionSurface_Impl>()->autocalculateNumberofVertices();
339 1 }
340
341 47 boost::optional<InteriorPartitionSurfaceGroup> InteriorPartitionSurface::interiorPartitionSurfaceGroup() const {
342
1/1
✓ Branch 3 taken 47 times.
47 return getImpl<detail::InteriorPartitionSurface_Impl>()->interiorPartitionSurfaceGroup();
343 }
344
345 189 bool InteriorPartitionSurface::setInteriorPartitionSurfaceGroup(const InteriorPartitionSurfaceGroup& interiorPartitionSurfaceGroup) {
346
1/1
✓ Branch 3 taken 189 times.
189 return getImpl<detail::InteriorPartitionSurface_Impl>()->setInteriorPartitionSurfaceGroup(interiorPartitionSurfaceGroup);
347 }
348
349 ✗ void InteriorPartitionSurface::resetInteriorPartitionSurfaceGroup() {
350 ✗ getImpl<detail::InteriorPartitionSurface_Impl>()->resetInteriorPartitionSurfaceGroup();
351 ✗ }
352
353 162 boost::optional<DaylightingDeviceShelf> InteriorPartitionSurface::daylightingDeviceShelf() const {
354
1/1
✓ Branch 3 taken 162 times.
162 return getImpl<detail::InteriorPartitionSurface_Impl>()->daylightingDeviceShelf();
355 }
356
357 /// @cond
358
1/1
✓ Branch 3 taken 1143 times.
1143 InteriorPartitionSurface::InteriorPartitionSurface(std::shared_ptr<detail::InteriorPartitionSurface_Impl> impl) : PlanarSurface(std::move(impl)) {}
359 /// @endcond
360
361 } // namespace model
362 } // namespace openstudio
363