GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 56.9% 29 / 0 / 51
Functions: 100.0% 1 / 0 / 1
Branches: 41.1% 39 / 0 / 95

src/energyplus/ReverseTranslator/ReverseTranslateWindowMaterialGas.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/Gas.hpp"
9 #include "../../model/Gas_Impl.hpp"
10
11 #include <utilities/idd/WindowMaterial_Gas_FieldEnums.hxx>
12
13 using namespace openstudio::model;
14
15 namespace openstudio {
16 namespace energyplus {
17
18 16 boost::optional<ModelObject> ReverseTranslator::translateWindowMaterialGas(const WorkspaceObject& workspaceObject) {
19 16 OptionalModelObject result;
20
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 Gas gas(m_model);
21
1/1
✓ Branch 1 taken 16 times.
16 OptionalString optS = workspaceObject.name();
22
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (optS) {
23
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 gas.setName(*optS);
24 }
25
26
1/1
✓ Branch 1 taken 16 times.
16 optS = workspaceObject.getString(WindowMaterial_GasFields::GasType);
27
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (optS) {
28
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 gas.setGasType(*optS);
29 }
30
31
1/1
✓ Branch 1 taken 16 times.
16 OptionalDouble d1 = workspaceObject.getDouble(WindowMaterial_GasFields::Thickness);
32
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 3 times.
16 if (d1) {
33
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 gas.setThickness(*d1);
34 }
35
36
1/1
✓ Branch 1 taken 16 times.
16 d1 = workspaceObject.getDouble(WindowMaterial_GasFields::ConductivityCoefficientA);
37
1/1
✓ Branch 1 taken 16 times.
16 OptionalDouble d2 = workspaceObject.getDouble(WindowMaterial_GasFields::ConductivityCoefficientB);
38
1/1
✓ Branch 1 taken 16 times.
16 OptionalDouble d3 = workspaceObject.getDouble(WindowMaterial_GasFields::ConductivityCoefficientC);
39
4/8
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 16 times.
48 if (d1 || d2 || d3) {
40 ✗ if (!d1) {
41 ✗ d1 = 0.0;
42 }
43 ✗ if (!d2) {
44 ✗ d2 = 0.0;
45 }
46 ✗ if (!d3) {
47 ✗ d3 = 0.0;
48 }
49 ✗ gas.setCustomConductivity(*d1, *d2, *d3);
50 }
51
52
1/1
✓ Branch 1 taken 16 times.
16 d1 = workspaceObject.getDouble(WindowMaterial_GasFields::ViscosityCoefficientA);
53
1/1
✓ Branch 1 taken 16 times.
16 d2 = workspaceObject.getDouble(WindowMaterial_GasFields::ViscosityCoefficientB);
54
1/1
✓ Branch 1 taken 16 times.
16 d3 = workspaceObject.getDouble(WindowMaterial_GasFields::ViscosityCoefficientC);
55
4/8
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 16 times.
48 if (d1 || d2 || d3) {
56 ✗ if (!d1) {
57 ✗ d1 = 0.0;
58 }
59 ✗ if (!d2) {
60 ✗ d2 = 0.0;
61 }
62 ✗ if (!d3) {
63 ✗ d3 = 0.0;
64 }
65 ✗ gas.setCustomViscosity(*d1, *d2, *d3);
66 }
67
68
1/1
✓ Branch 1 taken 16 times.
16 d1 = workspaceObject.getDouble(WindowMaterial_GasFields::SpecificHeatCoefficientA);
69
1/1
✓ Branch 1 taken 16 times.
16 d2 = workspaceObject.getDouble(WindowMaterial_GasFields::SpecificHeatCoefficientB);
70
1/1
✓ Branch 1 taken 16 times.
16 d3 = workspaceObject.getDouble(WindowMaterial_GasFields::SpecificHeatCoefficientC);
71
4/8
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 16 times.
48 if (d1 || d2 || d3) {
72 ✗ if (!d1) {
73 ✗ d1 = 0.0;
74 }
75 ✗ if (!d2) {
76 ✗ d2 = 0.0;
77 }
78 ✗ if (!d3) {
79 ✗ d3 = 0.0;
80 }
81 ✗ gas.setCustomSpecificHeat(*d1, *d2, *d3);
82 }
83
84
1/1
✓ Branch 1 taken 16 times.
16 d1 = workspaceObject.getDouble(WindowMaterial_GasFields::MolecularWeight);
85
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (d1) {
86 ✗ gas.setCustomMolecularWeight(*d1);
87 }
88
89
1/1
✓ Branch 1 taken 16 times.
16 result = gas;
90 32 return result;
91 16 }
92
93 } // namespace energyplus
94 } // namespace openstudio
95