GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 96.8% 366 / 0 / 378
Functions: 97.6% 124 / 0 / 127
Branches: 74.0% 233 / 0 / 315

src/model/FoundationKiva.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 "FoundationKiva.hpp"
8 #include "FoundationKiva_Impl.hpp"
9 #include "FoundationKivaSettings.hpp"
10 #include "FoundationKivaSettings_Impl.hpp"
11 #include "Material.hpp"
12 #include "Material_Impl.hpp"
13 #include "ConstructionBase.hpp"
14 #include "ConstructionBase_Impl.hpp"
15 #include "Surface.hpp"
16 #include "Surface_Impl.hpp"
17
18 #include "Model.hpp"
19 #include "Model_Impl.hpp"
20
21 #include "../utilities/idf/WorkspaceExtensibleGroup.hpp"
22
23 #include <utilities/idd/IddEnums.hxx>
24 #include <utilities/idd/OS_Foundation_Kiva_FieldEnums.hxx>
25
26 #include "../utilities/core/Assert.hpp"
27
28 namespace openstudio {
29 namespace model {
30
31 40 CustomBlock::CustomBlock(const Material& material, double depth, double xPosition, double zPosition)
32 40 : m_material(material), m_depth(depth), m_xPosition(xPosition), m_zPosition(zPosition) {
33
34
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
40 if (m_depth < 0) {
35 ✗ LOG_AND_THROW("Unable to create custom block, depth of " << m_depth << " less than 0");
36 }
37 40 }
38
39 16 Material CustomBlock::material() const {
40 16 return m_material;
41 }
42
43 23 double CustomBlock::depth() const {
44 23 return m_depth;
45 }
46
47 15 double CustomBlock::xPosition() const {
48 15 return m_xPosition;
49 }
50
51 15 double CustomBlock::zPosition() const {
52 15 return m_zPosition;
53 }
54
55 ✗ std::ostream& operator<<(std::ostream& out, const openstudio::model::CustomBlock& customBlock) {
56 ✗ out << "material name=" << customBlock.material().name().get() << ", depth=" << customBlock.depth() << ", x position=" << customBlock.xPosition()
57 ✗ << ", z position=" << customBlock.zPosition();
58 ✗ return out;
59 }
60
61 namespace detail {
62
63 12 FoundationKiva_Impl::FoundationKiva_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
64 12 : ModelObject_Impl(idfObject, model, keepHandle) {
65
4/6
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 12 times.
✗ Branch 13 not taken.
12 OS_ASSERT(idfObject.iddObject().type() == FoundationKiva::iddObjectType());
66 12 }
67
68 1 FoundationKiva_Impl::FoundationKiva_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
69 1 : ModelObject_Impl(other, model, keepHandle) {
70
4/6
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 time.
✗ Branch 13 not taken.
1 OS_ASSERT(other.iddObject().type() == FoundationKiva::iddObjectType());
71 1 }
72
73 8 FoundationKiva_Impl::FoundationKiva_Impl(const FoundationKiva_Impl& other, Model_Impl* model, bool keepHandle)
74 8 : ModelObject_Impl(other, model, keepHandle) {}
75
76 4 ModelObject FoundationKiva_Impl::clone(Model model) const {
77
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 auto result = ModelObject_Impl::clone(model);
78
79 // FoundationKiva cannot be used without FoundationKivaSettings.
80 // Note that FoundationKiva can be constructed without FoundationKivaSettings
81
1/1
✓ Branch 1 taken 4 times.
4 auto targetModelSettings = model.getOptionalUniqueModelObject<FoundationKivaSettings>();
82
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 time.
4 if (!targetModelSettings) {
83 // If the target model does not already have FoundationKivaSettings,
84 // and the source model does have settings, then bring them over
85
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 auto sourceModelSettings = this->model().getOptionalUniqueModelObject<FoundationKivaSettings>();
86
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
3 if (sourceModelSettings) {
87
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 sourceModelSettings->clone(model);
88 }
89 3 }
90
91 8 return result;
92 4 }
93
94 ✗ const std::vector<std::string>& FoundationKiva_Impl::outputVariableNames() const {
95 ✗ static const std::vector<std::string> result;
96 ✗ return result;
97 }
98
99 ✗ IddObjectType FoundationKiva_Impl::iddObjectType() const {
100 ✗ return FoundationKiva::iddObjectType();
101 }
102
103 2 boost::optional<double> FoundationKiva_Impl::initialIndoorAirTemperature() {
104 2 return getDouble(OS_Foundation_KivaFields::InitialIndoorAirTemperature);
105 }
106
107 2 boost::optional<Material> FoundationKiva_Impl::interiorHorizontalInsulationMaterial() const {
108
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return getObject<ModelObject>().getModelObjectTarget<Material>(OS_Foundation_KivaFields::InteriorHorizontalInsulationMaterialName);
109 }
110
111 4 double FoundationKiva_Impl::interiorHorizontalInsulationDepth() const {
112
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_Foundation_KivaFields::InteriorHorizontalInsulationDepth, true);
113
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
114
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
115 }
116
117 5 bool FoundationKiva_Impl::isInteriorHorizontalInsulationDepthDefaulted() const {
118 5 return isEmpty(OS_Foundation_KivaFields::InteriorHorizontalInsulationDepth);
119 }
120
121 1 boost::optional<double> FoundationKiva_Impl::interiorHorizontalInsulationWidth() {
122 1 return getDouble(OS_Foundation_KivaFields::InteriorHorizontalInsulationWidth);
123 }
124
125 2 boost::optional<Material> FoundationKiva_Impl::interiorVerticalInsulationMaterial() const {
126
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return getObject<ModelObject>().getModelObjectTarget<Material>(OS_Foundation_KivaFields::InteriorVerticalInsulationMaterialName);
127 }
128
129 1 boost::optional<double> FoundationKiva_Impl::interiorVerticalInsulationDepth() {
130 1 return getDouble(OS_Foundation_KivaFields::InteriorVerticalInsulationDepth);
131 }
132
133 2 boost::optional<Material> FoundationKiva_Impl::exteriorHorizontalInsulationMaterial() const {
134
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return getObject<ModelObject>().getModelObjectTarget<Material>(OS_Foundation_KivaFields::ExteriorHorizontalInsulationMaterialName);
135 }
136
137 1 boost::optional<double> FoundationKiva_Impl::exteriorHorizontalInsulationDepth() {
138 1 return getDouble(OS_Foundation_KivaFields::ExteriorHorizontalInsulationDepth);
139 }
140
141 2 double FoundationKiva_Impl::exteriorHorizontalInsulationWidth() const {
142
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_Foundation_KivaFields::ExteriorHorizontalInsulationWidth, true);
143
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
144
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
145 }
146
147 5 bool FoundationKiva_Impl::isExteriorHorizontalInsulationWidthDefaulted() const {
148 5 return isEmpty(OS_Foundation_KivaFields::ExteriorHorizontalInsulationWidth);
149 }
150
151 2 boost::optional<Material> FoundationKiva_Impl::exteriorVerticalInsulationMaterial() const {
152
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return getObject<ModelObject>().getModelObjectTarget<Material>(OS_Foundation_KivaFields::ExteriorVerticalInsulationMaterialName);
153 }
154
155 1 boost::optional<double> FoundationKiva_Impl::exteriorVerticalInsulationDepth() {
156 1 return getDouble(OS_Foundation_KivaFields::ExteriorVerticalInsulationDepth);
157 }
158
159 2 double FoundationKiva_Impl::wallHeightAboveGrade() const {
160
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_Foundation_KivaFields::WallHeightAboveGrade, true);
161
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
162
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
163 }
164
165 3 bool FoundationKiva_Impl::isWallHeightAboveGradeDefaulted() const {
166 3 return isEmpty(OS_Foundation_KivaFields::WallHeightAboveGrade);
167 }
168
169 2 double FoundationKiva_Impl::wallDepthBelowSlab() const {
170
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_Foundation_KivaFields::WallDepthBelowSlab, true);
171
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
172
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
173 }
174
175 3 bool FoundationKiva_Impl::isWallDepthBelowSlabDefaulted() const {
176 3 return isEmpty(OS_Foundation_KivaFields::WallDepthBelowSlab);
177 }
178
179 2 boost::optional<ConstructionBase> FoundationKiva_Impl::footingWallConstruction() const {
180
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_Foundation_KivaFields::FootingWallConstructionName);
181 }
182
183 2 boost::optional<Material> FoundationKiva_Impl::footingMaterial() const {
184
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return getObject<ModelObject>().getModelObjectTarget<Material>(OS_Foundation_KivaFields::FootingMaterialName);
185 }
186
187 2 double FoundationKiva_Impl::footingDepth() const {
188
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_Foundation_KivaFields::FootingDepth, true);
189
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
190
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
191 }
192
193 3 bool FoundationKiva_Impl::isFootingDepthDefaulted() const {
194 3 return isEmpty(OS_Foundation_KivaFields::FootingDepth);
195 }
196
197 1 bool FoundationKiva_Impl::setInitialIndoorAirTemperature(double initialIndoorAirTemperature) {
198 1 bool result = setDouble(OS_Foundation_KivaFields::InitialIndoorAirTemperature, initialIndoorAirTemperature);
199
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
200 1 return result;
201 }
202
203 1 bool FoundationKiva_Impl::setInteriorHorizontalInsulationMaterial(const Material& material) {
204
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return setPointer(OS_Foundation_KivaFields::InteriorHorizontalInsulationMaterialName, material.handle());
205 }
206
207 1 void FoundationKiva_Impl::resetInteriorHorizontalInsulationMaterial() {
208
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::InteriorHorizontalInsulationMaterialName, "");
209
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
210 1 }
211
212 4 bool FoundationKiva_Impl::setInteriorHorizontalInsulationDepth(double interiorHorizontalInsulationDepth) {
213 4 bool result = setDouble(OS_Foundation_KivaFields::InteriorHorizontalInsulationDepth, interiorHorizontalInsulationDepth);
214
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 OS_ASSERT(result);
215 4 return result;
216 }
217
218 1 void FoundationKiva_Impl::resetInteriorHorizontalInsulationDepth() {
219
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::InteriorHorizontalInsulationDepth, "");
220
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
221 1 }
222
223 1 bool FoundationKiva_Impl::setInteriorHorizontalInsulationWidth(double interiorHorizontalInsulationWidth) {
224 1 bool result = setDouble(OS_Foundation_KivaFields::InteriorHorizontalInsulationWidth, interiorHorizontalInsulationWidth);
225
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
226 1 return result;
227 }
228
229 1 bool FoundationKiva_Impl::setInteriorVerticalInsulationMaterial(const Material& material) {
230
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return setPointer(OS_Foundation_KivaFields::InteriorVerticalInsulationMaterialName, material.handle());
231 }
232
233 1 void FoundationKiva_Impl::resetInteriorVerticalInsulationMaterial() {
234
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::InteriorVerticalInsulationMaterialName, "");
235
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
236 1 }
237
238 1 bool FoundationKiva_Impl::setInteriorVerticalInsulationDepth(double interiorVerticalInsulationDepth) {
239 1 bool result = setDouble(OS_Foundation_KivaFields::InteriorVerticalInsulationDepth, interiorVerticalInsulationDepth);
240
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
241 1 return result;
242 }
243
244 1 bool FoundationKiva_Impl::setExteriorHorizontalInsulationMaterial(const Material& material) {
245
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return setPointer(OS_Foundation_KivaFields::ExteriorHorizontalInsulationMaterialName, material.handle());
246 }
247
248 1 void FoundationKiva_Impl::resetExteriorHorizontalInsulationMaterial() {
249
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::ExteriorHorizontalInsulationMaterialName, "");
250
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
251 1 }
252
253 1 bool FoundationKiva_Impl::setExteriorHorizontalInsulationDepth(double exteriorHorizontalInsulationDepth) {
254 1 bool result = setDouble(OS_Foundation_KivaFields::ExteriorHorizontalInsulationDepth, exteriorHorizontalInsulationDepth);
255
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
256 1 return result;
257 }
258
259 3 bool FoundationKiva_Impl::setExteriorHorizontalInsulationWidth(double exteriorHorizontalInsulationWidth) {
260 3 bool result = setDouble(OS_Foundation_KivaFields::ExteriorHorizontalInsulationWidth, exteriorHorizontalInsulationWidth);
261
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 OS_ASSERT(result);
262 3 return result;
263 }
264
265 1 void FoundationKiva_Impl::resetExteriorHorizontalInsulationWidth() {
266
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::ExteriorHorizontalInsulationWidth, "");
267
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
268 1 }
269
270 1 bool FoundationKiva_Impl::setExteriorVerticalInsulationMaterial(const Material& material) {
271
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return setPointer(OS_Foundation_KivaFields::ExteriorVerticalInsulationMaterialName, material.handle());
272 }
273
274 1 void FoundationKiva_Impl::resetExteriorVerticalInsulationMaterial() {
275
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::ExteriorVerticalInsulationMaterialName, "");
276
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
277 1 }
278
279 1 bool FoundationKiva_Impl::setExteriorVerticalInsulationDepth(double exteriorVerticalInsulationDepth) {
280 1 bool result = setDouble(OS_Foundation_KivaFields::ExteriorVerticalInsulationDepth, exteriorVerticalInsulationDepth);
281
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
282 1 return result;
283 }
284
285 3 bool FoundationKiva_Impl::setWallHeightAboveGrade(double wallHeightAboveGrade) {
286 3 bool result = setDouble(OS_Foundation_KivaFields::WallHeightAboveGrade, wallHeightAboveGrade);
287
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 OS_ASSERT(result);
288 3 return result;
289 }
290
291 1 void FoundationKiva_Impl::resetWallHeightAboveGrade() {
292
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::WallHeightAboveGrade, "");
293
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
294 1 }
295
296 3 bool FoundationKiva_Impl::setWallDepthBelowSlab(double wallDepthBelowSlab) {
297 3 bool result = setDouble(OS_Foundation_KivaFields::WallDepthBelowSlab, wallDepthBelowSlab);
298
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 OS_ASSERT(result);
299 3 return result;
300 }
301
302 1 void FoundationKiva_Impl::resetWallDepthBelowSlab() {
303
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::WallDepthBelowSlab, "");
304
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
305 1 }
306
307 1 bool FoundationKiva_Impl::setFootingWallConstruction(const ConstructionBase& construction) {
308
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return setPointer(OS_Foundation_KivaFields::FootingWallConstructionName, construction.handle());
309 }
310
311 1 void FoundationKiva_Impl::resetFootingWallConstruction() {
312
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::FootingWallConstructionName, "");
313
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
314 1 }
315
316 1 bool FoundationKiva_Impl::setFootingMaterial(const Material& material) {
317
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return setPointer(OS_Foundation_KivaFields::FootingMaterialName, material.handle());
318 }
319
320 1 void FoundationKiva_Impl::resetFootingMaterial() {
321
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::FootingMaterialName, "");
322
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
323 1 }
324
325 3 bool FoundationKiva_Impl::setFootingDepth(double footingDepth) {
326 3 bool result = setDouble(OS_Foundation_KivaFields::FootingDepth, footingDepth);
327
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 OS_ASSERT(result);
328 3 return result;
329 }
330
331 1 void FoundationKiva_Impl::resetFootingDepth() {
332
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Foundation_KivaFields::FootingDepth, "");
333
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
334 1 }
335
336 3 SurfaceVector FoundationKiva_Impl::surfaces() const {
337
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 return getObject<ModelObject>().getModelObjectSources<Surface>(Surface::iddObjectType());
338 }
339
340 39 unsigned int FoundationKiva_Impl::numberofCustomBlocks() const {
341 39 return numExtensibleGroups();
342 }
343
344 16 bool FoundationKiva_Impl::addCustomBlock(const CustomBlock& customBlock) {
345 bool result;
346
347 16 unsigned int num = numberofCustomBlocks();
348 // Max number of custom blocks is 10
349
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 15 times.
16 if (num >= 10) {
350
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
1 LOG(Warn, briefDescription() << " already has 10 custom blocks which is the limit");
351 1 result = false;
352 } else {
353 // Push an extensible group
354
3/3
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
15 auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
355
3/3
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
15 bool material = eg.setPointer(OS_Foundation_KivaExtensibleFields::CustomBlockMaterialName, customBlock.material().handle());
356
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 bool depth = eg.setDouble(OS_Foundation_KivaExtensibleFields::CustomBlockDepth, customBlock.depth());
357
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 bool xPosition = eg.setDouble(OS_Foundation_KivaExtensibleFields::CustomBlockXPosition, customBlock.xPosition());
358
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 bool zPosition = eg.setDouble(OS_Foundation_KivaExtensibleFields::CustomBlockZPosition, customBlock.zPosition());
359
4/8
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 15 times.
✗ Branch 7 not taken.
15 if (material && depth && xPosition && zPosition) {
360 15 result = true;
361 } else {
362 // Something went wrong
363 // So erase the new extensible group
364 ✗ getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex());
365 ✗ result = false;
366 }
367 15 result = true;
368 15 }
369 16 return result;
370 }
371
372 13 bool FoundationKiva_Impl::addCustomBlock(const Material& material, double depth, double xPosition, double zPosition) {
373 // Make a custom block, and then call the above function
374
1/1
✓ Branch 1 taken 13 times.
13 CustomBlock customBlock(material, depth, xPosition, zPosition);
375
1/1
✓ Branch 1 taken 13 times.
26 return addCustomBlock(customBlock);
376 13 }
377
378 3 bool FoundationKiva_Impl::removeCustomBlock(unsigned groupIndex) {
379 bool result;
380
381 3 unsigned int num = numberofCustomBlocks();
382
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
3 if (groupIndex < num) {
383
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 getObject<ModelObject>().eraseExtensibleGroup(groupIndex);
384 2 result = true;
385 } else {
386 1 result = false;
387 }
388 3 return result;
389 }
390
391 2 void FoundationKiva_Impl::removeAllCustomBlocks() {
392
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 getObject<ModelObject>().clearExtensibleGroups();
393 2 }
394
395 4 std::vector<CustomBlock> FoundationKiva_Impl::customBlocks() const {
396 4 std::vector<CustomBlock> result;
397
398
1/1
✓ Branch 1 taken 4 times.
4 std::vector<IdfExtensibleGroup> groups = extensibleGroups();
399
400
2/2
✓ Branch 5 taken 15 times.
✓ Branch 6 taken 4 times.
19 for (const auto& group : groups) {
401 boost::optional<WorkspaceObject> wo =
402
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 group.cast<WorkspaceExtensibleGroup>().getTarget(OS_Foundation_KivaExtensibleFields::CustomBlockMaterialName);
403
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 boost::optional<Material> material = wo->optionalCast<Material>();
404
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 boost::optional<double> depth = group.cast<WorkspaceExtensibleGroup>().getDouble(OS_Foundation_KivaExtensibleFields::CustomBlockDepth);
405 boost::optional<double> xPosition =
406
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 group.cast<WorkspaceExtensibleGroup>().getDouble(OS_Foundation_KivaExtensibleFields::CustomBlockXPosition);
407 boost::optional<double> zPosition =
408
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 group.cast<WorkspaceExtensibleGroup>().getDouble(OS_Foundation_KivaExtensibleFields::CustomBlockZPosition);
409
410
5/10
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 15 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 15 times.
✗ Branch 9 not taken.
60 if (material && depth && xPosition && zPosition) {
411
5/5
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
✓ Branch 10 taken 15 times.
✓ Branch 13 taken 15 times.
15 CustomBlock customBlock(material.get(), depth.get(), xPosition.get(), zPosition.get());
412
1/1
✓ Branch 1 taken 15 times.
15 result.push_back(customBlock);
413 15 }
414 15 }
415
416 8 return result;
417 4 }
418
419 2 bool FoundationKiva_Impl::addCustomBlocks(const std::vector<CustomBlock>& customBlocks) {
420 2 unsigned int num = numberofCustomBlocks();
421
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
2 if ((num + customBlocks.size()) > 10) {
422
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
1 LOG(Warn, briefDescription() << " would have more than the 10 maximum custom blocks");
423 1 return false;
424 } else {
425
2/2
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 time.
3 for (const CustomBlock& customBlock : customBlocks) {
426
1/1
✓ Branch 1 taken 2 times.
2 addCustomBlock(customBlock);
427 }
428 1 return true;
429 }
430 }
431
432 } // namespace detail
433
434 11 FoundationKiva::FoundationKiva(Model& model) : ModelObject(FoundationKiva::iddObjectType(), model) {}
435
436 7623 IddObjectType FoundationKiva::iddObjectType() {
437
1/1
✓ Branch 1 taken 7623 times.
7623 return {IddObjectType::OS_Foundation_Kiva};
438 }
439
440 2 boost::optional<double> FoundationKiva::initialIndoorAirTemperature() {
441
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->initialIndoorAirTemperature();
442 }
443
444 2 boost::optional<Material> FoundationKiva::interiorHorizontalInsulationMaterial() const {
445
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->interiorHorizontalInsulationMaterial();
446 }
447
448 4 double FoundationKiva::interiorHorizontalInsulationDepth() const {
449
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::FoundationKiva_Impl>()->interiorHorizontalInsulationDepth();
450 }
451
452 5 bool FoundationKiva::isInteriorHorizontalInsulationDepthDefaulted() const {
453
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::FoundationKiva_Impl>()->isInteriorHorizontalInsulationDepthDefaulted();
454 }
455
456 1 boost::optional<double> FoundationKiva::interiorHorizontalInsulationWidth() {
457
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->interiorHorizontalInsulationWidth();
458 }
459
460 2 boost::optional<Material> FoundationKiva::interiorVerticalInsulationMaterial() const {
461
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->interiorVerticalInsulationMaterial();
462 }
463
464 1 boost::optional<double> FoundationKiva::interiorVerticalInsulationDepth() {
465
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->interiorVerticalInsulationDepth();
466 }
467
468 2 boost::optional<Material> FoundationKiva::exteriorHorizontalInsulationMaterial() const {
469
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->exteriorHorizontalInsulationMaterial();
470 }
471
472 1 boost::optional<double> FoundationKiva::exteriorHorizontalInsulationDepth() {
473
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->exteriorHorizontalInsulationDepth();
474 }
475
476 2 double FoundationKiva::exteriorHorizontalInsulationWidth() const {
477
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->exteriorHorizontalInsulationWidth();
478 }
479
480 5 bool FoundationKiva::isExteriorHorizontalInsulationWidthDefaulted() const {
481
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::FoundationKiva_Impl>()->isExteriorHorizontalInsulationWidthDefaulted();
482 }
483
484 2 boost::optional<Material> FoundationKiva::exteriorVerticalInsulationMaterial() const {
485
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->exteriorVerticalInsulationMaterial();
486 }
487
488 1 boost::optional<double> FoundationKiva::exteriorVerticalInsulationDepth() {
489
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->exteriorVerticalInsulationDepth();
490 }
491
492 2 double FoundationKiva::wallHeightAboveGrade() const {
493
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->wallHeightAboveGrade();
494 }
495
496 3 bool FoundationKiva::isWallHeightAboveGradeDefaulted() const {
497
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::FoundationKiva_Impl>()->isWallHeightAboveGradeDefaulted();
498 }
499
500 2 double FoundationKiva::wallDepthBelowSlab() const {
501
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->wallDepthBelowSlab();
502 }
503
504 3 bool FoundationKiva::isWallDepthBelowSlabDefaulted() const {
505
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::FoundationKiva_Impl>()->isWallDepthBelowSlabDefaulted();
506 }
507
508 2 boost::optional<ConstructionBase> FoundationKiva::footingWallConstruction() const {
509
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->footingWallConstruction();
510 }
511
512 2 boost::optional<Material> FoundationKiva::footingMaterial() const {
513
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->footingMaterial();
514 }
515
516 2 double FoundationKiva::footingDepth() const {
517
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->footingDepth();
518 }
519
520 3 bool FoundationKiva::isFootingDepthDefaulted() const {
521
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::FoundationKiva_Impl>()->isFootingDepthDefaulted();
522 }
523
524 1 bool FoundationKiva::setInitialIndoorAirTemperature(double initialIndoorAirTemperature) {
525
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setInitialIndoorAirTemperature(initialIndoorAirTemperature);
526 }
527
528 1 bool FoundationKiva::setInteriorHorizontalInsulationMaterial(const Material& material) {
529
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setInteriorHorizontalInsulationMaterial(material);
530 }
531
532 1 void FoundationKiva::resetInteriorHorizontalInsulationMaterial() {
533
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetInteriorHorizontalInsulationMaterial();
534 1 }
535
536 4 bool FoundationKiva::setInteriorHorizontalInsulationDepth(double interiorHorizontalInsulationDepth) {
537
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::FoundationKiva_Impl>()->setInteriorHorizontalInsulationDepth(interiorHorizontalInsulationDepth);
538 }
539
540 1 void FoundationKiva::resetInteriorHorizontalInsulationDepth() {
541
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetInteriorHorizontalInsulationDepth();
542 1 }
543
544 1 bool FoundationKiva::setInteriorHorizontalInsulationWidth(double interiorHorizontalInsulationWidth) {
545
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setInteriorHorizontalInsulationWidth(interiorHorizontalInsulationWidth);
546 }
547
548 1 bool FoundationKiva::setInteriorVerticalInsulationMaterial(const Material& material) {
549
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setInteriorVerticalInsulationMaterial(material);
550 }
551
552 1 void FoundationKiva::resetInteriorVerticalInsulationMaterial() {
553
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetInteriorVerticalInsulationMaterial();
554 1 }
555
556 1 bool FoundationKiva::setInteriorVerticalInsulationDepth(double interiorVerticalInsulationDepth) {
557
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setInteriorVerticalInsulationDepth(interiorVerticalInsulationDepth);
558 }
559
560 1 bool FoundationKiva::setExteriorHorizontalInsulationMaterial(const Material& material) {
561
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setExteriorHorizontalInsulationMaterial(material);
562 }
563
564 1 void FoundationKiva::resetExteriorHorizontalInsulationMaterial() {
565
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetExteriorHorizontalInsulationMaterial();
566 1 }
567
568 1 bool FoundationKiva::setExteriorHorizontalInsulationDepth(double exteriorHorizontalInsulationDepth) {
569
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setExteriorHorizontalInsulationDepth(exteriorHorizontalInsulationDepth);
570 }
571
572 3 bool FoundationKiva::setExteriorHorizontalInsulationWidth(double exteriorHorizontalInsulationWidth) {
573
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::FoundationKiva_Impl>()->setExteriorHorizontalInsulationWidth(exteriorHorizontalInsulationWidth);
574 }
575
576 1 void FoundationKiva::resetExteriorHorizontalInsulationWidth() {
577
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetExteriorHorizontalInsulationWidth();
578 1 }
579
580 1 bool FoundationKiva::setExteriorVerticalInsulationMaterial(const Material& material) {
581
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setExteriorVerticalInsulationMaterial(material);
582 }
583
584 1 void FoundationKiva::resetExteriorVerticalInsulationMaterial() {
585
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetExteriorVerticalInsulationMaterial();
586 1 }
587
588 1 bool FoundationKiva::setExteriorVerticalInsulationDepth(double exteriorVerticalInsulationDepth) {
589
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setExteriorVerticalInsulationDepth(exteriorVerticalInsulationDepth);
590 }
591
592 3 bool FoundationKiva::setWallHeightAboveGrade(double wallHeightAboveGrade) {
593
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::FoundationKiva_Impl>()->setWallHeightAboveGrade(wallHeightAboveGrade);
594 }
595
596 1 void FoundationKiva::resetWallHeightAboveGrade() {
597
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetWallHeightAboveGrade();
598 1 }
599
600 3 bool FoundationKiva::setWallDepthBelowSlab(double wallDepthBelowSlab) {
601
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::FoundationKiva_Impl>()->setWallDepthBelowSlab(wallDepthBelowSlab);
602 }
603
604 1 void FoundationKiva::resetWallDepthBelowSlab() {
605
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetWallDepthBelowSlab();
606 1 }
607
608 1 bool FoundationKiva::setFootingWallConstruction(const ConstructionBase& construction) {
609
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setFootingWallConstruction(construction);
610 }
611
612 1 void FoundationKiva::resetFootingWallConstruction() {
613
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetFootingWallConstruction();
614 1 }
615
616 1 bool FoundationKiva::setFootingMaterial(const Material& material) {
617
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->setFootingMaterial(material);
618 }
619
620 1 void FoundationKiva::resetFootingMaterial() {
621
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetFootingMaterial();
622 1 }
623
624 3 bool FoundationKiva::setFootingDepth(double footingDepth) {
625
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::FoundationKiva_Impl>()->setFootingDepth(footingDepth);
626 }
627
628 1 void FoundationKiva::resetFootingDepth() {
629
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FoundationKiva_Impl>()->resetFootingDepth();
630 1 }
631
632 3 std::vector<Surface> FoundationKiva::surfaces() const {
633
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::FoundationKiva_Impl>()->surfaces();
634 }
635
636 18 unsigned int FoundationKiva::numberofCustomBlocks() const {
637
1/1
✓ Branch 3 taken 18 times.
18 return getImpl<detail::FoundationKiva_Impl>()->numberofCustomBlocks();
638 }
639
640 1 bool FoundationKiva::addCustomBlock(const CustomBlock& customBlock) {
641
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::FoundationKiva_Impl>()->addCustomBlock(customBlock);
642 }
643
644 13 bool FoundationKiva::addCustomBlock(const Material& material, double depth, double xPosition, double zPosition) {
645
1/1
✓ Branch 3 taken 13 times.
13 return getImpl<detail::FoundationKiva_Impl>()->addCustomBlock(material, depth, xPosition, zPosition);
646 }
647
648 3 void FoundationKiva::removeCustomBlock(int groupIndex) {
649
1/1
✓ Branch 3 taken 3 times.
3 getImpl<detail::FoundationKiva_Impl>()->removeCustomBlock(groupIndex);
650 3 }
651
652 2 void FoundationKiva::removeAllCustomBlocks() {
653
1/1
✓ Branch 3 taken 2 times.
2 getImpl<detail::FoundationKiva_Impl>()->removeAllCustomBlocks();
654 2 }
655
656 4 std::vector<CustomBlock> FoundationKiva::customBlocks() const {
657
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::FoundationKiva_Impl>()->customBlocks();
658 }
659
660 2 bool FoundationKiva::addCustomBlocks(const std::vector<CustomBlock>& customBlocks) {
661
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FoundationKiva_Impl>()->addCustomBlocks(customBlocks);
662 }
663
664 /// @cond
665
1/1
✓ Branch 3 taken 17 times.
17 FoundationKiva::FoundationKiva(std::shared_ptr<detail::FoundationKiva_Impl> impl) : ModelObject(std::move(impl)) {}
666
667 /// @endcond
668
669 } // namespace model
670 } // namespace openstudio
671