Skip to content

Commit

Permalink
Fix clang-tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Rombur committed Feb 12, 2024
1 parent 44335f7 commit 8228672
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
20 changes: 5 additions & 15 deletions source/DataAssimilator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ DataAssimilator::calc_sample_covariance_sparse(
element_value /= (_num_ensemble_members - 1.0);

// Apply localization
double localization_scaling;
double localization_scaling = 1.0;
if (i < _sim_size && j < _sim_size)
{
double dist = _covariance_distance_map.find(std::make_pair(i, j))->second;
Expand All @@ -730,22 +730,12 @@ DataAssimilator::calc_sample_covariance_sparse(
localization_scaling =
gaspari_cohn_function(2.0 * dist / _localization_cutoff_distance);
}
else if (_localization_cutoff_function ==
LocalizationCutoff::step_function)
else if ((_localization_cutoff_function ==
LocalizationCutoff::step_function) &&
(dist > _localization_cutoff_distance))
{
if (dist <= _localization_cutoff_distance)
localization_scaling = 1.0;
else
localization_scaling = 0.0;
localization_scaling = 0.0;
}
else
{
localization_scaling = 1.0;
}
}
else
{
localization_scaling = 1.0;
}

conv_iter->value() = element_value * localization_scaling;
Expand Down
14 changes: 4 additions & 10 deletions source/MechanicalOperator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,10 @@ void MechanicalOperator<dim, MemorySpaceType>::assemble_system(
// Get the appropriate reference temperature for the cell. If the cell
// is not in the unmelted substrate, the reference temperature depends
// on the material.
double reference_temperature;
if (_has_melted[cell_indices[cell->active_cell_index()]])
{
reference_temperature =
_reference_temperatures[temperature_cell->material_id()];
}
else
{
reference_temperature = initial_temperature;
}
double reference_temperature =
_has_melted[cell_indices[cell->active_cell_index()]]
? _reference_temperatures[temperature_cell->material_id()]
: initial_temperature;

displacement_hp_fe_values.reinit(cell);
auto const &fe_values = displacement_hp_fe_values.get_present_fe_values();
Expand Down
2 changes: 1 addition & 1 deletion source/Timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void Timer::reset() { _elapsed_time = boost::chrono::milliseconds(0); }

void Timer::print()
{
int rank;
int rank = -1;
MPI_Comm_rank(_communicator, &rank);
if (rank == 0)
{
Expand Down

0 comments on commit 8228672

Please sign in to comment.