Skip to content

Commit

Permalink
clang-tidy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Apr 10, 2024
1 parent a741dd6 commit a48c3c5
Show file tree
Hide file tree
Showing 14 changed files with 125 additions and 164 deletions.
2 changes: 1 addition & 1 deletion packages/seacas/applications/ejoin/EJ_index_sort.C
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace {

size_t ndx = 0;

using TT = typename std::remove_cv<T>::type;
using TT = typename std::remove_cv_t<T>;
TT small = v[iv[0]];
for (size_t i = 1; i < N; i++) {
if (v[iv[i]] < small) {
Expand Down
62 changes: 25 additions & 37 deletions packages/seacas/applications/nem_slice/elb.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,46 +215,40 @@ template <typename INT> struct Graph_Description
};

/* Various constants */
#define NODAL 0
#define ELEMENTAL 1
enum DecompType { NODAL, ELEMENTAL };

#define UTIL_NAME "nem_slice"

/* Load balance types */
#define MULTIKL 0
#define SPECTRAL 1
#define INERTIAL 2
#define LINEAR 3
#define RANDOM 4
#define SCATTERED 5
#define INFILE 6
#define KL_REFINE 7
#define NO_REFINE 8
#define NUM_SECTS 9
#define CNCT_DOM 10
#define OUTFILE 11
#define ZPINCH 12
#define BRICK 13
#define ZOLTAN_RCB 14
#define ZOLTAN_RIB 15
#define ZOLTAN_HSFC 16
#define IGNORE_Z 17
enum Balance {
MULTIKL,
SPECTRAL,
INERTIAL,
LINEAR,
RANDOM,
SCATTERED,
INFILE,
KL_REFINE,
NO_REFINE,
NUM_SECTS,
CNCT_DOM,
OUTFILE,
ZPINCH,
BRICK,
ZOLTAN_RCB,
ZOLTAN_RIB,
ZOLTAN_HSFC,
IGNORE_Z
};

/* Machine types */
#define MESH 0
#define HCUBE 1
#define HYPERCUBE 2
#define CLUSTER 3
enum MachineType { MESH, HCUBE, HYPERCUBE, CLUSTER };

/* Solver options */
#define TOLER 0
#define USE_RQI 1
#define VMAX 2
enum SolverOptions { TOLER, USE_RQI, VMAX };

/* ISSUES options */

#define LOCAL_ISSUES 0
#define GLOBAL_ISSUES 1
enum Issues { LOCAL_ISSUES, GLOBAL_ISSUES };

/* Weighting options */
/*
Expand All @@ -265,10 +259,4 @@ template <typename INT> struct Graph_Description
* currently used in the type, but are needed since they appear
* on the command line.
*/
#define NO_WEIGHT 0
#define READ_EXO 1
#define EL_BLK 2
#define VAR_INDX 3
#define EDGE_WGT 4
#define TIME_INDX 5
#define VAR_NAME 6
enum WeightingOptions { NO_WEIGHT, READ_EXO, EL_BLK, VAR_INDX, EDGE_WGT, TIME_INDX, VAR_NAME };
38 changes: 19 additions & 19 deletions packages/seacas/applications/nem_slice/elb_elem.h
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down Expand Up @@ -55,37 +55,37 @@ enum E_Type {
extern const char *elem_name_from_enum(E_Type elem_type);

extern E_Type get_elem_type(const char *elem_name, /* ExodusII element name */
const int num_nodes, /* Number of nodes in the element */
const int num_dim /* Number of dimensions of the mesh */
int num_nodes, /* Number of nodes in the element */
int num_dim /* Number of dimensions of the mesh */
);

extern int get_elem_info(const int info, /* The requested information */
const E_Type elem_type /* The element type */
extern int get_elem_info(int info, /* The requested information */
E_Type elem_type /* The element type */
);

template <typename INT>
int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT side_nodes[],
const int skip_check, const int partial_adj);
int get_side_id(E_Type etype, const INT *connect, int nsnodes, INT side_nodes[], int skip_check,
int partial_adj);

template <typename INT>
int get_side_id_hex_tet(const E_Type etype, /* The element type */
const INT *conn, /* The element connectivity */
const int nsnodes, /* The number of side nodes */
const INT side_nodes[] /* The list of side node IDs */
int get_side_id_hex_tet(E_Type etype, /* The element type */
const INT *conn, /* The element connectivity */
int nsnodes, /* The number of side nodes */
const INT side_nodes[] /* The list of side node IDs */
);

template <typename INT>
int ss_to_node_list(const E_Type etype, /* The element type */
const INT *connect, /* The element connectivity */
int side_num, /* The element side number */
INT ss_node_list[] /* The list of side node IDs */
int ss_to_node_list(E_Type etype, /* The element type */
const INT *connect, /* The element connectivity */
int side_num, /* The element side number */
INT ss_node_list[] /* The list of side node IDs */
);

template <typename INT>
int get_ss_mirror(const E_Type etype, /* The element type */
const INT *ss_node_list, /* The list of side node IDs */
int side_num, /* The element side number */
INT mirror_node_list[] /* The list of the mirror side node IDs */
int get_ss_mirror(E_Type etype, /* The element type */
const INT *ss_node_list, /* The list of side node IDs */
int side_num, /* The element side number */
INT mirror_node_list[] /* The list of the mirror side node IDs */
);

/* Define element info requests */
Expand Down
3 changes: 1 addition & 2 deletions packages/seacas/applications/nem_slice/elb_time.C
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/*
* Copyright(C) 1999-2020 National Technology & Engineering Solutions
* Copyright(C) 1999-2020, 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 <chrono> // for duration, etc
#include <ratio> // for ratio
double get_time()
{
static auto start = std::chrono::steady_clock::now();
Expand Down
52 changes: 18 additions & 34 deletions packages/seacas/applications/nem_slice/elb_util.C
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down Expand Up @@ -73,18 +73,12 @@ int token_compare(char *token, const char *key)
/*****************************************************************************/
void strip_string(char inp_str[], const char *tokens)
{
int i;
int j;
int itok;
int ntokes;
int bval;

i = 0;
ntokes = strlen(tokens);
int i = 0;
int ntokes = strlen(tokens);

while (inp_str[i] != '\0') {
bval = 0;
for (itok = 0; itok < ntokes; itok++) {
int bval = 0;
for (int itok = 0; itok < ntokes; itok++) {
if (inp_str[i] == tokens[itok]) {
i++;
bval = 1;
Expand All @@ -97,7 +91,7 @@ void strip_string(char inp_str[], const char *tokens)
}

/* Move real part of string to the front */
j = 0;
int j = 0;
while (inp_str[j + i] != '\0') {
inp_str[j] = inp_str[j + i];
j++;
Expand All @@ -107,8 +101,8 @@ void strip_string(char inp_str[], const char *tokens)

/* Remove trailing tokens */
while (j != -1) {
bval = 0;
for (itok = 0; itok < ntokes; itok++) {
int bval = 0;
for (int itok = 0; itok < ntokes; itok++) {
if (inp_str[j] == tokens[itok]) {
bval = 1;
j--;
Expand All @@ -128,11 +122,8 @@ void strip_string(char inp_str[], const char *tokens)
/*****************************************************************************/
void string_to_lower(char in_string[], char cval)
{
int len;
int cnt;

len = strlen(in_string);
for (cnt = 0; cnt < len; cnt++) {
int len = strlen(in_string);
for (int cnt = 0; cnt < len; cnt++) {
if (in_string[cnt] == cval) {
return;
}
Expand All @@ -148,34 +139,27 @@ void string_to_lower(char in_string[], char cval)
/*****************************************************************************/
void clean_string(char inp_str[], const char *tokens)
{
int i;
int j;
int itok;
int ntokes;
int bval;
int inplen;

ntokes = strlen(tokens);
inplen = strlen(inp_str);

i = 0;
bval = 0;
int ntokes = strlen(tokens);
int inplen = strlen(inp_str);

int i = 0;
int bval = 0;
while (inp_str[i] != '\0') {
for (itok = 0; itok < ntokes; itok++) {
for (int itok = 0; itok < ntokes; itok++) {
if (i < 0) {
i = 0;
}
if (inp_str[i] == tokens[itok]) {
/* Find out if the next character is also a token */
for (j = 0; j < ntokes; j++) {
for (int j = 0; j < ntokes; j++) {
if (inp_str[i + 1] == tokens[j]) {
bval = 1;
break;
}
}

if (bval == 1) {
for (j = i + 1; j < inplen; j++) {
for (int j = i + 1; j < inplen; j++) {
inp_str[j] = inp_str[j + 1];
}

Expand Down
94 changes: 46 additions & 48 deletions packages/seacas/applications/nem_spread/el_elm.h
Original file line number Diff line number Diff line change
@@ -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.
*
Expand All @@ -12,57 +12,55 @@
*/

/* 1-d elements */
#define BAR2 0
#define BAR3 1
#define SHELL2 2
#define SHELL3 3
enum Elements {
BAR2,
BAR3,
SHELL2,
SHELL3,

/* 2-d elements */
#define QUAD4 14
#define QUAD8 18
#define QUAD9 19
#define TRI3 23
#define TRI4 24
#define TRI6 26
#define TRI7 27

/* 3-d elements */
#define HEX8 108
#define HEX16 116
#define HEX20 120
#define HEX27 127
#define TET4 204
#define TET10 210
#define TET8 208
#define TET14 214
#define TET15 215
#define SHELL4 304
#define SHELL8 308
#define SHELL9 309
#define SPHERE 401
#define WEDGE6 506
#define WEDGE12 512
#define WEDGE15 515
#define WEDGE16 516
#define WEDGE20 520
#define WEDGE21 521
#define HEXSHELL 608
#define TSHELL3 703
#define TSHELL4 704
#define TSHELL6 706
#define TSHELL7 707
#define PYRAMID5 805
#define PYRAMID13 813
#define PYRAMID14 814
#define PYRAMID18 818
#define PYRAMID19 819
/* 2-d elements */
QUAD4,
QUAD8,
QUAD9,
TRI3,
TRI4,
TRI6,
TRI7,

/* 3-d elements */
HEX8,
HEX16,
HEX20,
HEX27,
TET4,
TET10,
TET8,
TET14,
TET15,
SHELL4,
SHELL8,
SHELL9,
SPHERE,
WEDGE6,
WEDGE12,
WEDGE15,
WEDGE16,
WEDGE20,
WEDGE21,
HEXSHELL,
TSHELL3,
TSHELL4,
TSHELL6,
TSHELL7,
PYRAMID5,
PYRAMID13,
PYRAMID14,
PYRAMID18,
PYRAMID19
};
/* define element data "request for information" types */

#define NNODES 1
#define NDIM 3
#define NINTERP 5
#define NN_SIDE 6
enum ElementRequest { NNODES = 1, NDIM = 3, NINTERP = 5, NN_SIDE = 6 };

/******************************* PROTOTYPES FOR el_elm_info.c ****************/

Expand Down
Loading

0 comments on commit a48c3c5

Please sign in to comment.