Skip to content

Commit

Permalink
Protect against mixed positive and negative extrusion heights in Fanc…
Browse files Browse the repository at this point in the history
…yExtruderGenerator. Refs idaholab#21273
  • Loading branch information
aprilnovak authored and crb3874 committed Jun 27, 2022
1 parent d20c11a commit e93835a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions framework/src/meshgenerators/FancyExtruderGenerator.C
Expand Up @@ -162,6 +162,19 @@ FancyExtruderGenerator::FancyExtruderGenerator(const InputParameters & parameter
elevation_extra_swap_pairs[elevation_extra_swaps[k]] = elevation_extra_swaps[k + 1];
}
}

bool has_negative_entry = false;
bool has_positive_entry = false;
for (const auto & h : _heights)
{
if (h > 0.0)
has_positive_entry = true;
else
has_negative_entry = true;
}

if (has_negative_entry && has_positive_entry)
paramError("heights", "Cannot have both positive and negative heights!");
}

std::unique_ptr<MeshBase>
Expand Down
9 changes: 9 additions & 0 deletions test/tests/meshgenerators/fancy_extruder_generator/tests
Expand Up @@ -61,4 +61,13 @@
design = 'FancyExtruderGenerator.md'
issues = '#18087'
[]
[mixed_extrude]
type = RunException
input = gen_extrude.i
cli_args = 'Mesh/extrude/heights="1 2 -3" --mesh-only'
expect_err = "Cannot have both positive and negative heights!"
requirement = "The system shall error if missing a consistent positive or negative extrusion direction."
design = "FancyExtruderGenerator.md"
issues = "#21273"
[]
[]

0 comments on commit e93835a

Please sign in to comment.