GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 97.1% 68 / 0 / 70
Functions: 100.0% 23 / 0 / 23
Branches: 66.0% 35 / 0 / 53

src/model/SimpleGlazing.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 "SimpleGlazing.hpp"
7 #include "SimpleGlazing_Impl.hpp"
8
9 #include <utilities/idd/OS_WindowMaterial_SimpleGlazingSystem_FieldEnums.hxx>
10 #include <utilities/idd/IddEnums.hxx>
11
12 #include "../utilities/core/Assert.hpp"
13
14 namespace openstudio {
15 namespace model {
16
17 namespace detail {
18
19 263 SimpleGlazing_Impl::SimpleGlazing_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
20 263 : Glazing_Impl(idfObject, model, keepHandle) {
21
4/6
✓ Branch 1 taken 263 times.
✓ Branch 4 taken 263 times.
✓ Branch 7 taken 263 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 263 times.
✗ Branch 13 not taken.
263 OS_ASSERT(idfObject.iddObject().type() == SimpleGlazing::iddObjectType());
22 263 }
23
24 56 SimpleGlazing_Impl::SimpleGlazing_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
25 56 : Glazing_Impl(other, model, keepHandle) {
26
4/6
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
✓ Branch 7 taken 56 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 56 times.
✗ Branch 13 not taken.
56 OS_ASSERT(other.iddObject().type() == SimpleGlazing::iddObjectType());
27 56 }
28
29 152 SimpleGlazing_Impl::SimpleGlazing_Impl(const SimpleGlazing_Impl& other, Model_Impl* model, bool keepHandle)
30 152 : Glazing_Impl(other, model, keepHandle) {}
31
32 1 const std::vector<std::string>& SimpleGlazing_Impl::outputVariableNames() const {
33
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;
34 1 return result;
35 }
36
37 2 IddObjectType SimpleGlazing_Impl::iddObjectType() const {
38 2 return SimpleGlazing::iddObjectType();
39 }
40
41 6 boost::optional<double> SimpleGlazing_Impl::getVisibleTransmittance() const {
42 6 return visibleTransmittance();
43 }
44
45 78 double SimpleGlazing_Impl::uFactor() const {
46
1/1
✓ Branch 1 taken 78 times.
78 boost::optional<double> value = getDouble(OS_WindowMaterial_SimpleGlazingSystemFields::UFactor, true);
47
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
✗ Branch 4 not taken.
78 OS_ASSERT(value);
48
1/1
✓ Branch 1 taken 78 times.
156 return value.get();
49 }
50
51 78 double SimpleGlazing_Impl::solarHeatGainCoefficient() const {
52
1/1
✓ Branch 1 taken 78 times.
78 boost::optional<double> value = getDouble(OS_WindowMaterial_SimpleGlazingSystemFields::SolarHeatGainCoefficient, true);
53
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
✗ Branch 4 not taken.
78 OS_ASSERT(value);
54
1/1
✓ Branch 1 taken 78 times.
156 return value.get();
55 }
56
57 86 boost::optional<double> SimpleGlazing_Impl::visibleTransmittance() const {
58 86 return getDouble(OS_WindowMaterial_SimpleGlazingSystemFields::VisibleTransmittance, true);
59 }
60
61 407 bool SimpleGlazing_Impl::setUFactor(double uFactor) {
62 407 bool result = setDouble(OS_WindowMaterial_SimpleGlazingSystemFields::UFactor, uFactor);
63 407 return result;
64 }
65
66 407 bool SimpleGlazing_Impl::setSolarHeatGainCoefficient(double solarHeatGainCoefficient) {
67 407 bool result = setDouble(OS_WindowMaterial_SimpleGlazingSystemFields::SolarHeatGainCoefficient, solarHeatGainCoefficient);
68 407 return result;
69 }
70
71 199 bool SimpleGlazing_Impl::setVisibleTransmittance(boost::optional<double> visibleTransmittance) {
72 199 bool result(false);
73
1/2
✓ Branch 0 taken 199 times.
✗ Branch 1 not taken.
199 if (visibleTransmittance) {
74 199 result = setDouble(OS_WindowMaterial_SimpleGlazingSystemFields::VisibleTransmittance, visibleTransmittance.get());
75 } else {
76 ✗ resetVisibleTransmittance();
77 ✗ result = true;
78 }
79 199 return result;
80 }
81
82 1 void SimpleGlazing_Impl::resetVisibleTransmittance() {
83
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_SimpleGlazingSystemFields::VisibleTransmittance, "");
84
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
85 1 }
86
87 } // namespace detail
88
89 206 SimpleGlazing::SimpleGlazing(const Model& model, double uFactor, double solarHeatGainCoefficient) : Glazing(SimpleGlazing::iddObjectType(), model) {
90
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
✗ Branch 5 not taken.
206 OS_ASSERT(getImpl<detail::SimpleGlazing_Impl>());
91
92 206 bool ok = true;
93
1/1
✓ Branch 1 taken 206 times.
206 ok = setUFactor(uFactor);
94
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 3 not taken.
206 OS_ASSERT(ok);
95
1/1
✓ Branch 1 taken 206 times.
206 ok = setSolarHeatGainCoefficient(solarHeatGainCoefficient);
96
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 3 not taken.
206 OS_ASSERT(ok);
97 206 }
98
99 8127 IddObjectType SimpleGlazing::iddObjectType() {
100
1/1
✓ Branch 1 taken 8127 times.
8127 return {IddObjectType::OS_WindowMaterial_SimpleGlazingSystem};
101 }
102
103 78 double SimpleGlazing::uFactor() const {
104
1/1
✓ Branch 3 taken 78 times.
78 return getImpl<detail::SimpleGlazing_Impl>()->uFactor();
105 }
106
107 78 double SimpleGlazing::solarHeatGainCoefficient() const {
108
1/1
✓ Branch 3 taken 78 times.
78 return getImpl<detail::SimpleGlazing_Impl>()->solarHeatGainCoefficient();
109 }
110
111 80 boost::optional<double> SimpleGlazing::visibleTransmittance() const {
112
1/1
✓ Branch 3 taken 80 times.
80 return getImpl<detail::SimpleGlazing_Impl>()->visibleTransmittance();
113 }
114
115 407 bool SimpleGlazing::setUFactor(double uFactor) {
116
1/1
✓ Branch 3 taken 407 times.
407 return getImpl<detail::SimpleGlazing_Impl>()->setUFactor(uFactor);
117 }
118
119 407 bool SimpleGlazing::setSolarHeatGainCoefficient(double solarHeatGainCoefficient) {
120
1/1
✓ Branch 3 taken 407 times.
407 return getImpl<detail::SimpleGlazing_Impl>()->setSolarHeatGainCoefficient(solarHeatGainCoefficient);
121 }
122
123 199 bool SimpleGlazing::setVisibleTransmittance(double visibleTransmittance) {
124
2/2
✓ Branch 3 taken 199 times.
✓ Branch 6 taken 199 times.
199 return getImpl<detail::SimpleGlazing_Impl>()->setVisibleTransmittance(visibleTransmittance);
125 }
126
127 1 void SimpleGlazing::resetVisibleTransmittance() {
128
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::SimpleGlazing_Impl>()->resetVisibleTransmittance();
129 1 }
130
131 /// @cond
132
1/1
✓ Branch 3 taken 111 times.
111 SimpleGlazing::SimpleGlazing(std::shared_ptr<detail::SimpleGlazing_Impl> impl) : Glazing(std::move(impl)) {}
133 /// @endcond
134
135 } // namespace model
136 } // namespace openstudio
137