diff --git a/framework/src/utils/MooseMeshUtils.C b/framework/src/utils/MooseMeshUtils.C index 6db1a9eaa42b..e7f865672da0 100644 --- a/framework/src/utils/MooseMeshUtils.C +++ b/framework/src/utils/MooseMeshUtils.C @@ -137,6 +137,12 @@ getBoundaryIDs(const MeshBase & mesh, { std::istringstream ss(boundary_name[i]); ss >> id; + if (ss.fail()) + mooseError("Failed to convert integer ", + boundary_name[i], + " to a boundary id. Got ", + id, + " instead. Is the integer too large for boundary_id_type?"); } ids[i] = id; diff --git a/test/tests/meshgenerators/polyline_mesh_generator/gold/polyline_mesh_generator_good_boundary_in.e b/test/tests/meshgenerators/polyline_mesh_generator/gold/polyline_mesh_generator_good_boundary_in.e new file mode 100644 index 000000000000..9104684a198d Binary files /dev/null and b/test/tests/meshgenerators/polyline_mesh_generator/gold/polyline_mesh_generator_good_boundary_in.e differ diff --git a/test/tests/meshgenerators/polyline_mesh_generator/polyline_mesh_generator_bad_boundary.i b/test/tests/meshgenerators/polyline_mesh_generator/polyline_mesh_generator_bad_boundary.i new file mode 100644 index 000000000000..2c4125af0bde --- /dev/null +++ b/test/tests/meshgenerators/polyline_mesh_generator/polyline_mesh_generator_bad_boundary.i @@ -0,0 +1,12 @@ +[Mesh] + [poly] + type = PolyLineMeshGenerator + points = '-1.0 0.0 0.0 + 1.0 1.0 1.0 + 1.0 2.0 3.0' + # This should error for 16-bit boundary id configs: + start_boundary = 40000 + # This should error even for 64-bit boundary id configs: + end_boundary = 123456789012345678901234567890 + [] +[] diff --git a/test/tests/meshgenerators/polyline_mesh_generator/polyline_mesh_generator_good_boundary.i b/test/tests/meshgenerators/polyline_mesh_generator/polyline_mesh_generator_good_boundary.i new file mode 100644 index 000000000000..3f2c8b9e9e0c --- /dev/null +++ b/test/tests/meshgenerators/polyline_mesh_generator/polyline_mesh_generator_good_boundary.i @@ -0,0 +1,10 @@ +[Mesh] + [poly] + type = PolyLineMeshGenerator + points = '-1.0 0.0 0.0 + 1.0 1.0 1.0 + 1.0 2.0 3.0' + start_boundary = 'non_numbered' + end_boundary = 42 + [] +[] diff --git a/test/tests/meshgenerators/polyline_mesh_generator/tests b/test/tests/meshgenerators/polyline_mesh_generator/tests index 623fd9dd442a..7f88d5b5b107 100644 --- a/test/tests/meshgenerators/polyline_mesh_generator/tests +++ b/test/tests/meshgenerators/polyline_mesh_generator/tests @@ -37,4 +37,24 @@ detail = "refining a loop if requested" [] [] + [polyline_good_boundary] + design = 'meshgenerators/PolyLineMeshGenerator.md' + type = 'Exodiff' + input = 'polyline_mesh_generator_good_boundary.i' + issues = '#24950' + cli_args = '--mesh-only' + exodiff = 'polyline_mesh_generator_good_boundary_in.e' + recover = false + requirement = "The system shall set a boundary name or id if requested." + [] + [polyline_bad_boundary] + design = 'meshgenerators/PolyLineMeshGenerator.md' + type = 'RunException' + input = 'polyline_mesh_generator_bad_boundary.i' + expect_err = "Failed to convert integer" + issues = '#24950' + cli_args = '--mesh-only' + recover = false + requirement = "The system shall detect any unsatisfiable boundary id requests." + [] []