diff --git a/framework/include/utils/MooseMeshUtils.h b/framework/include/utils/MooseMeshUtils.h index 2e30ce91945e..d175e273791c 100644 --- a/framework/include/utils/MooseMeshUtils.h +++ b/framework/include/utils/MooseMeshUtils.h @@ -291,8 +291,9 @@ void makeOrderedNodeList(std::vector> & node std::vector & ordered_elem_id_list); /** - * Converts a given name (BoundaryName or SubdomainName) into a corresponding ID (BoundaryID or - * SubdomainID) and performs bounds checking to ensure that overflow doesn't happen. + * Converts a given name (BoundaryName or SubdomainName) that is known to only contain digits into a + * corresponding ID (BoundaryID or SubdomainID) and performs bounds checking to ensure that overflow + * doesn't happen. * @param name Name that is to be converted into an ID. * @return ID type corresponding to the type of name. */ @@ -300,7 +301,9 @@ template Q getIDFromName(const T & name) { - std::istringstream ss(name); + if (!MooseUtils::isDigits(name)) + mooseError( + "'name' ", name, " should only contain digits that can be converted to a numerical type."); long long id = std::stoll(name); Q id_Q = Q(id); if (id < std::numeric_limits::min() || id > std::numeric_limits::max())