GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 94.7% 36 / 0 / 38
Functions: 100.0% 1 / 0 / 1
Branches: 75.0% 51 / 0 / 68

src/energyplus/ReverseTranslator/ReverseTranslateOutputIlluminanceMap.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 "../ReverseTranslator.hpp"
7
8 #include "../../model/IlluminanceMap.hpp"
9 #include "../../model/IlluminanceMap_Impl.hpp"
10 #include "../../model/Space.hpp"
11 #include "../../model/Space_Impl.hpp"
12
13 #include <utilities/idd/Output_IlluminanceMap_FieldEnums.hxx>
14 #include "../../utilities/idd/IddEnums.hpp"
15 #include <utilities/idd/IddEnums.hxx>
16
17 using namespace openstudio::model;
18
19 namespace openstudio {
20
21 namespace energyplus {
22
23 7 OptionalModelObject ReverseTranslator::translateOutputIlluminanceMap(const WorkspaceObject& workspaceObject) {
24
4/5
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 7 times.
7 if (workspaceObject.iddObject().type() != IddObjectType::Output_IlluminanceMap) {
25 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: Output:IlluminanceMap");
26 ✗ return boost::none;
27 }
28
29
1/1
✓ Branch 1 taken 7 times.
7 IlluminanceMap illuminanceMap(m_model);
30
31
1/1
✓ Branch 1 taken 7 times.
7 OptionalString s = workspaceObject.name();
32
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (s) {
33
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 illuminanceMap.setName(*s);
34 }
35
36
1/1
✓ Branch 1 taken 7 times.
7 OptionalWorkspaceObject target = workspaceObject.getTarget(Output_IlluminanceMapFields::ZoneorSpaceName);
37
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (target) {
38
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
39
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (modelObject) {
40
3/4
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
14 if (modelObject->optionalCast<Space>()) {
41
3/3
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
7 illuminanceMap.setSpace(modelObject->cast<Space>());
42 }
43 }
44 7 }
45
46
1/1
✓ Branch 1 taken 7 times.
7 OptionalDouble d = workspaceObject.getDouble(Output_IlluminanceMapFields::Zheight);
47
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (d) {
48
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 illuminanceMap.setOriginZCoordinate(*d);
49 }
50
51
1/1
✓ Branch 1 taken 7 times.
7 d = workspaceObject.getDouble(Output_IlluminanceMapFields::XMinimumCoordinate);
52
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (d) {
53
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 illuminanceMap.setOriginXCoordinate(*d);
54
55
1/1
✓ Branch 1 taken 7 times.
7 OptionalDouble maxX = workspaceObject.getDouble(Output_IlluminanceMapFields::XMaximumCoordinate);
56
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (maxX) {
57
3/3
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
7 illuminanceMap.setXLength(*maxX - *d);
58 }
59 }
60
61
1/1
✓ Branch 1 taken 7 times.
7 OptionalInt i = workspaceObject.getInt(Output_IlluminanceMapFields::NumberofXGridPoints);
62
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (i) {
63
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 illuminanceMap.setNumberofXGridPoints(*i);
64 }
65
66
1/1
✓ Branch 1 taken 7 times.
7 d = workspaceObject.getDouble(Output_IlluminanceMapFields::YMinimumCoordinate);
67
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (d) {
68
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 illuminanceMap.setOriginYCoordinate(*d);
69
70
1/1
✓ Branch 1 taken 7 times.
7 OptionalDouble maxY = workspaceObject.getDouble(Output_IlluminanceMapFields::YMaximumCoordinate);
71
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (maxY) {
72
3/3
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
7 illuminanceMap.setYLength(*maxY - *d);
73 }
74 }
75
76
1/1
✓ Branch 1 taken 7 times.
7 i = workspaceObject.getInt(Output_IlluminanceMapFields::NumberofYGridPoints);
77
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (i) {
78
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 illuminanceMap.setNumberofYGridPoints(*i);
79 }
80
81
1/1
✓ Branch 1 taken 7 times.
7 return illuminanceMap;
82 7 }
83
84 } // namespace energyplus
85
86 } // namespace openstudio
87