Skip to content

Commit

Permalink
IOSS: Add ts version of group/ungroup test
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Oct 14, 2024
1 parent 3716e4a commit 7fded87
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 11 deletions.
32 changes: 32 additions & 0 deletions packages/seacas/libraries/ioss/src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
38 changes: 27 additions & 11 deletions packages/seacas/libraries/ioss/src/main/io_shell_ts.C
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7fded87

Please sign in to comment.