Skip to content

Commit

Permalink
fix clangformat spacing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tijcolem committed Feb 18, 2022
1 parent 7bcafb4 commit 46721d8
Showing 1 changed file with 98 additions and 97 deletions.
195 changes: 98 additions & 97 deletions src/gbxml/Test/ForwardTranslator_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,111 +408,112 @@ TEST_F(gbXMLFixture, ForwardTranslator_Issue_4375) {
}
}
}
}

Model testModel() {
Model model;

Building building = model.getUniqueModelObject<Building>();
BuildingStory buildingStory(model);
buildingStory.setNominalZCoordinate(0);
buildingStory.setNominalFloortoFloorHeight(3);

ThermalZone thermalZone(model);

std::vector<Point3d> floorPrint;
floorPrint.push_back(Point3d(0, 0, 0));
floorPrint.push_back(Point3d(0, 10, 0));
floorPrint.push_back(Point3d(10, 10, 0));
floorPrint.push_back(Point3d(10, 0, 0));

// make spaces
boost::optional<Space> space1 = Space::fromFloorPrint(floorPrint, 3, model);
OS_ASSERT(space1);
space1->setThermalZone(thermalZone);
space1->setBuildingStory(buildingStory);

boost::optional<Space> space2 = Space::fromFloorPrint(floorPrint, 3, model);
OS_ASSERT(space2);
space2->setXOrigin(10);
space2->setThermalZone(thermalZone);
space2->setBuildingStory(buildingStory);

boost::optional<Space> space3 = Space::fromFloorPrint(floorPrint, 3, model);
OS_ASSERT(space3);
space3->setYOrigin(10);
space3->setThermalZone(thermalZone);
space3->setBuildingStory(buildingStory);

boost::optional<Space> space4 = Space::fromFloorPrint(floorPrint, 3, model);
OS_ASSERT(space4);
space4->setXOrigin(10);
space4->setYOrigin(10);
space4->setThermalZone(thermalZone);
space4->setBuildingStory(buildingStory);

// add a door to south wall of space1
std::vector<Point3d> doorPoints;
doorPoints.push_back(Point3d(2, 0, 2));
doorPoints.push_back(Point3d(2, 0, 0));
doorPoints.push_back(Point3d(4, 0, 0));
doorPoints.push_back(Point3d(4, 0, 2));

// find south wall
std::vector<Surface> searchResults;

searchResults = space1->findSurfaces(180.0, 180.0, 90.0, 90.0);
OS_ASSERT(searchResults.size() >= 1);

// add door
SubSurface door(doorPoints, model);
door.setSurface(searchResults[0]);

// add a window to east wall of space2
std::vector<Point3d> windowPoints;
windowPoints.push_back(Point3d(10, 2, 2));
windowPoints.push_back(Point3d(10, 2, 1));
windowPoints.push_back(Point3d(10, 8, 1));
windowPoints.push_back(Point3d(10, 8, 2));

// find east wall
searchResults = space2->findSurfaces(90.0, 90.0, 90.0, 90.0);
OS_ASSERT(searchResults.size() >= 1);

// add window
SubSurface window(windowPoints, model);
window.setSurface(searchResults[0]);

// match surfaces
std::vector<Space> spaces = model.getConcreteModelObjects<Space>();
matchSurfaces(spaces);

return model;
}
Model testModel() {
Model model;

// Create two gbxml models from two identical osm models should produce
// gbxml models with surfaces in the same order. issue 4438
TEST_F(gbXMLFixture, ForwardTranslator_4438_Deterministic) {
Model model1 = testModel();
Building building = model.getUniqueModelObject<Building>();
BuildingStory buildingStory(model);
buildingStory.setNominalZCoordinate(0);
buildingStory.setNominalFloortoFloorHeight(3);

ThermalZone thermalZone(model);

std::vector<Point3d> floorPrint;
floorPrint.push_back(Point3d(0, 0, 0));
floorPrint.push_back(Point3d(0, 10, 0));
floorPrint.push_back(Point3d(10, 10, 0));
floorPrint.push_back(Point3d(10, 0, 0));

// make spaces
boost::optional<Space> space1 = Space::fromFloorPrint(floorPrint, 3, model);
OS_ASSERT(space1);
space1->setThermalZone(thermalZone);
space1->setBuildingStory(buildingStory);

boost::optional<Space> space2 = Space::fromFloorPrint(floorPrint, 3, model);
OS_ASSERT(space2);
space2->setXOrigin(10);
space2->setThermalZone(thermalZone);
space2->setBuildingStory(buildingStory);

boost::optional<Space> space3 = Space::fromFloorPrint(floorPrint, 3, model);
OS_ASSERT(space3);
space3->setYOrigin(10);
space3->setThermalZone(thermalZone);
space3->setBuildingStory(buildingStory);

boost::optional<Space> space4 = Space::fromFloorPrint(floorPrint, 3, model);
OS_ASSERT(space4);
space4->setXOrigin(10);
space4->setYOrigin(10);
space4->setThermalZone(thermalZone);
space4->setBuildingStory(buildingStory);

// add a door to south wall of space1
std::vector<Point3d> doorPoints;
doorPoints.push_back(Point3d(2, 0, 2));
doorPoints.push_back(Point3d(2, 0, 0));
doorPoints.push_back(Point3d(4, 0, 0));
doorPoints.push_back(Point3d(4, 0, 2));

// find south wall
std::vector<Surface> searchResults;

searchResults = space1->findSurfaces(180.0, 180.0, 90.0, 90.0);
OS_ASSERT(searchResults.size() >= 1);

// add door
SubSurface door(doorPoints, model);
door.setSurface(searchResults[0]);

// add a window to east wall of space2
std::vector<Point3d> windowPoints;
windowPoints.push_back(Point3d(10, 2, 2));
windowPoints.push_back(Point3d(10, 2, 1));
windowPoints.push_back(Point3d(10, 8, 1));
windowPoints.push_back(Point3d(10, 8, 2));

// find east wall
searchResults = space2->findSurfaces(90.0, 90.0, 90.0, 90.0);
OS_ASSERT(searchResults.size() >= 1);

// add window
SubSurface window(windowPoints, model);
window.setSurface(searchResults[0]);

// match surfaces
std::vector<Space> spaces = model.getConcreteModelObjects<Space>();
matchSurfaces(spaces);

return model;
}

path p1 = resourcesPath() / openstudio::toPath("gbxml/exampleModel1.xml");
// Create two gbxml models from two identical osm models should produce
// gbxml models with surfaces in the same order. issue 4438
TEST_F(gbXMLFixture, ForwardTranslator_4438_Deterministic) {
Model model1 = testModel();

ForwardTranslator forwardTranslator;
bool test1 = forwardTranslator.modelToGbXML(model1, p1);
path p1 = resourcesPath() / openstudio::toPath("gbxml/exampleModel1.xml");

EXPECT_TRUE(test1);
ForwardTranslator forwardTranslator;
bool test1 = forwardTranslator.modelToGbXML(model1, p1);

path ps1 = resourcesPath() / openstudio::toPath("gbxml/exampleModel1.osm");
model1.save(ps1, true);
EXPECT_TRUE(test1);

Model model2 = testModel();
path ps1 = resourcesPath() / openstudio::toPath("gbxml/exampleModel1.osm");
model1.save(ps1, true);

path p2 = resourcesPath() / openstudio::toPath("gbxml/exampleModel2.xml");
Model model2 = testModel();

//ForwardTranslator forwardTranslator;
bool test2 = forwardTranslator.modelToGbXML(model2, p2);
path p2 = resourcesPath() / openstudio::toPath("gbxml/exampleModel2.xml");

EXPECT_TRUE(test2);
//ForwardTranslator forwardTranslator;
bool test2 = forwardTranslator.modelToGbXML(model2, p2);

path ps2 = resourcesPath() / openstudio::toPath("gbxml/exampleModel2.osm");
model1.save(ps2, true);
}
EXPECT_TRUE(test2);

path ps2 = resourcesPath() / openstudio::toPath("gbxml/exampleModel2.osm");
model1.save(ps2, true);
}

0 comments on commit 46721d8

Please sign in to comment.