GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 62.4% 88 / 0 / 141
Functions: 68.6% 24 / 0 / 35
Branches: 46.4% 52 / 0 / 112

src/model/SpaceInfiltrationEffectiveLeakageArea.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 "SpaceInfiltrationEffectiveLeakageArea.hpp"
7 #include "SpaceInfiltrationEffectiveLeakageArea_Impl.hpp"
8
9 #include "Schedule.hpp"
10 #include "Schedule_Impl.hpp"
11 #include "Space.hpp"
12 #include "Space_Impl.hpp"
13 #include "SpaceType.hpp"
14 #include "SpaceType_Impl.hpp"
15 #include "DefaultScheduleSet.hpp"
16 #include "DefaultScheduleSet_Impl.hpp"
17 #include "LifeCycleCost.hpp"
18
19 #include <utilities/idd/IddFactory.hxx>
20
21 #include <utilities/idd/OS_SpaceInfiltration_EffectiveLeakageArea_FieldEnums.hxx>
22 #include <utilities/idd/IddEnums.hxx>
23
24 #include "../utilities/core/Assert.hpp"
25
26 namespace openstudio {
27 namespace model {
28
29 namespace detail {
30
31 7 SpaceInfiltrationEffectiveLeakageArea_Impl::SpaceInfiltrationEffectiveLeakageArea_Impl(const IdfObject& idfObject, Model_Impl* model,
32 7 bool keepHandle)
33 7 : SpaceLoad_Impl(idfObject, model, keepHandle) {
34
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() == SpaceInfiltrationEffectiveLeakageArea::iddObjectType());
35 7 }
36
37 ✗ SpaceInfiltrationEffectiveLeakageArea_Impl::SpaceInfiltrationEffectiveLeakageArea_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
38 ✗ Model_Impl* model, bool keepHandle)
39 ✗ : SpaceLoad_Impl(other, model, keepHandle) {
40 ✗ OS_ASSERT(other.iddObject().type() == SpaceInfiltrationEffectiveLeakageArea::iddObjectType());
41 ✗ }
42
43 31 SpaceInfiltrationEffectiveLeakageArea_Impl::SpaceInfiltrationEffectiveLeakageArea_Impl(const SpaceInfiltrationEffectiveLeakageArea_Impl& other,
44 31 Model_Impl* model, bool keepHandle)
45 31 : SpaceLoad_Impl(other, model, keepHandle) {}
46
47 ✗ const std::vector<std::string>& SpaceInfiltrationEffectiveLeakageArea_Impl::outputVariableNames() const {
48 ✗ static const std::vector<std::string> result;
49 ✗ return result;
50 }
51
52 ✗ IddObjectType SpaceInfiltrationEffectiveLeakageArea_Impl::iddObjectType() const {
53 ✗ return SpaceInfiltrationEffectiveLeakageArea::iddObjectType();
54 }
55
56 ✗ std::vector<ScheduleTypeKey> SpaceInfiltrationEffectiveLeakageArea_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
57 ✗ std::vector<ScheduleTypeKey> result;
58 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
59 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
60 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
61 ✗ if (std::find(b, e, OS_SpaceInfiltration_EffectiveLeakageAreaFields::ScheduleName) != e) {
62 ✗ result.push_back(ScheduleTypeKey("SpaceInfiltrationEffectiveLeakageArea", "Infiltration"));
63 }
64 ✗ return result;
65 ✗ }
66
67 12 bool SpaceInfiltrationEffectiveLeakageArea_Impl::hardSize() {
68
1/1
✓ Branch 1 taken 12 times.
12 boost::optional<Space> space = this->space();
69
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
12 if (!space) {
70 ✗ return false;
71 }
72 12 return false;
73 12 }
74
75 16 bool SpaceInfiltrationEffectiveLeakageArea_Impl::hardApplySchedules() {
76 16 bool result = false;
77
1/1
✓ Branch 1 taken 16 times.
16 boost::optional<Schedule> schedule = this->schedule();
78
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (schedule) {
79 ✗ result = this->setSchedule(*schedule);
80 }
81 16 return result;
82 16 }
83
84 ✗ bool SpaceInfiltrationEffectiveLeakageArea_Impl::isAbsolute() const {
85 ✗ return true;
86 }
87
88 27 double SpaceInfiltrationEffectiveLeakageArea_Impl::effectiveAirLeakageArea() const {
89
1/1
✓ Branch 1 taken 27 times.
27 boost::optional<double> value = getDouble(OS_SpaceInfiltration_EffectiveLeakageAreaFields::EffectiveAirLeakageArea, true);
90
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 4 not taken.
27 OS_ASSERT(value);
91
1/1
✓ Branch 1 taken 27 times.
54 return value.get();
92 }
93
94 15 double SpaceInfiltrationEffectiveLeakageArea_Impl::stackCoefficient() const {
95
1/1
✓ Branch 1 taken 15 times.
15 boost::optional<double> value = getDouble(OS_SpaceInfiltration_EffectiveLeakageAreaFields::StackCoefficient, true);
96
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 4 not taken.
15 OS_ASSERT(value);
97
1/1
✓ Branch 1 taken 15 times.
30 return value.get();
98 }
99
100 15 double SpaceInfiltrationEffectiveLeakageArea_Impl::windCoefficient() const {
101
1/1
✓ Branch 1 taken 15 times.
15 boost::optional<double> value = getDouble(OS_SpaceInfiltration_EffectiveLeakageAreaFields::WindCoefficient, true);
102
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 4 not taken.
15 OS_ASSERT(value);
103
1/1
✓ Branch 1 taken 15 times.
30 return value.get();
104 }
105
106 13 bool SpaceInfiltrationEffectiveLeakageArea_Impl::setEffectiveAirLeakageArea(double effectiveAirLeakageArea) {
107 13 bool result = setDouble(OS_SpaceInfiltration_EffectiveLeakageAreaFields::EffectiveAirLeakageArea, effectiveAirLeakageArea);
108 13 return result;
109 }
110
111 9 bool SpaceInfiltrationEffectiveLeakageArea_Impl::setStackCoefficient(double stackCoefficient) {
112 9 bool result = setDouble(OS_SpaceInfiltration_EffectiveLeakageAreaFields::StackCoefficient, stackCoefficient);
113 9 return result;
114 }
115
116 9 bool SpaceInfiltrationEffectiveLeakageArea_Impl::setWindCoefficient(double windCoefficient) {
117 9 bool result = setDouble(OS_SpaceInfiltration_EffectiveLeakageAreaFields::WindCoefficient, windCoefficient);
118 9 return result;
119 }
120
121 149 int SpaceInfiltrationEffectiveLeakageArea_Impl::spaceIndex() const {
122 149 return OS_SpaceInfiltration_EffectiveLeakageAreaFields::SpaceorSpaceTypeName;
123 }
124
125 30 boost::optional<Schedule> SpaceInfiltrationEffectiveLeakageArea_Impl::schedule() const {
126 boost::optional<Schedule> result =
127
2/2
✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
30 getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_SpaceInfiltration_EffectiveLeakageAreaFields::ScheduleName);
128
2/2
✓ Branch 1 taken 29 times.
✓ Branch 2 taken 1 time.
30 if (!result) {
129 // search upwards
130
1/1
✓ Branch 1 taken 29 times.
29 OptionalSpace space = this->space();
131
1/1
✓ Branch 1 taken 29 times.
29 OptionalSpaceType spaceType = this->spaceType();
132
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 4 times.
29 if (space) {
133
3/3
✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
25 result = space->getDefaultSchedule(DefaultScheduleType::InfiltrationSchedule);
134
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 } else if (spaceType) {
135
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
4 result = spaceType->getDefaultSchedule(DefaultScheduleType::InfiltrationSchedule);
136 }
137 29 }
138 30 return result;
139 ✗ }
140
141 ✗ bool SpaceInfiltrationEffectiveLeakageArea_Impl::isScheduleDefaulted() const {
142 ✗ return isEmpty(OS_SpaceInfiltration_EffectiveLeakageAreaFields::ScheduleName);
143 }
144
145 1 bool SpaceInfiltrationEffectiveLeakageArea_Impl::setSchedule(Schedule& schedule) {
146
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
4 bool result = ModelObject_Impl::setSchedule(OS_SpaceInfiltration_EffectiveLeakageAreaFields::ScheduleName,
147 "SpaceInfiltrationEffectiveLeakageArea", "Infiltration", schedule);
148 1 return result;
149 }
150
151 ✗ void SpaceInfiltrationEffectiveLeakageArea_Impl::resetSchedule() {
152 ✗ bool result = setString(OS_SpaceInfiltration_EffectiveLeakageAreaFields::ScheduleName, "");
153 ✗ OS_ASSERT(result);
154 ✗ }
155
156 ✗ boost::optional<ModelObject> SpaceInfiltrationEffectiveLeakageArea_Impl::scheduleAsModelObject() const {
157 ✗ OptionalModelObject result;
158 ✗ OptionalSchedule intermediate = schedule();
159 ✗ if (intermediate) {
160 ✗ result = *intermediate;
161 }
162 ✗ return result;
163 ✗ }
164
165 ✗ bool SpaceInfiltrationEffectiveLeakageArea_Impl::setScheduleAsModelObject(const boost::optional<ModelObject>& modelObject) {
166 ✗ if (modelObject) {
167 ✗ OptionalSchedule intermediate = modelObject->optionalCast<Schedule>();
168 ✗ if (intermediate) {
169 ✗ Schedule schedule(*intermediate);
170 ✗ return setSchedule(schedule);
171 ✗ } else {
172 ✗ return false;
173 }
174 ✗ } else {
175 ✗ resetSchedule();
176 }
177 ✗ return true;
178 }
179
180 } // namespace detail
181
182 7 SpaceInfiltrationEffectiveLeakageArea::SpaceInfiltrationEffectiveLeakageArea(const Model& model)
183 7 : SpaceLoad(SpaceInfiltrationEffectiveLeakageArea::iddObjectType(), model) {
184
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
✗ Branch 5 not taken.
7 OS_ASSERT(getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>());
185
1/1
✓ Branch 1 taken 7 times.
7 bool test = setEffectiveAirLeakageArea(0.1);
186
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
7 OS_ASSERT(test);
187
1/1
✓ Branch 1 taken 7 times.
7 test = setStackCoefficient(0.1);
188
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
7 OS_ASSERT(test);
189
1/1
✓ Branch 1 taken 7 times.
7 test = setWindCoefficient(0.1);
190
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
7 OS_ASSERT(test);
191 7 }
192
193 10785 IddObjectType SpaceInfiltrationEffectiveLeakageArea::iddObjectType() {
194
1/1
✓ Branch 1 taken 10785 times.
10785 IddObjectType result(IddObjectType::OS_SpaceInfiltration_EffectiveLeakageArea);
195 10785 return result;
196 }
197
198 14 boost::optional<Schedule> SpaceInfiltrationEffectiveLeakageArea::schedule() const {
199
1/1
✓ Branch 3 taken 14 times.
14 return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->schedule();
200 }
201
202 ✗ bool SpaceInfiltrationEffectiveLeakageArea::isScheduleDefaulted() const {
203 ✗ return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->isScheduleDefaulted();
204 }
205
206 27 double SpaceInfiltrationEffectiveLeakageArea::effectiveAirLeakageArea() const {
207
1/1
✓ Branch 3 taken 27 times.
27 return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->effectiveAirLeakageArea();
208 }
209
210 15 double SpaceInfiltrationEffectiveLeakageArea::stackCoefficient() const {
211
1/1
✓ Branch 3 taken 15 times.
15 return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->stackCoefficient();
212 }
213
214 15 double SpaceInfiltrationEffectiveLeakageArea::windCoefficient() const {
215
1/1
✓ Branch 3 taken 15 times.
15 return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->windCoefficient();
216 }
217
218 1 bool SpaceInfiltrationEffectiveLeakageArea::setSchedule(Schedule& schedule) {
219
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->setSchedule(schedule);
220 }
221
222 ✗ void SpaceInfiltrationEffectiveLeakageArea::resetSchedule() {
223 ✗ getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->resetSchedule();
224 ✗ }
225
226 13 bool SpaceInfiltrationEffectiveLeakageArea::setEffectiveAirLeakageArea(double effectiveAirLeakageArea) {
227
1/1
✓ Branch 3 taken 13 times.
13 return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->setEffectiveAirLeakageArea(effectiveAirLeakageArea);
228 }
229
230 9 bool SpaceInfiltrationEffectiveLeakageArea::setStackCoefficient(double stackCoefficient) {
231
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->setStackCoefficient(stackCoefficient);
232 }
233
234 9 bool SpaceInfiltrationEffectiveLeakageArea::setWindCoefficient(double windCoefficient) {
235
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::SpaceInfiltrationEffectiveLeakageArea_Impl>()->setWindCoefficient(windCoefficient);
236 }
237
238 /// @cond
239 86 SpaceInfiltrationEffectiveLeakageArea::SpaceInfiltrationEffectiveLeakageArea(
240 86 std::shared_ptr<detail::SpaceInfiltrationEffectiveLeakageArea_Impl> impl)
241
1/1
✓ Branch 3 taken 86 times.
86 : SpaceLoad(std::move(impl)) {}
242 /// @endcond
243
244 } // namespace model
245 } // namespace openstudio
246