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

Fix clang-tidy complaints #15422

Merged
merged 1 commit into from
Jun 22, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/step-36/step-36.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ namespace Step36
IndexSet eigenfunction_index_set = dof_handler.locally_owned_dofs();
eigenfunctions.resize(
parameters.get_integer("Number of eigenvalues/eigenfunctions"));
for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
eigenfunctions[i].reinit(eigenfunction_index_set, MPI_COMM_WORLD);
for (auto &eigenfunction : eigenfunctions)
eigenfunction.reinit(eigenfunction_index_set, MPI_COMM_WORLD);

eigenvalues.resize(eigenfunctions.size());
}
Expand Down Expand Up @@ -384,8 +384,8 @@ namespace Step36
// does not necessarily have to be attained at a node, and so
// $\max_{\mathbf x}\phi_i(\mathbf x)\ge\max_j (\Phi_i)_j$ (although the
// equality is usually nearly true).
for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
eigenfunctions[i] /= eigenfunctions[i].linfty_norm();
for (auto &eigenfunction : eigenfunctions)
eigenfunction /= eigenfunction.linfty_norm();

// Finally return the number of iterations it took to converge:
return solver_control.last_step();
Expand Down
6 changes: 3 additions & 3 deletions examples/step-71/step-71.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3799,9 +3799,9 @@ namespace Step71
Coupled_Magnetomechanical_Constitutive_Law_Base<dim>
&material_hand_calculated,
Coupled_Magnetomechanical_Constitutive_Law_Base<dim>
& material_assisted_computation,
TimerOutput & timer,
const std::string filename)
& material_assisted_computation,
TimerOutput & timer,
const std::string &filename)
{
// We can take the hand-implemented constitutive law and compare the
// results that we attain with it to those that we get using AD or SD.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,12 +664,12 @@ namespace Differentiation

// ... followed by any intermediate evaluations due to the application
// of CSE. These are fed directly back into the substitution map...
for (unsigned i = 0; i < intermediate_symbols_exprs.size(); ++i)
for (const auto &expression : intermediate_symbols_exprs)
{
const SymEngine::RCP<const SymEngine::Basic> &cse_symbol =
intermediate_symbols_exprs[i].first;
expression.first;
const SymEngine::RCP<const SymEngine::Basic> &cse_expr =
intermediate_symbols_exprs[i].second;
expression.second;
Assert(substitution_value_map.find(cse_symbol) ==
substitution_value_map.end(),
ExcMessage(
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/differentiation/sd/symengine_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,7 @@ namespace Differentiation
/**
* Move constructor.
*/
BatchOptimizer(BatchOptimizer &&) = default;
BatchOptimizer(BatchOptimizer &&) noexcept = default;

/**
* Destructor.
Expand Down
2 changes: 1 addition & 1 deletion source/differentiation/sd/symengine_number_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace Differentiation
{expression_otherwise.get_RCP(), SE::boolTrue});

// Initialize
expression = SE::piecewise(std::move(piecewise_function));
expression = SE::piecewise(piecewise_function);
}


Expand Down
4 changes: 2 additions & 2 deletions source/differentiation/sd/symengine_utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ namespace Differentiation
std::vector<std::pair<SD::Expression, SD::Expression>> symb_val_vec;
symb_val_vec.reserve(symbol_value_vector.size());
for (const auto &entry : symbol_value_vector)
symb_val_vec.push_back(std::make_pair(SD::Expression(entry.first),
SD::Expression(entry.second)));
symb_val_vec.emplace_back(SD::Expression(entry.first),
SD::Expression(entry.second));
return symb_val_vec;
}

Expand Down
18 changes: 9 additions & 9 deletions source/opencascade/manifold_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,25 +236,25 @@ namespace OpenCASCADE
TopoDS_Shape out_shape;
Tensor<1, spacedim> average_normal;
# ifdef DEBUG
for (unsigned int i = 0; i < surrounding_points.size(); ++i)
for (const auto &point : surrounding_points)
{
Assert(closest_point(sh, surrounding_points[i], tolerance)
.distance(surrounding_points[i]) <
std::max(tolerance * surrounding_points[i].norm(),
tolerance),
ExcPointNotOnManifold<spacedim>(surrounding_points[i]));
Assert(closest_point(sh, point, tolerance).distance(point) <
std::max(tolerance * point.norm(), tolerance),
ExcPointNotOnManifold<spacedim>(point));
}
# endif

switch (surrounding_points.size())
{
case 2:
{
for (unsigned int i = 0; i < surrounding_points.size(); ++i)
for (const auto &point : surrounding_points)
{
std::tuple<Point<3>, Tensor<1, 3>, double, double>
p_and_diff_forms = closest_point_and_differential_forms(
sh, surrounding_points[i], tolerance);
p_and_diff_forms =
closest_point_and_differential_forms(sh,
point,
tolerance);
average_normal += std::get<1>(p_and_diff_forms);
}

Expand Down
5 changes: 2 additions & 3 deletions source/sundials/ida.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,8 @@ namespace SUNDIALS
{
VectorType diff_comp_vector(solution);
diff_comp_vector = 0.0;
auto dc = differential_components();
for (auto i = dc.begin(); i != dc.end(); ++i)
diff_comp_vector[*i] = 1.0;
for (const auto &component : differential_components())
diff_comp_vector[component] = 1.0;
diff_comp_vector.compress(VectorOperation::insert);

const auto diff_id = internal::make_nvector_view(diff_comp_vector
Expand Down