From 7fded87d768ef0b650138b78480e350e66d40223 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 14 Oct 2024 14:52:16 -0600 Subject: [PATCH] IOSS: Add ts version of group/ungroup test --- .../libraries/ioss/src/main/CMakeLists.txt | 32 ++++++++++++++++ .../libraries/ioss/src/main/io_shell_ts.C | 38 +++++++++++++------ 2 files changed, 59 insertions(+), 11 deletions(-) diff --git a/packages/seacas/libraries/ioss/src/main/CMakeLists.txt b/packages/seacas/libraries/ioss/src/main/CMakeLists.txt index b5d2f39e3d..7fc007273e 100644 --- a/packages/seacas/libraries/ioss/src/main/CMakeLists.txt +++ b/packages/seacas/libraries/ioss/src/main/CMakeLists.txt @@ -233,6 +233,38 @@ IF (SEACASIoss_ENABLE_THREADSAFE) FINAL_PASS_REGULAR_EXPRESSION ) ENDIF() + + if (TPL_Netcdf_Enables_Netcdf4) + SET(IOSHELL_ARG --split_times 1 --in_type generated 10x10x10+shell:xXyYzZ+times:4+variables:element,2,nodal,3) + TRIBITS_ADD_ADVANCED_TEST( + io_shell_ts_group_ungroup + TEST_0 NOEXEPREFIX NOEXESUFFIX EXEC io_shell ARGS ${IOSHELL_ARG} splits_ts.g + TEST_1 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS splits_ts.g_1 splits_ts.g_2 splits_ts.g_3 splits_ts.g_4 grouped_ts.g + TEST_2 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS --extract_group splits_ts.g_1 grouped_ts.g split_ts-extract.g_1 + TEST_3 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS --extract_group splits_ts.g_2 grouped_ts.g split_ts-extract.g_2 + TEST_4 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS --extract_group splits_ts.g_3 grouped_ts.g split_ts-extract.g_3 + TEST_5 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS --extract_group splits_ts.g_4 grouped_ts.g split_ts-extract.g_4 + TEST_6 EXEC exodiff ARGS -pedantic splits_ts.g_1 split_ts-extract.g_1 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_7 EXEC exodiff ARGS -pedantic splits_ts.g_2 split_ts-extract.g_2 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_8 EXEC exodiff ARGS -pedantic splits_ts.g_3 split_ts-extract.g_3 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_9 EXEC exodiff ARGS -pedantic splits_ts.g_4 split_ts-extract.g_4 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + COMM serial + FINAL_PASS_REGULAR_EXPRESSION + ) + endif() + ENDIF() IF (TPL_ENABLE_Pamgen OR Trilinos_ENABLE_Pamgen) diff --git a/packages/seacas/libraries/ioss/src/main/io_shell_ts.C b/packages/seacas/libraries/ioss/src/main/io_shell_ts.C index 45bf61a950..52a7b9eba1 100644 --- a/packages/seacas/libraries/ioss/src/main/io_shell_ts.C +++ b/packages/seacas/libraries/ioss/src/main/io_shell_ts.C @@ -196,7 +196,6 @@ namespace { { Ioss::PropertyManager properties = set_properties(interFace); - bool first = true; for (const auto &inpfile : interFace.inputFile) { Ioss::DatabaseIO *dbi = Ioss::IOFactory::create(interFace.inFiletype, inpfile, Ioss::READ_MODEL, @@ -219,7 +218,14 @@ namespace { } if (!interFace.groupName.empty()) { - bool success = dbi->open_group(interFace.groupName); + bool success = dbi->open_root_group(); + if (!success) { + if (rank == 0) { + fmt::print(stderr, "ERROR: Unable to open root group in file '{}'\n", inpfile); + } + return; + } + success = dbi->open_group(interFace.groupName); if (!success) { if (rank == 0) { fmt::print(stderr, "ERROR: Unable to open group '{}' in file '{}'\n", @@ -283,15 +289,25 @@ namespace { if (interFace.inputFile.size() > 1) { properties.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - if (!first) { - // Putting each file into its own output group... - // The name of the group will be the basename portion of the filename... - Ioss::FileInfo file(inpfile); - dbo->create_subgroup(file.tailname()); - } - else { - first = false; - } + bool success = dbo->open_root_group(); + if (!success) { + if (rank == 0) { + fmt::print(stderr, "ERROR: Unable to open root group in output file.\n"); + } + return; + } + + // Putting each file into its own output group... + // The name of the group will be the basename portion of the filename... + Ioss::FileInfo file(inpfile); + success = dbo->create_subgroup(file.tailname()); + if (!success) { + if (rank == 0) { + fmt::print(stderr, "ERROR: Unable to create group {} in output file.\n", + file.tailname()); + } + return; + } } if (interFace.debug) {