Skip to content

Commit

Permalink
#1838: lb: use const where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Oct 3, 2022
1 parent 535db9f commit 40a4635
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/balance/model/composed_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ComposedModel::getModeledLoad(ElementIDStruct object, PhaseOffset when) const {
}

TimeType
ComposedModel::getModeledComm(ElementIDStruct object, PhaseOffset when) {
ComposedModel::getModeledComm(ElementIDStruct object, PhaseOffset when) const {
return base_->getModeledComm(object, when);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace vt { namespace vrt { namespace collection { namespace balance {

TimeType WeightedCommunicationVolume::getModeledLoad(
ElementIDStruct object, PhaseOffset when
) {
) const {
return alpha_ * ComposedModel::getModeledLoad(object, when) +
beta_ * ComposedModel::getModeledComm(object, when) + gamma_;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class WeightedCommunicationVolume : public ComposedModel {
beta_(beta),
gamma_(gamma) { }

TimeType getModeledLoad(ElementIDStruct object, PhaseOffset when) override;
TimeType getModeledLoad(ElementIDStruct object, PhaseOffset when) const override;

private:
double alpha_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct StubModel : LoadModel {

void updateLoads(PhaseType) override { }

TimeType getModeledLoad(ElementIDStruct id, PhaseOffset phase) override {
TimeType getModeledLoad(ElementIDStruct id, PhaseOffset phase) const override {
const auto work = proc_load_->at(0).at(id).whole_phase_load;

if (phase.subphase == PhaseOffset::WHOLE_PHASE) {
Expand All @@ -94,17 +94,17 @@ struct StubModel : LoadModel {
}
}

ObjectIterator begin() override {
ObjectIterator begin() const override {
return {std::make_unique<LoadMapObjectIterator>(
proc_load_->at(0).begin(), proc_load_->at(0).end()
)};
}

unsigned int getNumCompletedPhases() override { return num_phases; }
unsigned int getNumCompletedPhases() const override { return num_phases; }

// Not used in this test
int getNumSubphases() override { return 0; }
unsigned int getNumPastPhasesNeeded(unsigned int look_back = 0) override {
int getNumSubphases() const override { return 0; }
unsigned int getNumPastPhasesNeeded(unsigned int look_back = 0) const override {
return look_back;
}

Expand Down

0 comments on commit 40a4635

Please sign in to comment.