| 1703 | /// @endcond |
| 1704 | |
| 1705 | std::vector<SubSurface> applySkylightPattern(const std::vector<std::vector<Point3d>>& pattern, const std::vector<Space>& spaces, |
| 1706 | const boost::optional<ConstructionBase>& construction) { |
| 1707 | double inset = 0.0254; |
| 1708 | |
| 1709 | std::vector<SubSurface> result; |
| 1710 | |
| 1711 | for (const Space& space : spaces) { |
| 1712 | |
| 1713 | if (space.isPlenum()) { |
| 1714 | LOG_FREE(Warn, "OpenStudio.applySkylightPattern", "Cannot apply skylights to plenum space"); |
| 1715 | continue; |
| 1716 | } |
| 1717 | |
| 1718 | Transformation transformation = space.buildingTransformation(); |
| 1719 | Transformation inverseTransformation = transformation.inverse(); |
| 1720 | |
| 1721 | std::vector<std::vector<Point3d>> spacePattern; |
| 1722 | spacePattern.reserve(pattern.size()); |
| 1723 | for (const std::vector<Point3d>& face : pattern) { |
| 1724 | spacePattern.push_back(inverseTransformation * face); |
| 1725 | } |
| 1726 | |
| 1727 | for (Surface& surface : space.surfaces()) { |
| 1728 | if (istringEqual("RoofCeiling", surface.surfaceType()) && istringEqual("Outdoors", surface.outsideBoundaryCondition())) { |
| 1729 | |
| 1730 | Plane surfacePlane = surface.plane(); |
| 1731 | |
| 1732 | std::vector<std::vector<Point3d>> surfacePattern; |
| 1733 | spacePattern.reserve(pattern.size()); |
| 1734 | for (const std::vector<Point3d>& spaceFace : spacePattern) { |
| 1735 | surfacePattern.push_back(surfacePlane.project(spaceFace)); |
| 1736 | } |
| 1737 | |
| 1738 | std::vector<SubSurface> newSkylights = surface.createSubSurfaces(surfacePattern, inset, construction); |
| 1739 | result.insert(result.end(), newSkylights.begin(), newSkylights.end()); |
| 1740 | } |
| 1741 | } |
| 1742 | } |
| 1743 | |
| 1744 | return result; |
| 1745 | } |
| 1746 | |
| 1747 | AirflowNetworkSurface SubSurface::getAirflowNetworkSurface(const AirflowNetworkDetailedOpening& surfaceAirflowLeakage) { |
| 1748 | return getImpl<detail::SubSurface_Impl>()->getAirflowNetworkSurface(surfaceAirflowLeakage); |