Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEACAS: Test fixes and clang-format #9499

Merged
merged 2 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion packages/seacas/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ alias install-user-include : install-user-include0
install-user-include3
install-user-include4
install-user-include5
install-user-include6 ;
install-user-include6
install-user-include7
install-user-include8 ;

# This rule copies all headers it finds in the include directory of the
# source to the include directory of the install-root.
Expand Down Expand Up @@ -222,6 +224,21 @@ install install-user-include6
: <location>$(install-root)/io_system/include
;


explicit install-user-include7 ;
install install-user-include7
: [ glob $(seacas-root)/libraries/aprepro_lib/*.h ]
: <location>$(install-root)/seacas/include
;


explicit install-user-include8 ;
install install-user-include8
: [ glob $(seacas-root)/libraries/suplib_cpp/fmt/*.h ]
: <location>$(install-root)/io_system/include/fmt
;


explicit install-user-env ;
alias install-user-env : install-user-jamfile
install-user-bin install-user-include install-user-lib ;
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/applications/aprepro/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ TRIBITS_ADD_ADVANCED_TEST(
TRIBITS_ADD_ADVANCED_TEST(
aprepro_command_line_include_test
TEST_0 EXEC aprepro
ARGS -q --info=test-vars.dump --include ${CMAKE_CURRENT_SOURCE_DIR}/test-include.i ${CMAKE_CURRENT_SOURCE_DIR}/test-dump.i
ARGS -q --info=test-include.dump --include ${CMAKE_CURRENT_SOURCE_DIR}/test-include.i ${CMAKE_CURRENT_SOURCE_DIR}/test-dump.i
test-include.out
NOEXEPREFIX NOEXESUFFIX
PASS_ANY
TEST_1 CMND diff ARGS -w
${CMAKE_CURRENT_SOURCE_DIR}/test-dump.gold
${CMAKE_CURRENT_BINARY_DIR}/test-vars.dump
${CMAKE_CURRENT_BINARY_DIR}/test-include.dump
COMM mpi serial
OVERALL_NUM_MPI_PROCS 1
FINAL_PASS_REGULAR_EXPRESSION
Expand Down
12 changes: 6 additions & 6 deletions packages/seacas/applications/epu/epu.C
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@ namespace {
size_t max_nodes = glob_blocks[b].entity_count() * glob_blocks[b].nodesPerElement;
linkage.resize(max_nodes);
attributes.resize(static_cast<size_t>(glob_blocks[b].attributeCount) *
glob_blocks[b].entity_count());
glob_blocks[b].entity_count());

int error = 0;
for (int p = 0; p < part_count; p++) {
Expand Down Expand Up @@ -2008,7 +2008,7 @@ namespace {

// Get attributes list, if it exists
if (blocks[p][b].attributeCount > 0) {
size_t max_attr = blocks[p][b].entity_count() * blocks[p][b].attributeCount;
size_t max_attr = blocks[p][b].entity_count() * blocks[p][b].attributeCount;
local_attr.resize(max_attr);

error = ex_get_attr(id, EX_ELEM_BLOCK, blocks[p][b].id, local_attr.data());
Expand Down Expand Up @@ -2039,8 +2039,8 @@ namespace {
int id_out = ExodusFile::output(); // output file identifier

if (!linkage.empty()) {
error = ex_put_conn(id_out, EX_ELEM_BLOCK, glob_blocks[b].id, linkage.data(), nullptr,
nullptr);
error =
ex_put_conn(id_out, EX_ELEM_BLOCK, glob_blocks[b].id, linkage.data(), nullptr, nullptr);
if (error < 0) {
exodus_error(__LINE__);
}
Expand Down Expand Up @@ -3635,8 +3635,8 @@ namespace {

if (local_mesh[p]
.truthTable[static_cast<int>(vars.objectType)][input_truth_table_loc] > 0) {
int error = ex_get_var(id, time_step + 1, exodus_object_type(vars.objectType), i + 1,
local_sets[p][b].id, entity_count, values.data());
int error = ex_get_var(id, time_step + 1, exodus_object_type(vars.objectType),
i + 1, local_sets[p][b].id, entity_count, values.data());
if (error < 0) {
exodus_error(__LINE__);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/seacas/applications/nas2exo/N2EDataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef INCLUDE_N2EDATATYPES_H_
#define INCLUDE_N2EDATATYPES_H_

#include <exodusII.h>
#include <cstring>
#include <exodusII.h>
#include <string>
#include <tuple>

Expand Down
12 changes: 6 additions & 6 deletions packages/seacas/applications/nas2exo/N2EExoWriter.C
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ namespace ExoModules {
bool result{true};

// Now we write the nodes
size_t num_nodes = this->gridList.size();
double * x = new double[num_nodes];
double * y = new double[num_nodes];
double * z = new double[num_nodes];
size_t num_nodes = this->gridList.size();
double *x = new double[num_nodes];
double *y = new double[num_nodes];
double *z = new double[num_nodes];
for (size_t i = 0; i < num_nodes; i++) {

N2EPoint3D crd = std::get<1>(this->gridList[i]);
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace ExoModules {
std::vector<elementType> thisBlock;
int64_t block = (int)std::get<0>(sect);

int retvalue{0};
int retvalue{0};

for (const elementType &elem : this->elementList) {

Expand Down Expand Up @@ -193,7 +193,7 @@ namespace ExoModules {

for (const elementType &elem : thisBlock) {

const N2EModules::N2EGridPtList &pts{std::get<3>(elem)};
const N2EModules::N2EGridPtList &pts{std::get<3>(elem)};
std::copy(pts.v, pts.v + nodes_per_elem, elemCon.data() + numNodesCopied);
numNodesCopied += nodes_per_elem;
}
Expand Down
34 changes: 17 additions & 17 deletions packages/seacas/applications/nem_slice/elb_loadbal.C
Original file line number Diff line number Diff line change
Expand Up @@ -616,23 +616,23 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem,
}
}
else {
tmp_nv = problem->num_vertices;
if (!graph->start.empty()) {
tmp_start = &graph->start[0];
}
if (!graph->adj.empty()) {
tmp_adj = &graph->adj[0];
}
if (!weight->vertices.empty()) {
tmp_vwgts = &weight->vertices[0];
}
if (!weight->edges.empty()) {
tmp_ewgts = &weight->edges[0];
}
tmp_x = x_ptr;
tmp_y = y_ptr;
tmp_z = z_ptr;
tmp_v2p = lb->vertex2proc;
tmp_nv = problem->num_vertices;
if (!graph->start.empty()) {
tmp_start = &graph->start[0];
}
if (!graph->adj.empty()) {
tmp_adj = &graph->adj[0];
}
if (!weight->vertices.empty()) {
tmp_vwgts = &weight->vertices[0];
}
if (!weight->edges.empty()) {
tmp_ewgts = &weight->edges[0];
}
tmp_x = x_ptr;
tmp_y = y_ptr;
tmp_z = z_ptr;
tmp_v2p = lb->vertex2proc;

for (int cnt = 0; cnt < machine->num_dims; cnt++) {
tmpdim[cnt] = machine->dim[cnt];
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/applications/zellij/Cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ enum class Loc { C = 0, BL, B, BR, L, R, TL, T, TR };
class Cell
{
public:
Cell() = default;
Cell(const Cell&) = default;
Cell() = default;
Cell(const Cell &) = default;

std::pair<double, double> get_coordinate_range(enum Axis) const;
void initialize(size_t i, size_t j, std::shared_ptr<UnitCell> unit_cell);
Expand Down
1 change: 0 additions & 1 deletion packages/seacas/applications/zellij/Decompose.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

extern unsigned int debug_level;


namespace {
#ifdef USE_ZOLTAN
#define STRINGIFY(x) #x
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/applications/zellij/UnitCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ struct GeneratedSideBlock
//!
//! Note that the `element_offset` is the 1-based index of the
//! element within the element block that it is a member of
GeneratedSideBlock() = default;
GeneratedSideBlock(const GeneratedSideBlock&) = delete;
GeneratedSideBlock() = default;
GeneratedSideBlock(const GeneratedSideBlock &) = delete;

std::map<std::string, std::vector<int64_t>> m_faces;

Expand Down
3 changes: 2 additions & 1 deletion packages/seacas/applications/zellij/ZE_SystemInterface.C
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ void SystemInterface::enroll_options()
"\t\t 16 = Put exodus library into verbose mode.\n"
"\t\t 32 = Verbose decomposition information.\n"
"\t\t 64 = Verbose output database summary information.\n"
"\t\t 128 = Verbose sideset generation information.", "0");
"\t\t 128 = Verbose sideset generation information.",
"0");

options_.enroll("copyright", Ioss::GetLongOption::NoValue, "Show copyright and license data.",
nullptr);
Expand Down
62 changes: 30 additions & 32 deletions packages/seacas/libraries/aprepro_lib/apr_aprepro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,24 @@

namespace {
const unsigned int HASHSIZE = 5939;
const char * version_string = "5.27 (2021/07/20)";
const char * version_string = "5.29 (2021/07/22";

void output_copyright();

std::string get_value(const std::string &option, const std::string &optional_value)
{
size_t index = option.find_first_of('=');
std::string value;

if (index != std::string::npos) {
value = option.substr(index + 1);
}
else {
value = optional_value;
}
return value;
}

unsigned hash_symbol(const char *symbol)
{
unsigned hashval;
Expand Down Expand Up @@ -56,8 +70,8 @@ namespace SEAMS {
outputStream.top()->flush();
}

// May need to delete this if set via --info=file, but need a way to determine this.
// For now, flush so all data written and leave as is.
// May need to delete this if set via --info=filename command.
// May need a flag to determine this...
infoStream->flush();

if ((stringScanner != nullptr) && stringScanner != lexer) {
Expand Down Expand Up @@ -448,28 +462,17 @@ namespace SEAMS {
ap_options.end_on_exit = true;
}
else if (option.find("--info") != std::string::npos) {
std::string value;

size_t index = option.find_first_of('=');
if (index != std::string::npos) {
value = option.substr(index + 1);
auto info = open_file(value, "w");
if (info != nullptr) {
set_error_streams(nullptr, nullptr, info);
}
std::string value = get_value(option, optional_value);
ret_value = value == optional_value ? 1 : 0;

auto info = open_file(value, "w");
if (info != nullptr) {
set_error_streams(nullptr, nullptr, info);
}
}
else if (option.find("--include") != std::string::npos || (option[1] == 'I')) {
std::string value;

size_t index = option.find_first_of('=');
if (index != std::string::npos) {
value = option.substr(index + 1);
}
else {
value = optional_value;
ret_value = 1;
}
std::string value = get_value(option, optional_value);
ret_value = value == optional_value ? 1 : 0;

if (is_directory(value)) {
ap_options.include_path = value;
Expand All @@ -489,14 +492,8 @@ namespace SEAMS {
comment = option.substr(2);
}
else {
size_t index = option.find_first_of('=');
if (index != std::string::npos) {
comment = option.substr(index + 1);
}
else {
comment = optional_value;
ret_value = 1;
}
comment = get_value(option, optional_value);
ret_value = comment == optional_value ? 1 : 0;
}
symrec *ptr = getsym("_C_");
if (ptr != nullptr) {
Expand All @@ -516,7 +513,7 @@ namespace SEAMS {
"encountered\n"
<< " --errors_and_warnings_fatal or -F: Exit program with nonzero status if "
"warnings are encountered\n"
<< "--require_defined or -R: Tread undefined variable warnings as fatal\n"
<< "--require_defined or -R: Treat undefined variable warnings as fatal\n"
<< "--one_based_index or -1: Array indexing is one-based (default = zero-based)\n"
<< " --interactive or -i: Interactive use, no buffering \n"
<< " --include=P or -I=P: Include file or include path \n"
Expand All @@ -527,8 +524,9 @@ namespace SEAMS {
<< " --exit_on or -e: End when 'Exit|EXIT|exit' entered \n"
<< " --help or -h: Print this list \n"
<< " --message or -M: Print INFO messages \n"
<< " --info=file: Output INFO messages (e.g. DUMP() output) to file.\n"
<< " --nowarning or -W: Do not print WARN messages \n"
<< " --comment=char or -c=char: Change comment character to 'char' \n"
<< " --comment=char or -c=char: Change comment character to 'char' \n"
<< " --copyright or -C: Print copyright message \n"
<< " --keep_history or -k: Keep a history of aprepro substitutions.\n"
<< " (not for general interactive use) \n"
Expand Down
25 changes: 14 additions & 11 deletions packages/seacas/libraries/aprepro_lib/apr_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ namespace SEAMS {
* (0.0 -> rows-1) (0.0 -> cols-1)
*/

if (aprepro->ap_options.one_based_index) {
row--;
col--;
}
int cols = arr->cols;
int rows = arr->rows;

int irl = row;
int irh = irl + 1;
int irh = rows > 1 ? irl + 1 : irl;
int icl = col;
int ich = icl + 1;

int cols = arr->cols;
int rows = arr->rows;
int ich = cols > 1 ? icl + 1 : icl;

double value = 0.0;

Expand All @@ -38,8 +33,16 @@ namespace SEAMS {
double v21 = arr->data[irh * cols + icl];
double v12 = arr->data[irl * cols + ich];
double v22 = arr->data[irh * cols + ich];
value = v11 * (irh - row) * (ich - col) + v21 * (row - irl) * (ich - col) +
v12 * (irh - row) * (col - icl) + v22 * (row - irl) * (col - icl);
if (rows > 1 && cols > 1) {
value = (v11 * (irh - row) + v21 * (row - irl)) * (ich - col) +
(v12 * (irh - row) * v22 * (row - irl)) * (col - icl);
}
else if (rows > 1 && cols == 1) {
value = v11 * (irh - row) + v21 * (row - irl);
}
else if (cols > 1 && rows == 1) {
value = v11 * (ich - col) + v12 * (col - icl);
}
}
else {
aprepro->error("Row or Column index out of range");
Expand Down
27 changes: 13 additions & 14 deletions packages/seacas/libraries/exodus/src/ex_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,19 @@ int ex_open_int(const char *path, int mode, int *comp_ws, int *io_ws, float *ver
#endif
}
else if (type == 1) {
/* Possibly an issue with an older file created by a Java-based NetCDF library which wrote
* corrupted data which is now being checked by newer releases of the NetCDF library...
* SEE: https://github.com/Unidata/netcdf-c/issues/1115
*/
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to open '%s' of type %d for reading.\n"
"\t\tIf this is an old file, it is possible that it has some internal corruption\n"
"\t\tthat is now being checked by recent versions of the NetCDF library.\n"
"\t\tTo fix, you can find an older version of `nccopy` (prior to 4.6.0)\n"
"\t\tthen try `nccopy bad_file.g fixed_file.g`.",
path, type);
ex_err(__func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);

/* Possibly an issue with an older file created by a Java-based NetCDF library which wrote
* corrupted data which is now being checked by newer releases of the NetCDF library...
* SEE: https://github.com/Unidata/netcdf-c/issues/1115
*/
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to open '%s' of type %d for reading.\n"
"\t\tIf this is an old file, it is possible that it has some internal corruption\n"
"\t\tthat is now being checked by recent versions of the NetCDF library.\n"
"\t\tTo fix, you can find an older version of `nccopy` (prior to 4.6.0)\n"
"\t\tthen try `nccopy bad_file.g fixed_file.g`.",
path, type);
ex_err(__func__, errmsg, status);
EX_FUNC_LEAVE(EX_FATAL);
}
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to open %s of type %d for reading. Either "
Expand Down
Loading