Skip to content

Commit e42988b

Browse files
committed
fix broken test
1 parent 34a1e7a commit e42988b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/DecimationReductionMethod.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,15 @@ void DecimationReductionMethod::parameterize_for_variable(
112112
throw UnknownDecimationOptionException(XBT_THROW_POINT, key);
113113
}
114114

115-
// Always (re)create the parameterization — avoids field-by-field update complexity.
116-
per_variable_parameterizations_[&var] =
117-
std::make_shared<ParameterizedDecimation>(var, stride, interpolation_method, cost_per_element);
115+
if (it == per_variable_parameterizations_.end()) {
116+
per_variable_parameterizations_.try_emplace(
117+
&var, std::make_shared<ParameterizedDecimation>(var, stride, interpolation_method, cost_per_element));
118+
} else {
119+
// Update in-place to preserve per-actor state accumulated by reduce_variable().
120+
it->second->set_stride(stride);
121+
it->second->set_interpolation_method(interpolation_method);
122+
it->second->set_cost_per_element(cost_per_element);
123+
}
118124
}
119125

120126
void DecimationReductionMethod::reduce_variable(const Variable& var)

0 commit comments

Comments
 (0)