GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 94.3% 99 / 0 / 105
Functions: 94.3% 33 / 0 / 35
Branches: 56.7% 55 / 0 / 97

src/model/ZoneAirHeatBalanceAlgorithm.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 "ZoneAirHeatBalanceAlgorithm.hpp"
7 #include "ZoneAirHeatBalanceAlgorithm_Impl.hpp"
8 #include "SimulationControl.hpp"
9 #include "SimulationControl_Impl.hpp"
10 #include "Model.hpp"
11 #include "Model_Impl.hpp"
12
13 #include "../utilities/core/Assert.hpp"
14 #include <utilities/idd/IddFactory.hxx>
15
16 #include <utilities/idd/OS_ZoneAirHeatBalanceAlgorithm_FieldEnums.hxx>
17 #include <utilities/idd/IddEnums.hxx>
18
19 namespace openstudio {
20 namespace model {
21
22 namespace detail {
23
24 216 ZoneAirHeatBalanceAlgorithm_Impl::ZoneAirHeatBalanceAlgorithm_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
25 216 : ModelObject_Impl(idfObject, model, keepHandle) {
26
4/6
✓ Branch 1 taken 216 times.
✓ Branch 4 taken 216 times.
✓ Branch 7 taken 216 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 216 times.
✗ Branch 13 not taken.
216 OS_ASSERT(idfObject.iddObject().type() == ZoneAirHeatBalanceAlgorithm::iddObjectType());
27 216 }
28
29 39 ZoneAirHeatBalanceAlgorithm_Impl::ZoneAirHeatBalanceAlgorithm_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model,
30 39 bool keepHandle)
31 39 : ModelObject_Impl(other, model, keepHandle) {
32
4/6
✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
✓ Branch 7 taken 39 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 39 times.
✗ Branch 13 not taken.
39 OS_ASSERT(other.iddObject().type() == ZoneAirHeatBalanceAlgorithm::iddObjectType());
33 39 }
34
35 110 ZoneAirHeatBalanceAlgorithm_Impl::ZoneAirHeatBalanceAlgorithm_Impl(const ZoneAirHeatBalanceAlgorithm_Impl& other, Model_Impl* model,
36 110 bool keepHandle)
37 110 : ModelObject_Impl(other, model, keepHandle) {}
38
39 // return the parent object in the hierarchy
40 1 boost::optional<ParentObject> ZoneAirHeatBalanceAlgorithm_Impl::parent() const {
41
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 boost::optional<ParentObject> result(model().getUniqueModelObject<SimulationControl>());
42 1 return result;
43 }
44
45 // set the parent, child may have to call methods on the parent
46 ✗ bool ZoneAirHeatBalanceAlgorithm_Impl::setParent(ParentObject& newParent) {
47 ✗ if (newParent.optionalCast<SimulationControl>() && (newParent.model() == model())) {
48 ✗ return true;
49 }
50 ✗ return false;
51 }
52
53 // Get all output variable names that could be associated with this object.
54 1 const std::vector<std::string>& ZoneAirHeatBalanceAlgorithm_Impl::outputVariableNames() const {
55
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;
56 // Not appropriate
57 1 return result;
58 }
59
60 1 IddObjectType ZoneAirHeatBalanceAlgorithm_Impl::iddObjectType() const {
61 1 return ZoneAirHeatBalanceAlgorithm::iddObjectType();
62 }
63
64 50 std::string ZoneAirHeatBalanceAlgorithm_Impl::algorithm() const {
65
1/1
✓ Branch 1 taken 50 times.
50 boost::optional<std::string> value = getString(OS_ZoneAirHeatBalanceAlgorithmFields::Algorithm, true);
66
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✗ Branch 4 not taken.
50 OS_ASSERT(value);
67
2/2
✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
100 return value.get();
68 50 }
69
70 3 bool ZoneAirHeatBalanceAlgorithm_Impl::isAlgorithmDefaulted() const {
71 3 return isEmpty(OS_ZoneAirHeatBalanceAlgorithmFields::Algorithm);
72 }
73
74 51 bool ZoneAirHeatBalanceAlgorithm_Impl::doSpaceHeatBalanceforSizing() const {
75 51 return getBooleanFieldValue(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSizing);
76 }
77
78 5 bool ZoneAirHeatBalanceAlgorithm_Impl::isDoSpaceHeatBalanceforSizingDefaulted() const {
79 5 return isEmpty(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSizing);
80 }
81
82 51 bool ZoneAirHeatBalanceAlgorithm_Impl::doSpaceHeatBalanceforSimulation() const {
83 51 return getBooleanFieldValue(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSimulation);
84 }
85
86 5 bool ZoneAirHeatBalanceAlgorithm_Impl::isDoSpaceHeatBalanceforSimulationDefaulted() const {
87 5 return isEmpty(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSimulation);
88 }
89
90 5 bool ZoneAirHeatBalanceAlgorithm_Impl::setAlgorithm(const std::string& algorithm) {
91 5 bool result = setString(OS_ZoneAirHeatBalanceAlgorithmFields::Algorithm, algorithm);
92 5 return result;
93 }
94
95 1 void ZoneAirHeatBalanceAlgorithm_Impl::resetAlgorithm() {
96
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_ZoneAirHeatBalanceAlgorithmFields::Algorithm, "");
97
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
98 1 }
99
100 6 bool ZoneAirHeatBalanceAlgorithm_Impl::setDoSpaceHeatBalanceforSizing(bool doSpaceHeatBalanceforSizing) {
101 6 this->getBooleanFieldValue(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSizing);
102 6 bool result = false;
103
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
6 if (doSpaceHeatBalanceforSizing) {
104
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
9 result = setString(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSizing, "Yes");
105 } else {
106
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
9 result = setString(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSizing, "No");
107 }
108
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 OS_ASSERT(result);
109 6 return result;
110 }
111
112 1 void ZoneAirHeatBalanceAlgorithm_Impl::resetDoSpaceHeatBalanceforSizing() {
113
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSizing, "");
114
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
115 1 }
116
117 5 bool ZoneAirHeatBalanceAlgorithm_Impl::setDoSpaceHeatBalanceforSimulation(bool doSpaceHeatBalanceforSimulation) {
118 5 bool result = false;
119
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 if (doSpaceHeatBalanceforSimulation) {
120
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
9 result = setString(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSimulation, "Yes");
121 } else {
122
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
6 result = setString(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSimulation, "No");
123 }
124
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 OS_ASSERT(result);
125 5 return result;
126 }
127
128 1 void ZoneAirHeatBalanceAlgorithm_Impl::resetDoSpaceHeatBalanceforSimulation() {
129
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_ZoneAirHeatBalanceAlgorithmFields::DoSpaceHeatBalanceforSimulation, "");
130
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
131 1 }
132
133 } // namespace detail
134
135 9241 IddObjectType ZoneAirHeatBalanceAlgorithm::iddObjectType() {
136
1/1
✓ Branch 1 taken 9241 times.
9241 return {IddObjectType::OS_ZoneAirHeatBalanceAlgorithm};
137 }
138
139 ✗ std::vector<std::string> ZoneAirHeatBalanceAlgorithm::validAlgorithmValues() {
140 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ZoneAirHeatBalanceAlgorithmFields::Algorithm);
141 }
142
143 50 std::string ZoneAirHeatBalanceAlgorithm::algorithm() const {
144
1/1
✓ Branch 3 taken 50 times.
50 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->algorithm();
145 }
146
147 3 bool ZoneAirHeatBalanceAlgorithm::isAlgorithmDefaulted() const {
148
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->isAlgorithmDefaulted();
149 }
150
151 51 bool ZoneAirHeatBalanceAlgorithm::doSpaceHeatBalanceforSizing() const {
152
1/1
✓ Branch 3 taken 51 times.
51 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->doSpaceHeatBalanceforSizing();
153 }
154
155 5 bool ZoneAirHeatBalanceAlgorithm::isDoSpaceHeatBalanceforSizingDefaulted() const {
156
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->isDoSpaceHeatBalanceforSizingDefaulted();
157 }
158
159 51 bool ZoneAirHeatBalanceAlgorithm::doSpaceHeatBalanceforSimulation() const {
160
1/1
✓ Branch 3 taken 51 times.
51 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->doSpaceHeatBalanceforSimulation();
161 }
162
163 5 bool ZoneAirHeatBalanceAlgorithm::isDoSpaceHeatBalanceforSimulationDefaulted() const {
164
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->isDoSpaceHeatBalanceforSimulationDefaulted();
165 }
166
167 5 bool ZoneAirHeatBalanceAlgorithm::setAlgorithm(const std::string& algorithm) {
168
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->setAlgorithm(algorithm);
169 }
170
171 1 void ZoneAirHeatBalanceAlgorithm::resetAlgorithm() {
172
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->resetAlgorithm();
173 1 }
174
175 6 bool ZoneAirHeatBalanceAlgorithm::setDoSpaceHeatBalanceforSizing(bool doSpaceHeatBalanceforSizing) {
176
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->setDoSpaceHeatBalanceforSizing(doSpaceHeatBalanceforSizing);
177 }
178
179 1 void ZoneAirHeatBalanceAlgorithm::resetDoSpaceHeatBalanceforSizing() {
180
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->resetDoSpaceHeatBalanceforSizing();
181 1 }
182
183 5 bool ZoneAirHeatBalanceAlgorithm::setDoSpaceHeatBalanceforSimulation(bool doSpaceHeatBalanceforSimulation) {
184
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->setDoSpaceHeatBalanceforSimulation(doSpaceHeatBalanceforSimulation);
185 }
186
187 1 void ZoneAirHeatBalanceAlgorithm::resetDoSpaceHeatBalanceforSimulation() {
188
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>()->resetDoSpaceHeatBalanceforSimulation();
189 1 }
190
191 /// @cond
192 100 ZoneAirHeatBalanceAlgorithm::ZoneAirHeatBalanceAlgorithm(std::shared_ptr<detail::ZoneAirHeatBalanceAlgorithm_Impl> impl)
193
1/1
✓ Branch 3 taken 100 times.
100 : ModelObject(std::move(impl)) {}
194
195 176 ZoneAirHeatBalanceAlgorithm::ZoneAirHeatBalanceAlgorithm(Model& model) : ModelObject(ZoneAirHeatBalanceAlgorithm::iddObjectType(), model) {
196
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 176 times.
✗ Branch 5 not taken.
176 OS_ASSERT(getImpl<detail::ZoneAirHeatBalanceAlgorithm_Impl>());
197
198 // Leaving the IDD defaults
199 // Algorithm: ThirdOrderBackwardDifference
200 // DoSpaceHeatBalanceforSizing: false
201 // DoSpaceHeatBalanceforSimulation: false
202 176 }
203
204 /// @endcond
205
206 } // namespace model
207 } // namespace openstudio
208