From 01154df123f36f4c3ea2de80d2d7a20ad6000387 Mon Sep 17 00:00:00 2001 From: "Thomas J. Otahal" Date: Tue, 7 Nov 2023 10:07:06 -0700 Subject: [PATCH] Catalyst API 2 Added generated io_shell based tests for Catalyst API 2 using the generated input type. Created two failing tests for nodesets and sidesets. --- cmake-config | 1 + .../seacas/libraries/ioss/src/CMakeLists.txt | 4 +- .../ioss/src/catalyst/Iocatalyst_DatabaseIO.C | 23 +++++-- .../ioss/src/catalyst/Iocatalyst_DatabaseIO.h | 2 + .../ioss/src/catalyst_tests/CMakeLists.txt | 60 +++++++++++++++++++ 5 files changed, 84 insertions(+), 6 deletions(-) diff --git a/cmake-config b/cmake-config index 13d4748eb8..ca52a380f3 100755 --- a/cmake-config +++ b/cmake-config @@ -541,6 +541,7 @@ ${FAODEL_SYMBOLS} \ -D ParMETIS_ROOT:PATH=${PARMETIS_PATH} \ -D PNetCDF_ROOT:PATH=${PNETCDF_PATH} \ -D fmt_ROOT:PATH=${FMT_PATH} \ +-D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON \ $EXTRA_ARGS \ ${ACCESS} diff --git a/packages/seacas/libraries/ioss/src/CMakeLists.txt b/packages/seacas/libraries/ioss/src/CMakeLists.txt index 429b991ba9..51a005fb4a 100644 --- a/packages/seacas/libraries/ioss/src/CMakeLists.txt +++ b/packages/seacas/libraries/ioss/src/CMakeLists.txt @@ -150,5 +150,7 @@ TRIBITS_ADD_TEST_DIRECTORIES(utest) IF (TPL_ENABLE_GTest) TRIBITS_ADD_TEST_DIRECTORIES(unit_tests) - TRIBITS_ADD_TEST_DIRECTORIES(catalyst_tests) + IF (TPL_ENABLE_Catalyst2) + TRIBITS_ADD_TEST_DIRECTORIES(catalyst_tests) + ENDIF() ENDIF() diff --git a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.C b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.C index 6445f2aca4..0b4ca3dd86 100644 --- a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.C @@ -33,6 +33,7 @@ #include // for Utils, IOSS_ERROR, etc #include +#include #include #include @@ -228,7 +229,7 @@ namespace Iocatalyst { auto num_to_get = field.verify(data_size); const auto num_components = field.raw_storage()->component_count(); if (num_to_get > 0) { - auto path = getFieldPath(containerName, groupName, field.get_name()) + "/value"; + auto path = getFieldPath(containerName, groupName, field.get_name()) + "/value"; const auto &&node = this->DBNode[path]; switch (field.get_type()) { case Ioss::Field::BasicType::DOUBLE: @@ -600,8 +601,7 @@ namespace Iocatalyst { // this->readEntityGroup(node["elementsets"], region); this->readEntityGroup(node["structured_blocks"], region); // this->readEntityGroup(node["assemblies"], region); - - return this->readTime(region); + return true; } DatabaseIO::DatabaseIO(Ioss::Region *region, const std::string &filename, @@ -631,8 +631,8 @@ namespace Iocatalyst { else { // we'll use filename as the location for the data dumps and read those. std::ostringstream path; - path << filename << "/execute_invc43_params.conduit_bin." << util().parallel_size() << "." - << util().parallel_rank(); + path << get_catalyst_dump_dir() << "execute_invc" << filename << "_params.conduit_bin." + << util().parallel_size() << "." << util().parallel_rank(); auto &root = this->Impl->root(); auto &dbase = this->Impl->databaseNode(); conduit_node_load(conduit_cpp::c_node(&root), path.str().c_str(), "conduit_bin"); @@ -791,6 +791,19 @@ namespace Iocatalyst { impl.print(); } + std::string DatabaseIO::get_catalyst_dump_dir() const + { + std::string retVal; + auto catalystDumpDir = std::getenv("CATALYST_DATA_DUMP_DIRECTORY"); + if (catalystDumpDir) { + retVal = catalystDumpDir; + } + if (!retVal.empty() && retVal.back() != '/') { + retVal += '/'; + } + return retVal; + } + int64_t DatabaseIO::put_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void *data, size_t data_size) const { diff --git a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.h b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.h index ba08ce9c8d..70f64c63c6 100644 --- a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.h @@ -82,6 +82,8 @@ namespace Iocatalyst { void print_catalyst_conduit_node(); + std::string get_catalyst_dump_dir() const; + private: bool open_group__(const std::string & /* group_name */) override { return false; } bool create_subgroup__(const std::string & /* group_name */) override { return false; } diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/CMakeLists.txt b/packages/seacas/libraries/ioss/src/catalyst_tests/CMakeLists.txt index cbb3b8c48d..7e7b1e1ee2 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/CMakeLists.txt +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/CMakeLists.txt @@ -85,3 +85,63 @@ FOREACH(CATALYST_TEST ${CATALYST_IOSS_ENTITY_TESTS}) ) ENDFOREACH() ENDFOREACH() + +function(catalyst_test_ioshell_generated test_name + ioshell_gen_args + ioshell_output_file_name + test_time + diff_command + diff_args) + +set(CATALYST_FNAME catalyst_time_${test_time}_${ioshell_output_file_name}) +set(IOSHELL_FNAME ioshell_time_${test_time}_${ioshell_output_file_name}) + +TRIBITS_ADD_ADVANCED_TEST(${test_name} + TEST_0 EXEC io_shell ARGS --in_type generated ${ioshell_gen_args} ${ioshell_output_file_name} + DIRECTORY ../main + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_1 EXEC io_shell ARGS -out_type catalyst ${ioshell_output_file_name} ${test_time} + DIRECTORY ../main + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_2 EXEC io_shell ARGS -in_type catalyst ${test_time} ${CATALYST_FNAME} + DIRECTORY ../main + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_3 EXEC io_shell ARGS -select_times ${test_time} ${ioshell_output_file_name} + ${IOSHELL_FNAME} + DIRECTORY ../main + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_4 EXEC ${diff_command} ARGS ${diff_args} ${IOSHELL_FNAME} ${CATALYST_FNAME} + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + ENVIRONMENT CATALYST_DATA_DUMP_DIRECTORY=${CMAKE_CURRENT_BINARY_DIR}/${test_name} + ) +endfunction() + +catalyst_test_ioshell_generated("catalyst_ioshell_10x10x10" + "10x10x10+times:4+variables:element,2,nodal,3" + "ioshell_10x10x10.g" "3" "exodiff" "-pedantic") + +catalyst_test_ioshell_generated("catalyst_ioshell_10x10x10_tets" + "10x10x10+tets:+times:2+variables:element,2,nodal,3" + "ioshell_10x10x10_tets.g" "1" "exodiff" "-pedantic") + +catalyst_test_ioshell_generated("catalyst_ioshell_10x10x10_pyramids" + "10x10x10+pyramids:+times:2+variables:element,2,nodal,3" + "ioshell_10x10x10_pyramids.g" "1" "exodiff" "-pedantic") + +catalyst_test_ioshell_generated("catalyst_ioshell_10x10x10_shell" + "10x10x10+shell:xX:+times:2+variables:element,2,nodal,3" + "ioshell_10x10x10_shell.g" "1" "exodiff" "-pedantic") + +catalyst_test_ioshell_generated("catalyst_ioshell_10x10x10_nodeset" + "10x10x10+nodeset:xX:+times:2+variables:element,2,nodal,3,nodeset,4" + "ioshell_10x10x10_nodeset.g" "1" "exodiff" "-pedantic") + +catalyst_test_ioshell_generated("catalyst_ioshell_10x10x10_sideset" + "10x10x10+sideset:xX:+times:2+variables:element,2,nodal,3,sideset,4" + "ioshell_10x10x10_sideset.g" "1" "exodiff" "-pedantic")