diff --git a/packages/seacas/libraries/ioss/src/main/io_shell.C b/packages/seacas/libraries/ioss/src/main/io_shell.C index 81a0df842b..a23596a35c 100644 --- a/packages/seacas/libraries/ioss/src/main/io_shell.C +++ b/packages/seacas/libraries/ioss/src/main/io_shell.C @@ -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) { @@ -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); diff --git a/packages/seacas/libraries/ioss/src/main/shell_interface.C b/packages/seacas/libraries/ioss/src/main/shell_interface.C index ce16bf76a5..b3122517c1 100644 --- a/packages/seacas/libraries/ioss/src/main/shell_interface.C +++ b/packages/seacas/libraries/ioss/src/main/shell_interface.C @@ -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); @@ -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) {