Skip to content

Commit

Permalink
IOSS: Add select_change_set to io_shell
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Nov 13, 2024
1 parent c12e76c commit 2f9e2cd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
17 changes: 14 additions & 3 deletions packages/seacas/libraries/ioss/src/main/io_shell.C
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,20 @@ namespace {

if (change_set_count > 1 && interFace.changeSetName.empty()) {
bool first = true;
auto cs_names = dbi->internal_change_set_describe();
Ioss::NameList cs_names;
if (!options.selected_change_sets.empty() && options.selected_change_sets != "ALL") {
cs_names = Ioss::tokenize(options.selected_change_sets, ",");
success = true;
for (const auto &cs_name : cs_names) {
success &= Ioss::Utils::check_valid_change_set_name(cs_name, region);
}
if (!success) {
return false;
}
}
else {
cs_names = dbi->internal_change_set_describe();
}
for (const auto &cs_name : cs_names) {
success = region.load_internal_change_set_mesh(cs_name);
if (!success) {
Expand All @@ -405,8 +418,6 @@ namespace {
}
return success;
}
// NEED TO FIX set_id as blocks are incrementing ids each group
// NEED TO FIX reset_region() is private -- exposed here for proof of concept.
output_region.reset_region();
output_region.get_database()->release_memory();
success = dbo->create_internal_change_set(cs_name);
Expand Down
15 changes: 11 additions & 4 deletions packages/seacas/libraries/ioss/src/main/shell_interface.C
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,9 @@ void IOShell::Interface::enroll_options()
nullptr, nullptr, true);
#endif

options_.enroll("select_change_sets", Ioss::GetLongOption::MandatoryValue,
"Read the specified change set(s) (comma-separated list) from the input file. "
"Use \"ALL\" for all change sets (default).",
nullptr);
options_.enroll(
"select_change_sets", Ioss::GetLongOption::MandatoryValue,
"Read only the specified change set(s) (comma-separated list) from the input file. Use \"ALL\" for all change sets (default).", nullptr);
options_.enroll(
"extract_change_set", Ioss::GetLongOption::MandatoryValue,
"Write the data from the specified change_set (formerly group) to the output file.", nullptr);
Expand Down Expand Up @@ -795,6 +794,14 @@ bool IOShell::Interface::parse_options(int argc, char **argv, int my_processor)
exit(EXIT_SUCCESS);
}

if (!changeSetName.empty() && !selectedChangeSets.empty()) {
if (my_processor == 0) {
fmt::print(stderr,
"ERROR: Only one of 'extract_change_set' or 'select_change_sets'can be specified.\n");
}
return false;
}

// Parse remaining options as directory paths.
if (option_index < argc - 1) {
while (option_index < argc - 1) {
Expand Down

0 comments on commit 2f9e2cd

Please sign in to comment.