MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / getNetArea

Method getNetArea

src/model/ConstructionBase.cpp:82–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 double ConstructionBase_Impl::getNetArea() const {
83 Handle handle = this->handle();
84 std::set<Handle> adjacentPlanarSurfacesToSkip;
85
86 double result = 0.0;
87 for (const PlanarSurface& planarSurface : model().getModelObjects<PlanarSurface>()) {
88
89 // if we have already processed this surface as an adjacent surface
90 if (std::find(adjacentPlanarSurfacesToSkip.begin(), adjacentPlanarSurfacesToSkip.end(), planarSurface.handle())
91 != adjacentPlanarSurfacesToSkip.end()) {
92 continue;
93 }
94
95 // PlanarSurface::construction now attempts to resolve surface matching mismatches
96 boost::optional<ConstructionBase> constructionBase = planarSurface.construction();
97 if (!constructionBase) {
98 continue;
99 }
100
101 if (constructionBase->handle() == handle) {
102 double netArea = getNetAreaHelper(planarSurface);
103
104 // avoid double counting construction for adjacent surface
105 if (planarSurface.optionalCast<Surface>()) {
106 boost::optional<Surface> adjacentSurface = planarSurface.cast<Surface>().adjacentSurface();
107 if (adjacentSurface) {
108 boost::optional<ConstructionBase> adjacentConstructionBase = adjacentSurface->construction();
109 if (adjacentConstructionBase && (constructionBase->handle() == adjacentConstructionBase->handle())) {
110 adjacentPlanarSurfacesToSkip.insert(adjacentSurface->handle());
111 netArea = std::max(netArea, getNetAreaHelper(*adjacentSurface));
112 }
113 }
114 }
115
116 if (planarSurface.optionalCast<SubSurface>()) {
117 boost::optional<SubSurface> adjacentSubSurface = planarSurface.cast<SubSurface>().adjacentSubSurface();
118 if (adjacentSubSurface) {
119 boost::optional<ConstructionBase> adjacentConstructionBase = adjacentSubSurface->construction();
120 if (adjacentConstructionBase && (constructionBase->handle() == adjacentConstructionBase->handle())) {
121 adjacentPlanarSurfacesToSkip.insert(adjacentSubSurface->handle());
122 netArea = std::max(netArea, getNetAreaHelper(*adjacentSubSurface));
123 }
124 }
125 }
126
127 result += netArea;
128 }
129 }
130 return result;
131 }
132
133 std::vector<ModelObject> ConstructionBase_Impl::children() const {
134

Callers 9

runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
costedAreaMethod · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80

Calls 8

getNetAreaHelperFunction · 0.85
beginMethod · 0.80
adjacentSurfaceMethod · 0.80
adjacentSubSurfaceMethod · 0.80
handleMethod · 0.45
endMethod · 0.45
constructionMethod · 0.45
insertMethod · 0.45

Tested by 3

TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64