diff --git a/src/vt/vrt/collection/balance/read_lb.cc b/src/vt/vrt/collection/balance/read_lb.cc index cdb1807e2c..39ee0085d2 100644 --- a/src/vt/vrt/collection/balance/read_lb.cc +++ b/src/vt/vrt/collection/balance/read_lb.cc @@ -64,16 +64,16 @@ namespace vt { namespace vrt { namespace collection { namespace balance { /*static*/ bool ReadLBSpec::read_complete_ = false; /*static*/ bool ReadLBSpec::openSpec(std::string const& filename) { - // Ignore attempt to open same spec. - if (not open_filename_.empty() and open_filename_ == filename) { - return true; - } - // No-op if no file specified. Can't be used to clear. if (filename.empty()) { return false; } + // Ignore attempt to open same spec. + if (not open_filename_.empty() and open_filename_ == filename) { + return true; + } + vtAssert( open_filename_.empty(), "Spec already opened. Use clear first to load again." @@ -332,7 +332,7 @@ auto excluded_str = [](SpecIndex idx) -> std::string { std::stringstream ss; if (open_filename_.empty()) { - return ""; + return "[No LB Spec open]"; } if (not ReadLBSpec::getExactEntries().empty()) { diff --git a/src/vt/vrt/collection/balance/read_lb.h b/src/vt/vrt/collection/balance/read_lb.h index b552faf564..182b4e6d5f 100644 --- a/src/vt/vrt/collection/balance/read_lb.h +++ b/src/vt/vrt/collection/balance/read_lb.h @@ -182,10 +182,16 @@ struct ReadLBSpec { using ParamMapType = std::map; /** - * \brief Prepare the spec for reading, if it exists. + * \brief Opens and reads the spec file, if it exists. * - * This will also ensure the spec is loaded. - * This method MUST be called before the other methods. + * This method MUST be called before the other access methods. + * + * \param[in] filename The path to the file to read. + * + * \pre A different spec file is not currently open. + * \pre The filename refers to a valid spec file. + * + * \return True if the spec was opened and can be used. */ static bool openSpec(std::string const& filename);