Skip to content

Commit

Permalink
fix some clang-tidy issues for wdmerger (#2949)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Aug 28, 2024
1 parent 0896c6f commit 2b3c853
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Exec/science/wdmerger/Prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ Castro::update_relaxation(Real time, Real dt) {

const Real ldt = new_time - old_time;

force[lev].reset(new MultiFab(getLevel(lev).grids, getLevel(lev).dmap, NUM_STATE, 0));
force[lev] = std::make_unique<MultiFab>(getLevel(lev).grids, getLevel(lev).dmap, NUM_STATE, 0);
force[lev]->setVal(0.0);

MultiFab& S_new = getLevel(lev).get_new_data(State_Type);
Expand Down
3 changes: 3 additions & 0 deletions Exec/science/wdmerger/Problem.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ void volInBoundary (amrex::Real time, amrex::Real& vol_p, amrex::Real& vol_s, am

// Computes standard dot product of two three-vectors.

static
amrex::Real dot_product(const amrex::Real a[], const amrex::Real b[]);


// Computes norm of a three vector.

static
amrex::Real norm(const amrex::Real a[]);

// Problem post-initialization routine.
Expand All @@ -48,6 +50,7 @@ void problem_post_timestep();

// Write out the git hashes for the various parts of the code.

static
void writeGitHashes(std::ostream& log);

// Update relaxation process.
Expand Down
2 changes: 1 addition & 1 deletion Exec/science/wdmerger/problem_checkpoint.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <prob_parameters.H>

AMREX_INLINE
void problem_checkpoint (std::string checkpoint_dir)
void problem_checkpoint (const std::string& checkpoint_dir)
{
std::ofstream com;
com.open(checkpoint_dir + "/COM", std::ios::out);
Expand Down
2 changes: 1 addition & 1 deletion Exec/science/wdmerger/problem_restart.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <fstream>

AMREX_INLINE
void problem_restart (std::string checkpoint_dir)
void problem_restart (const std::string& checkpoint_dir)
{
std::ifstream com;
com.open(checkpoint_dir + "/COM", std::ios::in);
Expand Down
2 changes: 1 addition & 1 deletion Exec/science/wdmerger/wdmerger_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ void binary_setup ()

Real v_P_r, v_S_r, v_P_phi, v_S_phi;

kepler_third_law(problem::radius_P, problem::mass_P, problem::radius_S, problem::mass_S,
kepler_third_law(problem::radius_P, problem::mass_P, problem::radius_S, problem::mass_S, // NOLINT(readability-suspicious-call-argument)
castro::rotational_period, problem::orbital_eccentricity, problem::orbital_angle,
problem::a, problem::r_P_initial, problem::r_S_initial, v_P_r, v_S_r, v_P_phi, v_S_phi);

Expand Down
12 changes: 6 additions & 6 deletions Source/gravity/Gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2777,12 +2777,12 @@ Gravity::fill_direct_sum_BCs(int crse_level, int fine_level, const Vector<MultiF
BL_ASSERT(nPtsXZ <= std::numeric_limits<int>::max());
BL_ASSERT(nPtsYZ <= std::numeric_limits<int>::max());

ParallelDescriptor::ReduceRealSum(bcXYLo.dataPtr(), nPtsXY);
ParallelDescriptor::ReduceRealSum(bcXYHi.dataPtr(), nPtsXY);
ParallelDescriptor::ReduceRealSum(bcXZLo.dataPtr(), nPtsXZ);
ParallelDescriptor::ReduceRealSum(bcXZHi.dataPtr(), nPtsXZ);
ParallelDescriptor::ReduceRealSum(bcYZLo.dataPtr(), nPtsYZ);
ParallelDescriptor::ReduceRealSum(bcYZHi.dataPtr(), nPtsYZ);
ParallelDescriptor::ReduceRealSum(bcXYLo.dataPtr(), static_cast<int>(nPtsXY));
ParallelDescriptor::ReduceRealSum(bcXYHi.dataPtr(), static_cast<int>(nPtsXY));
ParallelDescriptor::ReduceRealSum(bcXZLo.dataPtr(), static_cast<int>(nPtsXZ));
ParallelDescriptor::ReduceRealSum(bcXZHi.dataPtr(), static_cast<int>(nPtsXZ));
ParallelDescriptor::ReduceRealSum(bcYZLo.dataPtr(), static_cast<int>(nPtsYZ));
ParallelDescriptor::ReduceRealSum(bcYZHi.dataPtr(), static_cast<int>(nPtsYZ));

#ifdef _OPENMP
#pragma omp parallel
Expand Down
2 changes: 1 addition & 1 deletion Source/gravity/binary.H
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void lagrange_iterate (Real& r, Real mass_1, Real mass_2, Real r1, Real r2, Real
const Real tolerance = 1.0e-8_rt;
const int max_iters = 200;

Real rm, rp;
Real rm{}, rp{};

if (r_min == 0.0_rt && r_max == 0.0_rt) {
amrex::Abort("Lagrange point iteration must have at least one non-zero bound provided.");
Expand Down

0 comments on commit 2b3c853

Please sign in to comment.