From 45a20cc07335edd1e35dedbdd7ad53b00f8331da Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:46:47 +0000 Subject: [PATCH] Committing clang-format changes --- .../seacas/applications/exodiff/exo_read.C | 72 +++++++------- .../seacas/applications/exodiff/exodiff.C | 94 ++++++++++--------- 2 files changed, 84 insertions(+), 82 deletions(-) diff --git a/packages/seacas/applications/exodiff/exo_read.C b/packages/seacas/applications/exodiff/exo_read.C index dbcee10755..be0924d352 100644 --- a/packages/seacas/applications/exodiff/exo_read.C +++ b/packages/seacas/applications/exodiff/exo_read.C @@ -36,46 +36,46 @@ namespace { template Exo_Read::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]; + } } } diff --git a/packages/seacas/applications/exodiff/exodiff.C b/packages/seacas/applications/exodiff/exodiff.C index d2e2805642..a1bb596e98 100644 --- a/packages/seacas/applications/exodiff/exodiff.C +++ b/packages/seacas/applications/exodiff/exodiff.C @@ -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; } @@ -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); @@ -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); @@ -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); @@ -497,7 +497,10 @@ namespace { template bool exodiff(Exo_Read &file1, Exo_Read &file2); - template std::pair exodiff_setup(const std::string &file1_name, const std::string &file2_name, INT /* dummy */) { + template + std::pair exodiff_setup(const std::string &file1_name, const std::string &file2_name, + INT /* dummy */) + { // Open input files. Exo_Read file1(file1_name); file1.modify_time_values(interFace.time_value_scale, interFace.time_value_offset); @@ -508,14 +511,14 @@ 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", ""); } @@ -523,7 +526,7 @@ namespace { else { file1.Get_Meta_Data(); if (!interFace.summary_flag) { - file2.Get_Meta_Data(); + file2.Get_Meta_Data(); } diff_flag |= exodiff(file1, file2); } @@ -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) {