Skip to content

Commit

Permalink
Catalyst API 2
Browse files Browse the repository at this point in the history
Added generated io_shell based tests for Catalyst API 2
using the generated input type. Created two failing tests
for nodesets and sidesets.
  • Loading branch information
tjotaha committed Nov 7, 2023
1 parent 5182f64 commit 01154df
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 6 deletions.
1 change: 1 addition & 0 deletions cmake-config
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
4 changes: 3 additions & 1 deletion packages/seacas/libraries/ioss/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include <Ioss_Utils.h> // for Utils, IOSS_ERROR, etc
#include <climits>
#include <cstdlib>
#include <fmt/ostream.h>

#include <catalyst.hpp>
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -600,8 +601,7 @@ namespace Iocatalyst {
// this->readEntityGroup<Ioss::ElementSet>(node["elementsets"], region);
this->readEntityGroup<Ioss::StructuredBlock>(node["structured_blocks"], region);
// this->readEntityGroup<Ioss::Assembly>(node["assemblies"], region);

return this->readTime(region);
return true;
}

DatabaseIO::DatabaseIO(Ioss::Region *region, const std::string &filename,
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
60 changes: 60 additions & 0 deletions packages/seacas/libraries/ioss/src/catalyst_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 01154df

Please sign in to comment.