| 129 | } |
| 130 | |
| 131 | ModelObject Surface_Impl::clone(Model model) const { |
| 132 | ModelObject newParentAsModelObject = ModelObject_Impl::clone(model); |
| 133 | auto newParent = newParentAsModelObject.cast<ParentObject>(); |
| 134 | |
| 135 | for (const ModelObject& child : children()) { |
| 136 | ModelObject newChild = child.clone(model); |
| 137 | newChild.setParent(newParent); |
| 138 | if (auto ss_ = child.optionalCast<SubSurface>()) { |
| 139 | newChild.cast<SubSurface>().setSubSurfaceType(ss_->subSurfaceType()); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | auto coefficients = surfacePropertyConvectionCoefficients(); |
| 144 | if (coefficients) { |
| 145 | auto coefficientsClone = coefficients->clone(model).cast<SurfacePropertyConvectionCoefficients>(); |
| 146 | coefficientsClone.setSurface(newParentAsModelObject); |
| 147 | } |
| 148 | |
| 149 | // TODO: do we clone the SurfacePropertyLocalEnvironment? |
| 150 | |
| 151 | auto foundation = adjacentFoundation(); |
| 152 | if (foundation) { |
| 153 | auto foundationClone = foundation->clone(model).cast<FoundationKiva>(); |
| 154 | newParentAsModelObject.cast<Surface>().setAdjacentFoundation(foundationClone); |
| 155 | } |
| 156 | |
| 157 | return newParentAsModelObject; |
| 158 | } |
| 159 | |
| 160 | std::vector<IddObjectType> Surface_Impl::allowableChildTypes() const { |
| 161 | return std::vector<IddObjectType>{IddObjectType::OS_SubSurface}; |
no test coverage detected