diff --git a/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C b/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C index 31016664ed..d65f4ce7e4 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C +++ b/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C @@ -847,6 +847,19 @@ namespace { fmt::print(Ioss::DebugOut(), " Number of Nodes = {:14}\n", fmt::group_digits(num_nodes)); } + + if (options.omitted_blocks) { + size_t isize = inb->get_field("node_connectivity_status").get_size(); + pool.data.resize(isize); + inb->get_field_data("node_connectivity_status", pool.data.data(), isize); + + // Count number of "active" nodes + size_t active = + std::count_if(pool.data.begin(), pool.data.end(), [](auto &val) { return val >= 2; }); + fmt::print(Ioss::DebugOut(), " Number of Active Nodes = {:14}\n", + fmt::group_digits(active)); + } + auto *nb = new Ioss::NodeBlock(*inb); output_region.add(nb); diff --git a/packages/seacas/libraries/ioss/src/Ioss_MeshCopyOptions.h b/packages/seacas/libraries/ioss/src/Ioss_MeshCopyOptions.h index 585730006f..61e28d4d0f 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_MeshCopyOptions.h +++ b/packages/seacas/libraries/ioss/src/Ioss_MeshCopyOptions.h @@ -36,6 +36,7 @@ namespace Ioss { bool reverse{false}; // Used for testing CGNS bool add_proc_id{false}; // CGNS: Add proc_id field. bool boundary_sideset{false}; // Output a sideset of the boundary faces of the model + bool omitted_blocks{false}; // only used by Catalyst calls to `copy_database`; if false the // copy process skips the defining of the mesh geometry and the diff --git a/packages/seacas/libraries/ioss/src/main/io_shell.C b/packages/seacas/libraries/ioss/src/main/io_shell.C index 42ab148be3..251fe49cf6 100644 --- a/packages/seacas/libraries/ioss/src/main/io_shell.C +++ b/packages/seacas/libraries/ioss/src/main/io_shell.C @@ -73,6 +73,7 @@ namespace { options.add_proc_id = interFace.add_processor_id_field; options.boundary_sideset = interFace.boundary_sideset; options.ignore_qa_info = interFace.ignore_qa_info; + options.omitted_blocks = !interFace.omitted_blocks.empty(); return options; } @@ -263,6 +264,11 @@ namespace { } } + if (!interFace.omitted_blocks.empty()) { + std::vector inclusions{}; + dbi->set_block_omissions(interFace.omitted_blocks, inclusions); + } + // NOTE: 'region' owns 'db' pointer at this time... Ioss::Region region(dbi, "region_1"); diff --git a/packages/seacas/libraries/ioss/src/main/shell_interface.C b/packages/seacas/libraries/ioss/src/main/shell_interface.C index 93f68d817e..b505caba4a 100644 --- a/packages/seacas/libraries/ioss/src/main/shell_interface.C +++ b/packages/seacas/libraries/ioss/src/main/shell_interface.C @@ -305,6 +305,13 @@ void IOShell::Interface::enroll_options() "\t\tDefault is to ignore empty blocks.", nullptr); + options_.enroll("omit_blocks", Ioss::GetLongOption::MandatoryValue, + "comma-separated list of element block names that should NOT be transferred to " + "output database\n" + "\t\tNote that currently any nodes connected to only empty blocks will be " + "retained in the output.", + nullptr); + options_.enroll("boundary_sideset", Ioss::GetLongOption::NoValue, "Output a sideset for all boundary faces of the model", nullptr); @@ -606,6 +613,16 @@ bool IOShell::Interface::parse_options(int argc, char **argv, int my_processor) } } + { + const char *temp = options_.retrieve("omit_blocks"); + if (temp != nullptr) { + auto omit_str = Ioss::tokenize(std::string(temp), ","); + for (const auto &str : omit_str) { + omitted_blocks.push_back(str); + } + } + } + { const char *temp = options_.retrieve("surface_split_scheme"); if (temp != nullptr) { diff --git a/packages/seacas/libraries/ioss/src/main/shell_interface.h b/packages/seacas/libraries/ioss/src/main/shell_interface.h index 4d422fdd11..09d61a4f11 100644 --- a/packages/seacas/libraries/ioss/src/main/shell_interface.h +++ b/packages/seacas/libraries/ioss/src/main/shell_interface.h @@ -59,6 +59,10 @@ namespace IOShell { //! If non-empty, then it is a list of times that should be transferred to the output file. std::vector selected_times{}; + //! If non-empty, then it is a list of element blocks that should be omitted from the output + //! file + std::vector omitted_blocks{}; + //! If non-zero, then put `split_times` timesteps in each file. Then close file and start new //! file. // If `split_cyclic == 0`, then filenames will be