Skip to content

Commit

Permalink
#990 lb reader- update code per PR
Browse files Browse the repository at this point in the history
- Small changes for clarity.
  • Loading branch information
pnstickne committed Aug 25, 2020
1 parent 049c406 commit 83b1f75
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/vt/vrt/collection/balance/read_lb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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()) {
Expand Down
12 changes: 9 additions & 3 deletions src/vt/vrt/collection/balance/read_lb.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,16 @@ struct ReadLBSpec {
using ParamMapType = std::map<std::string, std::string>;

/**
* \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);

Expand Down

0 comments on commit 83b1f75

Please sign in to comment.