GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 12.6% 45 / 0 / 356
Functions: 12.5% 15 / 0 / 120
Branches: 17.6% 27 / 0 / 153

src/airflow/contam/PrjSubobjects.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 "../../utilities/core/StringHelpers.hpp"
7
8 #include "PrjSubobjects.hpp"
9 #include "PrjSubobjectsImpl.hpp"
10
11 namespace openstudio {
12 namespace contam {
13
14
2/4
✓ Branch 2 taken 16 times.
✓ Branch 5 taken 16 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
16 WeatherData::WeatherData() : m_impl(std::shared_ptr<detail::WeatherDataImpl>(new detail::WeatherDataImpl)) {}
15
16 ✗ WeatherData::WeatherData(std::string Tambt, std::string barpres, std::string windspd, std::string winddir, std::string relhum, int daytyp, int uTa,
17 ✗ int ubP, int uws, int uwd)
18 ✗ : m_impl(
19 ✗ std::shared_ptr<detail::WeatherDataImpl>(new detail::WeatherDataImpl(Tambt, barpres, windspd, winddir, relhum, daytyp, uTa, ubP, uws, uwd))) {
20 ✗ }
21
22 ✗ WeatherData::WeatherData(double Tambt, double barpres, double windspd, double winddir, double relhum, int daytyp, int uTa, int ubP, int uws,
23 ✗ int uwd)
24 ✗ : m_impl(
25 ✗ std::shared_ptr<detail::WeatherDataImpl>(new detail::WeatherDataImpl(Tambt, barpres, windspd, winddir, relhum, daytyp, uTa, ubP, uws, uwd))) {
26 ✗ }
27
28 ✗ WeatherData::WeatherData(const WeatherData& other) = default;
29
30 ✗ WeatherData& WeatherData::operator=(const WeatherData& other) = default;
31
32 ✗ bool WeatherData::operator==(const WeatherData& other) const {
33 ✗ return m_impl == other.m_impl;
34 }
35
36 ✗ bool WeatherData::operator!=(const WeatherData& other) const {
37 ✗ return m_impl != other.m_impl;
38 }
39
40 2 std::string WeatherData::write() {
41 2 return m_impl->write();
42 }
43
44 12 void WeatherData::read(Reader& input) {
45 12 m_impl->read(input);
46 12 }
47
48 ✗ double WeatherData::Tambt() const {
49 ✗ return m_impl->Tambt();
50 }
51
52 ✗ bool WeatherData::setTambt(const double Tambt) {
53 ✗ return m_impl->setTambt(Tambt);
54 }
55
56 ✗ bool WeatherData::setTambt(const std::string& Tambt) {
57 ✗ return m_impl->setTambt(Tambt);
58 }
59
60 ✗ double WeatherData::barpres() const {
61 ✗ return m_impl->barpres();
62 }
63
64 ✗ bool WeatherData::setBarpres(const double barpres) {
65 ✗ return m_impl->setBarpres(barpres);
66 }
67
68 ✗ bool WeatherData::setBarpres(const std::string& barpres) {
69 ✗ return m_impl->setBarpres(barpres);
70 }
71
72 ✗ double WeatherData::windspd() const {
73 ✗ return m_impl->windspd();
74 }
75
76 ✗ bool WeatherData::setWindspd(const double windspd) {
77 ✗ return m_impl->setWindspd(windspd);
78 }
79
80 ✗ bool WeatherData::setWindspd(const std::string& windspd) {
81 ✗ return m_impl->setWindspd(windspd);
82 }
83
84 ✗ double WeatherData::winddir() const {
85 ✗ return m_impl->winddir();
86 }
87
88 ✗ bool WeatherData::setWinddir(const double winddir) {
89 ✗ return m_impl->setWinddir(winddir);
90 }
91
92 ✗ bool WeatherData::setWinddir(const std::string& winddir) {
93 ✗ return m_impl->setWinddir(winddir);
94 }
95
96 ✗ double WeatherData::relhum() const {
97 ✗ return m_impl->relhum();
98 }
99
100 ✗ bool WeatherData::setRelhum(const double relhum) {
101 ✗ return m_impl->setRelhum(relhum);
102 }
103
104 ✗ bool WeatherData::setRelhum(const std::string& relhum) {
105 ✗ return m_impl->setRelhum(relhum);
106 }
107
108 ✗ int WeatherData::daytyp() const {
109 ✗ return m_impl->daytyp();
110 }
111
112 ✗ void WeatherData::setDaytyp(const int daytyp) {
113 ✗ m_impl->setDaytyp(daytyp);
114 ✗ }
115
116 ✗ int WeatherData::uTa() const {
117 ✗ return m_impl->uTa();
118 }
119
120 ✗ void WeatherData::setUTa(const int uTa) {
121 ✗ m_impl->setUTa(uTa);
122 ✗ }
123
124 ✗ int WeatherData::ubP() const {
125 ✗ return m_impl->ubP();
126 }
127
128 ✗ void WeatherData::setUbP(const int ubP) {
129 ✗ m_impl->setUbP(ubP);
130 ✗ }
131
132 ✗ int WeatherData::uws() const {
133 ✗ return m_impl->uws();
134 }
135
136 ✗ void WeatherData::setUws(const int uws) {
137 ✗ m_impl->setUws(uws);
138 ✗ }
139
140 ✗ int WeatherData::uwd() const {
141 ✗ return m_impl->uwd();
142 }
143
144 ✗ void WeatherData::setUwd(const int uwd) {
145 ✗ m_impl->setUwd(uwd);
146 ✗ }
147
148 ✗ Icon::Icon() : m_impl(std::shared_ptr<detail::IconImpl>(new detail::IconImpl())) {}
149
150 ✗ Icon::Icon(int icon, int col, int row, int nr) : m_impl(std::shared_ptr<detail::IconImpl>(new detail::IconImpl(icon, col, row, nr))) {}
151
152 ✗ Icon::Icon(const Icon& other) = default;
153
154 ✗ Icon& Icon::operator=(const Icon& other) = default;
155
156 ✗ bool Icon::operator==(const Icon& other) const {
157 ✗ return m_impl == other.m_impl;
158 }
159
160 ✗ bool Icon::operator!=(const Icon& other) const {
161 ✗ return m_impl != other.m_impl;
162 }
163
164 ✗ std::string Icon::write() {
165 ✗ return m_impl->write();
166 }
167
168 ✗ void Icon::read(Reader& input) {
169 ✗ m_impl->read(input);
170 ✗ }
171
172 ✗ int Icon::icon() const {
173 ✗ return m_impl->icon();
174 }
175
176 ✗ void Icon::setIcon(const int icon) {
177 ✗ m_impl->setIcon(icon);
178 ✗ }
179
180 ✗ int Icon::col() const {
181 ✗ return m_impl->col();
182 }
183
184 ✗ void Icon::setCol(const int col) {
185 ✗ m_impl->setCol(col);
186 ✗ }
187
188 ✗ int Icon::row() const {
189 ✗ return m_impl->row();
190 }
191
192 ✗ void Icon::setRow(const int row) {
193 ✗ m_impl->setRow(row);
194 ✗ }
195
196 ✗ int Icon::nr() const {
197 ✗ return m_impl->nr();
198 }
199
200 ✗ void Icon::setNr(const int nr) {
201 ✗ m_impl->setNr(nr);
202 ✗ }
203
204 ✗ bool Icon::isWall() {
205 ✗ return m_impl->isWall();
206 }
207
208 ✗ void FanDataPoint::setDefaults() {
209 ✗ m_mF = PRJFLOAT("0.0");
210 ✗ m_u_mF = 0;
211 ✗ m_dP = PRJFLOAT("0.0");
212 ✗ m_u_dP = 0;
213 ✗ m_rP = PRJFLOAT("0.0");
214 ✗ m_u_rP = 0;
215 ✗ }
216
217 ✗ FanDataPoint::FanDataPoint() {
218 ✗ setDefaults();
219 ✗ }
220
221 ✗ FanDataPoint::FanDataPoint(double mF, int u_mF, double dP, int u_dP, double rP, int u_rP) {
222 ✗ setDefaults();
223 ✗ setMF(mF);
224 ✗ setU_mF(u_mF);
225 ✗ setDP(dP);
226 ✗ setU_dP(u_dP);
227 ✗ setRP(rP);
228 ✗ setU_rP(u_rP);
229 ✗ }
230
231 ✗ FanDataPoint::FanDataPoint(std::string mF, int u_mF, std::string dP, int u_dP, std::string rP, int u_rP) {
232 ✗ setDefaults();
233 ✗ setMF(mF);
234 ✗ setU_mF(u_mF);
235 ✗ setDP(dP);
236 ✗ setU_dP(u_dP);
237 ✗ setRP(rP);
238 ✗ setU_rP(u_rP);
239 ✗ }
240
241 ✗ void FanDataPoint::read(Reader& input) {
242 ✗ setMF(input.readNumber<std::string>());
243 ✗ setU_mF(input.read<int>());
244 ✗ setDP(input.readNumber<std::string>());
245 ✗ setU_dP(input.read<int>());
246 ✗ setRP(input.readNumber<std::string>());
247 ✗ setU_rP(input.read<int>());
248 ✗ }
249
250 ✗ std::string FanDataPoint::write() {
251 ✗ std::string string;
252 ✗ string += ANY_TO_STR(m_mF) + ' ' + ANY_TO_STR(m_u_mF) + ' ' + ANY_TO_STR(m_dP) + ' ' + ANY_TO_STR(m_u_dP) + ' ' + ANY_TO_STR(m_rP) + ' '
253 ✗ + ANY_TO_STR(m_u_rP) + '\n';
254 ✗ return string;
255 ✗ }
256
257 ✗ double FanDataPoint::mF() const {
258 ✗ return openstudio::string_conversions::to<double>(m_mF);
259 }
260
261 ✗ bool FanDataPoint::setMF(const double mF) {
262 ✗ m_mF = openstudio::string_conversions::number(mF);
263 ✗ return true;
264 }
265
266 ✗ bool FanDataPoint::setMF(const std::string& mF) {
267 ✗ return assign_if_valid<double>(mF, m_mF);
268 }
269
270 ✗ int FanDataPoint::u_mF() const {
271 ✗ return m_u_mF;
272 }
273
274 ✗ void FanDataPoint::setU_mF(const int u_mF) {
275 ✗ m_u_mF = u_mF;
276 ✗ }
277
278 ✗ double FanDataPoint::dP() const {
279 ✗ return openstudio::string_conversions::to<double>(m_dP);
280 }
281
282 ✗ bool FanDataPoint::setDP(const double dP) {
283 ✗ m_dP = openstudio::string_conversions::number(dP);
284 ✗ return true;
285 }
286
287 ✗ bool FanDataPoint::setDP(const std::string& dP) {
288 ✗ return assign_if_valid<double>(dP, m_dP);
289 }
290
291 ✗ int FanDataPoint::u_dP() const {
292 ✗ return m_u_dP;
293 }
294
295 ✗ void FanDataPoint::setU_dP(const int u_dP) {
296 ✗ m_u_dP = u_dP;
297 ✗ }
298
299 ✗ double FanDataPoint::rP() const {
300 ✗ return openstudio::string_conversions::to<double>(m_rP);
301 }
302
303 ✗ bool FanDataPoint::setRP(const double rP) {
304 ✗ m_rP = openstudio::string_conversions::number(rP);
305 ✗ return true;
306 }
307
308 ✗ bool FanDataPoint::setRP(const std::string& rP) {
309 ✗ return assign_if_valid<double>(rP, m_rP);
310 }
311
312 ✗ int FanDataPoint::u_rP() const {
313 ✗ return m_u_rP;
314 }
315
316 ✗ void FanDataPoint::setU_rP(const int u_rP) {
317 ✗ m_u_rP = u_rP;
318 ✗ }
319
320 ✗ void XyDataPoint::setDefaults() {
321 ✗ m_x = PRJFLOAT("0.0");
322 ✗ m_y = PRJFLOAT("0.0");
323 ✗ }
324
325 ✗ XyDataPoint::XyDataPoint() {
326 ✗ setDefaults();
327 ✗ }
328
329 ✗ XyDataPoint::XyDataPoint(double x, double y) {
330 ✗ setDefaults();
331 ✗ setX(x);
332 ✗ setY(y);
333 ✗ }
334
335 ✗ XyDataPoint::XyDataPoint(std::string x, std::string y) {
336 ✗ setDefaults();
337 ✗ setX(x);
338 ✗ setY(y);
339 ✗ }
340
341 ✗ void XyDataPoint::read(Reader& input) {
342 ✗ setX(input.readNumber<std::string>());
343 ✗ setY(input.readNumber<std::string>());
344 ✗ }
345
346 ✗ std::string XyDataPoint::write() {
347 ✗ std::string string;
348 ✗ string += ANY_TO_STR(m_x) + ' ' + ANY_TO_STR(m_y) + '\n';
349 ✗ return string;
350 ✗ }
351
352 ✗ double XyDataPoint::x() const {
353 ✗ return openstudio::string_conversions::to<double>(m_x);
354 }
355
356 ✗ bool XyDataPoint::setX(const double x) {
357 ✗ m_x = openstudio::string_conversions::number(x);
358 ✗ return true;
359 }
360
361 ✗ bool XyDataPoint::setX(const std::string& x) {
362 ✗ return assign_if_valid<double>(x, m_x);
363 }
364
365 ✗ double XyDataPoint::y() const {
366 ✗ return openstudio::string_conversions::to<double>(m_y);
367 }
368
369 ✗ bool XyDataPoint::setY(const double y) {
370 ✗ m_y = openstudio::string_conversions::number(y);
371 ✗ return true;
372 }
373
374 ✗ bool XyDataPoint::setY(const std::string& y) {
375 ✗ return assign_if_valid<double>(y, m_y);
376 }
377
378 ✗ void AirflowSubelementData::setDefaults() {
379 ✗ m_nr = 0;
380 ✗ m_relHt = PRJFLOAT("0.0");
381 ✗ m_filt = 0;
382 ✗ }
383
384 ✗ AirflowSubelementData::AirflowSubelementData() {
385 ✗ setDefaults();
386 ✗ }
387
388 ✗ AirflowSubelementData::AirflowSubelementData(int nr, double relHt, int filt) {
389 ✗ setDefaults();
390 ✗ setNr(nr);
391 ✗ setRelHt(relHt);
392 ✗ setFilt(filt);
393 ✗ }
394
395 ✗ AirflowSubelementData::AirflowSubelementData(int nr, std::string relHt, int filt) {
396 ✗ setDefaults();
397 ✗ setNr(nr);
398 ✗ setRelHt(relHt);
399 ✗ setFilt(filt);
400 ✗ }
401
402 ✗ void AirflowSubelementData::read(Reader& input) {
403 ✗ setNr(input.read<int>());
404 ✗ setRelHt(input.readNumber<std::string>());
405 ✗ setFilt(input.read<int>());
406 ✗ }
407
408 ✗ std::string AirflowSubelementData::write() {
409 ✗ std::string string;
410 ✗ string += ANY_TO_STR(m_nr) + ' ' + ANY_TO_STR(m_relHt) + ' ' + ANY_TO_STR(m_filt) + '\n';
411 ✗ return string;
412 ✗ }
413
414 ✗ int AirflowSubelementData::nr() const {
415 ✗ return m_nr;
416 }
417
418 ✗ void AirflowSubelementData::setNr(const int nr) {
419 ✗ m_nr = nr;
420 ✗ }
421
422 ✗ double AirflowSubelementData::relHt() const {
423 ✗ return openstudio::string_conversions::to<double>(m_relHt);
424 }
425
426 ✗ bool AirflowSubelementData::setRelHt(const double relHt) {
427 ✗ m_relHt = openstudio::string_conversions::number(relHt);
428 ✗ return true;
429 }
430
431 ✗ bool AirflowSubelementData::setRelHt(const std::string& relHt) {
432 ✗ return assign_if_valid<double>(relHt, m_relHt);
433 }
434
435 ✗ int AirflowSubelementData::filt() const {
436 ✗ return m_filt;
437 }
438
439 ✗ void AirflowSubelementData::setFilt(const int filt) {
440 ✗ m_filt = filt;
441 ✗ }
442
443 330 void PressureCoefficientPoint::setDefaults() {
444
1/1
✓ Branch 1 taken 330 times.
660 m_azm = PRJFLOAT("0.0");
445
1/1
✓ Branch 1 taken 330 times.
330 m_coef = PRJFLOAT("0.0");
446 330 }
447
448 330 PressureCoefficientPoint::PressureCoefficientPoint() {
449
1/1
✓ Branch 1 taken 330 times.
330 setDefaults();
450 330 }
451
452 ✗ PressureCoefficientPoint::PressureCoefficientPoint(double azm, double coef) {
453 ✗ setDefaults();
454 ✗ setAzm(azm);
455 ✗ setCoef(coef);
456 ✗ }
457
458 ✗ PressureCoefficientPoint::PressureCoefficientPoint(std::string azm, std::string coef) {
459 ✗ setDefaults();
460 ✗ setAzm(azm);
461 ✗ setCoef(coef);
462 ✗ }
463
464 330 void PressureCoefficientPoint::read(Reader& input) {
465
2/2
✓ Branch 1 taken 330 times.
✓ Branch 4 taken 330 times.
330 setAzm(input.readNumber<std::string>());
466
2/2
✓ Branch 1 taken 330 times.
✓ Branch 4 taken 330 times.
330 setCoef(input.readNumber<std::string>());
467 330 }
468
469 55 std::string PressureCoefficientPoint::write() {
470 55 std::string string;
471
6/6
✓ Branch 1 taken 55 times.
✓ Branch 4 taken 55 times.
✓ Branch 7 taken 55 times.
✓ Branch 10 taken 55 times.
✓ Branch 13 taken 55 times.
✓ Branch 16 taken 55 times.
55 string += ANY_TO_STR(m_azm) + ' ' + ANY_TO_STR(m_coef) + '\n';
472 55 return string;
473 ✗ }
474
475 ✗ double PressureCoefficientPoint::azm() const {
476 ✗ return openstudio::string_conversions::to<double>(m_azm);
477 }
478
479 ✗ bool PressureCoefficientPoint::setAzm(const double azm) {
480 ✗ m_azm = openstudio::string_conversions::number(azm);
481 ✗ return true;
482 }
483
484 330 bool PressureCoefficientPoint::setAzm(const std::string& azm) {
485 330 return assign_if_valid<double>(azm, m_azm);
486 }
487
488 ✗ double PressureCoefficientPoint::coef() const {
489 ✗ return openstudio::string_conversions::to<double>(m_coef);
490 }
491
492 ✗ bool PressureCoefficientPoint::setCoef(const double coef) {
493 ✗ m_coef = openstudio::string_conversions::number(coef);
494 ✗ return true;
495 }
496
497 330 bool PressureCoefficientPoint::setCoef(const std::string& coef) {
498 330 return assign_if_valid<double>(coef, m_coef);
499 }
500
501 252 void SchedulePoint::setDefaults() {
502
1/1
✓ Branch 1 taken 252 times.
504 m_time = std::string("00:00:00");
503
1/1
✓ Branch 1 taken 252 times.
252 m_ctrl = PRJFLOAT("0.0");
504 252 }
505
506 252 SchedulePoint::SchedulePoint() {
507
1/1
✓ Branch 1 taken 252 times.
252 setDefaults();
508 252 }
509
510 ✗ SchedulePoint::SchedulePoint(std::string time, double ctrl) {
511 ✗ setDefaults();
512 ✗ setTime(time);
513 ✗ setCtrl(ctrl);
514 ✗ }
515
516 ✗ SchedulePoint::SchedulePoint(std::string time, std::string ctrl) {
517 ✗ setDefaults();
518 ✗ setTime(time);
519 ✗ setCtrl(ctrl);
520 ✗ }
521
522 252 void SchedulePoint::read(Reader& input) {
523
2/2
✓ Branch 1 taken 252 times.
✓ Branch 4 taken 252 times.
252 setTime(input.readString());
524
2/2
✓ Branch 1 taken 252 times.
✓ Branch 4 taken 252 times.
252 setCtrl(input.readNumber<std::string>());
525 252 }
526
527 42 std::string SchedulePoint::write() {
528 42 std::string string;
529
5/5
✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
✓ Branch 7 taken 42 times.
✓ Branch 10 taken 42 times.
✓ Branch 13 taken 42 times.
42 string += m_time + ' ' + ANY_TO_STR(m_ctrl) + '\n';
530 42 return string;
531 ✗ }
532
533 ✗ std::string SchedulePoint::time() const {
534 ✗ return m_time;
535 }
536
537 252 void SchedulePoint::setTime(const std::string& time) {
538 252 m_time = time;
539 252 }
540
541 ✗ double SchedulePoint::ctrl() const {
542 ✗ return openstudio::string_conversions::to<double>(m_ctrl);
543 }
544
545 ✗ bool SchedulePoint::setCtrl(const double ctrl) {
546 ✗ m_ctrl = openstudio::string_conversions::number(ctrl);
547 ✗ return true;
548 }
549
550 252 bool SchedulePoint::setCtrl(const std::string& ctrl) {
551 252 return assign_if_valid<double>(ctrl, m_ctrl);
552 }
553
554 } // namespace contam
555 } // namespace openstudio
556