diff --git a/packages/seacas/applications/aprepro/aprepro.C b/packages/seacas/applications/aprepro/aprepro.C
index 378ae87c6a23..1b74a9c00fdf 100644
--- a/packages/seacas/applications/aprepro/aprepro.C
+++ b/packages/seacas/applications/aprepro/aprepro.C
@@ -1,4 +1,4 @@
-// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions
+// Copyright(C) 1999-2021, 2023, 2024, 2024 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.
//
@@ -14,6 +14,17 @@
#include "aprepro.h"
+namespace {
+ bool is_double(const std::string &myString)
+ {
+ std::istringstream iss(myString);
+ double f;
+ iss >> std::noskipws >> f; // noskipws considers leading whitespace invalid
+ // Check the entire string was consumed and if either failbit or badbit is set
+ return iss.eof() && !iss.fail();
+ }
+} // namespace
+
int main(int argc, char *argv[])
{
SEAMS::Aprepro aprepro;
@@ -42,7 +53,9 @@ int main(int argc, char *argv[])
value = value.substr(1, value.length() - 2);
aprepro.add_variable(var, value, true); // Make it immutable
}
- else {
+ // See if `value` contains any characters that are invalid for a number...
+
+ else if (is_double(value)) {
try {
double dval = std::stod(value);
aprepro.add_variable(var, dval, true);
@@ -58,6 +71,9 @@ int main(int argc, char *argv[])
}
}
}
+ else {
+ aprepro.add_variable(var, value, true); // Make it immutable
+ }
}
else {
input_files.emplace_back(argv[ai]);
diff --git a/packages/seacas/applications/blot/linthc.blk b/packages/seacas/applications/blot/linthc.blk
index 0e53deb870dd..72def06804b4 100644
--- a/packages/seacas/applications/blot/linthc.blk
+++ b/packages/seacas/applications/blot/linthc.blk
@@ -1,4 +1,4 @@
-C Copyright(C) 1999-2020 National Technology & Engineering Solutions
+C Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions
C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
C NTESS, the U.S. Government retains certain rights in this software.
C
@@ -8,7 +8,7 @@ C See packages/seacas/LICENSE for details
REAL MSHBND, BLKBND, ELEBND
C -- Line thickness specification for lines appearing
C -- on mesh plots. Specification is a real value in the
-C -- range 0. - 1000., with 0. being the thinest line and
+C -- range 0. - 1000., with 0. being the thinnest line and
C -- 1000. being the thickest.
C -- MSHBND - Thickness of lines forming the mesh boundary.
C -- BLKBND - Thickness of lines forming element block boundaries.
diff --git a/packages/seacas/applications/cpup/CP_SystemInterface.C b/packages/seacas/applications/cpup/CP_SystemInterface.C
index dd9d21973134..38007c582c36 100644
--- a/packages/seacas/applications/cpup/CP_SystemInterface.C
+++ b/packages/seacas/applications/cpup/CP_SystemInterface.C
@@ -64,8 +64,12 @@ void Cpup::SystemInterface::enroll_options()
options_.enroll("steps", GetLongOption::MandatoryValue,
"Specify subset of timesteps to transfer to output file.\n"
"\t\tFormat is beg:end:step. 1:10:2 --> 1,3,5,7,9\n"
+ "\t\tIf the 'beg' or 'end' is < 0, then it is the \"-Nth\" step...\n"
+ "\t\t-1 is \"first last\" or last, -3 is \"third last\"\n"
+ "\t\tTo copy just the last 3 steps, do: `-steps -3:-1`\n"
"\t\tEnter LAST for last step",
"1:", nullptr, true);
+
options_.enroll("extension", GetLongOption::MandatoryValue,
"CGNS database extension for the input files", "cgns");
@@ -466,7 +470,11 @@ void Cpup::SystemInterface::parse_step_option(const char *tokens)
//:
":Y" -- 1 to Y by 1
//: "::Z" -- 1 to oo by Z
//:
- //: The count and step must always be >= 0
+ //: The step must always be > 0
+ //: If the 'from' or 'to' is < 0, then it is the "-Nth" step...
+ //: -1 is "first last" or last
+ //: -4 is "fourth last step"
+ //: To copy just the last 3 steps, do: `-steps -3:-1`
// Break into tokens separated by ":"
@@ -482,24 +490,24 @@ void Cpup::SystemInterface::parse_step_option(const char *tokens)
for (auto &val : vals) {
// Parse 'i'th field
char tmp_str[128];
- int k = 0;
+ int k = 0;
while (tokens[j] != '\0' && tokens[j] != ':') {
tmp_str[k++] = tokens[j++];
}
tmp_str[k] = '\0';
if (strlen(tmp_str) > 0) {
- val = strtoul(tmp_str, nullptr, 0);
+ val = strtol(tmp_str, nullptr, 0);
}
if (tokens[j++] == '\0') {
break; // Reached end of string
}
}
- stepMin_ = abs(vals[0]);
- stepMax_ = abs(vals[1]);
- stepInterval_ = abs(vals[2]);
+ stepMin_ = vals[0];
+ stepMax_ = vals[1];
+ stepInterval_ = abs(vals[2]); // step is always positive...
}
else if (str_equal("LAST", tokens)) {
stepMin_ = stepMax_ = -1;
diff --git a/packages/seacas/applications/cpup/CP_Version.h b/packages/seacas/applications/cpup/CP_Version.h
index 8ba908eaf3a6..9ddb0b5d1402 100644
--- a/packages/seacas/applications/cpup/CP_Version.h
+++ b/packages/seacas/applications/cpup/CP_Version.h
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2023 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2024 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.
*
@@ -8,4 +8,4 @@
#pragma once
#include
#include
-static const std::array qainfo{"cpup", "0.95 beta", "2023/04/25"};
+static const std::array qainfo{"cpup", "0.96 beta", "2024/08/06"};
diff --git a/packages/seacas/applications/cpup/cpup.C b/packages/seacas/applications/cpup/cpup.C
index a382b488ca50..c88c46703bda 100644
--- a/packages/seacas/applications/cpup/cpup.C
+++ b/packages/seacas/applications/cpup/cpup.C
@@ -1,4 +1,4 @@
-// Copyright(C) 1999-2023 National Technology & Engineering Solutions
+// Copyright(C) 1999-2024 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.
//
@@ -406,9 +406,11 @@ template void cpup(Cpup::SystemInterface &interFace, INT /*dummy*
int ts_max = interFace.step_max();
int ts_step = interFace.step_interval();
- if (ts_min == -1 && ts_max == -1) {
- ts_min = num_time_steps;
- ts_max = num_time_steps;
+ if (ts_min < 0) {
+ ts_min = num_time_steps + 1 + ts_min;
+ }
+ if (ts_max < 0) {
+ ts_max = num_time_steps + 1 + ts_max;
}
// Time steps for output file
diff --git a/packages/seacas/applications/ejoin/EJ_SystemInterface.C b/packages/seacas/applications/ejoin/EJ_SystemInterface.C
index a551af6ced4d..f1aeecd6d920 100644
--- a/packages/seacas/applications/ejoin/EJ_SystemInterface.C
+++ b/packages/seacas/applications/ejoin/EJ_SystemInterface.C
@@ -143,8 +143,11 @@ void SystemInterface::enroll_options()
options_.enroll("steps", GetLongOption::MandatoryValue,
"Specify subset of timesteps to transfer to output file.\n"
"\t\tFormat is beg:end:step. 1:10:2 --> 1,3,5,7,9\n"
- "\t\tTo only transfer last step, use '-steps LAST'",
- "1:");
+ "\t\tIf the 'beg' or 'end' is < 0, then it is the \"-Nth\" step...\n"
+ "\t\t-1 is \"first last\" or last, -3 is \"third last\"\n"
+ "\t\tTo copy just the last 3 steps, do: `-steps -3:-1`\n"
+ "\t\tEnter LAST for last step",
+ "1:", nullptr, true);
options_.enroll("gvar", GetLongOption::MandatoryValue,
"Comma-separated list of global variables to be joined or ALL or NONE.", nullptr);
@@ -478,15 +481,17 @@ void SystemInterface::parse_step_option(const char *tokens)
//: The defined formats for the count attribute are:
//:
//: - -- default -- 1 <= count <= oo (all steps)
- //: - "X" -- X <= count <= X (just step X). If X == LAST, last step
- // only
+ //: - "X" -- X <= count <= X (just step X) LAST for last step.
//: - "X:Y" -- X to Y by 1
//: - "X:" -- X to oo by 1
//: - ":Y" -- 1 to Y by 1
//: - "::Z" -- 1 to oo by Z
- //: - "LAST" -- last step only
//:
- //: The count and step must always be >= 0
+ //: The step must always be > 0
+ //: If the 'from' or 'to' is < 0, then it is the "-Nth" step...
+ //: -1 is "first last" or last
+ //: -4 is "fourth last step"
+ //: To copy just the last 3 steps, do: `-steps -3:-1`
// Break into tokens separated by ":"
@@ -502,24 +507,24 @@ void SystemInterface::parse_step_option(const char *tokens)
for (auto &val : vals) {
// Parse 'i'th field
char tmp_str[128];
- int k = 0;
+ int k = 0;
while (tokens[j] != '\0' && tokens[j] != ':') {
tmp_str[k++] = tokens[j++];
}
tmp_str[k] = '\0';
if (strlen(tmp_str) > 0) {
- val = strtoul(tmp_str, nullptr, 0);
+ val = strtol(tmp_str, nullptr, 0);
}
if (tokens[j++] == '\0') {
break; // Reached end of string
}
}
- stepMin_ = abs(vals[0]);
- stepMax_ = abs(vals[1]);
- stepInterval_ = abs(vals[2]);
+ stepMin_ = vals[0];
+ stepMax_ = vals[1];
+ stepInterval_ = abs(vals[2]); // step is always positive...
}
else if (str_equal("LAST", tokens)) {
stepMin_ = stepMax_ = -1;
diff --git a/packages/seacas/applications/ejoin/EJ_Version.h b/packages/seacas/applications/ejoin/EJ_Version.h
index 8fad82651f41..9389859444c1 100644
--- a/packages/seacas/applications/ejoin/EJ_Version.h
+++ b/packages/seacas/applications/ejoin/EJ_Version.h
@@ -9,6 +9,6 @@
static const std::array qainfo{
"ejoin",
- "2024/02/21",
- "1.6.3",
+ "2024/08/06",
+ "1.6.4",
};
diff --git a/packages/seacas/applications/ejoin/EJoin.C b/packages/seacas/applications/ejoin/EJoin.C
index ef15d73cc1c3..8cbbe7315c41 100644
--- a/packages/seacas/applications/ejoin/EJoin.C
+++ b/packages/seacas/applications/ejoin/EJoin.C
@@ -528,9 +528,11 @@ double ejoin(SystemInterface &interFace, std::vector &part_mesh,
int ts_step = interFace.step_interval();
int num_steps = static_cast(global_times.size());
- if (ts_min == -1 && ts_max == -1) {
- ts_min = num_steps;
- ts_max = num_steps;
+ if (ts_min < 0) {
+ ts_min = num_steps + 1 + ts_min;
+ }
+ if (ts_max < 0) {
+ ts_max = num_steps + 1 + ts_max;
}
ts_max = ts_max < num_steps ? ts_max : num_steps;
diff --git a/packages/seacas/applications/epu/EP_SystemInterface.C b/packages/seacas/applications/epu/EP_SystemInterface.C
index 21ff8d183e3c..ca97eb217f02 100644
--- a/packages/seacas/applications/epu/EP_SystemInterface.C
+++ b/packages/seacas/applications/epu/EP_SystemInterface.C
@@ -175,6 +175,9 @@ void Excn::SystemInterface::enroll_options()
options_.enroll("steps", GetLongOption::MandatoryValue,
"Specify subset of timesteps to transfer to output file.\n"
"\t\tFormat is beg:end:step. 1:10:2 --> 1,3,5,7,9\n"
+ "\t\tIf the 'beg' or 'end' is < 0, then it is the \"-Nth\" step...\n"
+ "\t\t-1 is \"first last\" or last, -3 is \"third last\"\n"
+ "\t\tTo copy just the last 3 steps, do: `-steps -3:-1`\n"
"\t\tEnter LAST for last step",
"1:", nullptr, true);
@@ -545,7 +548,11 @@ void Excn::SystemInterface::parse_step_option(const char *tokens)
//: ":Y" -- 1 to Y by 1
//: "::Z" -- 1 to oo by Z
//:
- //: The count and step must always be >= 0
+ //: The step must always be > 0
+ //: If the 'from' or 'to' is < 0, then it is the "-Nth" step...
+ //: -1 is "first last" or last
+ //: -4 is "fourth last step"
+ //: To copy just the last 3 steps, do: `-steps -3:-1`
// Break into tokens separated by ":"
@@ -555,34 +562,30 @@ void Excn::SystemInterface::parse_step_option(const char *tokens)
if (strchr(tokens, ':') != nullptr) {
// The string contains a separator
- int vals[3];
- vals[0] = stepMin_;
- vals[1] = stepMax_;
- vals[2] = stepInterval_;
+ std::array vals{stepMin_, stepMax_, stepInterval_};
int j = 0;
for (auto &val : vals) {
// Parse 'i'th field
char tmp_str[128];
- ;
- int k = 0;
+ int k = 0;
while (tokens[j] != '\0' && tokens[j] != ':') {
tmp_str[k++] = tokens[j++];
}
tmp_str[k] = '\0';
if (strlen(tmp_str) > 0) {
- val = strtoul(tmp_str, nullptr, 0);
+ val = strtol(tmp_str, nullptr, 0);
}
if (tokens[j++] == '\0') {
break; // Reached end of string
}
}
- stepMin_ = abs(vals[0]);
- stepMax_ = abs(vals[1]);
- stepInterval_ = abs(vals[2]);
+ stepMin_ = vals[0];
+ stepMax_ = vals[1];
+ stepInterval_ = abs(vals[2]); // step is always positive...
}
else if (str_equal("LAST", tokens)) {
stepMin_ = stepMax_ = -1;
diff --git a/packages/seacas/applications/epu/EP_Version.h b/packages/seacas/applications/epu/EP_Version.h
index aca0e9ff6557..44cabbaaa476 100644
--- a/packages/seacas/applications/epu/EP_Version.h
+++ b/packages/seacas/applications/epu/EP_Version.h
@@ -11,6 +11,6 @@
static const std::array qainfo{
"epu -- E Pluribus Unum",
- "6.09",
- "2024/04/18",
+ "6.10",
+ "2024/08/06",
};
diff --git a/packages/seacas/applications/epu/epu.C b/packages/seacas/applications/epu/epu.C
index 89fcb8cf97c9..30a11cefd1a1 100644
--- a/packages/seacas/applications/epu/epu.C
+++ b/packages/seacas/applications/epu/epu.C
@@ -1325,9 +1325,11 @@ int epu(SystemInterface &interFace, int start_part, int part_count, int cycle, T
int ts_max = interFace.step_max();
int ts_step = interFace.step_interval();
- if (ts_min == -1 && ts_max == -1) {
- ts_min = num_time_steps;
- ts_max = num_time_steps;
+ if (ts_min < 0) {
+ ts_min = num_time_steps + 1 + ts_min;
+ }
+ if (ts_max < 0) {
+ ts_max = num_time_steps + 1 + ts_max;
}
// Time steps for output file
diff --git a/packages/seacas/applications/exodiff/map.C b/packages/seacas/applications/exodiff/map.C
index 69b1fbae44de..62b872ccc7c5 100644
--- a/packages/seacas/applications/exodiff/map.C
+++ b/packages/seacas/applications/exodiff/map.C
@@ -1,4 +1,4 @@
-// Copyright(C) 1999-2023 National Technology & Engineering Solutions
+// Copyright(C) 1999-2024 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.
//
@@ -23,9 +23,9 @@ namespace {
double find_range(const double *x, size_t num_nodes);
template
- INT Find(double x0, double y0, double z0, const std::vector &x,
- const std::vector &y, const std::vector &z, const std::vector &id,
- int dim, bool ignore_dups);
+ int64_t Find(double x0, double y0, double z0, const std::vector &x,
+ const std::vector &y, const std::vector &z,
+ const std::vector &id, int dim, bool ignore_dups);
template
void Compute_Node_Map(std::vector &node_map, ExoII_Read &file1, ExoII_Read &file2);
@@ -164,7 +164,7 @@ void Compute_Maps(std::vector &node_map, std::vector &elmt_map, ExoII_
}
// Locate midpoint in sorted array.
- INT sort_idx = Find(mid_x, mid_y, mid_z, x2, y2, z2, id, dim, interFace.ignore_dups);
+ int64_t sort_idx = Find(mid_x, mid_y, mid_z, x2, y2, z2, id, dim, interFace.ignore_dups);
if (sort_idx < 0) {
Error(fmt::format("Files are different (couldn't match element {} from block {} from first "
@@ -457,7 +457,7 @@ void Compute_Partial_Maps(std::vector &node_map, std::vector &elmt_map
}
// Locate midpoint in sorted array.
- INT sort_idx = Find(mid_x, mid_y, mid_z, x2, y2, z2, id2, dim, interFace.ignore_dups);
+ int64_t sort_idx = Find(mid_x, mid_y, mid_z, x2, y2, z2, id2, dim, interFace.ignore_dups);
if (sort_idx < 0) {
unmatched++;
if (first && interFace.show_unmatched) {
@@ -826,9 +826,9 @@ namespace {
}
template
- INT Find(double x0, double y0, double z0, const std::vector &x,
- const std::vector &y, const std::vector &z, const std::vector &id,
- int dim, bool ignore_dups)
+ int64_t Find(double x0, double y0, double z0, const std::vector &x,
+ const std::vector &y, const std::vector &z,
+ const std::vector &id, int dim, bool ignore_dups)
{
if (x.empty()) {
return -1;
@@ -856,7 +856,7 @@ namespace {
}
}
- INT i = low == N ? N - 1 : low; // Make sure index falls within array bounds.
+ int64_t i = low == N ? N - 1 : low; // Make sure index falls within array bounds.
if (i == 0 && interFace.coord_tol.Diff(x[id[i]], x0)) {
// Could not find an index within tolerance on x coordinate.
@@ -871,7 +871,7 @@ namespace {
// Search until tolerance between the x coordinate fails or a match is found.
// If a match is found, the loop continues in order to check for dups.
- INT index = -1;
+ int64_t index = -1;
do {
if (dim == 1 || (dim == 2 && !interFace.coord_tol.Diff(y[id[i]], y0)) ||
(dim == 3 && !interFace.coord_tol.Diff(y[id[i]], y0) &&
@@ -900,7 +900,7 @@ namespace {
index = i;
}
- } while (++i < (INT)N && !interFace.coord_tol.Diff(x[id[i]], x0));
+ } while (++i < (int64_t)N && !interFace.coord_tol.Diff(x[id[i]], x0));
interFace.coord_tol.type = save_tolerance_type;
return index;
diff --git a/packages/seacas/applications/nem_slice/elb.h b/packages/seacas/applications/nem_slice/elb.h
index 815c873e6514..6255820f5106 100644
--- a/packages/seacas/applications/nem_slice/elb.h
+++ b/packages/seacas/applications/nem_slice/elb.h
@@ -14,7 +14,7 @@
#include
#include
-#define ELB_VERSION "5.00"
+#define ELB_VERSION "5.04 (2024/08/19)"
#define UTIL_NAME "nem_slice"
#define ELB_FALSE 0
#define ELB_TRUE 1
diff --git a/packages/seacas/applications/nem_slice/elb_elem.C b/packages/seacas/applications/nem_slice/elb_elem.C
index cd56ccc4d82e..f706c25dee7b 100644
--- a/packages/seacas/applications/nem_slice/elb_elem.C
+++ b/packages/seacas/applications/nem_slice/elb_elem.C
@@ -326,8 +326,8 @@ int get_elem_info(const int req, const E_Type etype)
case BAR2:
switch (req) {
case NNODES: answer = 2; break;
- case NSIDE_NODES: answer = 2; break;
- case NSIDES: answer = 1; break;
+ case NSIDE_NODES: answer = 1; break;
+ case NSIDES: answer = 2; break;
case NDIM: /* number of physical dimensions */ answer = 1; break;
default:
Gen_Error(0, "fatal: unknown quantity");
@@ -365,8 +365,8 @@ int get_elem_info(const int req, const E_Type etype)
case BAR3:
switch (req) {
case NNODES: answer = 3; break;
- case NSIDE_NODES: answer = 2; break;
- case NSIDES: answer = 1; break;
+ case NSIDE_NODES: answer = 1; break;
+ case NSIDES: answer = 2; break;
case NDIM: /* number of physical dimensions */ answer = 1; break;
default:
Gen_Error(0, "fatal: unknown quantity");
@@ -945,6 +945,15 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s
switch (etype) {
case BAR2:
case BAR3:
+ /* SIDE 1 */
+ if (side_nodes[0] == connect[0]) {
+ return 1;
+ }
+ if (side_nodes[0] == connect[1]) {
+ return 2;
+ }
+ break;
+
case SHELL2:
case SHELL3:
/* SIDE 1 */
@@ -1661,26 +1670,33 @@ int ss_to_node_list(const E_Type etype, /* The element type */
{1, 4, 3, 2, 9, 8, 7, 6, 14} // side 5 (quad)
};
- static int bar_table[1][3] = {{1, 2, 3}};
+ static int shell_bar_table[1][3] = {{1, 2, 3}};
+ static int bar_table[2][1] = {{1}, {2}};
/* Locally decrement side_num */
side_num--;
/* Switch over the element type. */
switch (etype) {
+ case BAR3:
case BAR2:
+ /* Bar1 has 2 sides, each is a single node */
+ for (i = 0; i < 1; i++) {
+ ss_node_list[i] = connect[(bar_table[side_num][i] - 1)];
+ }
+ break;
+
case SHELL2:
/* Bar1 has 1 side */
for (i = 0; i < 2; i++) {
- ss_node_list[i] = connect[(bar_table[side_num][i] - 1)];
+ ss_node_list[i] = connect[(shell_bar_table[side_num][i] - 1)];
}
break;
- case BAR3:
case SHELL3:
/* Bar has 1 side */
for (i = 0; i < 3; i++) {
- ss_node_list[i] = connect[(bar_table[side_num][i] - 1)];
+ ss_node_list[i] = connect[(shell_bar_table[side_num][i] - 1)];
}
break;
diff --git a/packages/seacas/applications/nem_slice/elb_loadbal.C b/packages/seacas/applications/nem_slice/elb_loadbal.C
index 0d65ba204a41..f716bccf9f93 100644
--- a/packages/seacas/applications/nem_slice/elb_loadbal.C
+++ b/packages/seacas/applications/nem_slice/elb_loadbal.C
@@ -1535,358 +1535,419 @@ namespace {
/* Find the internal and border elements */
double time1 = get_time();
- for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) {
- int proc = lb->vertex2proc[ecnt];
- assert(proc < machine->num_procs);
- bool internal = true;
- int flag = 0;
- E_Type etype = mesh->elem_type[ecnt];
- int dim1 = get_elem_info(NDIM, etype);
-
- /* need to check for hex's or tet's */
- hflag1 = is_hex(etype);
-
- /* a TET10 cannot connect to a HEX */
- tflag1 = is_tet(etype);
+ int mesh_dim = mesh->num_dims;
+ if (mesh_dim == 1) {
+ std::vector categorized(mesh->num_elems);
+ for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) {
+ int proce = lb->vertex2proc[ecnt];
+ auto etype = mesh->elem_type[ecnt];
+ int nsides = get_elem_info(NSIDES, etype);
+ assert(nsides == 2);
+
+ /* check each side of this element */
+ for (int nscnt = 0; nscnt < nsides; nscnt++) {
+
+ /* get the node on this element side (should only be one)*/
+ side_cnt = ss_to_node_list(etype, mesh->connect[ecnt], (nscnt + 1), side_nodes);
+ assert(side_cnt == 1);
+
+ size_t nhold = graph->sur_elem[side_nodes[0]].size();
+ assert(nhold == 1 || nhold == 2);
+ if (nhold == 2) {
+ // 2 elements connected to this node -- `ecnt` and the other one...
+ for (size_t ncnt = 0; ncnt < nhold; ncnt++) {
+ size_t elem = graph->sur_elem[side_nodes[0]][ncnt];
+ if (elem == ecnt) {
+ continue;
+ }
+ int proc2 = lb->vertex2proc[elem];
+ if (proce == proc2) {
+ continue;
+ }
+ else {
+ // Processors of the two elements are different, so we are
+ // at a processor boundary...
+ if (!categorized[ecnt]) {
+ lb->bor_elems[proce].push_back(ecnt);
+ categorized[ecnt] = 1;
+ }
+ lb->e_cmap_elems[proc2].push_back(elem);
+ lb->e_cmap_sides[proc2].push_back(2 - ncnt);
+ lb->e_cmap_procs[proc2].push_back(proce);
+ lb->e_cmap_neigh[proc2].push_back(ecnt);
+ }
+ }
+ }
+ }
+ if (!categorized[ecnt]) {
+ lb->int_elems[proce].push_back(ecnt);
+ categorized[ecnt] = 1;
+ }
+ }
+ }
+ else {
+ for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) {
+ int proc = lb->vertex2proc[ecnt];
+ assert(proc < machine->num_procs);
+ bool internal = true;
+ int flag = 0;
+ auto etype = mesh->elem_type[ecnt];
+ int dim1 = get_elem_info(NDIM, etype);
- int nsides = get_elem_info(NSIDES, etype);
+ /* need to check for hex's or tet's */
+ hflag1 = is_hex(etype);
- /* check each side of this element */
- for (int nscnt = 0; nscnt < nsides; nscnt++) {
+ /* a tet10 cannot connect to a hex */
+ tflag1 = is_tet(etype);
- /* get the list of nodes on this element side */
- side_cnt = ss_to_node_list(etype, mesh->connect[ecnt], (nscnt + 1), side_nodes);
+ int nsides = get_elem_info(NSIDES, etype);
- /*
- * now determine how many side set nodes are needed to
- * determine if there is an element connected to this side.
- *
- * 2-D - need two nodes, so find one intersection
- * 3-D - need three nodes, so find two intersections
- * NOTE: must check to make sure that this number is not
- * larger than the number of nodes on the sides (ie - SHELL).
- */
+ /* check each side of this element */
+ for (int nscnt = 0; nscnt < nsides; nscnt++) {
- int nnodes = mesh->num_dims;
- if (side_cnt < nnodes) {
- nnodes = side_cnt;
- }
- nnodes--; /* decrement to find the number of intersections needed */
+ /* get the list of nodes on this element side */
+ side_cnt = ss_to_node_list(etype, mesh->connect[ecnt], (nscnt + 1), side_nodes);
- nelem = 0; /* reset this in case no intersections are needed */
+ /*
+ * now determine how many side set nodes are needed to
+ * determine if there is an element connected to this side.
+ *
+ * 1-d - need one node
+ * 2-d - need two nodes, so find one intersection
+ * 3-d - need three nodes, so find two intersections
+ * note: must check to make sure that this number is not
+ * larger than the number of nodes on the sides (ie - shell).
+ */
- /*
- * need to handle hex's differently because of
- * the tet/hex combination
- */
+ int nnodes = mesh->num_dims;
+ if (side_cnt < nnodes) {
+ nnodes = side_cnt;
+ }
+ if (nnodes > 1)
+ nnodes--; /* decrement to find the number of intersections needed */
- if (!hflag1) { /* Not a hex */
+ nelem = 0; /* reset this in case no intersections are needed */
- /* ignore degenerate bars */
+ /*
+ * need to handle hex's differently because of
+ * the tet/hex combination
+ */
- if (!((etype == BAR2 || etype == SHELL2) && side_nodes[0] == side_nodes[1])) {
+ if (!hflag1) { /* not a hex */
- size_t nhold = graph->sur_elem[side_nodes[0]].size();
- for (size_t ncnt = 0; ncnt < nhold; ncnt++) {
- hold_elem[ncnt] = graph->sur_elem[side_nodes[0]][ncnt];
+ if (etype == BAR2 || etype == BAR3) {
+ size_t nhold = graph->sur_elem[side_nodes[0]].size();
+ if (nhold > 1) {
+ for (size_t ncnt = 0; ncnt < nhold; ncnt++) {
+ hold_elem[ncnt] = graph->sur_elem[side_nodes[0]][ncnt];
+ }
+ }
}
+ else if (!((etype == BAR2 || etype == SHELL2) && side_nodes[0] == side_nodes[1])) {
- for (int ncnt = 0; ncnt < nnodes; ncnt++) {
- /* Find elements connected to both node '0' and node 'ncnt+1' */
- nelem =
- find_inter(Data(hold_elem), Data(graph->sur_elem[side_nodes[(ncnt + 1)]]), nhold,
- graph->sur_elem[side_nodes[(ncnt + 1)]].size(), Data(pt_list));
-
- if (nelem < 2) {
- break;
+ size_t nhold = graph->sur_elem[side_nodes[0]].size();
+ for (size_t ncnt = 0; ncnt < nhold; ncnt++) {
+ hold_elem[ncnt] = graph->sur_elem[side_nodes[0]][ncnt];
}
- nhold = nelem;
- for (int ncnt2 = 0; ncnt2 < nelem; ncnt2++) {
- hold_elem[ncnt2] = hold_elem[pt_list[ncnt2]];
- }
- }
- }
- else {
- fmt::print("WARNING: Element = {} is a DEGENERATE BAR\n", ecnt + 1);
- }
- }
- else { /* Is a hex */
+ for (int ncnt = 0; ncnt < nnodes; ncnt++) {
+ /* Find elements connected to both node '0' and node 'ncnt+1' */
+ nelem = find_inter(Data(hold_elem), Data(graph->sur_elem[side_nodes[(ncnt + 1)]]),
+ nhold, graph->sur_elem[side_nodes[(ncnt + 1)]].size(),
+ Data(pt_list));
- /*
- * Hex faces are fairly complicated now. There are two
- * exceptions to the standard case:
- * 1. it is a degenerate hex (mimics a wedge). this has
- * two special faces, the first is a triangle, and the
- * second is a 2d line
- * 2. two tets are connected to this hex face
- */
+ if (nelem < 2) {
+ break;
+ }
- /* first need to check for a degenerate element */
- dflag = 0;
- if (side_nodes[0] == side_nodes[1] || side_nodes[0] == side_nodes[3]) {
- dflag++;
- }
- if (side_nodes[2] == side_nodes[1] || side_nodes[2] == side_nodes[3]) {
- dflag++;
+ nhold = nelem;
+ for (int ncnt2 = 0; ncnt2 < nelem; ncnt2++) {
+ hold_elem[ncnt2] = hold_elem[pt_list[ncnt2]];
+ }
+ }
+ }
+ else {
+ fmt::print("WARNING: Element = {} is a DEGENERATE BAR\n", ecnt + 1);
+ }
}
+ else { /* Is a hex */
- /*
- * if both flags are set, then this face is the 2d line,
- * and should be ignored with respect to elemental
- * communication maps
- */
- if (dflag == 2) {
- nelem = 1;
- }
- else {
/*
- * In order to check for two tets connected to this face,
- * check the intersection of opposite corners of this face.
- * Both tets should show up in the intersection of one of the
- * sets of opposite corners (nothing should show up in the
- * other).
+ * Hex faces are fairly complicated now. There are two
+ * exceptions to the standard case:
+ * 1. it is a degenerate hex (mimics a wedge). this has
+ * two special faces, the first is a triangle, and the
+ * second is a 2d line
+ * 2. two tets are connected to this hex face
*/
+ /* first need to check for a degenerate element */
+ dflag = 0;
+ if (side_nodes[0] == side_nodes[1] || side_nodes[0] == side_nodes[3]) {
+ dflag++;
+ }
+ if (side_nodes[2] == side_nodes[1] || side_nodes[2] == side_nodes[3]) {
+ dflag++;
+ }
+
/*
- * Initial check is side nodes 0 and 2 which are
- * diagonally opposite
+ * if both flags are set, then this face is the 2d line,
+ * and should be ignored with respect to elemental
+ * communication maps
*/
- int inode = 0;
- int node = 2;
- size_t nhold = 0;
- for (int ncnt = 0; ncnt < nnodes; ncnt++) {
- /* Find elements connected to both node 'inode' and node 'node' */
- nelem = find_inter(Data(graph->sur_elem[side_nodes[inode]]),
- Data(graph->sur_elem[side_nodes[node]]),
- graph->sur_elem[side_nodes[inode]].size(),
- graph->sur_elem[side_nodes[node]].size(), Data(pt_list));
-
- if (nelem > 1) {
- if (ncnt == 0) {
- nhold = nelem;
- for (int ncnt2 = 0; ncnt2 < nelem; ncnt2++) {
- hold_elem[ncnt2] = graph->sur_elem[side_nodes[inode]][pt_list[ncnt2]];
- }
+ if (dflag == 2) {
+ nelem = 1;
+ }
+ else {
+ /*
+ * In order to check for two tets connected to this face,
+ * check the intersection of opposite corners of this face.
+ * Both tets should show up in the intersection of one of the
+ * sets of opposite corners (nothing should show up in the
+ * other).
+ */
- if (dflag) {
- /*
- * in this case, need to get an intersection with
- * another (unique) point since nodes 0 and 2
- * may represent an edge and not the diagonal
- */
- if (side_nodes[1] != side_nodes[0] && side_nodes[1] != side_nodes[2]) {
- node = 1;
+ /*
+ * Initial check is side nodes 0 and 2 which are
+ * diagonally opposite
+ */
+ int inode = 0;
+ int node = 2;
+ size_t nhold = 0;
+ for (int ncnt = 0; ncnt < nnodes; ncnt++) {
+ /* Find elements connected to both node 'inode' and node 'node' */
+ nelem = find_inter(Data(graph->sur_elem[side_nodes[inode]]),
+ Data(graph->sur_elem[side_nodes[node]]),
+ graph->sur_elem[side_nodes[inode]].size(),
+ graph->sur_elem[side_nodes[node]].size(), Data(pt_list));
+
+ if (nelem > 1) {
+ if (ncnt == 0) {
+ nhold = nelem;
+ for (int ncnt2 = 0; ncnt2 < nelem; ncnt2++) {
+ hold_elem[ncnt2] = graph->sur_elem[side_nodes[inode]][pt_list[ncnt2]];
+ }
+
+ if (dflag) {
+ /*
+ * in this case, need to get an intersection with
+ * another (unique) point since nodes 0 and 2
+ * may represent an edge and not the diagonal
+ */
+ if (side_nodes[1] != side_nodes[0] && side_nodes[1] != side_nodes[2]) {
+ node = 1;
+ }
+ else {
+ node = 3;
+ }
}
else {
- node = 3;
+ /*
+ * in the non-degenerate case, if an element is connected
+ * to two opposite nodes, then it must share a face.
+ */
+ break;
}
}
else {
- /*
- * in the non-degenerate case, if an element is connected
- * to two opposite nodes, then it must share a face.
- */
- break;
- }
- }
- else {
- /* This is the second or later time through this
- loop and each time through, there have been two
- or more elements that are connected to 'node'
- (which changes) and 'inode'. We want to make
- sure that the elements matched this time through
- were also in the list the first time through so
- that the elements contain nodes 0 1 2 of the face
- and not just 0 1 and 0 2...
- So, this time, only put an element in the list if
- it was in the list before.
- */
- for (size_t ncnt2 = 0; ncnt2 < nhold; ncnt2++) {
- hold_elem[ncnt2] = -hold_elem[ncnt2];
- }
- for (int ncnt3 = 0; ncnt3 < nelem; ncnt3++) {
+ /* This is the second or later time through this
+ loop and each time through, there have been two
+ or more elements that are connected to 'node'
+ (which changes) and 'inode'. We want to make
+ sure that the elements matched this time through
+ were also in the list the first time through so
+ that the elements contain nodes 0 1 2 of the face
+ and not just 0 1 and 0 2...
+ So, this time, only put an element in the list if
+ it was in the list before.
+ */
for (size_t ncnt2 = 0; ncnt2 < nhold; ncnt2++) {
- if (-hold_elem[ncnt2] == graph->sur_elem[side_nodes[inode]][pt_list[ncnt3]]) {
- hold_elem[ncnt2] = graph->sur_elem[side_nodes[inode]][pt_list[ncnt3]];
- break;
+ hold_elem[ncnt2] = -hold_elem[ncnt2];
+ }
+ for (int ncnt3 = 0; ncnt3 < nelem; ncnt3++) {
+ for (size_t ncnt2 = 0; ncnt2 < nhold; ncnt2++) {
+ if (-hold_elem[ncnt2] ==
+ graph->sur_elem[side_nodes[inode]][pt_list[ncnt3]]) {
+ hold_elem[ncnt2] = graph->sur_elem[side_nodes[inode]][pt_list[ncnt3]];
+ break;
+ }
}
}
- }
- /* Now, go through list and cull out element < 0 */
- size_t ncnt3 = 0;
- for (size_t ncnt2 = 0; ncnt2 < nhold; ncnt2++) {
- if (hold_elem[ncnt2] >= 0) {
- hold_elem[ncnt3] = hold_elem[ncnt2];
- ncnt3++;
+ /* Now, go through list and cull out element < 0 */
+ size_t ncnt3 = 0;
+ for (size_t ncnt2 = 0; ncnt2 < nhold; ncnt2++) {
+ if (hold_elem[ncnt2] >= 0) {
+ hold_elem[ncnt3] = hold_elem[ncnt2];
+ ncnt3++;
+ }
+ }
+ nelem = ncnt3;
+ if (!dflag && nelem > 2) {
+ fmt::print(
+ stderr,
+ "Possible corrupted mesh detected at element {}, strange connectivity.\n",
+ ecnt);
}
- }
- nelem = ncnt3;
- if (!dflag && nelem > 2) {
- fmt::print(
- stderr,
- "Possible corrupted mesh detected at element {}, strange connectivity.\n",
- ecnt);
}
}
- }
- else { /* nelem == 1 or 0 */
- if (!dflag) {
- nhold = graph->sur_elem[side_nodes[1]].size();
- for (size_t ncnt2 = 0; ncnt2 < nhold; ncnt2++) {
- hold_elem[ncnt2] = graph->sur_elem[side_nodes[1]][ncnt2];
+ else { /* nelem == 1 or 0 */
+ if (!dflag) {
+ nhold = graph->sur_elem[side_nodes[1]].size();
+ for (size_t ncnt2 = 0; ncnt2 < nhold; ncnt2++) {
+ hold_elem[ncnt2] = graph->sur_elem[side_nodes[1]][ncnt2];
+ }
}
+ inode = 1;
+ node = 3; /* The node diagonally opposite node 1 */
}
- inode = 1;
- node = 3; /* The node diagonally opposite node 1 */
}
}
- }
- } /* "if (!hflag1)" */
-
- /*
- * if there is an element on this side of ecnt, then there
- * will be at least two elements in the intersection (one
- * will be ecnt)
- */
- if (nelem > 1) {
+ } /* "if (!hflag1)" */
/*
- * now go through and check each element in the list to see
- * if it on a different processor than ecnt. Don't need to
- * worry about ecnt (which is in the list) since it is on
- * the same processor as itself. Note that due to filtering
- * done above, we are guaranteed to either have an element
- * on a different processor or elem==ecnt.
+ * if there is an element on this side of ecnt, then there
+ * will be at least two elements in the intersection (one
+ * will be ecnt)
*/
- for (int ncnt = 0; ncnt < nelem; ncnt++) {
+ if (nelem > 1) {
- INT elem = hold_elem[ncnt];
- int proc2 = lb->vertex2proc[elem];
- assert(proc2 < machine->num_procs);
+ /*
+ * now go through and check each element in the list to see
+ * if it on a different processor than ecnt. Don't need to
+ * worry about ecnt (which is in the list) since it is on
+ * the same processor as itself. Note that due to filtering
+ * done above, we are guaranteed to either have an element
+ * on a different processor or elem==ecnt.
+ */
+ for (int ncnt = 0; ncnt < nelem; ncnt++) {
- if (proc != proc2) {
+ INT elem = hold_elem[ncnt];
+ int proc2 = lb->vertex2proc[elem];
+ assert(proc2 < machine->num_procs);
- E_Type etype2 = mesh->elem_type[elem];
+ if (proc != proc2) {
- int dim2 = get_elem_info(NDIM, etype2);
+ E_Type etype2 = mesh->elem_type[elem];
- int diff = abs(dim1 - dim2);
+ int dim2 = get_elem_info(NDIM, etype2);
- /*
- * hex's to shells - ok
- * shells to bar - ok
- * hex to bar - BAD since a BAR will see a HEX but a HEX will not
- * see a BAR
- */
+ int diff = abs(dim1 - dim2);
- if (diff < 2) {
-
- /* need to check for hex's */
- hflag2 = is_hex(etype2);
- tflag2 = is_tet(etype2);
-
- /* check here for tet/hex combinations */
- if ((tflag1 && hflag2) || (hflag1 && tflag2)) {
- /*
- * have to call a special function to get the side id
- * in these cases. In both cases, the number of side
- * nodes for the element will not be consistent with
- * side_cnt, and:
- *
- * TET/HEX - side_nodes only contains three of the
- * the side nodes of the hex.
- *
- * HEX/TET - Have to check that this tet shares a side
- * with the hex.
- */
- sid = get_side_id_hex_tet(mesh->elem_type[elem], mesh->connect[elem], side_cnt,
- side_nodes);
- }
- else {
- /*
- * get the side id of elem. Make sure that ecnt is
- * trying to communicate to a valid side of elem
- */
- side_cnt = get_ss_mirror(etype, side_nodes, (nscnt + 1), mirror_nodes);
-
- /*
- * small kludge to handle 6 node faces butted up against
- * 4 node faces
- */
- if (etype == HEXSHELL && side_cnt == 6) {
- side_cnt = 4;
- }
+ /*
+ * hex's to shells - ok
+ * shells to bar - ok
+ * hex to bar - BAD since a BAR will see a HEX but a HEX will not
+ * see a BAR
+ */
- /*
- * in order to get the correct side order for elem,
- * get the mirror of the side of ecnt
- */
- sid = get_side_id(mesh->elem_type[elem], mesh->connect[elem], side_cnt,
- mirror_nodes, problem->skip_checks, problem->partial_adj);
- }
+ if (diff < 2) {
- if (sid > 0) {
- /* Element is a border element */
- internal = false;
- if (!flag) {
- flag = 1;
- lb->bor_elems[proc].push_back(ecnt);
- }
+ /* need to check for hex's */
+ hflag2 = is_hex(etype2);
+ tflag2 = is_tet(etype2);
- /* now put ecnt into proc2's communications map */
- lb->e_cmap_elems[proc2].push_back(elem);
- lb->e_cmap_sides[proc2].push_back(sid);
- lb->e_cmap_procs[proc2].push_back(proc);
- lb->e_cmap_neigh[proc2].push_back(ecnt);
- }
- else if ((sid < 0) && (!problem->skip_checks)) {
- /*
- * too many errors with bad meshes, print out
- * more information here for diagnostics
- */
- cmesg =
- fmt::format("Error returned while getting side id for communication map.");
- Gen_Error(0, cmesg);
- cmesg = fmt::format("Element 1: {}", (ecnt + 1));
- Gen_Error(0, cmesg);
- nnodes = get_elem_info(NNODES, etype);
- cmesg = "connect table:";
- for (int i = 0; i < nnodes; i++) {
- tmpstr = fmt::format(" {}", (size_t)(mesh->connect[ecnt][i] + 1));
- cmesg += tmpstr;
+ /* check here for tet/hex combinations */
+ if ((tflag1 && hflag2) || (hflag1 && tflag2)) {
+ /*
+ * have to call a special function to get the side id
+ * in these cases. In both cases, the number of side
+ * nodes for the element will not be consistent with
+ * side_cnt, and:
+ *
+ * TET/HEX - side_nodes only contains three of the
+ * the side nodes of the hex.
+ *
+ * HEX/TET - Have to check that this tet shares a side
+ * with the hex.
+ */
+ sid = get_side_id_hex_tet(mesh->elem_type[elem], mesh->connect[elem], side_cnt,
+ side_nodes);
}
- Gen_Error(0, cmesg);
- cmesg = fmt::format("side id: {}", static_cast(nscnt + 1));
- Gen_Error(0, cmesg);
- cmesg = "side nodes:";
- for (int i = 0; i < side_cnt; i++) {
- tmpstr = fmt::format(" {}", (size_t)(side_nodes[i] + 1));
- cmesg += tmpstr;
+ else {
+ /*
+ * get the side id of elem. Make sure that ecnt is
+ * trying to communicate to a valid side of elem
+ */
+ side_cnt = get_ss_mirror(etype, side_nodes, (nscnt + 1), mirror_nodes);
+
+ /*
+ * small kludge to handle 6 node faces butted up against
+ * 4 node faces
+ */
+ if (etype == HEXSHELL && side_cnt == 6) {
+ side_cnt = 4;
+ }
+
+ /*
+ * in order to get the correct side order for elem,
+ * get the mirror of the side of ecnt
+ */
+ sid = get_side_id(mesh->elem_type[elem], mesh->connect[elem], side_cnt,
+ mirror_nodes, problem->skip_checks, problem->partial_adj);
}
- Gen_Error(0, cmesg);
- cmesg = fmt::format("Element 2: {}", (size_t)(elem + 1));
- Gen_Error(0, cmesg);
- nnodes = get_elem_info(NNODES, etype2);
- cmesg = "connect table:";
- for (int i = 0; i < nnodes; i++) {
- tmpstr = fmt::format(" {}", (size_t)(mesh->connect[elem][i] + 1));
- cmesg += tmpstr;
+
+ if (sid > 0) {
+ /* Element is a border element */
+ internal = false;
+ if (!flag) {
+ flag = 1;
+ lb->bor_elems[proc].push_back(ecnt);
+ }
+
+ /* now put ecnt into proc2's communications map */
+ lb->e_cmap_elems[proc2].push_back(elem);
+ lb->e_cmap_sides[proc2].push_back(sid);
+ lb->e_cmap_procs[proc2].push_back(proc);
+ lb->e_cmap_neigh[proc2].push_back(ecnt);
}
- Gen_Error(0, cmesg);
- return 0; /* and get out of here */
+ else if ((sid < 0) && (!problem->skip_checks)) {
+ /*
+ * too many errors with bad meshes, print out
+ * more information here for diagnostics
+ */
+ cmesg =
+ fmt::format("Error returned while getting side id for communication map.");
+ Gen_Error(0, cmesg);
+ cmesg = fmt::format("Element 1: {}", (ecnt + 1));
+ Gen_Error(0, cmesg);
+ nnodes = get_elem_info(NNODES, etype);
+ cmesg = "connect table:";
+ for (int i = 0; i < nnodes; i++) {
+ tmpstr = fmt::format(" {}", (size_t)(mesh->connect[ecnt][i] + 1));
+ cmesg += tmpstr;
+ }
+ Gen_Error(0, cmesg);
+ cmesg = fmt::format("side id: {}", static_cast(nscnt + 1));
+ Gen_Error(0, cmesg);
+ cmesg = "side nodes:";
+ for (int i = 0; i < side_cnt; i++) {
+ tmpstr = fmt::format(" {}", (size_t)(side_nodes[i] + 1));
+ cmesg += tmpstr;
+ }
+ Gen_Error(0, cmesg);
+ cmesg = fmt::format("Element 2: {}", (size_t)(elem + 1));
+ Gen_Error(0, cmesg);
+ nnodes = get_elem_info(NNODES, etype2);
+ cmesg = "connect table:";
+ for (int i = 0; i < nnodes; i++) {
+ tmpstr = fmt::format(" {}", (size_t)(mesh->connect[elem][i] + 1));
+ cmesg += tmpstr;
+ }
+ Gen_Error(0, cmesg);
+ return 0; /* and get out of here */
- } /* End "if sid < 0 && !problem>skip_checks" */
- } /* End "if (sid > 0)" */
- } /* End "if (proc != proc2)" */
- } /* End "for (ncnt = 0; ncnt < nelem; ncnt++)" */
- } /* End "if (nelem > 1)" */
- } /* End "for (nscnt = 0; nscnt < nsides; nscnt++)" */
+ } /* End "if sid < 0 && !problem>skip_checks" */
+ } /* End "if (sid > 0)" */
+ } /* End "if (proc != proc2)" */
+ } /* End "for (ncnt = 0; ncnt < nelem; ncnt++)" */
+ } /* End "if (nelem > 1)" */
+ } /* End "for (nscnt = 0; nscnt < nsides; nscnt++)" */
- if (internal) {
- lb->int_elems[proc].push_back(ecnt);
- }
- } /* End "for(ecnt=0; ecnt < mesh->num_elems; ecnt++)" */
+ if (internal) {
+ lb->int_elems[proc].push_back(ecnt);
+ }
+ } /* End "for(ecnt=0; ecnt < mesh->num_elems; ecnt++)" */
+ }
time2 = get_time();
fmt::print("Time for elemental categorization: {}s\n", time2 - time1);
diff --git a/packages/seacas/applications/nem_slice/elb_output.C b/packages/seacas/applications/nem_slice/elb_output.C
index 12557f5b1ff9..7e0869e38b04 100644
--- a/packages/seacas/applications/nem_slice/elb_output.C
+++ b/packages/seacas/applications/nem_slice/elb_output.C
@@ -174,10 +174,10 @@ int write_nemesis(std::string &nemI_out_file, Machine_Description *machine,
std::string time = fmt::format("{:%H:%M:%S}", *lt);
std::string date = fmt::format("{:%Y/%m/%d}", *lt);
- char qa_date[15];
- char qa_time[10];
+ char qa_date[32];
+ char qa_time[32];
char qa_name[MAX_STR_LENGTH];
- char qa_vers[10];
+ char qa_vers[32];
copy_string(qa_time, time);
copy_string(qa_date, date);
diff --git a/packages/seacas/applications/nem_spread/ps_pario_const.h b/packages/seacas/applications/nem_spread/ps_pario_const.h
index 43442abd6de4..916a299fbeaf 100644
--- a/packages/seacas/applications/nem_spread/ps_pario_const.h
+++ b/packages/seacas/applications/nem_spread/ps_pario_const.h
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2020, 2022, 2023, 2024 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.
*
@@ -8,6 +8,7 @@
#pragma once
#include "rf_io_const.h"
+#include
#include
/* Global variables. */
diff --git a/packages/seacas/applications/slice/SL_Version.h b/packages/seacas/applications/slice/SL_Version.h
index 1560a65a3c8e..ca02cc306020 100644
--- a/packages/seacas/applications/slice/SL_Version.h
+++ b/packages/seacas/applications/slice/SL_Version.h
@@ -9,6 +9,6 @@
static const std::array qainfo{
"slice",
- "2024/06/10",
- "2.3.00",
+ "2024/07/17",
+ "2.3.01",
};
diff --git a/packages/seacas/applications/slice/Slice.C b/packages/seacas/applications/slice/Slice.C
index be73865ceb9e..2bba93b462ed 100644
--- a/packages/seacas/applications/slice/Slice.C
+++ b/packages/seacas/applications/slice/Slice.C
@@ -912,6 +912,8 @@ namespace {
size_t proc_size)
{
progress(__func__);
+ size_t spatial_dimension = region.get_property("spatial_dimension").get_int();
+
std::vector glob_coord_x;
std::vector glob_coord_y;
std::vector glob_coord_z;
@@ -968,8 +970,12 @@ namespace {
}
else {
gnb->get_field_data("mesh_model_coordinates_x", glob_coord_x);
- gnb->get_field_data("mesh_model_coordinates_y", glob_coord_y);
- gnb->get_field_data("mesh_model_coordinates_z", glob_coord_z);
+ if (spatial_dimension > 1) {
+ gnb->get_field_data("mesh_model_coordinates_y", glob_coord_y);
+ }
+ if (spatial_dimension > 2) {
+ gnb->get_field_data("mesh_model_coordinates_z", glob_coord_z);
+ }
progress("\tRead global mesh_model_coordinates");
for (size_t i = 0; i < node_count; i++) {
@@ -993,8 +999,12 @@ namespace {
for (size_t p = proc_begin; p < proc_begin + proc_size; p++) {
Ioss::NodeBlock *nb = proc_region[p]->get_node_blocks()[0];
nb->put_field_data("mesh_model_coordinates_x", coordinates_x[p]);
- nb->put_field_data("mesh_model_coordinates_y", coordinates_y[p]);
- nb->put_field_data("mesh_model_coordinates_z", coordinates_z[p]);
+ if (spatial_dimension > 1) {
+ nb->put_field_data("mesh_model_coordinates_y", coordinates_y[p]);
+ }
+ if (spatial_dimension > 2) {
+ nb->put_field_data("mesh_model_coordinates_z", coordinates_z[p]);
+ }
proc_progress(p, processor_count);
}
progress("\tOutput processor coordinate vectors");
@@ -1028,7 +1038,9 @@ namespace {
}
progress("\tReserve processor coordinate vectors");
- for (size_t comp = 0; comp < 3; comp++) {
+ size_t spatial_dimension = region.get_property("spatial_dimension").get_int();
+
+ for (size_t comp = 0; comp < spatial_dimension; comp++) {
for (size_t p = proc_begin; p < proc_begin + proc_size; p++) {
coordinates[p].resize(0);
}
@@ -1292,9 +1304,10 @@ namespace {
offset += element_count;
}
}
+ size_t spatial_dimension = region.get_property("spatial_dimension").get_int();
for (size_t p = 0; p < proc_count; p++) {
- auto *nb =
- new Ioss::NodeBlock(proc_region[p]->get_database(), "node_block1", on_proc_count[p], 3);
+ auto *nb = new Ioss::NodeBlock(proc_region[p]->get_database(), "node_block1",
+ on_proc_count[p], spatial_dimension);
proc_region[p]->add(nb);
if (debug_level & 2) {
fmt::print(stderr, "\tProcessor {} has {} nodes.\n", fmt::group_digits(p),
diff --git a/packages/seacas/applications/zellij/Cell.C b/packages/seacas/applications/zellij/Cell.C
index 30d13d8014ac..53b0d9f34710 100644
--- a/packages/seacas/applications/zellij/Cell.C
+++ b/packages/seacas/applications/zellij/Cell.C
@@ -1,4 +1,4 @@
-// Copyright(C) 2021, 2022, 2023 National Technology & Engineering Solutions
+// Copyright(C) 2021, 2022, 2023, 2024 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.
//
@@ -21,7 +21,7 @@ extern unsigned int debug_level;
template <> struct fmt::formatter : formatter
{
// parse is inherited from formatter.
- template auto format(Loc l, FormatContext &ctx)
+ template auto format(Loc l, FormatContext &ctx) const
{
std::string name = "unknown";
switch (l) {
diff --git a/packages/seacas/applications/zellij/Cell.h b/packages/seacas/applications/zellij/Cell.h
index 8db0dac91646..5006063f04d3 100644
--- a/packages/seacas/applications/zellij/Cell.h
+++ b/packages/seacas/applications/zellij/Cell.h
@@ -150,7 +150,7 @@ class Cell
double m_offY{0.0};
private:
- //! The UnitCell that occupies this location in the grid / latice
+ //! The UnitCell that occupies this location in the grid / lattice
std::shared_ptr m_unitCell;
//! The MPI ranks of all surrounding cells in order:
diff --git a/packages/seacas/applications/zellij/UnitCell.C b/packages/seacas/applications/zellij/UnitCell.C
index ccd98e996a7d..5ecc781ba198 100644
--- a/packages/seacas/applications/zellij/UnitCell.C
+++ b/packages/seacas/applications/zellij/UnitCell.C
@@ -279,7 +279,7 @@ void UnitCell::generate_boundary_faces(unsigned int which_faces)
auto &faces = face_generator.faces("ALL");
Ioss::ElementBlock *block = nullptr;
for (const auto &face : faces) {
- if (face.elementCount_ == 1) {
+ if (face.element_count() == 1) {
block = get_element_block(block, face.element[0] / 10, m_region);
auto block_offset = block->get_offset();
for (int i = 0; i < 6; i++) {
diff --git a/packages/seacas/cmake/tpls/FindTPLADIOS2.cmake b/packages/seacas/cmake/tpls/FindTPLADIOS2.cmake
deleted file mode 100644
index bddbe96e9ca4..000000000000
--- a/packages/seacas/cmake/tpls/FindTPLADIOS2.cmake
+++ /dev/null
@@ -1,90 +0,0 @@
-# @HEADER
-# ************************************************************************
-#
-# Trilinos: An Object-Oriented Solver Framework
-# Copyright (2001) Sandia Corporation
-#
-#
-# Copyright (2001) Sandia Corporation. Under the terms of Contract
-# DE-AC04-94AL85000, there is a non-exclusive license for use of this
-# work by or on behalf of the U.S. Government. Export of this program
-# may require a license from the United States Government.
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the Corporation nor the names of the
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# NOTICE: The United States Government is granted for itself and others
-# acting on its behalf a paid-up, nonexclusive, irrevocable worldwide
-# license in this data to reproduce, prepare derivative works, and
-# perform publicly and display publicly. Beginning five (5) years from
-# July 25, 2001, the United States Government is granted for itself and
-# others acting on its behalf a paid-up, nonexclusive, irrevocable
-# worldwide license in this data to reproduce, prepare derivative works,
-# distribute copies to the public, perform publicly and display
-# publicly, and to permit others to do so.
-#
-# NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT
-# OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES
-# ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR
-# RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY
-# INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS
-# THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
-#
-# ************************************************************************
-# @HEADER
-
-
-MESSAGE("-- Using FIND_PACKAGE(ADIOS2 ...) ...")
-
-FIND_PACKAGE(ADIOS2)
-
-IF (ADIOS2_FOUND)
- # Tell TriBITS that we found ADIOS2 and there no need to look any further!
- GET_TARGET_PROPERTY(_ADIOS2_INCLUDE_DIRS adios2::adios2 INTERFACE_INCLUDE_DIRECTORIES)
- GET_TARGET_PROPERTY(_ADIOS2_LIBRARY_LOCATION adios2::adios2 LOCATION)
- GET_FILENAME_COMPONENT(ADIOS2_LIBRARY_DIRS ${_ADIOS2_LIBRARY_LOCATION} DIRECTORY)
-
-# For compatibility with TriBITS:
-SET(DOCSTR "List of semi-colon separated paths to look for the TPL ADIOS2")
-
-GET_TARGET_PROPERTY(ADIOS2_LOCATION adios2::adios2 LOCATION)
-
-SET(TPL_ADIOS2_LIBRARIES ${ADIOS2_LOCATION} CACHE PATH ${DOCSTR})
-SET(TPL_ADIOS2_INCLUDE_DIRS ${_ADIOS2_INCLUDE_DIRS} CACHE PATH ${DOCSTR})
-SET(TPL_ADIOS2_LIBRARY_DIRS ${_ADIOS2_LIBRARY_DIRS} CACHE PATH ${DOCSTR})
-
-ENDIF()
-
-#
-# Third, call TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES()
-#
-TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( ADIOS2
- REQUIRED_HEADERS adios2.h
- REQUIRED_LIBS_NAMES adios2_cxx11_mpi,adios2_cxx11,adios2_core_mpi,adios2_core
- )
-
-# NOTE: If FIND_PACKAGE(ADIOS2 ...) was called and successfully found ADIOS2, then
-# TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES() will use the already-set
-# variables TPL_ADIOS2_INCLUDE_DIRS and TPL_ADIOS2_LIBRARIES and then print them
-# out (and set some other standard variables as well). This is the final
-# "hook" into the TriBITS TPL system.
diff --git a/packages/seacas/libraries/aprepro_lib/CMakeLists.txt b/packages/seacas/libraries/aprepro_lib/CMakeLists.txt
index b1665f2b28b5..13fcf791dda3 100644
--- a/packages/seacas/libraries/aprepro_lib/CMakeLists.txt
+++ b/packages/seacas/libraries/aprepro_lib/CMakeLists.txt
@@ -15,8 +15,6 @@ IF (${CMAKE_PROJECT_NAME}_ENABLE_SEACASExodus)
ADD_DEFINITIONS(-DEXODUS_SUPPORT)
ENDIF()
-ADD_DEFINITIONS(-DFMT_SUPPORT)
-
TRIBITS_INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
)
diff --git a/packages/seacas/libraries/exodus/include/exodusII.h b/packages/seacas/libraries/exodus/include/exodusII.h
index dd545b5ec7c1..8c978d67aa2a 100644
--- a/packages/seacas/libraries/exodus/include/exodusII.h
+++ b/packages/seacas/libraries/exodus/include/exodusII.h
@@ -55,12 +55,12 @@
#endif
/* EXODUS version number */
-#define EXODUS_VERSION "9.00"
+#define EXODUS_VERSION "9.01"
#define EXODUS_VERSION_MAJOR 9
-#define EXODUS_VERSION_MINOR 0
-#define EXODUS_RELEASE_DATE "May 30, 2024"
+#define EXODUS_VERSION_MINOR 1
+#define EXODUS_RELEASE_DATE "July 17, 2024"
-#define EX_API_VERS 9.00f
+#define EX_API_VERS 9.01f
#define EX_API_VERS_NODOT (100 * EXODUS_VERSION_MAJOR + EXODUS_VERSION_MINOR)
#define EX_VERS EX_API_VERS
@@ -1045,6 +1045,8 @@ EXODUS_EXPORT int ex_get_blob(int exoid, struct ex_blob *blob);
EXODUS_EXPORT int ex_put_blobs(int exoid, size_t count, const struct ex_blob *blobs);
EXODUS_EXPORT int ex_get_blobs(int exoid, struct ex_blob *blobs);
+EXODUS_EXPORT int ex_put_multi_field_metadata(int exoid, const ex_field *field,
+ const int field_count);
EXODUS_EXPORT int ex_put_field_metadata(int exoid, const ex_field field);
EXODUS_EXPORT int ex_put_field_suffices(int exoid, const ex_field field, const char *suffices);
EXODUS_EXPORT int ex_get_field_metadata(int exoid, ex_field *field);
@@ -1953,6 +1955,7 @@ enum ex_error_return_code {
EX_LASTERR = -1003, /**< in ex_err, use existing err_num value */
EX_NULLENTITY = -1006, /**< null entity found */
EX_NOENTITY = -1007, /**< no entities of that type on database */
+ EX_INTSIZEMISMATCH = -1008, /**< integer sizes do not match on input/output databases in ex_copy */
EX_NOTFOUND = -1008, /**< could not find requested variable on database */
EX_FATAL = -1, /**< fatal error flag def */
diff --git a/packages/seacas/libraries/exodus/include/exodusII_cfg.h.in b/packages/seacas/libraries/exodus/include/exodusII_cfg.h.in
index f407c0ed7964..304c65b4c734 100644
--- a/packages/seacas/libraries/exodus/include/exodusII_cfg.h.in
+++ b/packages/seacas/libraries/exodus/include/exodusII_cfg.h.in
@@ -1,8 +1,10 @@
-# Copyright(C) 1999-2022 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
+/*
+ * Copyright(C) 1999-2022 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
+ */
#pragma once
#cmakedefine EXODUSII_BUILD_SHARED_LIBS
diff --git a/packages/seacas/libraries/exodus/include/exodusII_int.h b/packages/seacas/libraries/exodus/include/exodusII_int.h
index 8657fa6755dc..e8bb5aca4ebc 100644
--- a/packages/seacas/libraries/exodus/include/exodusII_int.h
+++ b/packages/seacas/libraries/exodus/include/exodusII_int.h
@@ -91,7 +91,7 @@ extern "C" {
/* Utility function to find variable to store entity attribute on */
int exi_get_varid(int exoid, ex_entity_type obj_type, ex_entity_id id);
-void exi_reset_error_status(void);
+EXODUS_EXPORT void exi_reset_error_status(void);
#if defined(EXODUS_THREADSAFE)
#if !defined(exerrval)
@@ -686,28 +686,31 @@ typedef enum exi_element_type exi_element_type;
struct exi_file_item
{
int file_id;
- nc_type netcdf_type_code;
+ nc_type netcdf_type_code; /**< NC_FLOAT or NC_DOUBLE */
int int64_status;
int maximum_name_length;
int time_varid; /* Store to avoid lookup each timestep */
unsigned int assembly_count;
unsigned int blob_count;
+ unsigned int compression_level; /**< 0 (disabled) to 9 (maximum) compression level for
+ gzip, 4..32 and even for szip; NetCDF-4 only */
+ unsigned int persist_define_mode : 10; /**< Stay in define mode until exi_persist_leavedef is
+ called. Set by exi_persist_redef... */
unsigned int
- compression_algorithm : 2; /**< GZIP/ZLIB, SZIP, more may be supported by NetCDF soon */
- unsigned int compression_level : 6; /**< 0 (disabled) to 9 (maximum) compression level for
- gzip, 4..32 and even for szip; NetCDF-4 only */
+ compression_algorithm : 4; /**< GZIP/ZLIB, SZIP, more may be supported by NetCDF soon */
+ unsigned int shuffle : 1; /**< 1 true, 0 false */
unsigned int user_compute_wordsize : 1; /**< 0 for 4 byte or 1 for 8 byte reals */
- unsigned int shuffle : 1; /**< 1 true, 0 false */
unsigned int
file_type : 2; /**< 0 - classic, 1 -- 64 bit classic, 2 --NetCDF4, 3 --NetCDF4 classic */
- unsigned int is_write : 1; /**< for output or append */
- unsigned int is_parallel : 1; /**< 1 true, 0 false */
- unsigned int is_hdf5 : 1; /**< 1 true, 0 false */
- unsigned int is_pnetcdf : 1; /**< 1 true, 0 false */
- unsigned int has_nodes : 1; /**< for input only at this time */
- unsigned int has_edges : 1; /**< for input only at this time */
- unsigned int has_faces : 1; /**< for input only at this time */
- unsigned int has_elems : 1; /**< for input only at this time */
+ unsigned int is_write : 1; /**< for output or append */
+ unsigned int is_parallel : 1; /**< 1 true, 0 false */
+ unsigned int is_hdf5 : 1; /**< 1 true, 0 false */
+ unsigned int is_pnetcdf : 1; /**< 1 true, 0 false */
+ unsigned int has_nodes : 1; /**< for input only at this time */
+ unsigned int has_edges : 1; /**< for input only at this time */
+ unsigned int has_faces : 1; /**< for input only at this time */
+ unsigned int has_elems : 1; /**< for input only at this time */
+ unsigned int in_define_mode : 1; /**< Is the file in nc define mode... */
struct exi_file_item *next;
};
@@ -796,9 +799,9 @@ extern struct exi_obj_stats *exoII_edm;
extern struct exi_obj_stats *exoII_fam;
extern struct exi_obj_stats *exoII_nm;
-struct exi_file_item *exi_find_file_item(int exoid);
-struct exi_file_item *exi_add_file_item(int exoid);
-struct exi_obj_stats *exi_get_stat_ptr(int exoid, struct exi_obj_stats **obj_ptr);
+EXODUS_EXPORT struct exi_file_item *exi_find_file_item(int exoid);
+struct exi_file_item *exi_add_file_item(int exoid);
+struct exi_obj_stats *exi_get_stat_ptr(int exoid, struct exi_obj_stats **obj_ptr);
EXODUS_EXPORT void exi_rm_stat_ptr(int exoid, struct exi_obj_stats **obj_ptr);
@@ -854,9 +857,14 @@ EXODUS_EXPORT int exi_put_names(int exoid, int varid, size_t num_entity, char *
ex_entity_type obj_type, const char *subtype, const char *routine);
EXODUS_EXPORT void exi_trim(char *name);
EXODUS_EXPORT void exi_update_max_name_length(int exoid, int length);
+EXODUS_EXPORT int exi_redef(int exoid, const char *call_func);
+EXODUS_EXPORT int exi_persist_redef(int exoid, const char *call_func);
EXODUS_EXPORT int exi_leavedef(int exoid, /* NemesisI file ID */
const char *call_rout /* Name of calling function */
);
+EXODUS_EXPORT int exi_persist_leavedef(int exoid, /* NemesisI file ID */
+ const char *call_rout /* Name of calling function */
+ );
EXODUS_EXPORT int exi_check_version(int run_version);
EXODUS_EXPORT int exi_handle_mode(unsigned int my_mode, int is_parallel, int run_version);
diff --git a/packages/seacas/libraries/exodus/src/ex__put_homogenous_block_params.c b/packages/seacas/libraries/exodus/src/ex__put_homogenous_block_params.c
index ed4e31d7200b..0e16d4a9e0f8 100644
--- a/packages/seacas/libraries/exodus/src/ex__put_homogenous_block_params.c
+++ b/packages/seacas/libraries/exodus/src/ex__put_homogenous_block_params.c
@@ -118,7 +118,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct
/* ======================================================================== */
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
return (EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_add_attr.c b/packages/seacas/libraries/exodus/src/ex_add_attr.c
index 5d10849df2ce..a0f0e94776d3 100644
--- a/packages/seacas/libraries/exodus/src/ex_add_attr.c
+++ b/packages/seacas/libraries/exodus/src/ex_add_attr.c
@@ -123,7 +123,7 @@ int ex_add_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t
/* element attribute array */
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_close.c b/packages/seacas/libraries/exodus/src/ex_close.c
index 171f9559c901..33ac81497e08 100644
--- a/packages/seacas/libraries/exodus/src/ex_close.c
+++ b/packages/seacas/libraries/exodus/src/ex_close.c
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2020, 2022, 2023, 2024 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.
*
@@ -57,6 +57,11 @@ int ex_close(int exoid)
EX_FUNC_LEAVE(EX_FATAL);
}
+#ifndef NDEBUG
+ struct exi_file_item *file = exi_find_file_item(exoid);
+ assert(!file->in_define_mode && file->persist_define_mode == 0);
+#endif
+
/*
* NOTE: If using netcdf-4, exoid must refer to the root group.
* Need to determine whether there are any groups and if so,
diff --git a/packages/seacas/libraries/exodus/src/ex_conv.c b/packages/seacas/libraries/exodus/src/ex_conv.c
index bbb545e9c3ed..f053f185d37c 100644
--- a/packages/seacas/libraries/exodus/src/ex_conv.c
+++ b/packages/seacas/libraries/exodus/src/ex_conv.c
@@ -249,6 +249,8 @@ int exi_conv_init(int exoid, int *comp_wordsize, int *io_wordsize, int file_word
new_file->has_edges = 1;
new_file->has_faces = 1;
new_file->has_elems = 1;
+ new_file->in_define_mode = 0;
+ new_file->persist_define_mode = 0;
new_file->is_write = is_write;
new_file->next = file_list;
diff --git a/packages/seacas/libraries/exodus/src/ex_copy.c b/packages/seacas/libraries/exodus/src/ex_copy.c
index e7807dc9d4ac..8ccb00505f2b 100644
--- a/packages/seacas/libraries/exodus/src/ex_copy.c
+++ b/packages/seacas/libraries/exodus/src/ex_copy.c
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2023 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2024 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.
*
@@ -108,7 +108,7 @@ static int ex_copy_internal(int in_exoid, int out_exoid, int mesh_only)
}
/* put output file into define mode */
- EXCHECK(nc_redef(out_exoid));
+ EXCHECK(exi_redef(out_exoid, __func__));
/* copy global attributes */
EXCHECK(cpy_global_att(in_exoid, out_exoid));
diff --git a/packages/seacas/libraries/exodus/src/ex_create_group.c b/packages/seacas/libraries/exodus/src/ex_create_group.c
index 3d05f0ce541f..0adc0c3595b4 100644
--- a/packages/seacas/libraries/exodus/src/ex_create_group.c
+++ b/packages/seacas/libraries/exodus/src/ex_create_group.c
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2020, 2022, 2024 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.
*
@@ -26,7 +26,7 @@ int ex_create_group(int parent_id, const char *group_name)
EX_FUNC_LEAVE(EX_FATAL);
}
- if ((status = nc_redef(parent_id)) != NC_NOERR) {
+ if ((status = exi_redef(parent_id, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", parent_id);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_err.c b/packages/seacas/libraries/exodus/src/ex_err.c
index e3d95e4f0113..a2400ab978c9 100644
--- a/packages/seacas/libraries/exodus/src/ex_err.c
+++ b/packages/seacas/libraries/exodus/src/ex_err.c
@@ -333,7 +333,8 @@ const char *ex_strerror(int err_num)
case EX_MEMFAIL: return "Memory allocation failure";
case EX_BADFILEMODE: return "Bad file mode -- cannot specify both EX_READ and EX_WRITE";
case EX_BADFILEID: return "Bad file id. Could not find exodus file associated with file id.";
- case EX_WRONGFILETYPE: return "Integer sizes must match for input and output file in ex_copy.";
+ case EX_WRONGFILETYPE:
+ return "File does not exist or is not of a supported type (netcdf3, netcdf4, netcdf5).";
case EX_LOOKUPFAIL:
return "Id lookup failed for specified entity type. Could not find entity with specified id.";
case EX_BADFILENAME: return "Empty or null filename specified.";
@@ -344,6 +345,7 @@ const char *ex_strerror(int err_num)
case EX_INTERNAL: return "Internal logic error in exodus library.";
case EX_NOTROOTID: return "File id is not the root id; it is a subgroup id.";
case EX_NULLENTITY: return "Null entity found.";
+ case EX_INTSIZEMISMATCH: return "Integer sizes must match for input and output file in ex_copy.";
case EX_MSG: return "Message printed; no error implied.";
default: return nc_strerror(err_num);
}
diff --git a/packages/seacas/libraries/exodus/src/ex_field_utils.c b/packages/seacas/libraries/exodus/src/ex_field_utils.c
index df99363788d5..098e3c589f26 100644
--- a/packages/seacas/libraries/exodus/src/ex_field_utils.c
+++ b/packages/seacas/libraries/exodus/src/ex_field_utils.c
@@ -9,7 +9,6 @@
#include "exodusII.h" // for ex_err, etc
#include "exodusII_int.h" // for EX_FATAL, etc
#include
-#include
#define _GNU_SOURCE
#include
@@ -43,13 +42,19 @@ static size_t my_strlcat(char *restrict dst, const char *restrict src, size_t ma
return dstlen + srclen;
}
-static int number_width(const size_t number)
+static int number_width(size_t number)
{
+ /* Could use `(int)floor(log10(number)) + 1`, but that requires math library... */
if (number == 0) {
return 1;
}
- int width = (int)floor(log10(number)) + 1;
- return width;
+ int count = 0;
+ // Iterate till n has digits remaining
+ while (number != 0) {
+ number /= 10;
+ ++count;
+ }
+ return count;
}
static void verify_valid_component(int component, size_t cardinality, size_t suffix_size)
diff --git a/packages/seacas/libraries/exodus/src/ex_get_field_metadata.c b/packages/seacas/libraries/exodus/src/ex_get_field_metadata.c
index 7d1dbdd70e7f..1d25ed3c2956 100644
--- a/packages/seacas/libraries/exodus/src/ex_get_field_metadata.c
+++ b/packages/seacas/libraries/exodus/src/ex_get_field_metadata.c
@@ -122,11 +122,11 @@ int ex_get_field_metadata(int exoid, ex_field *field)
EX_FUNC_ENTER();
int varid;
- int att_count = exi_get_attribute_count(exoid, field->entity_type, field->entity_id, &varid);
+ int att_count = exi_get_attribute_count(exoid, field[0].entity_type, field[0].entity_id, &varid);
if (att_count < 0) {
char errmsg[MAX_ERR_LENGTH];
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Negative attribute count (%d) on %s with id %" PRId64,
- att_count, ex_name_of_object(field->entity_type), field->entity_id);
+ att_count, ex_name_of_object(field[0].entity_type), field[0].entity_id);
ex_err_fn(exoid, __func__, errmsg, EX_INTERNAL);
EX_FUNC_LEAVE(EX_FATAL);
}
@@ -140,7 +140,7 @@ int ex_get_field_metadata(int exoid, ex_field *field)
char errmsg[MAX_ERR_LENGTH];
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to get attribute named %s on %s with id %" PRId64, attr_name,
- ex_name_of_object(field->entity_type), field->entity_id);
+ ex_name_of_object(field[0].entity_type), field[0].entity_id);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
}
@@ -165,6 +165,10 @@ int ex_get_field_metadata(int exoid, ex_field *field)
if (found == -1) {
which = count;
strcpy(field[count].name, fld_name);
+ /* Set default separator type... */
+ field[count].component_separator[0] = '_';
+ field[count].component_separator[1] = '\0';
+
count++;
}
@@ -174,7 +178,7 @@ int ex_get_field_metadata(int exoid, ex_field *field)
char errmsg[MAX_ERR_LENGTH];
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to get parameters for attribute named %s on %s with id %" PRId64,
- attr_name, ex_name_of_object(field->entity_type), field->entity_id);
+ attr_name, ex_name_of_object(field[0].entity_type), field[0].entity_id);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
}
@@ -205,7 +209,7 @@ int ex_get_field_metadata(int exoid, ex_field *field)
snprintf(
errmsg, MAX_ERR_LENGTH,
"ERROR: Invalid field metadata attribute type %s on field %s on %s with id %" PRId64,
- fld_type, fld_name, ex_name_of_object(field->entity_type), field->entity_id);
+ fld_type, fld_name, ex_name_of_object(field[0].entity_type), field[0].entity_id);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
}
@@ -214,7 +218,7 @@ int ex_get_field_metadata(int exoid, ex_field *field)
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to read field metadata attribute type %s on field %s on %s with id "
"%" PRId64,
- fld_type, fld_name, ex_name_of_object(field->entity_type), field->entity_id);
+ fld_type, fld_name, ex_name_of_object(field[0].entity_type), field[0].entity_id);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
}
diff --git a/packages/seacas/libraries/exodus/src/ex_get_group_id.c b/packages/seacas/libraries/exodus/src/ex_get_group_id.c
index d98c8ca401d6..c07ac1f1b7c4 100644
--- a/packages/seacas/libraries/exodus/src/ex_get_group_id.c
+++ b/packages/seacas/libraries/exodus/src/ex_get_group_id.c
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2020 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2020, 2024, 2024 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.
*
@@ -23,12 +23,15 @@ int ex_get_group_id(int parent_id, const char *group_name, int *group_id)
char errmsg[MAX_ERR_LENGTH];
#if NC_HAS_HDF5
EX_FUNC_ENTER();
- /* See if name contains "/" indicating it is a full path name... */
- if (group_name == NULL) {
+ /* If the `group_name` is NULL, or is the single character '/', then
+ * return the root id.
+ */
+ if (group_name == NULL || (group_name[0] == '/' && group_name[1] == '\0')) {
/* Return root */
*group_id = (unsigned)parent_id & EX_FILE_ID_MASK;
}
- else if (strchr(group_name, '/') == NULL) {
+ /* If the name does not start with "/" then it is a relative name from current location... */
+ else if (group_name[0] != '/') {
/* Local child */
int status = nc_inq_grp_ncid(parent_id, group_name, group_id);
if (status != NC_NOERR) {
diff --git a/packages/seacas/libraries/exodus/src/ex_open.c b/packages/seacas/libraries/exodus/src/ex_open.c
index f8014692d4ba..baac050f4a14 100644
--- a/packages/seacas/libraries/exodus/src/ex_open.c
+++ b/packages/seacas/libraries/exodus/src/ex_open.c
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2023 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2024 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.
*
@@ -253,8 +253,8 @@ int ex_open_int(const char *path, int mode, int *comp_ws, int *io_ws, float *ver
EX_FUNC_LEAVE(EX_FATAL);
}
snprintf(errmsg, MAX_ERR_LENGTH,
- "ERROR: failed to open %s of type %d for reading.\n\tEither "
- "the file does not exist,\n\tor there is a permission or file "
+ "ERROR: failed to open %s of type %d for reading.\n\t\tThe "
+ "file does not exist, or there is a permission or file "
"format issue.",
canon_path, type);
ex_err(__func__, errmsg, status);
@@ -298,6 +298,7 @@ int ex_open_int(const char *path, int mode, int *comp_ws, int *io_ws, float *ver
int dim_str_name = 0;
int stat_dim = nc_inq_dimid(exoid, DIM_STR_NAME, &dim_str_name);
if (stat_att != NC_NOERR || stat_dim != NC_NOERR) {
+ /* This must still be nc_redef */
if ((status = nc_redef(exoid)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to place file id %d named %s into define mode", exoid, canon_path);
@@ -332,7 +333,7 @@ int ex_open_int(const char *path, int mode, int *comp_ws, int *io_ws, float *ver
EX_FUNC_LEAVE(EX_FATAL);
}
}
- if ((status = exi_leavedef(exoid, __func__)) != NC_NOERR) {
+ if ((status = nc_enddef(exoid)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to exit define mode in file id %d", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
free(canon_path);
diff --git a/packages/seacas/libraries/exodus/src/ex_open_par.c b/packages/seacas/libraries/exodus/src/ex_open_par.c
index 724d301eee76..5bfad214c030 100644
--- a/packages/seacas/libraries/exodus/src/ex_open_par.c
+++ b/packages/seacas/libraries/exodus/src/ex_open_par.c
@@ -291,9 +291,9 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float
}
snprintf(errmsg, MAX_ERR_LENGTH,
- "ERROR: failed to open %s for read/write.\n\tEither the file "
- "does not exist,\n\tor there is a permission or file format "
- "issue.",
+ "ERROR: failed to open %s of type %d for reading.\n\t\tThe "
+ "file does not exist, or there is a permission or file "
+ "format issue.",
canon_path);
ex_err(__func__, errmsg, status);
free(canon_path);
@@ -313,7 +313,7 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float
if (mode & EX_WRITE) { /* Appending */
/* turn off automatic filling of netCDF variables */
if (is_pnetcdf) {
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
free(canon_path);
@@ -359,7 +359,7 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float
}
if (in_redef) {
- if ((status = exi_leavedef(exoid, __func__)) != NC_NOERR) {
+ if ((status = nc_enddef(exoid)) != NC_NOERR) {
free(canon_path);
EX_FUNC_LEAVE(EX_FATAL);
}
diff --git a/packages/seacas/libraries/exodus/src/ex_put_all_var_param_ext.c b/packages/seacas/libraries/exodus/src/ex_put_all_var_param_ext.c
index 074a79d84f88..7bcf30eb1ef9 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_all_var_param_ext.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_all_var_param_ext.c
@@ -144,7 +144,7 @@ int ex_put_all_var_param_ext(int exoid, const ex_var_params *vp)
EX_ELEM_SET, VAR_ELS_STAT, elset_stat);
/* put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
goto error_ret;
diff --git a/packages/seacas/libraries/exodus/src/ex_put_assemblies.c b/packages/seacas/libraries/exodus/src/ex_put_assemblies.c
index c3e1f2c398c9..a731215b546a 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_assemblies.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_assemblies.c
@@ -45,7 +45,7 @@ int ex_put_assemblies(int exoid, size_t count, const struct ex_assembly *assembl
/* Assembly has not already been defined */
/* put netcdf file into define mode */
if (!in_define) {
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode",
exoid);
ex_err_fn(exoid, __func__, errmsg, status);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_attr_param.c b/packages/seacas/libraries/exodus/src/ex_put_attr_param.c
index 498d019c2df1..dd7847c7da5a 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_attr_param.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_attr_param.c
@@ -149,7 +149,7 @@ int ex_put_attr_param(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, i
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_attribute.c b/packages/seacas/libraries/exodus/src/ex_put_attribute.c
index 370cfe31ef5e..a63b09cc813f 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_attribute.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_attribute.c
@@ -38,7 +38,7 @@ int ex_put_double_attribute(int exoid, ex_entity_type obj_type, ex_entity_id id,
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
@@ -84,7 +84,7 @@ int ex_put_integer_attribute(int exoid, ex_entity_type obj_type, ex_entity_id id
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
@@ -137,7 +137,7 @@ int ex_put_text_attribute(int exoid, ex_entity_type obj_type, ex_entity_id id, c
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_blobs.c b/packages/seacas/libraries/exodus/src/ex_put_blobs.c
index 5bd70b3fdd05..89c22537bb60 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_blobs.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_blobs.c
@@ -29,7 +29,7 @@ int ex_put_blobs(int exoid, size_t count, const struct ex_blob *blobs)
int *entlst_id = (int *)calloc(count, sizeof(int));
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
free(entlst_id);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_block_params.c b/packages/seacas/libraries/exodus/src/ex_put_block_params.c
index 3f3801513056..b6d16dd3ccd8 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_block_params.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_block_params.c
@@ -253,7 +253,7 @@ int ex_put_block_params(int exoid, size_t block_count, const struct ex_block *bl
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
free(blocks_to_define);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_cmap_params.c b/packages/seacas/libraries/exodus/src/ex_put_cmap_params.c
index bf70211e32ad..196d1966bf7c 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_cmap_params.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_cmap_params.c
@@ -87,7 +87,7 @@ int ex_put_cmap_params(int exoid, const void_int *node_cmap_ids,
/* Put NetCDF file into define mode */
int status;
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to file ID %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_cmap_params_cc.c b/packages/seacas/libraries/exodus/src/ex_put_cmap_params_cc.c
index 6c6809380835..1df47f1eee80 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_cmap_params_cc.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_cmap_params_cc.c
@@ -215,7 +215,7 @@ file ID %d",
} /* "if (num_e_comm_maps >0)" */
/* Put NetCDF file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file ID %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_concat_all_blocks.c b/packages/seacas/libraries/exodus/src/ex_put_concat_all_blocks.c
index 53573ac67c65..f4b4a997bc78 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_concat_all_blocks.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_concat_all_blocks.c
@@ -205,7 +205,7 @@ int ex_put_concat_all_blocks(int exoid, const ex_block_params *param)
EX_FUNC_LEAVE(EX_NOERR);
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_concat_elem_block.c b/packages/seacas/libraries/exodus/src/ex_put_concat_elem_block.c
index f5c7ad17bfc4..92ce78b781b0 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_concat_elem_block.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_concat_elem_block.c
@@ -144,7 +144,7 @@ int ex_put_concat_elem_block(int exoid, const void_int *elem_blk_id, char *const
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
free(eb_array);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_concat_sets.c b/packages/seacas/libraries/exodus/src/ex_put_concat_sets.c
index 43a8807b6361..31c59c187c80 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_concat_sets.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_concat_sets.c
@@ -171,7 +171,7 @@ int ex_put_concat_sets(int exoid, ex_entity_type set_type, const struct ex_set_s
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
free(set_stat);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_coordinate_frames.c b/packages/seacas/libraries/exodus/src/ex_put_coordinate_frames.c
index b11c10c42a47..9e2edda44278 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_coordinate_frames.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_coordinate_frames.c
@@ -57,7 +57,7 @@ int ex_put_coordinate_frames(int exoid, int nframes, const void_int *cf_ids,
/* make the definitions */
/* go into define mode. define num_frames, num_frames9 */
int status;
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_field_metadata.c b/packages/seacas/libraries/exodus/src/ex_put_field_metadata.c
index 36ad8a30f8b7..ff388de656db 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_field_metadata.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_field_metadata.c
@@ -32,6 +32,28 @@ static int exi_print_attribute_error(int status, const char *name, const char *a
return EX_FATAL;
}
+int ex_put_multi_field_metadata(int exoid, const ex_field field[], const int count)
+{
+ exi_persist_redef(exoid, __func__);
+ for (int i = 0; i < count; i++) {
+ if (field[i].type[0] != EX_SCALAR) {
+ int status = ex_put_field_metadata(exoid, field[i]);
+ if (status != EX_NOERR) {
+ char errmsg[MAX_ERR_LENGTH];
+ snprintf(errmsg, MAX_ERR_LENGTH,
+ "ERROR: failed to store field metadata for field '%s' on %s with id %" PRId64
+ " in file id %d",
+ field[i].name, ex_name_of_object(field[i].entity_type), field[i].entity_id, exoid);
+ ex_err_fn(exoid, __func__, errmsg, status);
+ exi_persist_leavedef(exoid, __func__);
+ return EX_FATAL;
+ }
+ }
+ }
+ exi_persist_leavedef(exoid, __func__);
+ return EX_NOERR;
+}
+
int ex_put_field_metadata(int exoid, const ex_field field)
{
/*
@@ -53,28 +75,38 @@ int ex_put_field_metadata(int exoid, const ex_field field)
field.entity_id);
#endif
+ exi_persist_redef(exoid, __func__);
int status = 0;
static char *field_template = "Field@%s@%s";
char attribute_name[NC_MAX_NAME + 1];
sprintf(attribute_name, field_template, field.name, "type");
if ((status = ex_put_integer_attribute(exoid, field.entity_type, field.entity_id, attribute_name,
field.nesting, field.type)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_attribute_error(status, field.name, "type", field.entity_type, field.entity_id,
exoid, __func__);
}
- sprintf(attribute_name, field_template, field.name, "type_name");
- if ((status = ex_put_text_attribute(exoid, field.entity_type, field.entity_id, attribute_name,
- field.type_name)) != EX_NOERR) {
- return exi_print_attribute_error(status, field.name, "type_name", field.entity_type,
- field.entity_id, exoid, __func__);
+ /* Do not write if empty... */
+ if (field.type_name[0] != '\0') {
+ sprintf(attribute_name, field_template, field.name, "type_name");
+ if ((status = ex_put_text_attribute(exoid, field.entity_type, field.entity_id, attribute_name,
+ field.type_name)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
+ return exi_print_attribute_error(status, field.name, "type_name", field.entity_type,
+ field.entity_id, exoid, __func__);
+ }
}
- sprintf(attribute_name, field_template, field.name, "separator");
- if ((status = ex_put_text_attribute(exoid, field.entity_type, field.entity_id, attribute_name,
- field.component_separator)) != EX_NOERR) {
- return exi_print_attribute_error(status, field.name, "separator", field.entity_type,
- field.entity_id, exoid, __func__);
+ /* Default component_separator is '_'. Avoid writing if that is what it is... */
+ if (field.component_separator[0] != '_' || field.nesting > 1) {
+ sprintf(attribute_name, field_template, field.name, "separator");
+ if ((status = ex_put_text_attribute(exoid, field.entity_type, field.entity_id, attribute_name,
+ field.component_separator)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
+ return exi_print_attribute_error(status, field.name, "separator", field.entity_type,
+ field.entity_id, exoid, __func__);
+ }
}
bool needs_cardinality = false;
@@ -89,11 +121,13 @@ int ex_put_field_metadata(int exoid, const ex_field field)
if ((status = ex_put_integer_attribute(exoid, field.entity_type, field.entity_id,
attribute_name, field.nesting, field.cardinality)) !=
EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_attribute_error(status, field.name, "cardinality", field.entity_type,
field.entity_id, exoid, __func__);
}
}
+ exi_persist_leavedef(exoid, __func__);
return EX_NOERR;
}
@@ -145,46 +179,56 @@ int ex_put_basis(int exoid, const ex_basis basis)
* } ex_basis;
*/
+ exi_persist_redef(exoid, __func__);
int status;
if ((status = exi_put_basis_attribute(exoid, basis.name, "cardinality", EX_INTEGER, 1,
&basis.cardinality)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, basis.name, "basis", "cardinality", exoid, __func__);
}
if ((status = exi_put_basis_attribute(exoid, basis.name, "subc_dim", EX_INTEGER,
basis.cardinality, basis.subc_dim)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, basis.name, "basis", "subc_dim", exoid, __func__);
}
if ((status = exi_put_basis_attribute(exoid, basis.name, "subc_ordinal", EX_INTEGER,
basis.cardinality, basis.subc_ordinal)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, basis.name, "basis", "subc_ordinal", exoid, __func__);
}
if ((status = exi_put_basis_attribute(exoid, basis.name, "subc_dof_ordinal", EX_INTEGER,
basis.cardinality, basis.subc_dof_ordinal)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, basis.name, "basis", "subc_dof_ordinal", exoid, __func__);
}
if ((status = exi_put_basis_attribute(exoid, basis.name, "subc_num_dof", EX_INTEGER,
basis.cardinality, basis.subc_num_dof)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, basis.name, "basis", "subc_num_dof", exoid, __func__);
}
if ((status = exi_put_basis_attribute(exoid, basis.name, "xi", EX_DOUBLE, basis.cardinality,
basis.xi)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, basis.name, "basis", "xi", exoid, __func__);
}
if ((status = exi_put_basis_attribute(exoid, basis.name, "eta", EX_DOUBLE, basis.cardinality,
basis.eta)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, basis.name, "basis", "eta", exoid, __func__);
}
if ((status = exi_put_basis_attribute(exoid, basis.name, "zeta", EX_DOUBLE, basis.cardinality,
basis.zeta)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, basis.name, "basis", "zeta", exoid, __func__);
}
+ exi_persist_leavedef(exoid, __func__);
return EX_NOERR;
}
@@ -204,31 +248,38 @@ int ex_put_quadrature(int exoid, const ex_quadrature quad)
* } ex_quad;
*/
+ exi_persist_redef(exoid, __func__);
int status;
if ((status = exi_put_quad_attribute(exoid, quad.name, "cardinality", EX_INTEGER, 1,
&quad.cardinality)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, quad.name, "quad", "cardinality", exoid, __func__);
}
if ((status = exi_put_quad_attribute(exoid, quad.name, "xi", EX_DOUBLE, quad.cardinality,
quad.xi)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, quad.name, "quad", "xi", exoid, __func__);
}
if ((status = exi_put_quad_attribute(exoid, quad.name, "eta", EX_DOUBLE, quad.cardinality,
quad.eta)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, quad.name, "quad", "eta", exoid, __func__);
}
if ((status = exi_put_quad_attribute(exoid, quad.name, "zeta", EX_DOUBLE, quad.cardinality,
quad.zeta)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, quad.name, "quad", "zeta", exoid, __func__);
}
if ((status = exi_put_quad_attribute(exoid, quad.name, "weight", EX_DOUBLE, quad.cardinality,
quad.weight)) != EX_NOERR) {
+ exi_persist_leavedef(exoid, __func__);
return exi_print_type_error(status, quad.name, "quad", "weight", exoid, __func__);
}
+ exi_persist_leavedef(exoid, __func__);
return EX_NOERR;
}
diff --git a/packages/seacas/libraries/exodus/src/ex_put_id_map.c b/packages/seacas/libraries/exodus/src/ex_put_id_map.c
index eaae70e01318..fb38531d5578 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_id_map.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_id_map.c
@@ -83,7 +83,7 @@ int ex_put_id_map(int exoid, ex_entity_type map_type, const void_int *map)
/* put netcdf file into define mode */
if (nc_inq_varid(exoid, vmap, &mapid) != NC_NOERR) {
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_info.c b/packages/seacas/libraries/exodus/src/ex_put_info.c
index da69df0d83fd..4878d1d884f4 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_info.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_info.c
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2020, 2022, 2024 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.
*
@@ -95,7 +95,7 @@ int ex_put_info(int exoid, int num_info, char *const info[])
if (status != NC_NOERR) {
/* put file into define mode */
- if ((status = nc_redef(rootid)) != NC_NOERR) {
+ if ((status = exi_redef(rootid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed put file id %d into define mode", rootid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_init_ext.c b/packages/seacas/libraries/exodus/src/ex_put_init_ext.c
index 6d1ecb301a56..e07e8434444b 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_init_ext.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_init_ext.c
@@ -247,7 +247,7 @@ int ex_put_init_ext(int exoid, const ex_init_params *model)
}
/* put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
char errmsg[MAX_ERR_LENGTH];
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_init_global.c b/packages/seacas/libraries/exodus/src/ex_put_init_global.c
index 5053d37b27ec..f6731cd1640c 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_init_global.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_init_global.c
@@ -60,7 +60,7 @@ int ex_put_init_global(int exoid, int64_t num_nodes_g, int64_t num_elems_g, int6
id_type = NC_INT64;
}
/* Put NetCDF file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file ID %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_init_info.c b/packages/seacas/libraries/exodus/src/ex_put_init_info.c
index 0c88892b4364..29c55db5eb3e 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_init_info.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_init_info.c
@@ -68,7 +68,7 @@ int ex_put_init_info(int exoid, int num_proc, int num_proc_in_f, const char *fty
}
/* Put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file ID %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_loadbal_param.c b/packages/seacas/libraries/exodus/src/ex_put_loadbal_param.c
index f5463e863747..9307850593b9 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_loadbal_param.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_loadbal_param.c
@@ -91,7 +91,7 @@ int ex_put_loadbal_param(int exoid, int64_t num_int_nodes, int64_t num_bor_nodes
}
/* Put NetCDF file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_loadbal_param_cc.c b/packages/seacas/libraries/exodus/src/ex_put_loadbal_param_cc.c
index ed64526b4934..dc1d9dc35865 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_loadbal_param_cc.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_loadbal_param_cc.c
@@ -120,7 +120,7 @@ int ex_put_loadbal_param_cc(int exoid, const void_int *num_int_nodes, const void
}
/* Put NetCDF file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_map.c b/packages/seacas/libraries/exodus/src/ex_put_map.c
index 9861092f0553..f03881a42f21 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_map.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_map.c
@@ -75,7 +75,7 @@ int ex_put_map(int exoid, const void_int *elem_map)
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_map_param.c b/packages/seacas/libraries/exodus/src/ex_put_map_param.c
index f9d30aa53e45..8347e5c4b273 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_map_param.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_map_param.c
@@ -73,7 +73,7 @@ int ex_put_map_param(int exoid, int num_node_maps, int num_elem_maps)
}
/* put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_name.c b/packages/seacas/libraries/exodus/src/ex_put_name.c
index 0c161ab38533..c0dc4a93af31 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_name.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_name.c
@@ -39,7 +39,7 @@ int exi_put_assembly_name(int exoid, ex_entity_type obj_type, ex_entity_id entit
char errmsg[MAX_ERR_LENGTH];
if (nc_inq_varid(exoid, VAR_ENTITY_ASSEMBLY(entity_id), &entlst_id) == NC_NOERR) {
int status;
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_num_map.c b/packages/seacas/libraries/exodus/src/ex_put_num_map.c
index b4aa483fdc06..85a5c9d73f67 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_num_map.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_num_map.c
@@ -190,7 +190,7 @@ int ex_put_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_id, cons
EX_FUNC_LEAVE(EX_FATAL);
}
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_partial_id_map.c b/packages/seacas/libraries/exodus/src/ex_put_partial_id_map.c
index 7c1ffcdab5f6..6a97fd8ee04a 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_partial_id_map.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_partial_id_map.c
@@ -106,7 +106,7 @@ int ex_put_partial_id_map(int exoid, ex_entity_type map_type, int64_t start_enti
/* define the map if it doesn't already exist... */
if (nc_inq_varid(exoid, vmap, &mapid) != NC_NOERR) {
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_partial_var.c b/packages/seacas/libraries/exodus/src/ex_put_partial_var.c
index 8eabaae831ed..bc62bca91732 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_partial_var.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_partial_var.c
@@ -127,7 +127,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex
ex_name_of_object(var_type), &num_entity, &numobjdim, __func__);
/* variable doesn't exist so put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
return (EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_prop.c b/packages/seacas/libraries/exodus/src/ex_put_prop.c
index 6b1a86598a32..9300d2fb3026 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_prop.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_prop.c
@@ -152,7 +152,7 @@ int ex_put_prop(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const c
name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH) + 1;
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_prop_array.c b/packages/seacas/libraries/exodus/src/ex_put_prop_array.c
index 1e35e2197ab8..c49cedcc5381 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_prop_array.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_prop_array.c
@@ -144,7 +144,7 @@ int ex_put_prop_array(int exoid, ex_entity_type obj_type, const char *prop_name,
if (!found) {
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_prop_names.c b/packages/seacas/libraries/exodus/src/ex_put_prop_names.c
index d88b2aeccb76..bcf063f05012 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_prop_names.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_prop_names.c
@@ -130,7 +130,7 @@ int ex_put_prop_names(int exoid, ex_entity_type obj_type, int num_props, char **
nc_set_fill(exoid, NC_FILL, &oldfill); /* fill with zeros per routine spec */
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_qa.c b/packages/seacas/libraries/exodus/src/ex_put_qa.c
index 1b66067c9e63..a4efa3793670 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_qa.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_qa.c
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2020, 2022, 2024 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.
*
@@ -86,7 +86,7 @@ int ex_put_qa(int exoid, int num_qa_records, char *qa_record[][4])
if (status != NC_NOERR) {
/* put file into define mode */
- if ((status = nc_redef(rootid)) != NC_NOERR) {
+ if ((status = exi_redef(rootid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode",
rootid);
ex_err_fn(exoid, __func__, errmsg, status);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_param.c b/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_param.c
index 2f2f4ac8a661..d3d28c85685d 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_param.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_param.c
@@ -165,7 +165,7 @@ int ex_put_reduction_variable_param(int exoid, ex_entity_type obj_type, int num_
}
/* put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_reduction_vars.c b/packages/seacas/libraries/exodus/src/ex_put_reduction_vars.c
index b8b97e905628..f39948bcd026 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_reduction_vars.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_reduction_vars.c
@@ -84,7 +84,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, ex_entity_id obj_
}
/* variable doesn't exist so put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
return (EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_sets.c b/packages/seacas/libraries/exodus/src/ex_put_sets.c
index 0a81e9439bec..772994646260 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_sets.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_sets.c
@@ -96,7 +96,7 @@ int ex_put_sets(int exoid, size_t set_count, const struct ex_set *sets)
if (needs_define > 0) {
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
free(sets_to_define);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_truth_table.c b/packages/seacas/libraries/exodus/src/ex_put_truth_table.c
index ccc89a1b2155..09cb4e6973d8 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_truth_table.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_truth_table.c
@@ -236,7 +236,7 @@ int ex_put_truth_table(int exoid, ex_entity_type obj_type, int num_blk, int num_
}
/* put netcdf file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
free(stat_vals);
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
diff --git a/packages/seacas/libraries/exodus/src/ex_put_var_multi_time.c b/packages/seacas/libraries/exodus/src/ex_put_var_multi_time.c
index 821aec23ef59..a34123f5fb8c 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_var_multi_time.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_var_multi_time.c
@@ -128,7 +128,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex
ex_name_of_object(var_type), &num_entity, &numobjdim, __func__);
/* variable doesn't exist so put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
return EX_FATAL;
diff --git a/packages/seacas/libraries/exodus/src/ex_put_variable_param.c b/packages/seacas/libraries/exodus/src/ex_put_variable_param.c
index ed896f4a8c67..e19a10833f5f 100644
--- a/packages/seacas/libraries/exodus/src/ex_put_variable_param.c
+++ b/packages/seacas/libraries/exodus/src/ex_put_variable_param.c
@@ -174,7 +174,7 @@ int ex_put_variable_param(int exoid, ex_entity_type obj_type, int num_vars)
}
/* put file into define mode */
- if ((status = nc_redef(exoid)) != NC_NOERR) {
+ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
ex_err_fn(exoid, __func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
diff --git a/packages/seacas/libraries/exodus/src/ex_update.c b/packages/seacas/libraries/exodus/src/ex_update.c
index 02e2f8a93003..52b0d9101391 100644
--- a/packages/seacas/libraries/exodus/src/ex_update.c
+++ b/packages/seacas/libraries/exodus/src/ex_update.c
@@ -1,5 +1,5 @@
/*
- * Copyright(C) 1999-2021 National Technology & Engineering Solutions
+ * Copyright(C) 1999-2021, 2024 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.
*
@@ -20,7 +20,7 @@
#include "exodusII.h" // for ex_err, etc
#include "exodusII_int.h" // for EX_FATAL, EX_NOERR
-
+#include
/*!
* \ingroup Utilities
* updates an opened EXODUS file (or EXODUS history file)
@@ -35,6 +35,11 @@ int ex_update(int exoid)
EX_FUNC_LEAVE(EX_FATAL);
}
+#ifndef NDEBUG
+ struct exi_file_item *file = exi_find_file_item(exoid);
+ assert(!file->in_define_mode && file->persist_define_mode == 0);
+#endif
+
int status;
if ((status = nc_sync(exoid)) != NC_NOERR) {
char errmsg[MAX_ERR_LENGTH];
diff --git a/packages/seacas/libraries/exodus/src/ex_utils.c b/packages/seacas/libraries/exodus/src/ex_utils.c
index e23c6007b10f..0c33d625a32f 100644
--- a/packages/seacas/libraries/exodus/src/ex_utils.c
+++ b/packages/seacas/libraries/exodus/src/ex_utils.c
@@ -1777,16 +1777,114 @@ void exi_compress_variable(int exoid, int varid, int type)
\internal
\undoc
*/
-int exi_leavedef(int exoid, const char *call_rout)
+int exi_leavedef(int exoid, const char *call_func)
{
int status;
- if ((status = nc_enddef(exoid)) != NC_NOERR) {
+ struct exi_file_item *file = exi_find_file_item(exoid);
+ if (!file) {
char errmsg[MAX_ERR_LENGTH];
- snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to complete definition for file id %d", exoid);
- ex_err_fn(exoid, call_rout, errmsg, status);
+ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: unknown file id %d for %s called from %s.", exoid,
+ __func__, call_func);
+ ex_err_fn(exoid, __func__, errmsg, EX_BADFILEID);
+ return EX_FATAL;
+ }
- return (EX_FATAL);
+ if (!file->persist_define_mode && file->in_define_mode) {
+ if ((status = nc_enddef(exoid)) != NC_NOERR) {
+ char errmsg[MAX_ERR_LENGTH];
+ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to complete definition for file id %d",
+ exoid);
+ ex_err_fn(exoid, call_func, errmsg, status);
+
+ return (EX_FATAL);
+ }
+ file->in_define_mode = 0;
+ }
+ return (EX_NOERR);
+}
+
+int exi_redef(int exoid, const char *call_func)
+{
+ int status;
+
+ struct exi_file_item *file = exi_find_file_item(exoid);
+
+ if (!file) {
+ char errmsg[MAX_ERR_LENGTH];
+ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: unknown file id %d for %s called from %s.", exoid,
+ __func__, call_func);
+ ex_err_fn(exoid, __func__, errmsg, EX_BADFILEID);
+ return EX_FATAL;
+ }
+
+ if (!file->in_define_mode) {
+ if ((status = nc_redef(exoid)) != NC_NOERR) {
+ char errmsg[MAX_ERR_LENGTH];
+ snprintf(errmsg, MAX_ERR_LENGTH,
+ "ERROR: failed to put file %d into definition mode in exi_redef called from %s",
+ exoid, call_func);
+ ex_err_fn(exoid, __func__, errmsg, status);
+ return EX_FATAL;
+ }
+ file->in_define_mode = 1;
+ }
+ return EX_NOERR;
+}
+
+int exi_persist_redef(int exoid, const char *call_func)
+{
+ int status;
+
+ struct exi_file_item *file = exi_find_file_item(exoid);
+
+ if (!file) {
+ char errmsg[MAX_ERR_LENGTH];
+ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: unknown file id %d for %s called from %s.", exoid,
+ __func__, call_func);
+ ex_err_fn(exoid, __func__, errmsg, EX_BADFILEID);
+ return EX_FATAL;
+ }
+
+ if ((++file->persist_define_mode == 1) && !file->in_define_mode) {
+ if ((status = nc_redef(exoid)) != NC_NOERR) {
+ char errmsg[MAX_ERR_LENGTH];
+ snprintf(
+ errmsg, MAX_ERR_LENGTH,
+ "ERROR: failed to put file %d into definition mode in exi_persist_redef called from %s",
+ exoid, call_func);
+ ex_err_fn(exoid, __func__, errmsg, status);
+ return EX_FATAL;
+ }
+ file->in_define_mode = 1;
+ }
+ return EX_NOERR;
+}
+
+int exi_persist_leavedef(int exoid, const char *call_func)
+{
+ int status;
+
+ struct exi_file_item *file = exi_find_file_item(exoid);
+ if (!file) {
+ char errmsg[MAX_ERR_LENGTH];
+ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: unknown file id %d for %s called from %s.", exoid,
+ __func__, call_func);
+ ex_err_fn(exoid, __func__, errmsg, EX_BADFILEID);
+ return EX_FATAL;
+ }
+
+ if ((file->persist_define_mode-- == 1) && file->in_define_mode) {
+ if ((status = nc_enddef(exoid)) != NC_NOERR) {
+ char errmsg[MAX_ERR_LENGTH];
+ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to complete definition for file id %d",
+ exoid);
+ ex_err_fn(exoid, call_func, errmsg, status);
+
+ return (EX_FATAL);
+ }
+ file->in_define_mode = 0;
+ file->persist_define_mode = 0;
}
return (EX_NOERR);
}
@@ -2090,9 +2188,16 @@ int exi_handle_mode(unsigned int my_mode, int is_parallel, int run_version)
* unless specified differently via environment.
*/
{
- char *option = getenv("EXODUS_VERBOSE");
- if (option != NULL) {
- exoptval = EX_VERBOSE;
+ if (exoptval != EX_VERBOSE) {
+ /* Avoid getenv call if already in verbose mode */
+ char *option = getenv("EXODUS_VERBOSE");
+ if (option != NULL) {
+ exoptval = EX_VERBOSE;
+ if (option[0] != 'q') {
+ fprintf(stderr, "EXODUS: Setting EX_VERBOSE mode since EXODUS_VERBOSE environment "
+ "variable is set.\n");
+ }
+ }
}
ex_opts(exoptval); /* call required to set ncopts first time through */
}
diff --git a/packages/seacas/libraries/exodus/test/CMakeLists.txt b/packages/seacas/libraries/exodus/test/CMakeLists.txt
index fc3596d89435..6b1641c53c77 100644
--- a/packages/seacas/libraries/exodus/test/CMakeLists.txt
+++ b/packages/seacas/libraries/exodus/test/CMakeLists.txt
@@ -168,14 +168,15 @@ IF ( NETCDF_NCDUMP_BINARY )
)
IF (NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
- TRIBITS_ADD_TEST(
- testall
- NOEXEPREFIX
- NOEXESUFFIX
- NAME exodus_unit_tests
- COMM mpi serial
- NUM_MPI_PROCS 1
- )
+
+# TRIBITS_ADD_TEST(
+# testall
+# NOEXEPREFIX
+# NOEXESUFFIX
+# NAME exodus_unit_tests
+# COMM mpi serial
+# NUM_MPI_PROCS 1
+# )
if ( TPL_Netcdf_Enables_Netcdf4 )
TRIBITS_ADD_TEST(
@@ -199,15 +200,15 @@ IF ( NETCDF_NCDUMP_BINARY )
endif()
# if ( TPL_Netcdf_Enables_Netcdf5 )
- TRIBITS_ADD_TEST(
- testall
- NOEXEPREFIX
- NOEXESUFFIX
- NAME exodus_unit_tests_nc5_env
- ARGS netcdf5
- COMM mpi serial
- NUM_MPI_PROCS 1
- )
+# TRIBITS_ADD_TEST(
+# testall
+# NOEXEPREFIX
+# NOEXESUFFIX
+# NAME exodus_unit_tests_nc5_env
+# ARGS netcdf5
+# COMM mpi serial
+# NUM_MPI_PROCS 1
+# )
# endif()
endif()
ELSE()
diff --git a/packages/seacas/libraries/exodus/test/testall.in b/packages/seacas/libraries/exodus/test/testall.in
index 1e28a043b67f..889cf15434a0 100755
--- a/packages/seacas/libraries/exodus/test/testall.in
+++ b/packages/seacas/libraries/exodus/test/testall.in
@@ -357,8 +357,8 @@ echo "begin testwt-field-metadata" >> test.output
${PREFIX} ${BINDIR}/testwt-field-metadata${SUFFIX} >> test.output
ret_status=$((ret_status+$?))
# Filter out the "maximum_name_length" attribute. Moves around in ncdump output for nc4 vs nc3
-#${NCDUMP} -d5,5 test-field-metadata.exo | grep @ |sort | ${DIFF} - ${SRCDIR}/testwt-field-metadata.dmp | tee testwt-field-metadata.res
-#ret_status=$((ret_status+${PIPESTATUS[0]}+${PIPESTATUS[3]}))
+${NCDUMP} -d5,5 test-field-metadata.exo | grep @ |sort | ${DIFF} - ${SRCDIR}/testwt-field-metadata.dmp | tee testwt-field-metadata.res
+ret_status=$((ret_status+${PIPESTATUS[0]}+${PIPESTATUS[3]}))
echo "end testwt-field-metadata, status = $ret_status" >> test.output
# NOTE: netcdf-4 can put attributes in different order, so in that
diff --git a/packages/seacas/libraries/exodus/test/testwt-field-metadata.dmp b/packages/seacas/libraries/exodus/test/testwt-field-metadata.dmp
index 9b9e075aa8b9..37e75ddeb6e9 100644
--- a/packages/seacas/libraries/exodus/test/testwt-field-metadata.dmp
+++ b/packages/seacas/libraries/exodus/test/testwt-field-metadata.dmp
@@ -25,10 +25,8 @@
:Quad@2x2x2@zeta = -0.57735, -0.57735, -0.57735, -0.57735, 0.57735, 0.57735, 0.57735, 0.57735 ;
connect1:Field@Disp@separator = "" ;
connect1:Field@Disp@type = 8 ;
- connect1:Field@Disp@type_name = "" ;
connect1:Field@Velocity@separator = "%" ;
connect1:Field@Velocity@type = 8 ;
- connect1:Field@Velocity@type_name = "" ;
connect2:Field@Curl@separator = "@" ;
connect2:Field@Curl@type = 4 ;
connect2:Field@Curl@type_name = "2x2x2" ;
@@ -42,10 +40,8 @@
connect2:Field@Species@type_name = ",1x2x1" ;
coor_names:Field@Disp@separator = "" ;
coor_names:Field@Disp@type = 8 ;
- coor_names:Field@Disp@type_name = "" ;
coor_names:Field@Velocity@separator = "%" ;
coor_names:Field@Velocity@type = 8 ;
- coor_names:Field@Velocity@type_name = "" ;
"Curl@1",
"Curl@2",
"Curl@3",
diff --git a/packages/seacas/libraries/exodus/test/testwt-field-metadata2.c b/packages/seacas/libraries/exodus/test/testwt-field-metadata2.c
deleted file mode 100644
index ffa23d9513d0..000000000000
--- a/packages/seacas/libraries/exodus/test/testwt-field-metadata2.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright(C) 2022, 2023, 2024 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
- */
-
-#include
-#include
-#include
-#include
-
-#include "exodusII.h"
-
-#define STRINGIFY(x) #x
-#define TOSTRING(x) STRINGIFY(x)
-
-#define EXCHECK(funcall) \
- do { \
- int error = (funcall); \
- printf("after %s, error = %d\n", TOSTRING(funcall), error); \
- if (error != EX_NOERR) { \
- fprintf(stderr, "Error calling %s\n", TOSTRING(funcall)); \
- ex_close(exoid); \
- exit(-1); \
- } \
- } while (0)
-
-int main(int argc, char **argv)
-{
- ex_opts(EX_VERBOSE);
-
- /* Specify compute and i/o word size */
- int CPU_word_size = 8;
- int IO_word_size = 8;
-
- /* create EXODUS II file */
- int exoid = ex_create("test-field-metadata.exo", /* filename path */
- EX_CLOBBER, /* create mode */
- &CPU_word_size, /* CPU double word size in bytes */
- &IO_word_size); /* I/O double word size in bytes */
- printf("after ex_create for test.exo, exoid = %d\n", exoid);
- printf(" cpu word size: %d io word size: %d\n", CPU_word_size, IO_word_size);
-
- int num_elem_blk = 3;
- {
- ex_init_params par = {.num_dim = 3,
- .num_nodes = 1,
- .num_elem = 7,
- .num_elem_blk = num_elem_blk,
- .num_node_sets = 0,
- .num_side_sets = 0,
- .num_assembly = 0};
-
- char *title = "This is a test";
- ex_copy_string(par.title, title, MAX_LINE_LENGTH + 1);
- EXCHECK(ex_put_init_ext(exoid, &par));
- }
-
- double coord[] = {0.0};
- EXCHECK(ex_put_coord(exoid, coord, coord, coord));
-
- /* ======================================================================== */
- /* write element block parameters */
- struct ex_block blocks[num_elem_blk];
- for (int i = 0; i < num_elem_blk; i++) {
- blocks[i] = (ex_block){.type = EX_ELEM_BLOCK, .num_entry = 1, .id = i + 10};
- ex_copy_string(blocks[i].topology, "sphere", MAX_STR_LENGTH + 1);
- blocks[i].num_nodes_per_entry = 1;
- }
-
- EXCHECK(ex_put_block_params(exoid, num_elem_blk, blocks));
-
- int connect[] = {1};
- for (int i = 0; i < num_elem_blk; i++) {
- EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, blocks[i].id, connect, NULL, NULL));
- }
-
- /* Write element block names */
- for (int i = 0; i < num_elem_blk; i++) {
- char block_names[32];
- sprintf(block_names, "block_%c", i + 'A');
- EXCHECK(ex_put_name(exoid, EX_ELEM_BLOCK, blocks[i].id, block_names));
- }
-
- {
- int units[] = {1, 0, 0, -1};
-
- EXCHECK(ex_put_integer_attribute(exoid, EX_ELEM_BLOCK, 11, "Units", 4, units));
- EXCHECK(ex_put_text_attribute(exoid, EX_GLOBAL, 0, "SOLID_MODEL", "STEP-X-43-1547836-Rev 0"));
- }
-
- /* ======================================================================== */
- /* Transient Variables */
- char *var_names[] = {
- "DispX", "DispY", "DispZ", "Velocity%X", "Velocity%Y",
- "Velocity%Z", "Gradient-X$1",
- "Gradient-Y$1", "Gradient-Z$1", "Gradient-X$2", "Gradient-Y$2", "Gradient-Z$2",
- "Gradient-X$3", "Gradient-Y$3", "Gradient-Z$3", "Gradient-X$4", "Gradient-Y$4",
- "Gradient-Z$4", "Gradient-X$5", "Gradient-Y$5", "Gradient-Z$5", "Gradient-X$6",
- "Gradient-Y$6", "Gradient-Z$6", "Gradient-X$7", "Gradient-Y$7", "Gradient-Z$7",
- "Gradient-X$8", "Gradient-Y$8", "Gradient-Z$8", "Gradient-X$9", "Gradient-Y$9", "Gradient-Z$9", "Curl@1", "Curl@2",
- "Curl@3", "Curl@4", "Curl@5", "Curl@6", "Curl@7",
- "Curl@8", "User_h2o", "User_gas", "User_ch4", "User_methane"};
- int num_block_vars = sizeof(var_names) / sizeof(var_names[0]);
- int num_node_vars = 6;
-
- EXCHECK(ex_put_variable_param(exoid, EX_ELEM_BLOCK, num_block_vars));
- EXCHECK(ex_put_variable_names(exoid, EX_ELEM_BLOCK, num_block_vars, var_names));
- EXCHECK(ex_put_variable_param(exoid, EX_NODAL, num_node_vars));
- EXCHECK(ex_put_variable_names(exoid, EX_NODAL, num_node_vars, var_names));
-
- int vname = 0;
- {
- struct ex_field field = (ex_field){.entity_type = EX_ELEM_BLOCK,
- .entity_id = blocks[0].id,
- .name = "Disp",
- .type = {EX_VECTOR_3D},
- .nesting = 1,
- .component_separator[0] = 0};
- EXCHECK(ex_put_field_metadata(exoid, field));
-
- /* Put same field on the nodes... */
- field.entity_type = EX_NODAL;
- EXCHECK(ex_put_field_metadata(exoid, field));
-
- int cardinality =
- field.cardinality[0] != 0 ? field.cardinality[0] : ex_field_cardinality(field.type[0]);
- for (int i = 0; i < cardinality; i++) {
- const char *name = ex_component_field_name(&field, (int[]){i + 1});
- assert(strcmp(var_names[vname++], name) == 0);
- }
- }
-
- {
- struct ex_field field = (ex_field){.entity_type = EX_ELEM_BLOCK,
- .entity_id = blocks[0].id,
- .name = "Velocity",
- .type = {EX_VECTOR_3D},
- .nesting = 1,
- .component_separator[0] = '%'};
- EXCHECK(ex_put_field_metadata(exoid, field));
-
- /* Put same field on the nodes... */
- field.entity_type = EX_NODAL;
- EXCHECK(ex_put_field_metadata(exoid, field));
-
- int cardinality =
- field.cardinality[0] != 0 ? field.cardinality[0] : ex_field_cardinality(field.type[0]);
- for (int i = 0; i < cardinality; i++) {
- const char *name = ex_component_field_name(&field, (int[]){i + 1});
- assert(strcmp(var_names[vname++], name) == 0);
- }
- }
-
- {
- struct ex_field field = (ex_field){.entity_type = EX_ELEM_BLOCK,
- .entity_id = blocks[1].id,
- .name = "Gradient",
- .type = {EX_VECTOR_3D, EX_FIELD_TYPE_SEQUENCE},
- .nesting = 2,
- .cardinality = {0,9},
- .component_separator = {'-', '$'}};
- EXCHECK(ex_put_field_metadata(exoid, field));
-
- struct ex_field field2 = (ex_field){.entity_type = EX_ELEM_BLOCK,
- .entity_id = blocks[1].id,
- .name = "Curl",
- .type = {EX_FIELD_TYPE_SEQUENCE},
- .nesting = 1,
- .cardinality = {9},
- .component_separator = {'@'}};
- EXCHECK(ex_put_field_metadata(exoid, field2));
- }
-
- {
- struct ex_field field = (ex_field){.entity_type = EX_ELEM_BLOCK,
- .entity_id = blocks[1].id,
- .name = "User",
- .type = {EX_FIELD_TYPE_USER_DEFINED},
- .nesting = 1,
- .cardinality = {4},
- .component_separator = {'_'}};
- EXCHECK(ex_put_field_metadata(exoid, field));
- EXCHECK(ex_put_field_suffices(exoid, field, "h2o,gas,ch4,methane"));
- }
-
- { /* Output time steps ... */
- for (int ts = 0; ts < 1; ts++) {
- double time_val = (double)(ts + 1) / 100.0;
-
- EXCHECK(ex_put_time(exoid, ts + 1, &time_val));
-
- /* write variables */
- for (int k = 0; k < num_elem_blk; k++) {
- double *var_vals = (double *)calloc(blocks[k].num_entry, CPU_word_size);
- for (int var_idx = 0; var_idx < num_block_vars; var_idx++) {
- for (int elem = 0; elem < blocks[k].num_entry; elem++) {
- var_vals[elem] = (double)(var_idx + 2) * time_val + elem;
- }
- EXCHECK(ex_put_var(exoid, ts + 1, EX_ELEM_BLOCK, var_idx + 1, blocks[k].id,
- blocks[k].num_entry, var_vals));
- }
- free(var_vals);
- }
- }
- }
-
- /* close the EXODUS files
- */
- EXCHECK(ex_close(exoid));
- return 0;
-}
diff --git a/packages/seacas/libraries/exodus_for/test/testall.in b/packages/seacas/libraries/exodus_for/test/testall.in
index b50717ef20e0..f49dbc9c79c5 100644
--- a/packages/seacas/libraries/exodus_for/test/testall.in
+++ b/packages/seacas/libraries/exodus_for/test/testall.in
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
-# Copyright(C) 1999-2022 National Technology & Engineering Solutions
+# Copyright(C) 1999-2022, 2024 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.
#
@@ -111,7 +111,7 @@ ret_status=$((ret_status+${PIPESTATUS[0]}+${PIPESTATUS[3]}))
# test_nem - nemesis routines
echo "test_nem ..."
${PREFIX} ${BINDIR}/f_test_nem${SUFFIX} | ${DIFF} -w - ${SRCDIR}/test_nem.dmp | tee test_nem.res
-ret_status=$((ret_status+${PIPESTATUS[0]}+${PIPESTATUS[1}))
+ret_status=$((ret_status+${PIPESTATUS[0]}+${PIPESTATUS[1]}))
echo "end test_nem, status = $ret_status" >> test.output
# test partial read/write. Uses 'test.exo' from testwt.
diff --git a/packages/seacas/libraries/ioss/cmake/SEACASIoss_config.h.in b/packages/seacas/libraries/ioss/cmake/SEACASIoss_config.h.in
index 15b62c0beaa2..808f36ece452 100644
--- a/packages/seacas/libraries/ioss/cmake/SEACASIoss_config.h.in
+++ b/packages/seacas/libraries/ioss/cmake/SEACASIoss_config.h.in
@@ -11,6 +11,8 @@
#cmakedefine SEACAS_HAVE_EXODUS
+#cmakedefine SEACAS_HAVE_EXONULL
+
#cmakedefine SEACAS_HAVE_CGNS
#cmakedefine SEACAS_HAVE_PAMGEN
diff --git a/packages/seacas/libraries/ioss/src/CMakeLists.txt b/packages/seacas/libraries/ioss/src/CMakeLists.txt
index ee0779d4fdca..3ab10755d3e3 100644
--- a/packages/seacas/libraries/ioss/src/CMakeLists.txt
+++ b/packages/seacas/libraries/ioss/src/CMakeLists.txt
@@ -28,8 +28,12 @@ ENDIF()
IF (${PACKAGE_NAME}_ENABLE_SEACASExodus)
SET(SEACAS_HAVE_EXODUS ON)
+ IF (ENABLE_ExoNull)
+ SET(SEACAS_HAVE_EXONULL ON)
+ ENDIF()
ENDIF()
+
TRIBITS_CONFIGURE_FILE(${PACKAGE_NAME}_config.h)
SET(HEADERS "")
@@ -111,9 +115,12 @@ endif()
IF (${PACKAGE_NAME}_ENABLE_SEACASExodus)
ADD_SUBDIRECTORY(exodus)
- ADD_SUBDIRECTORY(exonull)
+ IF (ENABLE_ExoNull)
+ ADD_SUBDIRECTORY(exonull)
+ ENDIF()
ENDIF()
+
IF (TPL_ENABLE_Pamgen OR Trilinos_ENABLE_Pamgen )
ADD_SUBDIRECTORY(pamgen)
ENDIF()
diff --git a/packages/seacas/libraries/ioss/src/Ioss_BasisVariableType.C b/packages/seacas/libraries/ioss/src/Ioss_BasisVariableType.C
deleted file mode 100644
index 7515f145e624..000000000000
--- a/packages/seacas/libraries/ioss/src/Ioss_BasisVariableType.C
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright(C) 2024 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
-
-#include "Ioss_BasisVariableType.h"
-#include "Ioss_ComposedVariableType.h"
-#include "Ioss_CompositeVariableType.h"
-#include "Ioss_ConstructedVariableType.h"
-#include "Ioss_NamedSuffixVariableType.h"
-#include "Ioss_QuadratureVariableType.h"
-#include "Ioss_Utils.h"
-#include "Ioss_VariableType.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include