Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 20, 2024
1 parent be6f7ef commit 45a20cc
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 82 deletions.
72 changes: 36 additions & 36 deletions packages/seacas/applications/exodiff/exo_read.C
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,46 @@ namespace {
template <typename INT> Exo_Read<INT>::Exo_Read(std::string fname) : file_name(std::move(fname))
{
if (!file_name.empty()) {
int ws = 0, comp_ws = 8;
float dumb = 0.0;
int mode = EX_READ;
if (sizeof(INT) == 8) {
mode |= EX_ALL_INT64_API;
}
auto old_opt = ex_opts(EX_VERBOSE);
int err = ex_open(file_name.c_str(), mode, &comp_ws, &ws, &dumb);
ex_opts(old_opt);
if (err < 0) {
std::ostringstream oss;
fmt::print(oss, "Couldn't open file \"{}\".", file_name);

// ExodusII library could not open file. See if a file (exodusII
// or not) exists with the specified name.
FILE *fid = fopen(file_name.c_str(), "r");
if (fid != nullptr) {
fmt::print(oss, " File exists, but library could not open.");
fclose(fid);
}
else {
fmt::print(oss, " File does not exist.");
int ws = 0, comp_ws = 8;
float dumb = 0.0;
int mode = EX_READ;
if (sizeof(INT) == 8) {
mode |= EX_ALL_INT64_API;
}
auto old_opt = ex_opts(EX_VERBOSE);
int err = ex_open(file_name.c_str(), mode, &comp_ws, &ws, &dumb);
ex_opts(old_opt);
if (err < 0) {
std::ostringstream oss;
fmt::print(oss, "Couldn't open file \"{}\".", file_name);

// ExodusII library could not open file. See if a file (exodusII
// or not) exists with the specified name.
FILE *fid = fopen(file_name.c_str(), "r");
if (fid != nullptr) {
fmt::print(oss, " File exists, but library could not open.");
fclose(fid);
}
else {
fmt::print(oss, " File does not exist.");
}
throw std::runtime_error(oss.str());
}
throw std::runtime_error(oss.str());
}
file_id = err;
io_word_size = ws;
file_id = err;
io_word_size = ws;

// See if file contains change sets... If it does, open the first child change set (assumes all
// valid data are in change sets...)
num_change_sets = ex_inquire_int(file_id, EX_INQ_NUM_CHILD_GROUPS);
if (num_change_sets > 0) {
change_set_ids.resize(num_change_sets);
ex_get_group_ids(file_id, nullptr, change_set_ids.data());
// See if file contains change sets... If it does, open the first child change set (assumes all
// valid data are in change sets...)
num_change_sets = ex_inquire_int(file_id, EX_INQ_NUM_CHILD_GROUPS);
if (num_change_sets > 0) {
change_set_ids.resize(num_change_sets);
ex_get_group_ids(file_id, nullptr, change_set_ids.data());

query_change_sets(file_id, change_set_names, false);
query_change_sets(file_id, change_set_names, false);

// current_change_set_index = 0;
// file_id = change_set_ids[current_change_set_index];
}
// current_change_set_index = 0;
// file_id = change_set_ids[current_change_set_index];
}
}
}

Expand Down
94 changes: 48 additions & 46 deletions packages/seacas/applications/exodiff/exodiff.C
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,16 @@ namespace {
auto N = get_number(cs_name);
if (N < 0) {
if (no_case_equals(cs_name, "root") || no_case_equals(cs_name, "/")) {
return 0;
return 0;
}
for (size_t i = 0; i < cs_names.size(); i++) {
if (no_case_equals(cs_name, cs_names[i])) {
return (int)i + 1;
}
if (no_case_equals(cs_name, cs_names[i])) {
return (int)i + 1;
}
}
Error(fmt::format(
"Could not find a match for the change set named {}.\nValid change set names are: {}\n",
cs_name, fmt::join(cs_names, ", ")));
"Could not find a match for the change set named {}.\nValid change set names are: {}\n",
cs_name, fmt::join(cs_names, ", ")));
}
return N;
}
Expand Down Expand Up @@ -304,27 +304,27 @@ namespace {
// At least one file has change sets...
if (change_set_spec.empty()) {
if (cs_cnt_1 != cs_cnt_2) {
if (!interFace.summary_flag) {
if (cs_cnt_1 == 0 || cs_cnt_2 == 0) {
if (cs_cnt_1 == 0) {
Warning(fmt::format(
"Change set count mismatch file1 does not have change sets, file2 has {}.\n"
" Will compare file1 with the first change set in file2.\n",
cs_cnt_2));
if (!interFace.summary_flag) {
if (cs_cnt_1 == 0 || cs_cnt_2 == 0) {
if (cs_cnt_1 == 0) {
Warning(fmt::format(
"Change set count mismatch file1 does not have change sets, file2 has {}.\n"
" Will compare file1 with the first change set in file2.\n",
cs_cnt_2));
}
else {
Warning(fmt::format(
"Change set count mismatch file2 does not have change sets, file1 has {}.\n"
" Will compare file2 with the first change set in file1.\n",
cs_cnt_1));
}
}
else {
Warning(fmt::format(
"Change set count mismatch file2 does not have change sets, file1 has {}.\n"
" Will compare file2 with the first change set in file1.\n",
cs_cnt_1));
Warning(fmt::format("Change set count mismatch file1 has {}, file2 has {}.\n"
" Will compare the first {} change sets only.\n",
cs_cnt_1, cs_cnt_2, cs_cnt));
}
}
else {
Warning(fmt::format("Change set count mismatch file1 has {}, file2 has {}.\n"
" Will compare the first {} change sets only.\n",
cs_cnt_1, cs_cnt_2, cs_cnt));
}
}
}
for (int i = 0; i < cs_cnt; i++) {
cs1.push_back(i + 1);
Expand All @@ -342,11 +342,11 @@ namespace {
auto cs_list = SLIB::tokenize(tokens[0], ",");
if (cs_list.size() == 1 && (cs_cnt_1 == 0 || cs_cnt_2 == 0)) {
// Specifies the cs to compare to a file with no change_sets...
auto &cs_names = cs_cnt_2 == 0 ? file1.Change_Set_Names() : file2.Change_Set_Names();
auto N = get_change_set_index(cs_list[0], cs_names);
if (N < 0) {
return std::make_pair(cs1, cs2);
}
auto &cs_names = cs_cnt_2 == 0 ? file1.Change_Set_Names() : file2.Change_Set_Names();
auto N = get_change_set_index(cs_list[0], cs_names);
if (N < 0) {
return std::make_pair(cs1, cs2);
}

if (cs_cnt_1 == 0) {
cs1.push_back(0);
Expand Down Expand Up @@ -382,18 +382,18 @@ namespace {
}
for (size_t i = 0; i < cs1_list.size(); i++) {
auto N1 = get_change_set_index(cs1_list[i], file1.Change_Set_Names());
auto N2 = get_change_set_index(cs2_list[i], file2.Change_Set_Names());
auto N2 = get_change_set_index(cs2_list[i], file2.Change_Set_Names());

if (N1 >= 0 && N1 <= cs_cnt_1 && N2 >= 0 && N2 <= cs_cnt_2) {
cs1.push_back(N1);
cs2.push_back(N2);
}
else {
cs1.push_back(N1);
cs2.push_back(N2);
}
else {
Error(fmt::format("At least one change set index is invalid: ({} {}), file1 has {}, "
"file2 has {}. Ignoring this entry.\n",
N1, N2, cs_cnt_1, cs_cnt_2));
}
}
}
}
}
}
return std::make_pair(cs1, cs2);
Expand Down Expand Up @@ -497,7 +497,10 @@ namespace {

template <typename INT> bool exodiff(Exo_Read<INT> &file1, Exo_Read<INT> &file2);

template <typename INT> std::pair<bool,bool> exodiff_setup(const std::string &file1_name, const std::string &file2_name, INT /* dummy */) {
template <typename INT>
std::pair<bool, bool> exodiff_setup(const std::string &file1_name, const std::string &file2_name,
INT /* dummy */)
{
// Open input files.
Exo_Read<INT> file1(file1_name);
file1.modify_time_values(interFace.time_value_scale, interFace.time_value_offset);
Expand All @@ -508,22 +511,22 @@ namespace {
SMART_ASSERT(cs1.size() == cs2.size());

bool has_change_sets = !cs1.empty() && (interFace.summary_flag || !cs2.empty());
bool diff_flag = false;
bool diff_flag = false;

if (has_change_sets) {
for (size_t i = 0; i < cs1.size(); i++) {
file1.Open_Change_Set(cs1[i] - 1);
if (!interFace.summary_flag) {
file2.Open_Change_Set(cs2[i] - 1);
}
if (!interFace.summary_flag) {
file2.Open_Change_Set(cs2[i] - 1);
}
diff_flag |= exodiff(file1, file2);
fmt::print("{:-<80}\n", "");
}
}
else {
file1.Get_Meta_Data();
if (!interFace.summary_flag) {
file2.Get_Meta_Data();
file2.Get_Meta_Data();
}
diff_flag |= exodiff(file1, file2);
}
Expand Down Expand Up @@ -598,18 +601,17 @@ int main(int argc, char *argv[])
int_size = 8;
}


bool diff_flag = false;
bool has_change_sets = false;
if (int_size == 4) {
auto diff_change = exodiff_setup(file1_name, file2_name, int(0));
diff_flag = diff_change.first;
has_change_sets = diff_change.second;
diff_flag = diff_change.first;
has_change_sets = diff_change.second;
}
else {
auto diff_change = exodiff_setup(file1_name, file2_name, int64_t(0));
diff_flag = diff_change.first;
has_change_sets = diff_change.second;
diff_flag = diff_change.first;
has_change_sets = diff_change.second;
}

if (has_change_sets) {
Expand Down

0 comments on commit 45a20cc

Please sign in to comment.