Skip to content

Commit

Permalink
Clang-tidy readability identifier naming for functions (#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf authored Jul 22, 2024
1 parent fe73b70 commit 15896d0
Show file tree
Hide file tree
Showing 68 changed files with 225 additions and 223 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ CheckOptions:
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.ClassIgnoredRegexp, value: "incflo"}
- { key: readability-identifier-naming.FunctionIgnoredRegexp, value: "^.*"}
- { key: readability-identifier-naming.FunctionIgnoredRegexp, value: "(Godunov_|setVal|ComputeDt|ComputePrescribeDt|ApplyPredictor|ApplyCorrector|ApplyPrescribeStep|ApplyProjection|UpdateGradP|ReadCheckpointFile|Factory|ReadParameters|InitialProjection|InitialIterations|PrintMax|CheckForNans|InitData|Evolve|buildInfoGet|FAST_).*"}
- { key: readability-identifier-naming.GlobalConstantIgnoredRegexp, value: "^.*"}
- { key: readability-identifier-naming.NamespaceIgnoredRegexp, value: "Hydro"}
- { key: readability-identifier-naming.StructIgnoredRegexp, value: "(SC_DX|OpFM).*"}
Expand Down
4 changes: 2 additions & 2 deletions amr-wind/core/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void Field::to_uniform_space() noexcept
}

const auto& mesh_fac = m_repo.get_mesh_mapping_field(m_info->m_floc);
const auto& mesh_detJ = m_repo.get_mesh_mapping_detJ(m_info->m_floc);
const auto& mesh_detJ = m_repo.get_mesh_mapping_det_j(m_info->m_floc);

// scale velocity to accommodate for mesh mapping -> U^bar = U * J/fac
for (int lev = 0; lev < m_repo.num_active_levels(); ++lev) {
Expand Down Expand Up @@ -417,7 +417,7 @@ void Field::to_stretched_space() noexcept
}

const auto& mesh_fac = m_repo.get_mesh_mapping_field(m_info->m_floc);
const auto& mesh_detJ = m_repo.get_mesh_mapping_detJ(m_info->m_floc);
const auto& mesh_detJ = m_repo.get_mesh_mapping_det_j(m_info->m_floc);

// scale field back to stretched mesh -> U = U^bar * fac/J
for (int lev = 0; lev < m_repo.num_active_levels(); ++lev) {
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/core/FieldRepo.H
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public:

/** Return a previously created mesh mapping detJ using field location
*/
Field& get_mesh_mapping_detJ(FieldLoc floc) const;
Field& get_mesh_mapping_det_j(FieldLoc floc) const;

//! Query if field uniquely identified by name and time state exists in
//! repository
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/core/FieldRepo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Field& FieldRepo::get_mesh_mapping_field(FieldLoc floc) const
return *fac;
}

Field& FieldRepo::get_mesh_mapping_detJ(FieldLoc floc) const
Field& FieldRepo::get_mesh_mapping_det_j(FieldLoc floc) const
{
Field* detJ = nullptr;
switch (floc) {
Expand Down
16 changes: 8 additions & 8 deletions amr-wind/core/SimTime.H
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ public:
void set_restart_time(int tidx, amrex::Real time);

AMREX_FORCE_INLINE
amrex::Real deltaT() const { return m_dt[0]; }
amrex::Real delta_t() const { return m_dt[0]; }

AMREX_FORCE_INLINE
amrex::Real& deltaT() { return m_dt[0]; }
amrex::Real& delta_t() { return m_dt[0]; }

AMREX_FORCE_INLINE
amrex::Real deltaTNm1() const { return m_dt[1]; }
amrex::Real delta_t_nm1() const { return m_dt[1]; }

AMREX_FORCE_INLINE
amrex::Real deltaTNm2() const { return m_dt[2]; }
amrex::Real delta_t_nm2() const { return m_dt[2]; }

AMREX_FORCE_INLINE
amrex::Real& deltaTNm1() { return m_dt[1]; }
amrex::Real& delta_t_nm1() { return m_dt[1]; }

AMREX_FORCE_INLINE
amrex::Real& deltaTNm2() { return m_dt[2]; }
amrex::Real& delta_t_nm2() { return m_dt[2]; }

AMREX_FORCE_INLINE
amrex::Real current_time() const { return m_cur_time; }
Expand Down Expand Up @@ -163,10 +163,10 @@ private:
//! Maximum CFL constraint
amrex::Real m_max_cfl{0.5};

//! Fixed deltaT indicated by user
//! Fixed delta_t indicated by user
amrex::Real m_fixed_dt{-1.0};

//! Initial deltaT indicated by user
//! Initial delta_t indicated by user
amrex::Real m_initial_dt{-1.0};

//! Current CFL
Expand Down
4 changes: 2 additions & 2 deletions amr-wind/core/SimTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace amr_wind {

void SimTime::parse_parameters()
{
// Initialize deltaT to negative values
// Initialize delta_t to negative values
for (amrex::Real& i : m_dt) {
i = -1.0;
}
Expand Down Expand Up @@ -213,7 +213,7 @@ void SimTime::set_current_cfl(

} else {
// If user has specified fixed DT then issue a warning if the timestep
// is larger than the deltaT determined from max. CFL considerations.
// is larger than the delta_t determined from max. CFL considerations.
// Only issue warnings when the error is greater than 1% of the timestep
// specified
if ((1.0 - (dt_new / m_fixed_dt)) > 0.01) {
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/core/vs/tensor.H
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct TensorT
}

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static constexpr TensorT<T>
I() noexcept
identity() noexcept
{
return TensorT{Traits::one(), Traits::zero(), Traits::zero(),
Traits::zero(), Traits::one(), Traits::zero(),
Expand Down
6 changes: 3 additions & 3 deletions amr-wind/diffusion/incflo_diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ void viscosity_to_uniform_space(
const auto& mesh_fac_zf =
repo.get_mesh_mapping_field(amr_wind::FieldLoc::ZFACE);
const auto& mesh_detJ_xf =
repo.get_mesh_mapping_detJ(amr_wind::FieldLoc::XFACE);
repo.get_mesh_mapping_det_j(amr_wind::FieldLoc::XFACE);
const auto& mesh_detJ_yf =
repo.get_mesh_mapping_detJ(amr_wind::FieldLoc::YFACE);
repo.get_mesh_mapping_det_j(amr_wind::FieldLoc::YFACE);
const auto& mesh_detJ_zf =
repo.get_mesh_mapping_detJ(amr_wind::FieldLoc::ZFACE);
repo.get_mesh_mapping_det_j(amr_wind::FieldLoc::ZFACE);

// beta accounted for mesh mapping (x-face) = J/fac^2 * mu
for (amrex::MFIter mfi(b[0]); mfi.isValid(); ++mfi) {
Expand Down
4 changes: 2 additions & 2 deletions amr-wind/equation_systems/CompRHSOps.H
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct ComputeRHSOp
auto& conv_term = fields.conv_term.state(fstate);
auto& mask_cell = fields.repo.get_int_field("mask_cell");
Field const* mesh_detJ =
mesh_mapping ? &(fields.repo.get_mesh_mapping_detJ(FieldLoc::CELL))
mesh_mapping ? &(fields.repo.get_mesh_mapping_det_j(FieldLoc::CELL))
: nullptr;

for (int lev = 0; lev < nlevels; ++lev) {
Expand Down Expand Up @@ -190,7 +190,7 @@ struct ComputeRHSOp
auto& conv_term_old = fields.conv_term.state(FieldState::Old);
auto& mask_cell = fields.repo.get_int_field("mask_cell");
Field const* mesh_detJ =
mesh_mapping ? &(fields.repo.get_mesh_mapping_detJ(FieldLoc::CELL))
mesh_mapping ? &(fields.repo.get_mesh_mapping_det_j(FieldLoc::CELL))
: nullptr;

for (int lev = 0; lev < nlevels; ++lev) {
Expand Down
6 changes: 3 additions & 3 deletions amr-wind/equation_systems/DiffusionOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ void DiffSolverIface<LinOp>::set_acoeffs(LinOp& linop, const FieldState fstate)
auto& repo = m_pdefields.repo;
const int nlevels = repo.num_active_levels();
const auto& density = m_density.state(fstate);
Field const* mesh_detJ = m_mesh_mapping
? &(repo.get_mesh_mapping_detJ(FieldLoc::CELL))
: nullptr;
Field const* mesh_detJ =
m_mesh_mapping ? &(repo.get_mesh_mapping_det_j(FieldLoc::CELL))
: nullptr;
std::unique_ptr<ScratchField> rho_times_detJ =
m_mesh_mapping ? repo.create_scratch_field(
1, m_density.num_grow()[0], FieldLoc::CELL)
Expand Down
8 changes: 4 additions & 4 deletions amr-wind/equation_systems/PDE.H
Original file line number Diff line number Diff line change
Expand Up @@ -130,30 +130,30 @@ public:
{
BL_PROFILE(
"amr-wind::" + this->identifier() + "::compute_advection_term");
(*m_adv_op)(fstate, m_time.deltaT());
(*m_adv_op)(fstate, m_time.delta_t());
}

void pre_advection_actions(const FieldState fstate) override
{
BL_PROFILE(
"amr-wind::" + this->identifier() + "::pre_advection_actions");
m_adv_op->preadvect(fstate, m_time.deltaT(), m_time.current_time());
m_adv_op->preadvect(fstate, m_time.delta_t(), m_time.current_time());
}

void compute_predictor_rhs(const DiffusionType difftype) override
{
BL_PROFILE(
"amr-wind::" + this->identifier() + "::compute_predictor_rhs");
m_rhs_op.predictor_rhs(
difftype, m_time.deltaT(), m_sim.has_mesh_mapping());
difftype, m_time.delta_t(), m_sim.has_mesh_mapping());
}

void compute_corrector_rhs(const DiffusionType difftype) override
{
BL_PROFILE(
"amr-wind::" + this->identifier() + "::compute_corrector_rhs");
m_rhs_op.corrector_rhs(
difftype, m_time.deltaT(), m_sim.has_mesh_mapping());
difftype, m_time.delta_t(), m_sim.has_mesh_mapping());
}

void solve(const amrex::Real dt) override
Expand Down
6 changes: 3 additions & 3 deletions amr-wind/equation_systems/icns/icns_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@ void MacProjOp::mac_proj_to_uniform_space(
const auto& mesh_fac_zf =
repo.get_mesh_mapping_field(amr_wind::FieldLoc::ZFACE);
const auto& mesh_detJ_xf =
repo.get_mesh_mapping_detJ(amr_wind::FieldLoc::XFACE);
repo.get_mesh_mapping_det_j(amr_wind::FieldLoc::XFACE);
const auto& mesh_detJ_yf =
repo.get_mesh_mapping_detJ(amr_wind::FieldLoc::YFACE);
repo.get_mesh_mapping_det_j(amr_wind::FieldLoc::YFACE);
const auto& mesh_detJ_zf =
repo.get_mesh_mapping_detJ(amr_wind::FieldLoc::ZFACE);
repo.get_mesh_mapping_det_j(amr_wind::FieldLoc::ZFACE);

// scale U^mac to accommodate for mesh mapping -> U^bar = J/fac *
// U^mac beta accounted for mesh mapping = J/fac^2 * 1/rho construct
Expand Down
8 changes: 4 additions & 4 deletions amr-wind/equation_systems/icns/icns_diffusion.H
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public:
const auto& density = m_density.state(fstate);
const auto& viscosity = m_pdefields.mueff;
Field const* mesh_detJ =
m_mesh_mapping ? &(repo.get_mesh_mapping_detJ(FieldLoc::CELL))
m_mesh_mapping ? &(repo.get_mesh_mapping_det_j(FieldLoc::CELL))
: nullptr;
std::unique_ptr<ScratchField> rho_times_detJ =
m_mesh_mapping ? repo.create_scratch_field(
Expand Down Expand Up @@ -199,7 +199,7 @@ public:
auto rhs_ptr = repo.create_scratch_field("rhs", field.num_comp(), 0);
const auto& viscosity = m_pdefields.mueff;
Field const* mesh_detJ =
m_mesh_mapping ? &(repo.get_mesh_mapping_detJ(FieldLoc::CELL))
m_mesh_mapping ? &(repo.get_mesh_mapping_det_j(FieldLoc::CELL))
: nullptr;
std::unique_ptr<ScratchField> rho_times_detJ =
m_mesh_mapping ? repo.create_scratch_field(
Expand Down Expand Up @@ -344,7 +344,7 @@ public:
const auto& density = m_density.state(fstate);
const auto& viscosity = m_pdefields.mueff;
Field const* mesh_detJ =
m_mesh_mapping ? &(repo.get_mesh_mapping_detJ(FieldLoc::CELL))
m_mesh_mapping ? &(repo.get_mesh_mapping_det_j(FieldLoc::CELL))
: nullptr;
std::unique_ptr<ScratchField> rho_times_detJ =
m_mesh_mapping ? repo.create_scratch_field(
Expand Down Expand Up @@ -432,7 +432,7 @@ public:
const auto& geom = repo.mesh().Geom();

Field const* mesh_detJ =
m_mesh_mapping ? &(repo.get_mesh_mapping_detJ(FieldLoc::CELL))
m_mesh_mapping ? &(repo.get_mesh_mapping_det_j(FieldLoc::CELL))
: nullptr;
std::unique_ptr<ScratchField> rho_times_detJ =
m_mesh_mapping ? repo.create_scratch_field(
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/icns/source_terms/ABLForcing.H
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public:
const auto& current_time = m_time.current_time();
const auto& new_time = m_time.new_time();
const auto& nph_time = 0.5 * (current_time + new_time);
const auto& dt = m_time.deltaT();
const auto& dt = m_time.delta_t();
const auto& t_step = m_time.time_index();

if (!m_vel_timetable.empty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ABLMesoForcingMom::ABLMesoForcingMom(const CFDSim& sim)

if ((amrex::toLower(m_forcing_scheme) == "indirect") &&
!m_update_transition_height) {
indirectForcingInit(); // do this once
indirect_forcing_init(); // do this once
}
}

Expand Down Expand Up @@ -228,8 +228,8 @@ void ABLMesoForcingMom::mean_velocity_heights(
amrex::Print() << "current transition height = "
<< m_transition_height << std::endl;

setTransitionWeighting();
indirectForcingInit();
set_transition_weighting();
indirect_forcing_init();
}

amrex::Array<amrex::Real, 4> ezP_U;
Expand Down Expand Up @@ -287,8 +287,8 @@ void ABLMesoForcingMom::mean_velocity_heights(
}

if (amrex::toLower(m_forcing_transition) == "indirecttodirect") {
blendForcings(error_U, error_U_direct, error_U);
blendForcings(error_V, error_V_direct, error_V);
blend_forcings(error_U, error_U_direct, error_U);
blend_forcings(error_V, error_V_direct, error_V);

if (m_debug) {
for (size_t ih = 0; ih < n_levels; ih++) {
Expand All @@ -299,9 +299,9 @@ void ABLMesoForcingMom::mean_velocity_heights(
}
}

if (forcingToConstant()) {
constantForcingTransition(error_U);
constantForcingTransition(error_V);
if (forcing_to_constant()) {
constant_forcing_transition(error_U);
constant_forcing_transition(error_V);

if (m_debug) {
for (size_t ih = 0; ih < n_levels; ih++) {
Expand Down Expand Up @@ -336,7 +336,7 @@ void ABLMesoForcingMom::operator()(
return;
}

const auto& dt = m_time.deltaT();
const auto& dt = m_time.delta_t();
const auto& problo = m_mesh.Geom(lev).ProbLoArray();
const auto& dx = m_mesh.Geom(lev).CellSizeArray();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ABLMesoForcingTemp::ABLMesoForcingTemp(const CFDSim& sim)

if ((amrex::toLower(m_forcing_scheme) == "indirect") &&
!m_update_transition_height) {
indirectForcingInit(); // do this once
indirect_forcing_init(); // do this once
}
}

Expand Down Expand Up @@ -202,8 +202,8 @@ amrex::Real ABLMesoForcingTemp::mean_temperature_heights(
amrex::Print() << "current transition height = "
<< m_transition_height << std::endl;

setTransitionWeighting();
indirectForcingInit();
set_transition_weighting();
indirect_forcing_init();
}

amrex::Array<amrex::Real, 4> ezP_T;
Expand Down Expand Up @@ -247,7 +247,7 @@ amrex::Real ABLMesoForcingTemp::mean_temperature_heights(
}

if (amrex::toLower(m_forcing_transition) == "indirecttodirect") {
blendForcings(error_T, error_T_direct, error_T);
blend_forcings(error_T, error_T_direct, error_T);

if (m_debug) {
for (size_t ih = 0; ih < n_levels; ih++) {
Expand All @@ -258,8 +258,8 @@ amrex::Real ABLMesoForcingTemp::mean_temperature_heights(
}
}

if (forcingToConstant()) {
constantForcingTransition(error_T);
if (forcing_to_constant()) {
constant_forcing_transition(error_T);

if (m_debug) {
for (size_t ih = 0; ih < n_levels; ih++) {
Expand Down Expand Up @@ -290,7 +290,7 @@ void ABLMesoForcingTemp::operator()(
return;
}

const auto& dt = m_time.deltaT();
const auto& dt = m_time.delta_t();
const auto& problo = m_mesh.Geom(lev).ProbLoArray();
const auto& dx = m_mesh.Geom(lev).CellSizeArray();

Expand Down
Loading

0 comments on commit 15896d0

Please sign in to comment.