GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 22 / 0 / 22
Functions: 100.0% 1 / 0 / 1
Branches: 97.4% 38 / 0 / 39

src/energyplus/ForwardTranslator/ForwardTranslateCurveQuadratic.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 "../ForwardTranslator.hpp"
7
8 #include "../../model/CurveQuadratic.hpp"
9 #include "../../model/CurveQuadratic_Impl.hpp"
10
11 #include "../../utilities/core/Assert.hpp"
12
13 #include <utilities/idd/Curve_Quadratic_FieldEnums.hxx>
14 #include <utilities/idd/IddEnums.hxx>
15
16 using namespace openstudio::model;
17 using namespace std;
18
19 namespace openstudio {
20 namespace energyplus {
21
22 1074 boost::optional<IdfObject> ForwardTranslator::translateCurveQuadratic(CurveQuadratic& modelObject) {
23
2/2
✓ Branch 1 taken 1074 times.
✓ Branch 4 taken 1074 times.
1074 IdfObject idfObject(IddObjectType::Curve_Quadratic);
24
25
1/1
✓ Branch 1 taken 1074 times.
1074 m_idfObjects.push_back(idfObject);
26
27 1074 OptionalString s;
28 1074 OptionalDouble d;
29
30
2/3
✓ Branch 1 taken 1074 times.
✓ Branch 5 taken 1074 times.
✗ Branch 6 not taken.
2148 if ((s = modelObject.name())) {
31
2/2
✓ Branch 1 taken 1074 times.
✓ Branch 4 taken 1074 times.
1074 idfObject.setName(*s);
32 }
33
34
2/2
✓ Branch 1 taken 1074 times.
✓ Branch 4 taken 1074 times.
1074 idfObject.setDouble(Curve_QuadraticFields::Coefficient1Constant, modelObject.coefficient1Constant());
35
2/2
✓ Branch 1 taken 1074 times.
✓ Branch 4 taken 1074 times.
1074 idfObject.setDouble(Curve_QuadraticFields::Coefficient2x, modelObject.coefficient2x());
36
2/2
✓ Branch 1 taken 1074 times.
✓ Branch 4 taken 1074 times.
1074 idfObject.setDouble(Curve_QuadraticFields::Coefficient3x_POW_2, modelObject.coefficient3xPOW2());
37
2/2
✓ Branch 1 taken 1074 times.
✓ Branch 4 taken 1074 times.
1074 idfObject.setDouble(Curve_QuadraticFields::MinimumValueofx, modelObject.minimumValueofx());
38
2/2
✓ Branch 1 taken 1074 times.
✓ Branch 4 taken 1074 times.
1074 idfObject.setDouble(Curve_QuadraticFields::MaximumValueofx, modelObject.maximumValueofx());
39
3/3
✓ Branch 1 taken 1074 times.
✓ Branch 3 taken 123 times.
✓ Branch 4 taken 951 times.
2148 if ((d = modelObject.minimumCurveOutput())) {
40
2/2
✓ Branch 1 taken 123 times.
✓ Branch 4 taken 123 times.
123 idfObject.setDouble(Curve_QuadraticFields::MinimumCurveOutput, *d);
41 }
42
3/3
✓ Branch 1 taken 1074 times.
✓ Branch 3 taken 123 times.
✓ Branch 4 taken 951 times.
2148 if ((d = modelObject.maximumCurveOutput())) {
43
2/2
✓ Branch 1 taken 123 times.
✓ Branch 4 taken 123 times.
123 idfObject.setDouble(Curve_QuadraticFields::MaximumCurveOutput, *d);
44 }
45
3/3
✓ Branch 1 taken 1074 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 1026 times.
1074 if (!modelObject.isInputUnitTypeforXDefaulted()) {
46
2/2
✓ Branch 1 taken 48 times.
✓ Branch 4 taken 48 times.
48 idfObject.setString(Curve_QuadraticFields::InputUnitTypeforX, modelObject.inputUnitTypeforX());
47 }
48
3/3
✓ Branch 1 taken 1074 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 1026 times.
1074 if (!modelObject.isOutputUnitTypeDefaulted()) {
49
2/2
✓ Branch 1 taken 48 times.
✓ Branch 4 taken 48 times.
48 idfObject.setString(Curve_QuadraticFields::OutputUnitType, modelObject.outputUnitType());
50 }
51
52
1/1
✓ Branch 1 taken 1074 times.
2148 return idfObject;
53 1074 }
54
55 } // namespace energyplus
56 } // namespace openstudio
57