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

Function testModel

src/gbxml/Test/ForwardTranslator_GTest.cpp:413–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413Model testModel() {
414 Model model;
415
416 Building building = model.getUniqueModelObject<Building>();
417 BuildingStory buildingStory(model);
418 buildingStory.setNominalZCoordinate(0);
419 buildingStory.setNominalFloortoFloorHeight(3);
420
421 ThermalZone thermalZone(model);
422
423 std::vector<Point3d> floorPrint;
424 floorPrint.push_back(Point3d(0, 0, 0));
425 floorPrint.push_back(Point3d(0, 10, 0));
426 floorPrint.push_back(Point3d(10, 10, 0));
427 floorPrint.push_back(Point3d(10, 0, 0));
428
429 // make spaces
430 boost::optional<Space> space1 = Space::fromFloorPrint(floorPrint, 3, model);
431 OS_ASSERT(space1);
432 space1->setThermalZone(thermalZone);
433 space1->setBuildingStory(buildingStory);
434
435 boost::optional<Space> space2 = Space::fromFloorPrint(floorPrint, 3, model);
436 OS_ASSERT(space2);
437 space2->setXOrigin(10);
438 space2->setThermalZone(thermalZone);
439 space2->setBuildingStory(buildingStory);
440
441 boost::optional<Space> space3 = Space::fromFloorPrint(floorPrint, 3, model);
442 OS_ASSERT(space3);
443 space3->setYOrigin(10);
444 space3->setThermalZone(thermalZone);
445 space3->setBuildingStory(buildingStory);
446
447 boost::optional<Space> space4 = Space::fromFloorPrint(floorPrint, 3, model);
448 OS_ASSERT(space4);
449 space4->setXOrigin(10);
450 space4->setYOrigin(10);
451 space4->setThermalZone(thermalZone);
452 space4->setBuildingStory(buildingStory);
453
454 // add a door to south wall of space1
455 std::vector<Point3d> doorPoints;
456 doorPoints.push_back(Point3d(2, 0, 2));
457 doorPoints.push_back(Point3d(2, 0, 0));
458 doorPoints.push_back(Point3d(4, 0, 0));
459 doorPoints.push_back(Point3d(4, 0, 2));
460
461 // find south wall
462 std::vector<Surface> searchResults;
463
464 searchResults = space1->findSurfaces(180.0, 180.0, 90.0, 90.0);
465 OS_ASSERT(searchResults.size() >= 1);
466
467 // add door
468 SubSurface door(doorPoints, model);
469 door.setSurface(searchResults[0]);
470

Callers 2

TEST_FFunction · 0.85
TEST_FFunction · 0.85

Calls 13

matchSurfacesFunction · 0.85
setBuildingStoryMethod · 0.80
findSurfacesMethod · 0.80
Point3dClass · 0.50
setNominalZCoordinateMethod · 0.45
push_backMethod · 0.45
setThermalZoneMethod · 0.45
setXOriginMethod · 0.45
setYOriginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected