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

Method addSubSurface

src/model/ShadingControl.cpp:421–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419 }
420
421 bool ShadingControl_Impl::addSubSurface(const SubSurface& subSurface) {
422 // Check if subSurface already exists
423 boost::optional<unsigned> _existingIndex = subSurfaceIndex(subSurface);
424 if (_existingIndex) {
425 LOG(Warn, "For " << briefDescription() << ", SubSurface already exists.");
426 return true;
427 }
428
429 bool result;
430
431 auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
432 bool subsurface = eg.setPointer(OS_ShadingControlExtensibleFields::SubSurfaceName, subSurface.handle());
433 if (subsurface) {
434 result = true;
435 } else {
436 // Something went wrong
437 // So erase the new extensible group
438 getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex());
439 result = false;
440 }
441 return result;
442 }
443
444 bool ShadingControl_Impl::setSubSurfaceIndex(const SubSurface& subSurface, unsigned index) {
445 boost::optional<unsigned> idx = subSurfaceIndex(subSurface);

Callers 6

addShadingControlMethod · 0.80
addShadingControlsMethod · 0.80
TEST_FFunction · 0.80
translateModelPrivateMethod · 0.80
TEST_FFunction · 0.80

Calls 5

pushExtensibleGroupMethod · 0.80
eraseExtensibleGroupMethod · 0.80
groupIndexMethod · 0.80
setPointerMethod · 0.45
handleMethod · 0.45

Tested by 2

TEST_FFunction · 0.64
TEST_FFunction · 0.64