GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 33.9% 58 / 0 / 171
Functions: 31.1% 14 / 0 / 45
Branches: 51.7% 46 / 0 / 89

src/airflow/contam/PrjSubobjectsImpl.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 "PrjSubobjectsImpl.hpp"
7 #include "../../utilities/core/StringHelpers.hpp"
8 namespace openstudio {
9 namespace contam {
10 namespace detail {
11
12 16 void WeatherDataImpl::setDefaults() {
13
1/1
✓ Branch 1 taken 16 times.
32 m_Tambt = PRJFLOAT("0.0");
14
1/1
✓ Branch 1 taken 16 times.
32 m_barpres = PRJFLOAT("0.0");
15
1/1
✓ Branch 1 taken 16 times.
32 m_windspd = PRJFLOAT("0.0");
16
1/1
✓ Branch 1 taken 16 times.
32 m_winddir = PRJFLOAT("0.0");
17
1/1
✓ Branch 1 taken 16 times.
16 m_relhum = PRJFLOAT("0.0");
18 16 m_daytyp = 0;
19 16 m_uTa = 0;
20 16 m_ubP = 0;
21 16 m_uws = 0;
22 16 m_uwd = 0;
23 16 }
24
25 16 WeatherDataImpl::WeatherDataImpl() {
26
1/1
✓ Branch 1 taken 16 times.
16 setDefaults();
27 16 }
28
29 ✗ WeatherDataImpl::WeatherDataImpl(std::string Tambt, std::string barpres, std::string windspd, std::string winddir, std::string relhum, int daytyp,
30 ✗ int uTa, int ubP, int uws, int uwd) {
31 ✗ setDefaults();
32 ✗ setTambt(Tambt);
33 ✗ setBarpres(barpres);
34 ✗ setWindspd(windspd);
35 ✗ setWinddir(winddir);
36 ✗ setRelhum(relhum);
37 ✗ setDaytyp(daytyp);
38 ✗ setUTa(uTa);
39 ✗ setUbP(ubP);
40 ✗ setUws(uws);
41 ✗ setUwd(uwd);
42 ✗ }
43
44 ✗ WeatherDataImpl::WeatherDataImpl(double Tambt, double barpres, double windspd, double winddir, double relhum, int daytyp, int uTa, int ubP,
45 ✗ int uws, int uwd) {
46 ✗ setDefaults();
47 ✗ setTambt(Tambt);
48 ✗ setBarpres(barpres);
49 ✗ setWindspd(windspd);
50 ✗ setWinddir(winddir);
51 ✗ setRelhum(relhum);
52 ✗ setDaytyp(daytyp);
53 ✗ setUTa(uTa);
54 ✗ setUbP(ubP);
55 ✗ setUws(uws);
56 ✗ setUwd(uwd);
57 ✗ }
58
59 12 void WeatherDataImpl::read(Reader& input) {
60
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 setTambt(input.readNumber<std::string>());
61
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 setBarpres(input.readNumber<std::string>());
62
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 setWindspd(input.readNumber<std::string>());
63
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 setWinddir(input.readNumber<std::string>());
64
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 setRelhum(input.readNumber<std::string>());
65 12 setDaytyp(input.read<int>());
66 12 setUTa(input.read<int>());
67 12 setUbP(input.read<int>());
68 12 setUws(input.read<int>());
69 12 setUwd(input.read<int>());
70 12 }
71
72 2 std::string WeatherDataImpl::write() {
73 2 std::string string;
74
11/11
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
✓ Branch 22 taken 2 times.
✓ Branch 25 taken 2 times.
✓ Branch 28 taken 2 times.
✓ Branch 31 taken 2 times.
4 string += ANY_TO_STR(m_Tambt) + ' ' + ANY_TO_STR(m_barpres) + ' ' + ANY_TO_STR(m_windspd) + ' ' + ANY_TO_STR(m_winddir) + ' '
75
14/14
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
✓ Branch 22 taken 2 times.
✓ Branch 25 taken 2 times.
✓ Branch 28 taken 2 times.
✓ Branch 31 taken 2 times.
✓ Branch 34 taken 2 times.
✓ Branch 37 taken 2 times.
✓ Branch 40 taken 2 times.
8 + ANY_TO_STR(m_relhum) + ' ' + ANY_TO_STR(m_daytyp) + ' ' + ANY_TO_STR(m_uTa) + ' ' + ANY_TO_STR(m_ubP) + ' ' + ANY_TO_STR(m_uws)
76
5/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
6 + ' ' + ANY_TO_STR(m_uwd) + '\n';
77 2 return string;
78 ✗ }
79
80 ✗ double WeatherDataImpl::Tambt() const {
81 ✗ return openstudio::string_conversions::to<double>(m_Tambt);
82 }
83
84 ✗ bool WeatherDataImpl::setTambt(const double Tambt) {
85 ✗ m_Tambt = openstudio::string_conversions::number(Tambt);
86 ✗ return true;
87 }
88
89 12 bool WeatherDataImpl::setTambt(const std::string& Tambt) {
90 12 return assign_if_valid<double>(Tambt, m_Tambt);
91 }
92
93 ✗ double WeatherDataImpl::barpres() const {
94 ✗ return openstudio::string_conversions::to<double>(m_barpres);
95 }
96
97 ✗ bool WeatherDataImpl::setBarpres(const double barpres) {
98 ✗ m_barpres = openstudio::string_conversions::number(barpres);
99 ✗ return true;
100 }
101
102 12 bool WeatherDataImpl::setBarpres(const std::string& barpres) {
103 12 return assign_if_valid<double>(barpres, m_barpres);
104 }
105
106 ✗ double WeatherDataImpl::windspd() const {
107 ✗ return openstudio::string_conversions::to<double>(m_windspd);
108 }
109
110 ✗ bool WeatherDataImpl::setWindspd(const double windspd) {
111 ✗ m_windspd = openstudio::string_conversions::number(windspd);
112 ✗ return true;
113 }
114
115 12 bool WeatherDataImpl::setWindspd(const std::string& windspd) {
116 12 return assign_if_valid<double>(windspd, m_windspd);
117 }
118
119 ✗ double WeatherDataImpl::winddir() const {
120 ✗ return openstudio::string_conversions::to<double>(m_winddir);
121 }
122
123 ✗ bool WeatherDataImpl::setWinddir(const double winddir) {
124 ✗ m_winddir = openstudio::string_conversions::number(winddir);
125 ✗ return true;
126 }
127
128 12 bool WeatherDataImpl::setWinddir(const std::string& winddir) {
129 12 return assign_if_valid<double>(winddir, m_winddir);
130 }
131
132 ✗ double WeatherDataImpl::relhum() const {
133 ✗ return openstudio::string_conversions::to<double>(m_relhum);
134 }
135
136 ✗ bool WeatherDataImpl::setRelhum(const double relhum) {
137 ✗ m_relhum = openstudio::string_conversions::number(relhum);
138 ✗ return true;
139 }
140
141 12 bool WeatherDataImpl::setRelhum(const std::string& relhum) {
142 12 return assign_if_valid<double>(relhum, m_relhum);
143 }
144
145 ✗ int WeatherDataImpl::daytyp() const {
146 ✗ return m_daytyp;
147 }
148
149 12 void WeatherDataImpl::setDaytyp(const int daytyp) {
150 12 m_daytyp = daytyp;
151 12 }
152
153 ✗ int WeatherDataImpl::uTa() const {
154 ✗ return m_uTa;
155 }
156
157 12 void WeatherDataImpl::setUTa(const int uTa) {
158 12 m_uTa = uTa;
159 12 }
160
161 ✗ int WeatherDataImpl::ubP() const {
162 ✗ return m_ubP;
163 }
164
165 12 void WeatherDataImpl::setUbP(const int ubP) {
166 12 m_ubP = ubP;
167 12 }
168
169 ✗ int WeatherDataImpl::uws() const {
170 ✗ return m_uws;
171 }
172
173 12 void WeatherDataImpl::setUws(const int uws) {
174 12 m_uws = uws;
175 12 }
176
177 ✗ int WeatherDataImpl::uwd() const {
178 ✗ return m_uwd;
179 }
180
181 12 void WeatherDataImpl::setUwd(const int uwd) {
182 12 m_uwd = uwd;
183 12 }
184
185 ✗ void IconImpl::setDefaults() {
186 ✗ m_icon = 0;
187 ✗ m_col = 0;
188 ✗ m_row = 0;
189 ✗ m_nr = 0;
190 ✗ }
191
192 ✗ IconImpl::IconImpl() {
193 ✗ setDefaults();
194 ✗ }
195
196 ✗ IconImpl::IconImpl(int icon, int col, int row, int nr) {
197 ✗ setDefaults();
198 ✗ setIcon(icon);
199 ✗ setCol(col);
200 ✗ setRow(row);
201 ✗ setNr(nr);
202 ✗ }
203
204 ✗ void IconImpl::read(Reader& input) {
205 ✗ setIcon(input.read<int>());
206 ✗ setCol(input.read<int>());
207 ✗ setRow(input.read<int>());
208 ✗ setNr(input.read<int>());
209 ✗ }
210
211 ✗ std::string IconImpl::write() {
212 ✗ std::string string;
213 ✗ string += ANY_TO_STR(m_icon) + ' ' + ANY_TO_STR(m_col) + ' ' + ANY_TO_STR(m_row) + ' ' + ANY_TO_STR(m_nr) + '\n';
214 ✗ return string;
215 ✗ }
216
217 ✗ int IconImpl::icon() const {
218 ✗ return m_icon;
219 }
220
221 ✗ void IconImpl::setIcon(const int icon) {
222 ✗ m_icon = icon;
223 ✗ }
224
225 ✗ int IconImpl::col() const {
226 ✗ return m_col;
227 }
228
229 ✗ void IconImpl::setCol(const int col) {
230 ✗ m_col = col;
231 ✗ }
232
233 ✗ int IconImpl::row() const {
234 ✗ return m_row;
235 }
236
237 ✗ void IconImpl::setRow(const int row) {
238 ✗ m_row = row;
239 ✗ }
240
241 ✗ int IconImpl::nr() const {
242 ✗ return m_nr;
243 }
244
245 ✗ void IconImpl::setNr(const int nr) {
246 ✗ m_nr = nr;
247 ✗ }
248
249 ✗ bool IconImpl::isWall() {
250 ✗ return (m_icon >= WL_EW) && (m_icon <= WL_NESW);
251 }
252
253 } // namespace detail
254 } // namespace contam
255 } // namespace openstudio
256