diff --git a/packages/seacas/applications/aprepro/aprepro.C b/packages/seacas/applications/aprepro/aprepro.C index e60644f782b0..c8c22a504135 100644 --- a/packages/seacas/applications/aprepro/aprepro.C +++ b/packages/seacas/applications/aprepro/aprepro.C @@ -17,6 +17,8 @@ int main(int argc, char *argv[]) bool quiet = false; + int exit_status = EXIT_SUCCESS; + // Parse all options... for (int ai = 1; ai < argc; ++ai) { std::string arg = argv[ai]; @@ -66,6 +68,14 @@ int main(int argc, char *argv[]) aprepro.ap_options.interactive = true; try { aprepro.parse_stream(std::cin, "standard input"); + + if (aprepro.ap_options.errors_fatal && aprepro.get_error_count() > 0) { + exit_status = EXIT_FAILURE; + } + if ((aprepro.ap_options.errors_and_warnings_fatal) && + (aprepro.get_error_count() + aprepro.get_warning_count() > 0)) { + exit_status = EXIT_FAILURE; + } } catch (std::exception &e) { std::cerr << "Aprepro terminated due to exception: " << e.what() << '\n'; @@ -116,6 +126,7 @@ int main(int argc, char *argv[]) } } else { + exit_status = EXIT_FAILURE; std::cerr << "There were " << aprepro.get_error_count() << " errors and " << aprepro.get_warning_count() << " warnings." << "\n"; @@ -142,4 +153,5 @@ int main(int argc, char *argv[]) if (aprepro.ap_options.debugging || aprepro.ap_options.dumpvars) { aprepro.dumpsym("variable", false); } + return exit_status; } diff --git a/packages/seacas/applications/epu/EP_Version.h b/packages/seacas/applications/epu/EP_Version.h index f19b541c2029..83da8531f8c6 100644 --- a/packages/seacas/applications/epu/EP_Version.h +++ b/packages/seacas/applications/epu/EP_Version.h @@ -10,8 +10,8 @@ static char const *qainfo[] = { "epu -- E Pluribus Unum", - "2020/04/20", - "4.31", + "2020/06/17", + "4.32", }; #endif // SEACAS_Version_h diff --git a/packages/seacas/applications/epu/epu.C b/packages/seacas/applications/epu/epu.C index d8c135821980..511f1c61157c 100644 --- a/packages/seacas/applications/epu/epu.C +++ b/packages/seacas/applications/epu/epu.C @@ -723,9 +723,13 @@ int epu(SystemInterface &interFace, int start_part, int part_count, int cycle, T // must check for zero length blocks get_element_blocks(part_count, local_mesh, global, blocks, glob_blocks); + bool map_element_ids = interFace.map_element_ids(); + if (interFace.subcycle() >= 0) { + map_element_ids = false; + } std::vector global_element_map(global.elementCount); build_reverse_element_map(local_element_to_global, local_mesh, blocks, glob_blocks, &global, - part_count, global_element_map, interFace.map_element_ids()); + part_count, global_element_map, map_element_ids); // // NOTE: Node set/side set information can be different for each processor @@ -1765,8 +1769,7 @@ namespace { for (int b = 0; b < global_num_blocks; b++) { if (debug_level & 4) { - fmt::print(stderr, - "\nOutput element block info for...\n" + fmt::print("\nOutput element block info for...\n" "Block {}, Id = {}, Name = '{}', Elements = {:12n}, Nodes/element = {}, " "Attributes = {}\n" "B{}:\t", diff --git a/packages/seacas/applications/slice/SL_Version.h b/packages/seacas/applications/slice/SL_Version.h index 5b2131459af5..a9fe6e2cae92 100644 --- a/packages/seacas/applications/slice/SL_Version.h +++ b/packages/seacas/applications/slice/SL_Version.h @@ -1,15 +1,15 @@ // Copyright(C) 1999-2020 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. -// +// // See packages/seacas/LICENSE for details #ifndef SEACAS_Version_h #define SEACAS_Version_h static char const *qainfo[] = { "slice", - "2020/04/21", - "0.9.93", + "2020/06/10", + "0.9.94", }; #endif // SEACAS_Version_h diff --git a/packages/seacas/applications/slice/Slice.C b/packages/seacas/applications/slice/Slice.C index 9a67c2fbe5e6..75555fadc77f 100644 --- a/packages/seacas/applications/slice/Slice.C +++ b/packages/seacas/applications/slice/Slice.C @@ -1409,7 +1409,7 @@ namespace { } // Output histogram.. fmt::print(stderr, "Processor count per node histogram:\n"); - for (size_t i = 0; i < proc_histo.size(); i++) { + for (size_t i = 1; i < proc_histo.size(); i++) { if (proc_histo[i] > 0) { fmt::print(stderr, "\tNodes on {:2n} processors = {:12n}\t({:2})%\n", i, proc_histo[i], (proc_histo[i] * 100 + node_count / 2) / node_count); diff --git a/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc b/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc index a8ce91a3b718..6aefa97caa4d 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc @@ -24,7 +24,7 @@ namespace { const unsigned int HASHSIZE = 5939; - const char * version_string = "5.16 (2020/06/09)"; + const char * version_string = "5.17 (2020/07/27)"; void output_copyright(); diff --git a/packages/seacas/libraries/ioss/src/Ioss_CodeTypes.h b/packages/seacas/libraries/ioss/src/Ioss_CodeTypes.h index a5e676942606..0b8fa68bdd4f 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_CodeTypes.h +++ b/packages/seacas/libraries/ioss/src/Ioss_CodeTypes.h @@ -58,6 +58,9 @@ inline const std::string IOSS_SYM_TENSOR() { return std::string("sym_tensor_33") (void)(x); \ } while (0) +#ifndef MPI_COMM_SELF +#define MPI_COMM_SELF 0 +#endif #ifndef MPI_COMM_WORLD #define MPI_COMM_WORLD 0 using MPI_Comm = int; diff --git a/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C b/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C index 8bf63f97cd27..af433a28a357 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C @@ -74,8 +74,8 @@ namespace { if (max_hash != min_hash) { const std::string &ge_name = ge->name(); fmt::print(Ioss::WARNING(), - "Parallel inconsistency detected for {} field '{}' on entity '{}'\n", - in_out == 0 ? "writing" : "reading", field_name, ge_name); + "[{}] Parallel inconsistency detected for {} field '{}' on entity '{}'. (Hash: {} {} {})\n", + in_out == 0 ? "writing" : "reading", util.parallel_rank(), field_name, ge_name, hash_code, min_hash, max_hash); return false; } return true; @@ -131,7 +131,9 @@ namespace { namespace Ioss { DatabaseIO::DatabaseIO(Region *region, std::string filename, DatabaseUsage db_usage, MPI_Comm communicator, const PropertyManager &props) - : properties(props), DBFilename(std::move(filename)), dbUsage(db_usage), util_(communicator), + : properties(props), DBFilename(std::move(filename)), dbUsage(db_usage), + util_(db_usage == WRITE_HISTORY || db_usage == WRITE_HEARTBEAT ? MPI_COMM_SELF + : communicator), region_(region), isInput(is_input_event(db_usage)), singleProcOnly(db_usage == WRITE_HISTORY || db_usage == WRITE_HEARTBEAT || SerializeIO::isEnabled()) diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C index 4858852ed75b..f600139e4645 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C @@ -216,7 +216,7 @@ namespace Ioex { void BaseDatabaseIO::set_int_byte_size_api(Ioss::DataSize size) const { - if (exodusFilePtr > 0) { + if (m_exodusFilePtr > 0) { int old_status = ex_int64_status(get_file_pointer()); if (size == 8) { ex_set_int64_status(get_file_pointer(), EX_ALL_INT64_API | old_status); @@ -226,7 +226,7 @@ namespace Ioex { if ((old_status & EX_ALL_INT64_API) != 0) { old_status &= ~EX_ALL_INT64_API; assert(!(old_status & EX_ALL_INT64_API)); - ex_set_int64_status(exodusFilePtr, old_status); + ex_set_int64_status(m_exodusFilePtr, old_status); } } } @@ -276,7 +276,7 @@ namespace Ioex { { // Returns the file_pointer used to access the file on disk. // Checks that the file is open and if not, opens it first. - if (exodusFilePtr < 0) { + if (m_exodusFilePtr < 0) { bool write_message = true; bool abort_if_error = true; if (is_input()) { @@ -288,24 +288,24 @@ namespace Ioex { } if (!m_groupName.empty()) { - ex_get_group_id(exodusFilePtr, m_groupName.c_str(), &exodusFilePtr); + ex_get_group_id(m_exodusFilePtr, m_groupName.c_str(), &m_exodusFilePtr); } } - assert(exodusFilePtr >= 0); + assert(m_exodusFilePtr >= 0); fileExists = true; - return exodusFilePtr; + return m_exodusFilePtr; } int BaseDatabaseIO::free_file_pointer() const { - if (exodusFilePtr != -1) { + if (m_exodusFilePtr != -1) { bool do_timer = false; if (isParallel) { Ioss::Utils::check_set_bool_property(properties, "IOSS_TIME_FILE_OPEN_CLOSE", do_timer); } double t_begin = (do_timer ? Ioss::Utils::timer() : 0); - ex_close(exodusFilePtr); + ex_close(m_exodusFilePtr); closeDW(); if (do_timer && isParallel) { double t_end = Ioss::Utils::timer(); @@ -315,9 +315,9 @@ namespace Ioex { } } } - exodusFilePtr = -1; + m_exodusFilePtr = -1; - return exodusFilePtr; + return m_exodusFilePtr; } bool BaseDatabaseIO::ok__(bool write_message, std::string *error_msg, int *bad_count) const @@ -349,9 +349,9 @@ namespace Ioex { bool overwrite = false; is_ok = handle_output_file(write_message, error_msg, bad_count, overwrite, abort_if_error); // Close all open files... - if (exodusFilePtr >= 0) { - ex_close(exodusFilePtr); - exodusFilePtr = -1; + if (m_exodusFilePtr >= 0) { + ex_close(m_exodusFilePtr); + m_exodusFilePtr = -1; } } return is_ok; @@ -359,25 +359,25 @@ namespace Ioex { void BaseDatabaseIO::finalize_file_open() const { - assert(exodusFilePtr >= 0); + assert(m_exodusFilePtr >= 0); // Check byte-size of integers stored on the database... - if ((ex_int64_status(exodusFilePtr) & EX_ALL_INT64_DB) != 0) { + if ((ex_int64_status(m_exodusFilePtr) & EX_ALL_INT64_DB) != 0) { if (myProcessor == 0) { fmt::print(Ioss::OUTPUT(), "IOSS: Input database contains 8-byte integers. Setting Ioss to use " "8-byte integers.\n"); } - ex_set_int64_status(exodusFilePtr, EX_ALL_INT64_API); + ex_set_int64_status(m_exodusFilePtr, EX_ALL_INT64_API); set_int_byte_size_api(Ioss::USE_INT64_API); } // Check for maximum name length used on the input file. - int max_name_length = ex_inquire_int(exodusFilePtr, EX_INQ_DB_MAX_USED_NAME_LENGTH); + int max_name_length = ex_inquire_int(m_exodusFilePtr, EX_INQ_DB_MAX_USED_NAME_LENGTH); if (max_name_length > maximumNameLength) { maximumNameLength = max_name_length; } - ex_set_max_name_length(exodusFilePtr, maximumNameLength); + ex_set_max_name_length(m_exodusFilePtr, maximumNameLength); } bool BaseDatabaseIO::open_group__(const std::string &group_name) @@ -388,9 +388,9 @@ namespace Ioex { int exoid = get_file_pointer(); m_groupName = group_name; - ex_get_group_id(exoid, m_groupName.c_str(), &exodusFilePtr); + ex_get_group_id(exoid, m_groupName.c_str(), &m_exodusFilePtr); - if (exodusFilePtr < 0) { + if (m_exodusFilePtr < 0) { std::ostringstream errmsg; fmt::print(errmsg, "ERROR: Could not open group named '{}' in file '{}'.\n", m_groupName, get_filename()); @@ -427,7 +427,7 @@ namespace Ioex { IOSS_ERROR(errmsg); } else { - exodusFilePtr = exoid; + m_exodusFilePtr = exoid; success = true; } } @@ -630,7 +630,7 @@ namespace Ioex { if (nblob > 0) { std::vector blobs(nblob); - int max_name_length = ex_inquire_int(exodusFilePtr, EX_INQ_DB_MAX_USED_NAME_LENGTH); + int max_name_length = ex_inquire_int(m_exodusFilePtr, EX_INQ_DB_MAX_USED_NAME_LENGTH); for (auto &bl : blobs) { bl.name = new char[max_name_length + 1]; } @@ -2380,13 +2380,15 @@ namespace Ioex { } m_groupCount[EX_ELEM_BLOCK] = element_blocks.size(); - // Set "global_entity_count" property on all blocks. - // Used to skip output on "globally" empty blocks. - Ioss::Int64Vector global_counts(element_counts.size()); - util().global_count(element_counts, global_counts); - size_t idx = 0; - for (auto &element_block : element_blocks) { - element_block->property_add(Ioss::Property("global_entity_count", global_counts[idx++])); + if (isParallel) { + // Set "global_entity_count" property on all blocks. + // Used to skip output on "globally" empty blocks. + Ioss::Int64Vector global_counts(element_counts.size()); + util().global_count(element_counts, global_counts); + size_t idx = 0; + for (auto &element_block : element_blocks) { + element_block->property_add(Ioss::Property("global_entity_count", global_counts[idx++])); + } } } diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h index 151b0c39065f..34262dccca84 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h @@ -265,7 +265,10 @@ namespace Ioex { // Private member data... protected: - mutable int exodusFilePtr{-1}; + mutable int m_exodusFilePtr{-1}; + // If using links to file-per-state, the file pointer for "base" file. + mutable int m_exodusBasePtr{-1}; + mutable std::string m_groupName; mutable EntityIdSet ids_; diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C index 1d526adc8a44..1eff9301bd03 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C @@ -191,7 +191,7 @@ namespace Ioex { if (isParallel && no_collective_calls) { // Can't output a nice error message on processor 0 and throw a consistent error. // Have to just write message on processors that have issue and throw exception. - if (exodusFilePtr < 0) { + if (m_exodusFilePtr < 0) { std::ostringstream errmsg; std::string open_create = is_input() ? "open input" : "create output"; fmt::print(errmsg, "ERROR: Unable to {} exodus decomposed database file '{}'\n", @@ -209,19 +209,19 @@ namespace Ioex { } // Check for valid exodus_file_ptr (valid >= 0; invalid < 0) - int global_file_ptr = exodusFilePtr; + int global_file_ptr = m_exodusFilePtr; if (isParallel) { - global_file_ptr = util().global_minmax(exodusFilePtr, Ioss::ParallelUtils::DO_MIN); + global_file_ptr = util().global_minmax(m_exodusFilePtr, Ioss::ParallelUtils::DO_MIN); } if (global_file_ptr < 0) { if (write_message || error_msg != nullptr || bad_count != nullptr) { Ioss::IntVector status; if (isParallel) { - util().all_gather(exodusFilePtr, status); + util().all_gather(m_exodusFilePtr, status); } else { - status.push_back(exodusFilePtr); + status.push_back(m_exodusFilePtr); } std::string open_create = is_input() ? "open input" : "create output"; @@ -288,7 +288,7 @@ namespace Ioex { double t_begin = (do_timer ? Ioss::Utils::timer() : 0); int app_opt_val = ex_opts(EX_VERBOSE); - exodusFilePtr = ex_open(decoded_filename().c_str(), EX_READ | mode, &cpu_word_size, + m_exodusFilePtr = ex_open(decoded_filename().c_str(), EX_READ | mode, &cpu_word_size, &io_word_size, &version); if (do_timer) { @@ -356,7 +356,7 @@ namespace Ioex { #endif int app_opt_val = ex_opts(EX_VERBOSE); if (fileExists) { - exodusFilePtr = ex_open(decoded_filename().c_str(), EX_WRITE | mode, &cpu_word_size, + m_exodusFilePtr = ex_open(decoded_filename().c_str(), EX_WRITE | mode, &cpu_word_size, &io_word_size, &version); } else { @@ -374,22 +374,22 @@ namespace Ioex { mode |= EX_ALL_INT64_DB; } } - exodusFilePtr = ex_create(decoded_filename().c_str(), mode, &cpu_word_size, &dbRealWordSize); + m_exodusFilePtr = ex_create(decoded_filename().c_str(), mode, &cpu_word_size, &dbRealWordSize); } is_ok = check_valid_file_ptr(write_message, error_msg, bad_count, abort_if_error); if (is_ok) { - ex_set_max_name_length(exodusFilePtr, maximumNameLength); + ex_set_max_name_length(m_exodusFilePtr, maximumNameLength); // Check properties handled post-create/open... if (properties.exists("COMPRESSION_LEVEL")) { int comp_level = properties.get("COMPRESSION_LEVEL").get_int(); - ex_set_option(exodusFilePtr, EX_OPT_COMPRESSION_LEVEL, comp_level); + ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_LEVEL, comp_level); } if (properties.exists("COMPRESSION_SHUFFLE")) { int shuffle = properties.get("COMPRESSION_SHUFFLE").get_int(); - ex_set_option(exodusFilePtr, EX_OPT_COMPRESSION_SHUFFLE, shuffle); + ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_SHUFFLE, shuffle); } if (properties.exists("COMPRESSION_METHOD")) { auto method = properties.get("COMPRESSION_METHOD").get_string(); @@ -412,7 +412,7 @@ namespace Ioex { " 'zlib' will be used instead.\n\n", method); } - ex_set_option(exodusFilePtr, EX_OPT_COMPRESSION_TYPE, exo_method); + ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_TYPE, exo_method); } } ex_opts(app_opt_val); // Reset back to what it was. diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C index 40a91ef7aefd..09502a1cacac 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C @@ -214,7 +214,7 @@ namespace { // data, but in the node id map mapping, we have an int64_t coming // in and either an int or int64_t going out... template - void map_data(const Ioss::IntVector &owning_processor, int this_processor, const T *data, + void filter_owned_nodes(const Ioss::IntVector &owning_processor, int this_processor, const T *data, std::vector &file_data, size_t offset = 0, size_t stride = 1) { size_t index = offset; @@ -226,6 +226,21 @@ namespace { } } + // This version can be used *if* the input and output types are the same *and* the + // input `data` can be modified / overwritten. + template + void filter_owned_nodes(const Ioss::IntVector &owning_processor, int this_processor, T *data) + { + size_t index = 0; + size_t entry = 0; + for (auto op : owning_processor) { + if (op == this_processor) { + data[entry++] = data[index]; + } + index++; + } + } + template void map_local_to_global_implicit(INT *data, size_t count, const std::vector &global_implicit_map) @@ -298,12 +313,12 @@ namespace Ioex { { // Check for valid exodus_file_ptr (valid >= 0; invalid < 0) assert(isParallel); - int global_file_ptr = util().global_minmax(exodusFilePtr, Ioss::ParallelUtils::DO_MIN); + int global_file_ptr = util().global_minmax(m_exodusFilePtr, Ioss::ParallelUtils::DO_MIN); if (global_file_ptr < 0) { if (write_message || error_msg != nullptr || bad_count != nullptr) { Ioss::IntVector status; - util().all_gather(exodusFilePtr, status); + util().all_gather(m_exodusFilePtr, status); std::string open_create = is_input() ? "open input" : "create output"; if (write_message || error_msg != nullptr) { @@ -384,7 +399,7 @@ namespace Ioex { double t_begin = (do_timer ? Ioss::Utils::timer() : 0); int app_opt_val = ex_opts(EX_VERBOSE); - exodusFilePtr = ex_open_par(filename.c_str(), EX_READ | mode, &cpu_word_size, &io_word_size, + m_exodusFilePtr = ex_open_par(filename.c_str(), EX_READ | mode, &cpu_word_size, &io_word_size, &version, util().communicator(), info); if (do_timer) { @@ -476,7 +491,7 @@ namespace Ioex { double t_begin = (do_timer ? Ioss::Utils::timer() : 0); if (fileExists) { - exodusFilePtr = ex_open_par(filename.c_str(), EX_WRITE | mode, &cpu_word_size, &io_word_size, + m_exodusFilePtr = ex_open_par(filename.c_str(), EX_WRITE | mode, &cpu_word_size, &io_word_size, &version, util().communicator(), info); } else { @@ -494,7 +509,7 @@ namespace Ioex { mode |= EX_ALL_INT64_DB; } } - exodusFilePtr = ex_create_par(filename.c_str(), mode, &cpu_word_size, &dbRealWordSize, + m_exodusFilePtr = ex_create_par(filename.c_str(), mode, &cpu_word_size, &dbRealWordSize, util().communicator(), info); } @@ -513,16 +528,16 @@ namespace Ioex { bool is_ok = check_valid_file_ptr(write_message, error_msg, bad_count, abort_if_error); if (is_ok) { - ex_set_max_name_length(exodusFilePtr, maximumNameLength); + ex_set_max_name_length(m_exodusFilePtr, maximumNameLength); // Check properties handled post-create/open... if (properties.exists("COMPRESSION_LEVEL")) { int comp_level = properties.get("COMPRESSION_LEVEL").get_int(); - ex_set_option(exodusFilePtr, EX_OPT_COMPRESSION_LEVEL, comp_level); + ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_LEVEL, comp_level); } if (properties.exists("COMPRESSION_SHUFFLE")) { int shuffle = properties.get("COMPRESSION_SHUFFLE").get_int(); - ex_set_option(exodusFilePtr, EX_OPT_COMPRESSION_SHUFFLE, shuffle); + ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_SHUFFLE, shuffle); } } ex_opts(app_opt_val); // Reset back to what it was. @@ -545,8 +560,8 @@ namespace Ioex { } // Make sure all file pointers are valid... - int fp_min = util().global_minmax(exodusFilePtr, Ioss::ParallelUtils::DO_MIN); - int fp_max = util().global_minmax(exodusFilePtr, Ioss::ParallelUtils::DO_MAX); + int fp_min = util().global_minmax(m_exodusFilePtr, Ioss::ParallelUtils::DO_MIN); + int fp_max = util().global_minmax(m_exodusFilePtr, Ioss::ParallelUtils::DO_MAX); if (fp_min != fp_max && fp_min < 0) { std::ostringstream errmsg; fmt::print(errmsg, "ERROR: Inconsistent file pointer values."); @@ -2608,15 +2623,15 @@ int64_t ParallelDatabaseIO::write_attribute_field(ex_entity_type type, const Ios file_data.reserve(file_count); check_node_owning_processor_data(nodeOwningProcessor, file_count); if (ioss_type == Ioss::Field::REAL) { - map_data(nodeOwningProcessor, myProcessor, static_cast(data), file_data, i, + filter_owned_nodes(nodeOwningProcessor, myProcessor, static_cast(data), file_data, i, comp_count); } else if (ioss_type == Ioss::Field::INTEGER) { - map_data(nodeOwningProcessor, myProcessor, static_cast(data), file_data, i, + filter_owned_nodes(nodeOwningProcessor, myProcessor, static_cast(data), file_data, i, comp_count); } else if (ioss_type == Ioss::Field::INT64) { - map_data(nodeOwningProcessor, myProcessor, static_cast(data), file_data, i, + filter_owned_nodes(nodeOwningProcessor, myProcessor, static_cast(data), file_data, i, comp_count); } int ierr = ex_put_partial_one_attr(get_file_pointer(), type, id, proc_offset + 1, file_count, @@ -3277,7 +3292,7 @@ int64_t ParallelDatabaseIO::put_field_internal(const Ioss::NodeBlock *nb, const std::vector file_data; file_data.reserve(file_count); check_node_owning_processor_data(nodeOwningProcessor, file_count); - map_data(nodeOwningProcessor, myProcessor, rdata, file_data); + filter_owned_nodes(nodeOwningProcessor, myProcessor, rdata, file_data); int ierr = ex_put_partial_coord_component(get_file_pointer(), proc_offset + 1, file_count, 1, file_data.data()); @@ -3291,7 +3306,7 @@ int64_t ParallelDatabaseIO::put_field_internal(const Ioss::NodeBlock *nb, const std::vector file_data; file_data.reserve(file_count); check_node_owning_processor_data(nodeOwningProcessor, file_count); - map_data(nodeOwningProcessor, myProcessor, rdata, file_data); + filter_owned_nodes(nodeOwningProcessor, myProcessor, rdata, file_data); int ierr = ex_put_partial_coord_component(get_file_pointer(), proc_offset + 1, file_count, 2, file_data.data()); if (ierr < 0) { @@ -3304,7 +3319,7 @@ int64_t ParallelDatabaseIO::put_field_internal(const Ioss::NodeBlock *nb, const std::vector file_data; file_data.reserve(file_count); check_node_owning_processor_data(nodeOwningProcessor, file_count); - map_data(nodeOwningProcessor, myProcessor, rdata, file_data); + filter_owned_nodes(nodeOwningProcessor, myProcessor, rdata, file_data); int ierr = ex_put_partial_coord_component(get_file_pointer(), proc_offset + 1, file_count, 3, file_data.data()); if (ierr < 0) { @@ -3332,12 +3347,12 @@ int64_t ParallelDatabaseIO::put_field_internal(const Ioss::NodeBlock *nb, const // Cast 'data' to correct size -- double double *rdata = static_cast(data); check_node_owning_processor_data(nodeOwningProcessor, file_count); - map_data(nodeOwningProcessor, myProcessor, rdata, x, 0, spatialDimension); + filter_owned_nodes(nodeOwningProcessor, myProcessor, rdata, x, 0, spatialDimension); if (spatialDimension > 1) { - map_data(nodeOwningProcessor, myProcessor, rdata, y, 1, spatialDimension); + filter_owned_nodes(nodeOwningProcessor, myProcessor, rdata, y, 1, spatialDimension); } if (spatialDimension == 3) { - map_data(nodeOwningProcessor, myProcessor, rdata, z, 2, spatialDimension); + filter_owned_nodes(nodeOwningProcessor, myProcessor, rdata, z, 2, spatialDimension); } int ierr = ex_put_partial_coord(get_file_pointer(), proc_offset + 1, file_count, x.data(), @@ -3946,13 +3961,14 @@ void ParallelDatabaseIO::write_nodal_transient_field(ex_entity_type /* type */, for (int i = 0; i < comp_count; i++) { std::string var_name = var_type->label_name(field_name, i + 1, field_suffix_separator); - if (m_variables[EX_NODE_BLOCK].find(var_name) == m_variables[EX_NODE_BLOCK].end()) { + auto var_iter = m_variables[EX_NODE_BLOCK].find(var_name); + if (var_iter == m_variables[EX_NODE_BLOCK].end()) { std::ostringstream errmsg; fmt::print(errmsg, "ERROR: Could not find nodal variable '{}'\n", var_name); IOSS_ERROR(errmsg); } - var_index = m_variables[EX_NODE_BLOCK].find(var_name)->second; + var_index = var_iter->second; size_t begin_offset = (re_im * i) + complex_comp; size_t stride = re_im * comp_count; @@ -3991,12 +4007,10 @@ void ParallelDatabaseIO::write_nodal_transient_field(ex_entity_type /* type */, file_count = nb->get_property("locally_owned_count").get_int(); } - std::vector file_temp; - file_temp.reserve(file_count); check_node_owning_processor_data(nodeOwningProcessor, file_count); - map_data(nodeOwningProcessor, myProcessor, temp.data(), file_temp); + filter_owned_nodes(nodeOwningProcessor, myProcessor, temp.data()); int ierr = ex_put_partial_var(get_file_pointer(), step, EX_NODE_BLOCK, var_index, 0, - proc_offset + 1, file_count, file_temp.data()); + proc_offset + 1, file_count, temp.data()); if (ierr < 0) { std::ostringstream errmsg; fmt::print(errmsg, @@ -4640,7 +4654,7 @@ void ParallelDatabaseIO::output_node_map() const std::vector file_ids; file_ids.reserve(locally_owned_count); check_node_owning_processor_data(nodeOwningProcessor, locally_owned_count); - map_data(nodeOwningProcessor, myProcessor, &nodeMap.map()[1], file_ids); + filter_owned_nodes(nodeOwningProcessor, myProcessor, &nodeMap.map()[1], file_ids); ierr = ex_put_partial_id_map(get_file_pointer(), EX_NODE_MAP, processor_offset + 1, locally_owned_count, file_ids.data()); } @@ -4648,7 +4662,7 @@ void ParallelDatabaseIO::output_node_map() const std::vector file_ids; file_ids.reserve(locally_owned_count); check_node_owning_processor_data(nodeOwningProcessor, locally_owned_count); - map_data(nodeOwningProcessor, myProcessor, &nodeMap.map()[1], file_ids); + filter_owned_nodes(nodeOwningProcessor, myProcessor, &nodeMap.map()[1], file_ids); ierr = ex_put_partial_id_map(get_file_pointer(), EX_NODE_MAP, processor_offset + 1, locally_owned_count, file_ids.data()); } diff --git a/packages/seacas/libraries/ioss/src/utest/Utst_sort.C b/packages/seacas/libraries/ioss/src/utest/Utst_sort.C index a32d363622b8..eedc55904ffd 100644 --- a/packages/seacas/libraries/ioss/src/utest/Utst_sort.C +++ b/packages/seacas/libraries/ioss/src/utest/Utst_sort.C @@ -70,17 +70,21 @@ int main() break; } + auto xsave = x; Ioss::qsort(x); // Copy of x assert(verify_sorted(x)); + x = xsave; std::reverse(x.begin(), x.end()); // Reversed Ioss::qsort(x); assert(verify_sorted(x)); + x = xsave; std::reverse(&x[0], &x[n / 2]); // Front half reversed Ioss::qsort(x); assert(verify_sorted(x)); + x = xsave; std::reverse(&x[n / 2], &x[n]); // Back half reversed Ioss::qsort(x); assert(verify_sorted(x)); @@ -88,6 +92,7 @@ int main() Ioss::qsort(x); // Already sorted assert(verify_sorted(x)); + x = xsave; for (size_t p = 0; p < n; p++) { x[p] += p % 5; }