Skip to content

Commit

Permalink
Merge pull request #94 from DARMA-tasking/80-vt-tv-cannot-handle-shar…
Browse files Browse the repository at this point in the history
…ed_block_id-object-qoi

#80:  vt-tv cannot handle shared_block_id object QOI
  • Loading branch information
lifflander authored Jul 31, 2024
2 parents 0db60da + dc74e06 commit aa42d32
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/vt-tv/api/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ struct Info {
return convertQOIVariantTypeToDouble_(getObjectRankID(obj));
};
} else {
// Look in attributes (will throw an error if QOI doesn't exist)
// Look in attributes and user_defined (will throw an error if QOI doesn't exist)
qoi_getter = [&](ObjectWork obj) {
return convertQOIVariantTypeToDouble_(getObjectAttribute(obj, object_qoi));
return convertQOIVariantTypeToDouble_(getObjectAttributeOrUserDefined(obj, object_qoi));
};
}
return qoi_getter;
Expand Down Expand Up @@ -716,19 +716,23 @@ struct Info {
}

/**
* \brief Get the specified attribute of an object at a given phase
* \brief Get the specified attribute or user_defined QOI of an object at a given phase
*
* \param[in] object the current object
*
* \return the requested attribute
* \return the requested attribute or user_defined QOI
*/
QOIVariantTypes getObjectAttribute(ObjectWork object, std::string object_qoi) const {
QOIVariantTypes getObjectAttributeOrUserDefined(ObjectWork object, std::string object_qoi) const {
auto obj_attributes = object.getAttributes();
if (obj_attributes.count(object_qoi) > 0) {
return obj_attributes.at(object_qoi);
} else {
throw std::runtime_error("Invalid Object QOI: " + object_qoi);
auto obj_user_defined = object.getUserDefined();
if (obj_user_defined.count(object_qoi) > 0) {
return obj_user_defined.at(object_qoi);
}
}
throw std::runtime_error("Invalid Object QOI: " + object_qoi);
}

/* ---------------------------------------------------------- */
Expand Down

0 comments on commit aa42d32

Please sign in to comment.