Skip to content

Commit

Permalink
NEM_SLICE: Remove a template array which was not needed to be a template
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Jan 25, 2024
1 parent 73ef739 commit 9cad5d7
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 52 deletions.
12 changes: 6 additions & 6 deletions packages/seacas/applications/nem_slice/elb.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <string>
#include <vector>

#define ELB_VERSION "4.19"
#define ELB_VERSION "4.20"
#define UTIL_NAME "nem_slice"
#define ELB_FALSE 0
#define ELB_TRUE 1
Expand Down Expand Up @@ -141,7 +141,7 @@ struct Solver_Description

/* Structure used to store information about the weighting scheme, if
* any, that is to be used. */
template <typename INT> struct Weight_Description
struct Weight_Description
{
int type{-1}; /* See weight type below for possible types */
int ow_read{0}; /* 1 if element block settings overwrite exodus file read */
Expand All @@ -156,16 +156,16 @@ template <typename INT> struct Weight_Description
int nvals{0};

/* vectors to hold element block weights */
std::vector<INT> elemblk{}; /* Id of element block */
std::vector<INT> elemblk_wgt{}; /* Weight of that element block */
std::vector<int> elemblk{}; /* Id of element block */
std::vector<int> elemblk_wgt{}; /* Weight of that element block */

/* vector to indicate if weight value has already been overwritten */
std::vector<INT> ow{};
std::vector<int> ow{};

std::vector<int> vertices{};
std::vector<float> edges{};

Weight_Description<INT>() = default;
Weight_Description() = default;
};

/* Structure used to store information about the FEM mesh */
Expand Down
7 changes: 4 additions & 3 deletions packages/seacas/applications/nem_slice/elb_exo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
/* Function prototypes */
template <typename INT>
int read_exo_weights(Problem_Description *prob, /* Pointer to problem info structure */
Weight_Description<INT> *weight); /* Pointer to weight info structure */
Weight_Description *weight, /* Pointer to weight info structure */
INT dummy);

template <typename INT>
int read_mesh_params(const std::string &exo_file, /* Name of ExodusII geometry file */
Expand All @@ -24,9 +25,9 @@ template <typename INT>
int read_mesh(const std::string &exo_file, /* Name of ExodusII geometry file */
Problem_Description *problem, /* Problem information */
Mesh_Description<INT> *mesh, /* Mesh information structure */
Weight_Description<INT> *weight); /* Weight specification structure */
Weight_Description *weight); /* Weight specification structure */

template <typename INT>
int init_weight_struct(Problem_Description *problem, /* Problem information */
Mesh_Description<INT> *mesh, /* Mesh information structure */
Weight_Description<INT> *weight); /* Weight specification structure */
Weight_Description *weight); /* Weight specification structure */
20 changes: 10 additions & 10 deletions packages/seacas/applications/nem_slice/elb_exo_util.C
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <string>
#include <vector>

#include "elb.h" // for Weight_Description<INT>, etc
#include "elb.h" // for Weight_Description, etc
#include "elb_elem.h" // for get_elem_type, E_Type, etc
#include "elb_err.h" // for Gen_Error, MAX_ERR_MSG
#include "elb_exo.h"
Expand All @@ -34,11 +34,11 @@
* This function reads the nodal or elemental values from an ExodusII file
* which will be used by Chaco for weighting of the graph.
*****************************************************************************/
template int read_exo_weights(Problem_Description *prob, Weight_Description<int> *weight);
template int read_exo_weights(Problem_Description *prob, Weight_Description<int64_t> *weight);
template int read_exo_weights(Problem_Description *prob, Weight_Description *weight, int dummy);
template int read_exo_weights(Problem_Description *prob, Weight_Description *weight, int64_t dummy);

template <typename INT>
int read_exo_weights(Problem_Description *prob, Weight_Description<INT> *weight)
int read_exo_weights(Problem_Description *prob, Weight_Description *weight, INT /*dummy*/)
{
int exoid;
/*---------------------------Execution Begins--------------------------------*/
Expand Down Expand Up @@ -276,13 +276,13 @@ int read_mesh_params(const std::string &exo_file, Problem_Description *problem,
* This function reads in the finite element mesh.
*****************************************************************************/
template int read_mesh(const std::string &exo_file, Problem_Description *problem,
Mesh_Description<int> *mesh, Weight_Description<int> *weight);
Mesh_Description<int> *mesh, Weight_Description *weight);
template int read_mesh(const std::string &exo_file, Problem_Description *problem,
Mesh_Description<int64_t> *mesh, Weight_Description<int64_t> *weight);
Mesh_Description<int64_t> *mesh, Weight_Description *weight);

template <typename INT>
int read_mesh(const std::string &exo_file, Problem_Description *problem,
Mesh_Description<INT> *mesh, Weight_Description<INT> *weight)
Mesh_Description<INT> *mesh, Weight_Description *weight)
{
float version;
float *xptr;
Expand Down Expand Up @@ -451,13 +451,13 @@ int read_mesh(const std::string &exo_file, Problem_Description *problem,
* This function initializes the weight structure given the current mesh.
*****************************************************************************/
template int init_weight_struct(Problem_Description *problem, Mesh_Description<int> *mesh,
Weight_Description<int> *weight);
Weight_Description *weight);
template int init_weight_struct(Problem_Description *problem, Mesh_Description<int64_t> *mesh,
Weight_Description<int64_t> *weight);
Weight_Description *weight);

template <typename INT>
int init_weight_struct(Problem_Description *problem, Mesh_Description<INT> *mesh,
Weight_Description<INT> *weight)
Weight_Description *weight)
{
if (problem->type == NODAL) {
weight->nvals = mesh->num_nodes;
Expand Down
10 changes: 5 additions & 5 deletions packages/seacas/applications/nem_slice/elb_graph.C
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace {

template <typename INT>
int find_adjacency(Problem_Description * /*problem*/, Mesh_Description<INT> * /*mesh*/,
Graph_Description<INT> * /*graph*/, Weight_Description<INT> * /*weight*/,
Graph_Description<INT> * /*graph*/, Weight_Description * /*weight*/,
Sphere_Info * /*sphere*/);
} // namespace
/*****************************************************************************/
Expand All @@ -44,16 +44,16 @@ namespace {
* This function does the work to generate the graph from the FE mesh.
*****************************************************************************/
template int generate_graph(Problem_Description *problem, Mesh_Description<int> *mesh,
Graph_Description<int> *graph, Weight_Description<int> *weight,
Graph_Description<int> *graph, Weight_Description *weight,
Sphere_Info *sphere);

template int generate_graph(Problem_Description *problem, Mesh_Description<int64_t> *mesh,
Graph_Description<int64_t> *graph, Weight_Description<int64_t> *weight,
Graph_Description<int64_t> *graph, Weight_Description *weight,
Sphere_Info *sphere);

template <typename INT>
int generate_graph(Problem_Description *problem, Mesh_Description<INT> *mesh,
Graph_Description<INT> *graph, Weight_Description<INT> *weight,
Graph_Description<INT> *graph, Weight_Description *weight,
Sphere_Info *sphere)
{
double time1 = get_time();
Expand Down Expand Up @@ -180,7 +180,7 @@ namespace {
*****************************************************************************/
template <typename INT>
int find_adjacency(Problem_Description *problem, Mesh_Description<INT> *mesh,
Graph_Description<INT> *graph, Weight_Description<INT> *weight,
Graph_Description<INT> *graph, Weight_Description *weight,
Sphere_Info *sphere)
{
std::vector<INT> pt_list;
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/applications/nem_slice/elb_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ struct Problem_Description;
struct Sphere_Info;
template <typename INT> struct Graph_Description;
template <typename INT> struct Mesh_Description;
template <typename INT> struct Weight_Description;
struct Weight_Description;

template <typename INT>
int generate_graph(Problem_Description *problem, /* Pointer to structure containing information
* about the type of decomposition */
Mesh_Description<INT> *mesh, /* Pointer to structure containing the mesh */
Graph_Description<INT> *graph, /* Pointer to structure in which to store
* the graph. */
Weight_Description<INT> *weight, /* Pointer to structure for graph weighting */
Weight_Description *weight, /* Pointer to structure for graph weighting */
Sphere_Info *sphere /* Pointer to sphere adjustment structure */
);
18 changes: 9 additions & 9 deletions packages/seacas/applications/nem_slice/elb_inp.C
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ template int cmd_line_arg_parse(int argc, char *argv[], std::string &exoII_inp_f
std::string &ascii_inp_file, std::string &nemI_out_file,
Machine_Description *machine, LB_Description<int> *lb,
Problem_Description *prob, Solver_Description *solver,
Weight_Description<int> *weight);
Weight_Description *weight);

template int cmd_line_arg_parse(int argc, char *argv[], std::string &exoII_inp_file,
std::string &ascii_inp_file, std::string &nemI_out_file,
Machine_Description *machine, LB_Description<int64_t> *lb,
Problem_Description *prob, Solver_Description *solver,
Weight_Description<int64_t> *weight);
Weight_Description *weight);

template <typename INT>
int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by main() */
Expand All @@ -77,7 +77,7 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passe
LB_Description<INT> *lb, /* Structure for load balance description */
Problem_Description *prob, /* Structure for various problem params */
Solver_Description *solver, /* Structure for eigen solver params */
Weight_Description<INT> *weight /* Structure for weighting graph */
Weight_Description *weight /* Structure for weighting graph */
)
{
int opt_let;
Expand Down Expand Up @@ -633,17 +633,17 @@ value\n");
template int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file,
std::string &nemI_out_file, Machine_Description *machine,
LB_Description<int> *lb, Problem_Description *problem,
Solver_Description *solver, Weight_Description<int> *weight);
Solver_Description *solver, Weight_Description *weight);
template int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file,
std::string &nemI_out_file, Machine_Description *machine,
LB_Description<int64_t> *lb, Problem_Description *problem,
Solver_Description *solver, Weight_Description<int64_t> *weight);
Solver_Description *solver, Weight_Description *weight);

template <typename INT>
int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file,
std::string &nemI_out_file, Machine_Description *machine, LB_Description<INT> *lb,
Problem_Description *problem, Solver_Description *solver,
Weight_Description<INT> *weight)
Weight_Description *weight)
{
FILE *inp_fd;
std::string ctemp;
Expand Down Expand Up @@ -1301,18 +1301,18 @@ int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file,
template int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file,
Machine_Description *machine, LB_Description<int> *lb,
Problem_Description *prob, Solver_Description *solver,
Weight_Description<int> *weight);
Weight_Description *weight);

template int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file,
Machine_Description *machine, LB_Description<int64_t> *lb,
Problem_Description *prob, Solver_Description *solver,
Weight_Description<int64_t> *weight);
Weight_Description *weight);

template <typename INT>
int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file,
Machine_Description *machine, LB_Description<INT> *lb,
Problem_Description *prob, Solver_Description *solver,
Weight_Description<INT> *weight)
Weight_Description *weight)
{
/* Check that an input ExodusII file name was specified */
if (exoII_inp_file.empty()) {
Expand Down
8 changes: 4 additions & 4 deletions packages/seacas/applications/nem_slice/elb_inp.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Machine_Description;
struct Problem_Description;
struct Solver_Description;
template <typename INT> struct LB_Description;
template <typename INT> struct Weight_Description;
struct Weight_Description;

/* Prototype for command-line parsing function */
template <typename INT>
Expand All @@ -30,7 +30,7 @@ int cmd_line_arg_parse(
* information about the run */
Solver_Description *solver, /* Pointer to structure in which to place parameters
* for the eigensolver */
Weight_Description<INT> *weight /* Pointer to structure in which to place parameters
Weight_Description *weight /* Pointer to structure in which to place parameters
* for the graph weighting scheme */
);

Expand All @@ -47,7 +47,7 @@ int read_cmd_file(std::string &ascii_inp_file, /* The ASCII input file n
* information about the run */
Solver_Description *solver, /* Pointer to structure in which to place parameters
* for the eigensolver */
Weight_Description<INT> *weight /* Pointer to structure in which to place
Weight_Description *weight /* Pointer to structure in which to place
* parameters for the eigensolver */
);

Expand All @@ -63,7 +63,7 @@ int check_inp_specs(std::string &exoII_inp_file, /* The ExodusII input F
* information about the run */
Solver_Description *solver, /* Pointer to structure in which to place parameters
* for the eigensolver */
Weight_Description<INT> *weight /* Pointer to structure in which to place
Weight_Description *weight /* Pointer to structure in which to place
* parameters for the weighting scheme */
);

Expand Down
6 changes: 3 additions & 3 deletions packages/seacas/applications/nem_slice/elb_loadbal.C
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ namespace {
template int generate_loadbal(Machine_Description *machine, Problem_Description *problem,
Mesh_Description<int> *mesh, LB_Description<int> *lb,
Solver_Description *solve, Graph_Description<int> *graph,
Weight_Description<int> *weight, Sphere_Info *sphere, int argc,
Weight_Description *weight, Sphere_Info *sphere, int argc,
char *argv[]);
template int generate_loadbal(Machine_Description *machine, Problem_Description *problem,
Mesh_Description<int64_t> *mesh, LB_Description<int64_t> *lb,
Solver_Description *solve, Graph_Description<int64_t> *graph,
Weight_Description<int64_t> *weight, Sphere_Info *sphere, int argc,
Weight_Description *weight, Sphere_Info *sphere, int argc,
char *argv[]);

/* Variables used in Chaco */
Expand All @@ -123,7 +123,7 @@ template <typename INT>
int generate_loadbal(Machine_Description *machine, Problem_Description *problem,
Mesh_Description<INT> *mesh, LB_Description<INT> *lb,
Solver_Description *solve, Graph_Description<INT> *graph,
Weight_Description<INT> *weight, Sphere_Info *sphere, int argc, char *argv[])
Weight_Description *weight, Sphere_Info *sphere, int argc, char *argv[])
{
const char *assignfile = nullptr;

Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/applications/nem_slice/elb_loadbal.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ struct Sphere_Info;
template <typename INT> struct Graph_Description;
template <typename INT> struct LB_Description;
template <typename INT> struct Mesh_Description;
template <typename INT> struct Weight_Description;
struct Weight_Description;

template <typename INT>
int generate_loadbal(Machine_Description *machine, Problem_Description *problem,
Mesh_Description<INT> *mesh, LB_Description<INT> *lb,
Solver_Description *solve, Graph_Description<INT> *graph,
Weight_Description<INT> *weight, Sphere_Info *sphere, int argc, char *argv[]);
Weight_Description *weight, Sphere_Info *sphere, int argc, char *argv[]);

template <typename INT>
int generate_maps(Machine_Description *machine, Problem_Description *problem,
Expand Down
8 changes: 4 additions & 4 deletions packages/seacas/applications/nem_slice/elb_main.C
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace {
template <typename INT>
void print_input(Machine_Description * /*machine*/, LB_Description<INT> * /*lb*/,
Problem_Description * /*prob*/, Solver_Description * /*solver*/,
Weight_Description<INT> * /*weight*/);
Weight_Description * /*weight*/);
} // namespace

/*****************************************************************************/
Expand Down Expand Up @@ -174,7 +174,7 @@ template <typename INT> int internal_main(int argc, char *argv[], INT /* dummy *
LB_Description<INT> lb;
Problem_Description problem;
Solver_Description solver;
Weight_Description<INT> weight;
Weight_Description weight;
Mesh_Description<INT> mesh;
Sphere_Info sphere;
Graph_Description<INT> graph;
Expand Down Expand Up @@ -266,7 +266,7 @@ template <typename INT> int internal_main(int argc, char *argv[], INT /* dummy *
/* If desired, read in the weighting factors from the ExodusII file */
if (weight.type & READ_EXO) {
time1 = get_time();
if (!read_exo_weights(&problem, &weight)) {
if (!read_exo_weights(&problem, &weight, (INT)0)) {
fmt::print(stderr, "Error during read of ExodusII weights\n");
error_report();
exit(1);
Expand Down Expand Up @@ -515,7 +515,7 @@ template <typename INT> int internal_main(int argc, char *argv[], INT /* dummy *
namespace {
template <typename INT>
void print_input(Machine_Description *machine, LB_Description<INT> *lb, Problem_Description *prob,
Solver_Description *solver, Weight_Description<INT> *weight)
Solver_Description *solver, Weight_Description *weight)
{
fmt::print("{} version {}\n", UTIL_NAME, ELB_VERSION);

Expand Down
Loading

0 comments on commit 9cad5d7

Please sign in to comment.