本文整理汇总了C++中Point3dVector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3dVector::push_back方法的具体用法?C++ Point3dVector::push_back怎么用?C++ Point3dVector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3dVector
的用法示例。
在下文中一共展示了Point3dVector::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: thermalZone
TEST_F(EnergyPlusFixture,ForwardTranslator_ShadingSurface_Space)
{
Model model;
ThermalZone thermalZone(model);
Point3dVector points;
points.push_back(Point3d(0,1,0));
points.push_back(Point3d(1,1,0));
points.push_back(Point3d(1,0,0));
points.push_back(Point3d(0,0,0));
boost::optional<Space> space = Space::fromFloorPrint(points, 1, model);
ASSERT_TRUE(space);
space->setThermalZone(thermalZone);
ShadingSurfaceGroup shadingSurfaceGroup(model);
EXPECT_TRUE(shadingSurfaceGroup.setSpace(*space));
ShadingSurface shadingSurface(points, model);
EXPECT_TRUE(shadingSurface.setShadingSurfaceGroup(shadingSurfaceGroup));
ForwardTranslator forwardTranslator;
Workspace workspace = forwardTranslator.translateModel(model);
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Shading_Zone_Detailed).size());
WorkspaceObject zoneObject = workspace.getObjectsByType(IddObjectType::Zone)[0];
WorkspaceObject shadingSurfaceObject = workspace.getObjectsByType(IddObjectType::Shading_Zone_Detailed)[0];
EXPECT_TRUE(shadingSurfaceObject.getTarget(Shading_Zone_DetailedFields::BaseSurfaceName));
}
示例2: spaceType
TEST_F(EnergyPlusFixture,ForwardTranslator_ThermalZone_OneZone_OneSpace_Building)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(1, 1, 0));
points.push_back(Point3d(1, 0, 0));
SpaceType spaceType(model);
spaceType.setLightingPowerPerFloorArea(1);
Building building = model.getUniqueModelObject<Building>();
building.setSpaceType(spaceType);
ThermalZone zone(model);
Space space(model);
space.setThermalZone(zone);
Surface surface(points, model);
surface.setSpace(space);
EXPECT_EQ(1, space.floorArea());
EXPECT_EQ(1, space.lightingPowerPerFloorArea());
ForwardTranslator trans;
Workspace workspace = trans.translateModel(model);
EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::ZoneList).size());
EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::Lights).size());
}
示例3: surface
TEST_F(ModelFixture, ModelObject_Clone_SameModel) {
// Make model object with resource that has children
Model original;
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
Surface surface(points, original);
Construction construction(original);
surface.setConstruction(construction);
construction.standardsInformation(); // creates object
StandardOpaqueMaterial material(original);
construction.setLayers(MaterialVector(1u,material));
EXPECT_EQ(4u,original.numObjects());
// Clone into same model -- new object with different name. resources reused.
Surface newSurface = surface.clone(original).cast<Surface>();
EXPECT_FALSE(newSurface == surface);
EXPECT_EQ(5u,original.numObjects());
EXPECT_NE(surface.name().get(),newSurface.name().get());
ASSERT_TRUE(surface.construction());
ASSERT_TRUE(newSurface.construction());
EXPECT_TRUE(surface.construction().get() == newSurface.construction().get());
EXPECT_TRUE(newSurface.construction().get().cast<LayeredConstruction>().numLayers() == 1u);
}
示例4: thermalZone
TEST_F(EnergyPlusFixture,ForwardTranslator_Surface_Zone)
{
Model model;
ThermalZone thermalZone(model);
Space space(model);
space.setThermalZone(thermalZone);
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
Surface surface(points, model);
surface.setSpace(space);
ForwardTranslator forwardTranslator;
Workspace workspace = forwardTranslator.translateModel(model);
EXPECT_EQ(0u, forwardTranslator.errors().size());
EXPECT_EQ(0u, forwardTranslator.warnings().size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed).size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
WorkspaceObject surfaceObject = workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed)[0];
WorkspaceObject zoneObject = workspace.getObjectsByType(IddObjectType::Zone)[0];
ASSERT_TRUE(surfaceObject.getTarget(BuildingSurface_DetailedFields::ZoneName));
EXPECT_EQ(zoneObject.handle(), surfaceObject.getTarget(BuildingSurface_DetailedFields::ZoneName)->handle());
}
示例5: space
TEST_F(ModelFixture, InteriorPartitionSurface_DefaultConstruction)
{
Model model;
Space space(model);
Construction construction(model);
DefaultConstructionSet defaultConstructionSet(model);
defaultConstructionSet.setInteriorPartitionConstruction(construction);
space.setDefaultConstructionSet(defaultConstructionSet);
InteriorPartitionSurfaceGroup group(model);
group.setSpace(space);
Point3dVector points;
points.push_back(Point3d(0, 2, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
InteriorPartitionSurface surface(points, model);
EXPECT_FALSE(surface.construction());
surface.setInteriorPartitionSurfaceGroup(group);
ASSERT_TRUE(surface.construction());
EXPECT_EQ(construction.handle(), surface.construction()->handle());
}
示例6: surface
TEST_F(ModelFixture, DefaultConstructionSet_ShadingSurface)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0,1,0));
points.push_back(Point3d(0,0,0));
points.push_back(Point3d(1,0,0));
ShadingSurface surface(points, model);
ShadingSurfaceGroup shadingSurfaceGroup(model);
surface.setShadingSurfaceGroup(shadingSurfaceGroup);
DefaultConstructionSet defaultConstructionSet(model);
DefaultSurfaceConstructions defaultSurfaceConstructions(model);
Construction construction(model);
EXPECT_TRUE(shadingSurfaceGroup.setShadingSurfaceType("Site"));
EXPECT_EQ("Site", shadingSurfaceGroup.shadingSurfaceType());
EXPECT_FALSE(defaultConstructionSet.siteShadingConstruction());
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_TRUE(defaultConstructionSet.setSiteShadingConstruction(construction));
ASSERT_TRUE(defaultConstructionSet.siteShadingConstruction());
EXPECT_EQ(construction.handle(), defaultConstructionSet.siteShadingConstruction()->handle());
ASSERT_TRUE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_EQ(construction.handle(), defaultConstructionSet.getDefaultConstruction(surface)->handle());
defaultConstructionSet.resetSiteShadingConstruction();
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_TRUE(shadingSurfaceGroup.setShadingSurfaceType("Building"));
EXPECT_EQ("Building", shadingSurfaceGroup.shadingSurfaceType());
EXPECT_FALSE(defaultConstructionSet.buildingShadingConstruction());
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_TRUE(defaultConstructionSet.setBuildingShadingConstruction(construction));
ASSERT_TRUE(defaultConstructionSet.buildingShadingConstruction());
EXPECT_EQ(construction.handle(), defaultConstructionSet.buildingShadingConstruction()->handle());
ASSERT_TRUE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_EQ(construction.handle(), defaultConstructionSet.getDefaultConstruction(surface)->handle());
defaultConstructionSet.resetBuildingShadingConstruction();
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_FALSE(shadingSurfaceGroup.setShadingSurfaceType("Space"));
Space space(model);
EXPECT_TRUE(shadingSurfaceGroup.setSpace(space));
EXPECT_EQ("Space", shadingSurfaceGroup.shadingSurfaceType());
EXPECT_FALSE(defaultConstructionSet.spaceShadingConstruction());
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_TRUE(defaultConstructionSet.setSpaceShadingConstruction(construction));
ASSERT_TRUE(defaultConstructionSet.spaceShadingConstruction());
EXPECT_EQ(construction.handle(), defaultConstructionSet.spaceShadingConstruction()->handle());
ASSERT_TRUE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_EQ(construction.handle(), defaultConstructionSet.getDefaultConstruction(surface)->handle());
defaultConstructionSet.resetSpaceShadingConstruction();
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
}
示例7: thermalZone
TEST_F(ModelFixture, DesignSpecificationOutdoorAir_ThermalZone_2DifferentSpaces)
{
Model model;
// 1 m^2
Point3dVector points;
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(1, 1, 0));
points.push_back(Point3d(1, 0, 0));
ThermalZone thermalZone(model);
DesignSpecificationOutdoorAir designSpecificationOutdoorAir1(model);
EXPECT_TRUE(designSpecificationOutdoorAir1.setOutdoorAirFlowperPerson(0.0));
EXPECT_TRUE(designSpecificationOutdoorAir1.setOutdoorAirFlowperFloorArea(2.0));
DesignSpecificationOutdoorAir designSpecificationOutdoorAir2(model);
EXPECT_TRUE(designSpecificationOutdoorAir2.setOutdoorAirFlowperPerson(3.0));
Space space1(model);
EXPECT_TRUE(space1.setThermalZone(thermalZone));
EXPECT_TRUE(space1.setDesignSpecificationOutdoorAir(designSpecificationOutdoorAir1));
Surface surface1(points, model);
surface1.setParent(space1);
EXPECT_EQ(1.0, space1.floorArea());
space1.setPeoplePerFloorArea(1.0);
EXPECT_EQ(1.0, space1.numberOfPeople());
Space space2(model);
EXPECT_TRUE(space2.setThermalZone(thermalZone));
EXPECT_TRUE(space2.setDesignSpecificationOutdoorAir(designSpecificationOutdoorAir2));
Surface surface2(points, model);
surface2.setParent(space2);
EXPECT_EQ(1.0, space2.floorArea());
space2.setPeoplePerFloorArea(2.0);
EXPECT_EQ(2.0, space2.numberOfPeople());
EXPECT_EQ(2u, model.getModelObjects<DesignSpecificationOutdoorAir>().size());
boost::optional<Space> combinedSpace = thermalZone.combineSpaces();
ASSERT_TRUE(combinedSpace);
EXPECT_FALSE(combinedSpace->isDesignSpecificationOutdoorAirDefaulted());
ASSERT_TRUE(combinedSpace->designSpecificationOutdoorAir());
EXPECT_EQ(3u, model.getModelObjects<DesignSpecificationOutdoorAir>().size());
EXPECT_NE(designSpecificationOutdoorAir1.handle(), combinedSpace->designSpecificationOutdoorAir()->handle());
EXPECT_NE(designSpecificationOutdoorAir2.handle(), combinedSpace->designSpecificationOutdoorAir()->handle());
EXPECT_EQ(1.0, combinedSpace->designSpecificationOutdoorAir()->outdoorAirFlowperFloorArea()); // (2*1 + 0*1)/2
EXPECT_EQ(2.0, combinedSpace->designSpecificationOutdoorAir()->outdoorAirFlowperPerson()); // (0*1 + 3*2)/3
}
示例8: door
TEST_F(ModelFixture, DaylightingDeviceShelf_Throw)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 0, 1));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 1, 1));
SubSurface door(points, model);
EXPECT_TRUE(door.setSubSurfaceType("Door"));
EXPECT_EQ("Door", door.subSurfaceType());
EXPECT_EQ(0, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
bool didThrow = false;
try{
DaylightingDeviceShelf shelf(door);
}catch(const openstudio::Exception&){
didThrow = true;
}
EXPECT_TRUE(didThrow);
EXPECT_EQ(0, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
// change to a window
EXPECT_TRUE(door.setSubSurfaceType("FixedWindow"));
EXPECT_EQ("FixedWindow", door.subSurfaceType());
// first one succeeds
didThrow = false;
try{
DaylightingDeviceShelf shelf(door);
}catch(const openstudio::Exception&){
didThrow = true;
}
EXPECT_FALSE(didThrow);
EXPECT_EQ(1, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
// second call throws
didThrow = false;
try{
DaylightingDeviceShelf shelf(door);
}catch(const openstudio::Exception&){
didThrow = true;
}
EXPECT_TRUE(didThrow);
EXPECT_EQ(1, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
// changing to door removes light shelf
EXPECT_TRUE(door.setSubSurfaceType("Door"));
EXPECT_EQ("Door", door.subSurfaceType());
EXPECT_FALSE(door.daylightingDeviceShelf());
EXPECT_FALSE(door.addDaylightingDeviceShelf());
EXPECT_EQ(0, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
}
示例9: space
TEST_F(ModelFixture, ShadingSurfaceGroup_Space_Hierarchy)
{
Model model;
// add a space
Space space(model);
// add a shading surface group
ShadingSurfaceGroup group(model);
EXPECT_EQ("Building", group.shadingSurfaceType());
EXPECT_TRUE(group.setSpace(space));
EXPECT_EQ("Space", group.shadingSurfaceType());
ASSERT_TRUE(group.space());
EXPECT_EQ(space.handle(), group.space()->handle());
// make a new shading surface
Point3dVector points;
points.push_back(Point3d(0, 2, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
ShadingSurface surface(points, model);
EXPECT_TRUE(surface.setShadingSurfaceGroup(group));
ASSERT_TRUE(surface.shadingSurfaceGroup());
EXPECT_EQ(group.handle(), surface.shadingSurfaceGroup()->handle());
// check children from group
ASSERT_EQ(static_cast<unsigned>(1), group.children().size());
EXPECT_EQ(surface.handle(), group.children()[0].handle());
// now check children from space
ASSERT_EQ(static_cast<unsigned>(1), space.children().size());
EXPECT_EQ(group.handle(), space.children()[0].handle());
// check parent from group
ASSERT_TRUE(group.parent());
EXPECT_EQ(space.handle(), group.parent()->handle());
// check parent from surface
ASSERT_TRUE(surface.parent());
EXPECT_EQ(group.handle(), surface.parent()->handle());
// clone the space
ModelObject clone = space.clone(model);
OptionalSpace spaceClone = clone.optionalCast<Space>();
ASSERT_TRUE(spaceClone);
ASSERT_EQ(static_cast<unsigned>(1), spaceClone->children().size());
EXPECT_NE(group.handle(), spaceClone->children()[0].handle());
OptionalShadingSurfaceGroup cloneChild = spaceClone->children()[0].optionalCast<ShadingSurfaceGroup>();
ASSERT_TRUE(cloneChild);
ASSERT_EQ(static_cast<unsigned>(1), cloneChild->children().size());
EXPECT_NE(surface.handle(), cloneChild->children()[0].handle());
}
示例10: interiorPartitionSurface
TEST_F(ModelFixture, InteriorPartitionSurface)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
EXPECT_NO_THROW(InteriorPartitionSurface(points, model));
InteriorPartitionSurface interiorPartitionSurface(points, model);
EXPECT_FALSE(interiorPartitionSurface.interiorPartitionSurfaceGroup());
}
示例11: shadingSurface
TEST_F(ModelFixture, ShadingSurface)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
EXPECT_NO_THROW(ShadingSurface(points, model));
ShadingSurface shadingSurface(points, model);
EXPECT_FALSE(shadingSurface.shadingSurfaceGroup());
}
示例12: window
TEST_F(ModelFixture, DaylightingDeviceShelf)
{
Model model;
// triangle with unit area
Point3dVector points;
points.push_back(Point3d(0, 2, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
SubSurface window(points, model);
DaylightingDeviceShelf shelf(window);
EXPECT_EQ(window.handle(), shelf.subSurface().handle());
}
示例13: construction
TEST_F(EnergyPlusFixture,ForwardTranslator_Surface_DefaultConstruction)
{
Model model;
Construction construction(model);
DefaultSurfaceConstructions defaultSurfaceConstructions(model);
defaultSurfaceConstructions.setRoofCeilingConstruction(construction);
DefaultConstructionSet defaultConstructionSet(model);
defaultConstructionSet.setDefaultExteriorSurfaceConstructions(defaultSurfaceConstructions);
Building building = model.getUniqueModelObject<Building>();
building.setDefaultConstructionSet(defaultConstructionSet);
Space space(model);
ThermalZone zone(model);
EXPECT_TRUE(space.setThermalZone(zone));
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
Surface surface(points, model);
surface.setSpace(space);
EXPECT_EQ("RoofCeiling", surface.surfaceType());
EXPECT_EQ("Outdoors", surface.outsideBoundaryCondition());
EXPECT_FALSE(surface.adjacentSurface());
ASSERT_TRUE(surface.construction());
EXPECT_TRUE(surface.isConstructionDefaulted());
EXPECT_EQ(construction.handle(), surface.construction()->handle());
ForwardTranslator forwardTranslator;
Workspace workspace = forwardTranslator.translateModel(model);
EXPECT_EQ(0u, forwardTranslator.errors().size());
EXPECT_EQ(0u, forwardTranslator.warnings().size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed).size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Construction).size());
WorkspaceObject surfaceObject = workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed)[0];
WorkspaceObject constructionObject = workspace.getObjectsByType(IddObjectType::Construction)[0];
ASSERT_TRUE(surfaceObject.getTarget(BuildingSurface_DetailedFields::ConstructionName));
EXPECT_EQ(constructionObject.handle(), surfaceObject.getTarget(BuildingSurface_DetailedFields::ConstructionName)->handle());
}
示例14: spaceType
TEST_F(ModelFixture, ElectricEquipment_Cost) {
Model model;
Building building = model.getUniqueModelObject<Building>();
SpaceType spaceType(model);
Point3dVector floorPrint;
floorPrint.push_back(Point3d(0, 10, 0));
floorPrint.push_back(Point3d(10, 10, 0));
floorPrint.push_back(Point3d(10, 0, 0));
floorPrint.push_back(Point3d(0, 0, 0));
boost::optional<Space> space1 = Space::fromFloorPrint(floorPrint, 3, model);
ASSERT_TRUE(space1);
boost::optional<Space> space2 = Space::fromFloorPrint(floorPrint, 3, model);
ASSERT_TRUE(space2);
EXPECT_DOUBLE_EQ(200, building.floorArea());
ElectricEquipmentDefinition definition(model);
ElectricEquipment electricEquipment1(definition);
ElectricEquipment electricEquipment2(definition);
boost::optional<LifeCycleCost> cost = LifeCycleCost::createLifeCycleCost("Dusting", definition, 0.5, "CostPerArea", "Maintenance", 1);
ASSERT_TRUE(cost);
EXPECT_EQ(1, cost->repeatPeriodYears());
EXPECT_DOUBLE_EQ(0, cost->totalCost());
electricEquipment1.setSpace(*space1);
EXPECT_DOUBLE_EQ(50, cost->totalCost());
electricEquipment2.setSpace(*space2);
EXPECT_DOUBLE_EQ(100, cost->totalCost());
ThermalZone thermalZone(model);
space1->setThermalZone(thermalZone);
thermalZone.setMultiplier(4);
EXPECT_DOUBLE_EQ(250.0, cost->totalCost());
building.setSpaceType(spaceType);
electricEquipment1.setSpaceType(spaceType);
EXPECT_DOUBLE_EQ(300.0, cost->totalCost());
}
示例15: surface
TEST_F(EnergyPlusFixture,ForwardTranslator_Surface)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
Surface surface(points, model);
ForwardTranslator forwardTranslator;
Workspace workspace = forwardTranslator.translateModel(model);
EXPECT_EQ(0u, forwardTranslator.errors().size());
EXPECT_EQ(0u, forwardTranslator.warnings().size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed).size());
}