Skip to content

Commit

Permalink
Merge pull request #24951 from roystgnr/test_failbit
Browse files Browse the repository at this point in the history
Test failbit when converting boundary ids
  • Loading branch information
lindsayad authored Jul 13, 2023
2 parents c7d8753 + 63d5b90 commit 7d7e685
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
6 changes: 6 additions & 0 deletions framework/src/utils/MooseMeshUtils.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
[]
[]
Original file line number Diff line number Diff line change
@@ -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
[]
[]
20 changes: 20 additions & 0 deletions test/tests/meshgenerators/polyline_mesh_generator/tests
Original file line number Diff line number Diff line change
Expand Up @@ -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."
[]
[]

0 comments on commit 7d7e685

Please sign in to comment.