Skip to content

Commit

Permalink
Remove remove override and update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-robertson authored and jmarrec committed Jan 9, 2025
1 parent 84bb380 commit 33a57ff
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 31 deletions.
22 changes: 0 additions & 22 deletions src/model/ZoneHVACEvaporativeCoolerUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,6 @@ namespace model {
return std::move(evaporativeCoolUnitClone);
}

std::vector<IdfObject> ZoneHVACEvaporativeCoolerUnit_Impl::remove() {
std::vector<IdfObject> result;

if (OptionalHVACComponent intermediate = optionalSupplyAirFan()) {
std::vector<IdfObject> removedSupplyAirFans = intermediate->remove();
result.insert(result.end(), removedSupplyAirFans.begin(), removedSupplyAirFans.end());
}
if (OptionalHVACComponent intermediate = optionalFirstEvaporativeCooler()) {
std::vector<IdfObject> removedFirstEvaporativeCoolers = intermediate->remove();
result.insert(result.end(), removedFirstEvaporativeCoolers.begin(), removedFirstEvaporativeCoolers.end());
}
if (OptionalHVACComponent intermediate = secondEvaporativeCooler()) {
std::vector<IdfObject> removedSecondEvaporativeCoolers = intermediate->remove();
result.insert(result.end(), removedSecondEvaporativeCoolers.begin(), removedSecondEvaporativeCoolers.end());
}

std::vector<IdfObject> removedZoneHVACEvaporativeCoolerUnit = ZoneHVACComponent_Impl::remove();
result.insert(result.end(), removedZoneHVACEvaporativeCoolerUnit.begin(), removedZoneHVACEvaporativeCoolerUnit.end());

return result;
}

const std::vector<std::string>& ZoneHVACEvaporativeCoolerUnit_Impl::outputVariableNames() const {
static std::vector<std::string> result;
if (result.empty()) {
Expand Down
2 changes: 0 additions & 2 deletions src/model/ZoneHVACEvaporativeCoolerUnit_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ namespace model {

virtual ModelObject clone(Model model) const override;

virtual std::vector<IdfObject> remove() override;

virtual const std::vector<std::string>& outputVariableNames() const override;

virtual IddObjectType iddObjectType() const override;
Expand Down
25 changes: 18 additions & 7 deletions src/model/test/ZoneHVACEvaporativeCoolerUnit_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "../ZoneHVACEvaporativeCoolerUnit_Impl.hpp"
#include "../Schedule.hpp"
#include "../Schedule_Impl.hpp"
#include "../ScheduleConstant.hpp"
#include "../ScheduleConstant_Impl.hpp"
#include "../FanComponentModel.hpp"
#include "../FanComponentModel_Impl.hpp"
#include "../EvaporativeCoolerDirectResearchSpecial.hpp"
Expand Down Expand Up @@ -204,9 +206,9 @@ TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_clone) {
EXPECT_NE(firstEvaporativeCooler.handle(), zonehvacClone.firstEvaporativeCooler().handle());
ASSERT_TRUE(zonehvacClone.secondEvaporativeCooler());
EXPECT_NE(secondEvaporativeCooler.handle(), zonehvacClone.secondEvaporativeCooler().get().handle());
EXPECT_EQ(1u, m.getConcreteModelObjects<FanComponentModel>().size());
EXPECT_EQ(1u, m.getConcreteModelObjects<EvaporativeCoolerDirectResearchSpecial>().size());
EXPECT_EQ(1u, m.getConcreteModelObjects<EvaporativeCoolerIndirectResearchSpecial>().size());
EXPECT_EQ(2u, m.getConcreteModelObjects<FanComponentModel>().size());
EXPECT_EQ(2u, m.getConcreteModelObjects<EvaporativeCoolerDirectResearchSpecial>().size());
EXPECT_EQ(2u, m.getConcreteModelObjects<EvaporativeCoolerIndirectResearchSpecial>().size());
}
}

Expand All @@ -215,9 +217,18 @@ TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_remove) {
ZoneHVACEvaporativeCoolerUnit zonehvac(m);

auto size = m.modelObjects().size();
EXPECT_EQ(1, m.getConcreteModelObjects<ZoneHVACEvaporativeCoolerUnit>().size());
EXPECT_EQ(1, m.getConcreteModelObjects<FanComponentModel>().size());
EXPECT_EQ(1, m.getConcreteModelObjects<EvaporativeCoolerDirectResearchSpecial>().size());
EXPECT_EQ(0, m.getConcreteModelObjects<EvaporativeCoolerIndirectResearchSpecial>().size());
EXPECT_EQ(1, m.getConcreteModelObjects<ScheduleConstant>().size());
EXPECT_FALSE(zonehvac.remove().empty());
EXPECT_EQ(size - 1, m.modelObjects().size());
EXPECT_EQ(0, m.getConcreteModelObjects<ZoneHVACEvaporativeCoolerUnit>().size());
EXPECT_EQ(0, m.getConcreteModelObjects<FanComponentModel>().size());
EXPECT_EQ(0, m.getConcreteModelObjects<EvaporativeCoolerDirectResearchSpecial>().size());
EXPECT_EQ(0, m.getConcreteModelObjects<EvaporativeCoolerIndirectResearchSpecial>().size());
EXPECT_EQ(1, m.getConcreteModelObjects<ScheduleConstant>().size());
}

TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_addToNode) {
Expand All @@ -238,8 +249,8 @@ TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_addToNode) {

PlantLoop plantLoop(m);
supplyOutletNode = plantLoop.supplyOutletNode();
EXPECT_TRUE(zonehvac.addToNode(supplyOutletNode));
EXPECT_EQ(7, plantLoop.supplyComponents().size());
EXPECT_FALSE(zonehvac.addToNode(supplyOutletNode));
EXPECT_EQ(5, plantLoop.supplyComponents().size());

Node demandOutletNode = plantLoop.demandOutletNode();
EXPECT_FALSE(zonehvac.addToNode(demandOutletNode));
Expand All @@ -248,6 +259,6 @@ TEST_F(ModelFixture, ZoneHVACEvaporativeCoolerUnit_addToNode) {
auto zonehvacClone = zonehvac.clone(m).cast<ZoneHVACEvaporativeCoolerUnit>();
supplyOutletNode = plantLoop.supplyOutletNode();

EXPECT_TRUE(zonehvacClone.addToNode(supplyOutletNode));
EXPECT_EQ(9, plantLoop.supplyComponents().size());
EXPECT_FALSE(zonehvacClone.addToNode(supplyOutletNode));
EXPECT_EQ(5, plantLoop.supplyComponents().size());
}

0 comments on commit 33a57ff

Please sign in to comment.