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

Clang-Tidy changes in Tools #3478

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Tools/Plotfile/fcompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ int main_main()

if (! all_variables_found) {
amrex::Print() << " WARNING: not all variables present in both files\n";
if (abort_if_not_all_found) return EXIT_FAILURE;
if (abort_if_not_all_found) { return EXIT_FAILURE; }
}

if (any_nans) {
Expand Down
4 changes: 2 additions & 2 deletions Tools/Plotfile/fextract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void main_main()

const IntVect ivloc{AMREX_D_DECL(iloc,jloc,kloc)};

if (fine_level < 0) fine_level = pf.finestLevel();
if (fine_level < 0) { fine_level = pf.finestLevel(); }
// sanity check on valid selected levels
if (fine_level > pf.finestLevel() || coarse_level < 0 || coarse_level > fine_level) {
amrex::Abort("Invalid level selection");
Expand Down Expand Up @@ -373,7 +373,7 @@ void main_main()
for (int i = 0; i < posidx.size(); ++i) {
ofs << std::setw(25) << std::right << std::setprecision(precision) << posidx[i].first;
for (int j = 0; j < var_names.size(); ++j) {
if (std::abs(data[j][posidx[i].second])< tolerance ) data[j][posidx[i].second] = 0.;
if (std::abs(data[j][posidx[i].second])< tolerance ) { data[j][posidx[i].second] = 0.; }
ofs << std::setw(25) << std::right << std::setprecision(precision) << data[j][posidx[i].second];
}
ofs << "\n";
Expand Down
2 changes: 1 addition & 1 deletion Tools/Plotfile/fnan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main_main()

int num_nans = 0;
for (int b : has_nan) {
if (b) ++num_nans;
if (b) { ++num_nans; }
}
if (num_nans == 0) {
amrex::Print() << " " << std::setw(nwidth+1) << std::left << varname << ": clean" << "\n";
Expand Down
6 changes: 3 additions & 3 deletions Tools/Plotfile/fsnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ void main_main()

// make sure we have valid options set
if (do_log) {
if (ldef_mx && def_mx < 0.) amrex::Abort("ERROR: log plot specified with negative maximum");
if (ldef_mn && def_mn < 0.) amrex::Abort("ERROR: log plot specified with negative minimum");
if (ldef_mx && def_mx < 0.) { amrex::Abort("ERROR: log plot specified with negative maximum"); }
if (ldef_mn && def_mn < 0.) { amrex::Abort("ERROR: log plot specified with negative minimum"); }
}

// get the palette
Expand Down Expand Up @@ -291,7 +291,7 @@ void main_main()
int jj = (idir == 2) ? height - 1 - j : j; // flip the data in second image direction
int kk = (idir == 2) ? k : height - 1 - k;
Real rd = realarr(i,jj,kk);
if (do_log) rd = std::log10(rd);
if (do_log) { rd = std::log10(rd); }
int id = std::max(0,std::min(255,static_cast<int>((rd-gmn)*fac)));
auto c = static_cast<unsigned char>(id);
constexpr auto cmn = static_cast<unsigned char>(1); // avoid zero
Expand Down
6 changes: 3 additions & 3 deletions Tools/Postprocessing/C_Src/particle_compare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ int sort_particles_ascending(const void *p, const void *q)
std::memcpy(&cpu1, iptr1, sizeof(int));
std::memcpy(&cpu2, iptr2, sizeof(int));

if (cpu1 != cpu2) return (cpu1 - cpu2);
if (id1 != id2 ) return (id1 - id2 );
if (cpu1 != cpu2) { return (cpu1 - cpu2); }
if (id1 != id2 ) { return (id1 - id2 ); }
return 0;
}

Expand All @@ -312,7 +312,7 @@ void compare_particle_chunk(const ParticleHeader& header1,
std::vector<double>& norms,
int level, int file_num, int np, int offset) {

if (np == 0) return;
if (np == 0) { return; }

std::string read_file1 = getDataFileName(header1.par_file_name, level, file_num);
std::string read_file2 = getDataFileName(header2.par_file_name, level, file_num);
Expand Down
Loading