Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/SandiaLabs/seacas
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Aug 26, 2024
2 parents 4bfc9c8 + 0ce8548 commit efdc141
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 56 deletions.
2 changes: 1 addition & 1 deletion packages/seacas/applications/nem_slice/elb.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <string>
#include <vector>

#define ELB_VERSION "5.04 (2024/08/19)"
#define ELB_VERSION "5.02 (2024-08-22)"
#define UTIL_NAME "nem_slice"
#define ELB_FALSE 0
#define ELB_TRUE 1
Expand Down
68 changes: 51 additions & 17 deletions packages/seacas/applications/nem_slice/elb_elem.C
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const char *elem_name_from_enum(const E_Type elem_type)
"TSHELL4", "TSHELL6", "TSHELL7", "HEX8", "HEX16", "HEX20", "HEX27",
"HEXSHELL", "TET4", "TET10", "TET8", "TET14", "TET15", "WEDGE6",
"WEDGE12", "WEDGE15", "WEDGE16", "WEDGE20", "WEDGE21", "PYRAMID5", "PYRAMID13",
"PYRAMID14", "PYRAMID18", "PYRAMID19", "SHELL2", "SHELL3"};
"PYRAMID14", "PYRAMID18", "PYRAMID19", "SHELL2", "SHELL3", "BAR1D2", "BAR1D3"};
return elem_names[elem_type];
}

Expand Down Expand Up @@ -126,8 +126,8 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d
if (strncasecmp(elem_name, "BEAM", 4) == 0 || strncasecmp(elem_name, "TRUSS", 5) == 0 ||
strncasecmp(elem_name, "ROD", 3) == 0 || strncasecmp(elem_name, "BAR", 3) == 0) {
switch (num_nodes) {
case 2: answer = BAR2; break;
case 3: answer = BAR3; break;
case 2: answer = num_dim == 1 ? BAR1D2 : BAR2; break;
case 3: answer = num_dim == 1 ? BAR1D3 : BAR3; break;
default:
Gen_Error(0, "fatal: unsupported BAR/BEAM/TRUSS element");
error_report();
Expand Down Expand Up @@ -323,7 +323,7 @@ int get_elem_info(const int req, const E_Type etype)

switch (etype) /* Switch over the element type */
{
case BAR2:
case BAR1D2:
switch (req) {
case NNODES: answer = 2; break;
case NSIDE_NODES: answer = 1; break;
Expand All @@ -336,6 +336,19 @@ int get_elem_info(const int req, const E_Type etype)
}
break;

case BAR2:
switch (req) {
case NNODES: answer = 2; break;
case NSIDE_NODES: answer = 2; break;
case NSIDES: answer = 1; break;
case NDIM: /* number of physical dimensions */ answer = 1; break;
default:
Gen_Error(0, "fatal: unknown quantity");
error_report();
exit(1);
}
break;

case SHELL2:
switch (req) {
case NNODES: answer = 2; break;
Expand All @@ -362,7 +375,7 @@ int get_elem_info(const int req, const E_Type etype)
}
break;

case BAR3:
case BAR1D3:
switch (req) {
case NNODES: answer = 3; break;
case NSIDE_NODES: answer = 1; break;
Expand All @@ -375,6 +388,19 @@ int get_elem_info(const int req, const E_Type etype)
}
break;

case BAR3:
switch (req) {
case NNODES: answer = 3; break;
case NSIDE_NODES: answer = 2; break;
case NSIDES: answer = 1; break;
case NDIM: /* number of physical dimensions */ answer = 1; break;
default:
Gen_Error(0, "fatal: unknown quantity");
error_report();
exit(1);
}
break;

case SPHERE:
switch (req) {
case NNODES: answer = 1; break;
Expand Down Expand Up @@ -943,8 +969,8 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s

/* Find the side ID */
switch (etype) {
case BAR2:
case BAR3:
case BAR1D2:
case BAR1D3:
/* SIDE 1 */
if (side_nodes[0] == connect[0]) {
return 1;
Expand All @@ -954,6 +980,8 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s
}
break;

case BAR2:
case BAR3:
case SHELL2:
case SHELL3:
/* SIDE 1 */
Expand Down Expand Up @@ -1670,33 +1698,32 @@ 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 shell_bar_table[1][3] = {{1, 2, 3}};
static int bar_table[2][1] = {{1}, {2}};
static int bar_table[1][3] = {{1, 2, 3}};

/* 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)];
}
case BAR1D2:
case BAR1D3:
ss_node_list[0] = connect[side_num];
i = 1;
break;

case BAR2:
case SHELL2:
/* Bar1 has 1 side */
for (i = 0; i < 2; i++) {
ss_node_list[i] = connect[(shell_bar_table[side_num][i] - 1)];
ss_node_list[i] = connect[(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[(shell_bar_table[side_num][i] - 1)];
ss_node_list[i] = connect[(bar_table[side_num][i] - 1)];
}
break;

Expand Down Expand Up @@ -2105,6 +2132,13 @@ int get_ss_mirror(const E_Type etype, /* The element type */

/* Switch over the element type. */
switch (etype) {
case BAR1D2:
case BAR1D3:
// Side is a single node...
mirror_node_list[0] = ss_node_list[0];
i = 1;
break;

case BAR2:
case SHELL2:
for (i = 0; i < 2; i++) {
Expand Down
2 changes: 2 additions & 0 deletions packages/seacas/applications/nem_slice/elb_elem.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ enum E_Type {
PYRAMID19,
SHELL2,
SHELL3,
BAR1D2,
BAR1D3,
NULL_EL
};

Expand Down
51 changes: 13 additions & 38 deletions packages/seacas/applications/nem_slice/elb_loadbal.C
Original file line number Diff line number Diff line change
Expand Up @@ -1589,15 +1589,15 @@ namespace {
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);
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 */
/* a TET10 cannot connect to a HEX */
tflag1 = is_tet(etype);

int nsides = get_elem_info(NSIDES, etype);
Expand All @@ -1612,19 +1612,17 @@ namespace {
* 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).
* 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).
*/

int nnodes = mesh->num_dims;
if (side_cnt < nnodes) {
nnodes = side_cnt;
}
if (nnodes > 1)
nnodes--; /* decrement to find the number of intersections needed */
nnodes--; /* decrement to find the number of intersections needed */

nelem = 0; /* reset this in case no intersections are needed */

Expand All @@ -1633,33 +1631,11 @@ namespace {
* the tet/hex combination
*/

if (!hflag1) { /* not a hex */
if (!hflag1) { /* Not a hex */

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];
}

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;
}
/* ignore degenerate bars */

nhold = nelem;
for (int ncnt2 = 0; ncnt2 < nelem; ncnt2++) {
hold_elem[ncnt2] = hold_elem[pt_list[ncnt2]];
}
}
}
}
else if (!((etype == BAR2 || etype == SHELL2) && side_nodes[0] == side_nodes[1])) {
if (!((etype == BAR2 || etype == SHELL2) && side_nodes[0] == side_nodes[1])) {

size_t nhold = graph->sur_elem[side_nodes[0]].size();
for (size_t ncnt = 0; ncnt < nhold; ncnt++) {
Expand Down Expand Up @@ -1964,7 +1940,6 @@ namespace {
}
} /* End "for(ecnt=0; ecnt < mesh->num_elems; ecnt++)" */
}

time2 = get_time();
fmt::print("Time for elemental categorization: {}s\n", time2 - time1);

Expand Down

0 comments on commit efdc141

Please sign in to comment.