GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 78.9% 15 / 1 / 20
Functions: 78.9% 15 / 1 / 20
Branches: 68.8% 44 / 1 / 65

src/energyplus/GeometryTranslator.hpp
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 #ifndef ENERGYPLUS_GEOMETRYTRANSLATOR_HPP
7 #define ENERGYPLUS_GEOMETRYTRANSLATOR_HPP
8
9 #include "EnergyPlusAPI.hpp"
10
11 #include "../utilities/idf/Workspace.hpp"
12 #include "../utilities/core/Logger.hpp"
13 #include "../utilities/core/Enum.hpp"
14 #include "../utilities/geometry/Transformation.hpp"
15 #include "../utilities/geometry/Point3d.hpp"
16
17 namespace openstudio {
18 namespace energyplus {
19
20 // clang-format off
21
22 /** \class StartingVertexPosition
23 *
24 * \relates GeometryTranslator */
25
11/16
openstudio::energyplus::StartingVertexPosition::buildStringVec[abi:cxx11](bool):
✓ Branch 0 taken 204 times.
✓ Branch 1 taken 292 times.
✓ Branch 3 taken 204 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 204 times.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✓ Branch 17 taken 292 times.
✓ Branch 20 taken 292 times.
✓ Branch 23 taken 372 times.
✓ Branch 24 taken 248 times.
✓ Branch 25 taken 124 times.
✓ Branch 26 taken 124 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 124 times.
openstudio::energyplus::StartingVertexPosition::enumName[abi:cxx11]():
✗ Branch 1 not taken.
1534 OPENSTUDIO_ENUM(StartingVertexPosition,
26 ((UpperLeftCorner))
27 ((LowerLeftCorner))
28 ((UpperRightCorner))
29 ((LowerRightCorner))
30 );
31
32 /** \class VertexEntryDirection
33 *
34 * \relates GeometryTranslator */
35
11/16
openstudio::energyplus::VertexEntryDirection::buildStringVec[abi:cxx11](bool):
✓ Branch 0 taken 102 times.
✓ Branch 1 taken 146 times.
✓ Branch 3 taken 102 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 102 times.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✓ Branch 17 taken 146 times.
✓ Branch 20 taken 146 times.
✓ Branch 23 taken 124 times.
✓ Branch 24 taken 248 times.
✓ Branch 25 taken 124 times.
✓ Branch 26 taken 124 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 124 times.
openstudio::energyplus::VertexEntryDirection::enumName[abi:cxx11]():
✗ Branch 1 not taken.
1082 OPENSTUDIO_ENUM(VertexEntryDirection,
36 ((Counterclockwise))
37 ((Clockwise))
38 );
39
40 /** \class CoordinateSystem
41 *
42 * \relates GeometryTranslator */
43
14/16
openstudio::energyplus::CoordinateSystem::buildStringVec[abi:cxx11](bool):
✓ Branch 0 taken 102 times.
✓ Branch 1 taken 258 times.
✓ Branch 3 taken 102 times.
✓ Branch 6 taken 51 times.
✓ Branch 7 taken 51 times.
✓ Branch 9 taken 51 times.
✓ Branch 12 taken 51 times.
✓ Branch 17 taken 258 times.
✓ Branch 20 taken 258 times.
✓ Branch 23 taken 180 times.
✓ Branch 24 taken 360 times.
✓ Branch 25 taken 180 times.
✓ Branch 26 taken 180 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 180 times.
openstudio::energyplus::CoordinateSystem::enumName[abi:cxx11]():
✗ Branch 1 not taken.
4131 OPENSTUDIO_ENUM(CoordinateSystem,
44 ((Relative))
45 ((Absolute)(World))
46 );
47
48 /** \class CoordinateChange
49 *
50 * \relates GeometryTranslator */
51
8/16
openstudio::energyplus::CoordinateChange::buildStringVec[abi:cxx11](bool):
✗ Branch 0 not taken.
✓ Branch 1 taken 219 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✓ Branch 17 taken 219 times.
✓ Branch 20 taken 219 times.
✓ Branch 23 taken 146 times.
✓ Branch 24 taken 146 times.
✓ Branch 25 taken 73 times.
✓ Branch 26 taken 73 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 73 times.
openstudio::energyplus::CoordinateChange::enumName[abi:cxx11]():
✗ Branch 1 not taken.
681 OPENSTUDIO_ENUM(CoordinateChange,
52 ((RelativeToAbsolute))
53 ((AbsoluteToRelative))
54 ((NoChange))
55 );
56
57 // clang-format on
58
59 /// test equality of coordinate systems
60 ENERGYPLUS_API bool equal(const CoordinateSystem& left, const CoordinateSystem& right);
61
62 /* Translates EnergyPlus simulation input geometry between various coordinate systems and
63 * changes simple geometry to detailed geometry.
64 *
65 * All geometry in the OpenStudio Building Model is expressed in relative coordinates using
66 * the UpperLeftCorner, CounterClockWise convention.
67 *
68 */
69 class ENERGYPLUS_API GeometryTranslator
70 {
71 public:
72 /// constructor with an EnergyPlus Workspace
73 GeometryTranslator(const openstudio::Workspace& workspace);
74
75 /// convert workspace to given coordinate systems
76 /// all geometry will be converted to upper-left-corner, counterclockwise
77 /// all simple geometry will be converted to detailed geometry
78 bool convert(const CoordinateSystem& detailedSystem, const CoordinateSystem& daylightingSystem);
79
80 private:
81 − REGISTER_LOGGER("openstudio.energyplus.GeometryTranslator");
82
83 // private struct to hold GlobalGeometryRules
84 struct GlobalGeometryRules
85 {
86 StartingVertexPosition svp;
87 VertexEntryDirection ved;
88 CoordinateSystem detailedSystem;
89 CoordinateSystem daylightingSystem;
90 CoordinateSystem rectangularSystem;
91 };
92
93 // get the current GlobalGeometryRules
94 GlobalGeometryRules globalGeometryRules() const;
95
96 // set the GlobalGeometryRules, only changes the object does not transform geometry
97 bool setGlobalGeometryRules(const StartingVertexPosition& svp, const VertexEntryDirection& ved, const CoordinateSystem& detailedSystem,
98 const CoordinateSystem& daylightingSystem, const CoordinateSystem& rectangularSystem);
99
100 // get the transformation from building to world
101 Transformation buildingTransformation() const;
102
103 // get the transformation from zone to building
104 Transformation zoneTransformation(const WorkspaceObject& zone) const;
105
106 // convert simple shading to detailed in the current system
107 bool convertSimpleShading(const CoordinateChange& coordChange);
108
109 // convert simple subsurfaces to detailed in the current system
110 bool convertSimpleSubSurfaces();
111
112 // convert simple surfaces to detailed in the current system
113 bool convertSimpleSurfaces(const CoordinateChange& coordChange);
114
115 // convert daylighting geometry from the current system to the new system
116 bool convertDaylightingGeometry(const CoordinateChange& daylightingCoordChange);
117
118 // convert detailed geometry from the current system to the new system
119 bool convertDetailedGeometry(const CoordinateChange& detailedCoordChange);
120
121 // reverse all detailed vertices
122 bool reverseAllDetailedVertices();
123
124 // apply upper left corner rule to all detailed vertices
125 bool applyUpperLeftCornerRule();
126
127 openstudio::Workspace m_workspace;
128 };
129
130 /** Get vertices for a surface. \relates GeometryTranslator */
131 ENERGYPLUS_API openstudio::Point3dVector getVertices(unsigned firstVertex, const IdfObject& surface);
132
133 /** Set vertices for a surface, only detailed surfaces are supported. \relates GeometryTranslator */
134 ENERGYPLUS_API bool setVertices(unsigned firstVertex, WorkspaceObject& surface, const openstudio::Point3dVector& vertices);
135
136 /** Convert azimuth, tilt, starting x, y, z, length, and width to vertices
137 * azimith and tilt are in degrees. \relates GeometryTranslator */
138 ENERGYPLUS_API openstudio::Point3dVector verticesForAzimuthTiltXYZLengthWidthOrHeight(double azimuth, double tilt, double x0, double y0, double z0,
139 double length, double widthOrHeight);
140
141 } // namespace energyplus
142 } // namespace openstudio
143
144 #endif // ENERGYPLUS_GEOMETRYTRANSLATOR_HPP
145