From 642a1842dfd01e9be2818a489d84a3dff42c8d88 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 28 Feb 2024 11:49:02 -0700 Subject: [PATCH] NEM_SPREAD: Fix problem with last refactor --- .../applications/nem_spread/nem_spread.h | 2 +- .../nem_spread/pe_write_parExo_info.C | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/seacas/applications/nem_spread/nem_spread.h b/packages/seacas/applications/nem_spread/nem_spread.h index fd8fc3bba1..a7546d734d 100644 --- a/packages/seacas/applications/nem_spread/nem_spread.h +++ b/packages/seacas/applications/nem_spread/nem_spread.h @@ -15,7 +15,7 @@ #include "rf_io_const.h" #define UTIL_NAME "nem_spread" -#define VER_STR "7.03 (2023/07/28)" +#define VER_STR "7.04 (2024/02/28)" extern void check_exodus_error(int, const char *); extern double second(); diff --git a/packages/seacas/applications/nem_spread/pe_write_parExo_info.C b/packages/seacas/applications/nem_spread/pe_write_parExo_info.C index 62ead5021f..f185d1dbf0 100644 --- a/packages/seacas/applications/nem_spread/pe_write_parExo_info.C +++ b/packages/seacas/applications/nem_spread/pe_write_parExo_info.C @@ -618,12 +618,13 @@ void NemSpread::write_parExo_data(int mesh_exoid, int max_name_length, i * The Nemesis node maps are lists of internal, border and external * FEM node numbers. These are output as local node numbers. */ - std::vector nem_node_mapi(globals.Num_Internal_Nodes[iproc], 1); - std::vector nem_node_mapb(globals.Num_Border_Nodes[iproc], 1); - std::vector nem_node_mape(globals.Num_External_Nodes[iproc], 1); + INT *nem_node_mapi = (INT *)array_alloc(__FILE__, __LINE__, 1, itotal_nodes, sizeof(INT)); + INT *nem_node_mapb = nem_node_mapi + globals.Num_Internal_Nodes[iproc]; + INT *nem_node_mape = nem_node_mapb + globals.Num_Border_Nodes[iproc]; + std::iota(nem_node_mapi, nem_node_mapi + itotal_nodes, (INT)1); - if (ex_put_processor_node_maps(mesh_exoid, Data(nem_node_mapi), Data(nem_node_mapb), - Data(nem_node_mape), proc_for) < 0) { + if (ex_put_processor_node_maps(mesh_exoid, nem_node_mapi, nem_node_mapb, nem_node_mape, + proc_for) < 0) { fmt::print(stderr, "[{}]: ERROR, could not write Nemesis nodal number map!\n", __func__); check_exodus_error(ex_close(mesh_exoid), "ex_close"); ex_close(mesh_exoid); @@ -656,9 +657,7 @@ void NemSpread::write_parExo_data(int mesh_exoid, int max_name_length, i PIO_Time_Array[11] = (second() - tt1); total_out_time += PIO_Time_Array[11]; - nem_node_mapi.clear(); - nem_node_mapb.clear(); - nem_node_mape.clear(); + safe_free((void **)&nem_node_mapi); PIO_Time_Array[13] = 0.0; PIO_Time_Array[14] = 0.0; @@ -1518,6 +1517,13 @@ namespace { /* Sort the 'global' array via the index array 'tmp_index' */ gds_iqsort(global, Data(tmp_index), gsize); +#if 0 + for (size_t i2 = 0; i2 < gsize; i2++) { + INT gval = global[tmp_index[i2]] + p01; + fmt::print(stderr, "GLOBAL: {} {} {}\n", i2, tmp_index[i2], gval); + } +#endif + size_t i3 = 0; if (index != nullptr) { for (size_t i2 = 0; i2 < gsize; i2++) {