mpi-*,
performance-*,
-performance-inefficient-string-concatenation,
- -performance-no-automatic-move
+ -performance-no-automatic-move,
+ readability-qualified-auto
WarningsAsErrors: '*'
// <a href="http://en.cppreference.com/w/cpp/language/range-for">range-
// based for loops</a>, which wrap up all of the syntax shown above into a
// much shorter form:
- for (auto &cell : triangulation.active_cell_iterators())
+ for (const auto &cell : triangulation.active_cell_iterators())
{
// @note See @ref Iterators for more information about the iterator
// classes used in deal.II, and @ref CPP11 for more information about
system_matrix,
right_hand_side);
- for (auto &cdf : c.face_data)
+ for (const auto &cdf : c.face_data)
{
constraints.distribute_local_to_global(cdf.cell_matrix,
cdf.joint_dof_indices,
for (unsigned int step = 0; step < 3; ++step)
{
- for (auto &cell : triangulation.active_cell_iterators())
+ for (const auto &cell : triangulation.active_cell_iterators())
for (const auto v : cell->vertex_indices())
{
const double distance_from_center =
system_matrix,
system_rhs);
- for (auto &cdf : copy_data.face_data)
+ for (const auto &cdf : copy_data.face_data)
{
constraints.distribute_local_to_global(cdf.cell_matrix,
cdf.joint_dof_indices,
if (copy_data.cell_index != numbers::invalid_unsigned_int)
estimated_error_square_per_cell[copy_data.cell_index] += copy_data.value;
- for (auto &cdf : copy_data.face_data)
+ for (const auto &cdf : copy_data.face_data)
for (unsigned int j = 0; j < 2; ++j)
estimated_error_square_per_cell[cdf.cell_indices[j]] += cdf.values[j];
};
const T & t,
const Patterns::PatternBase &pattern = *Convert<T>::to_pattern())
{
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a "
"string to a List type."));
{
AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description()));
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a string "
"to a List type."));
const T & t,
const Patterns::PatternBase &pattern = *Convert<T>::to_pattern())
{
- auto p = dynamic_cast<const Patterns::Map *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::Map *>(&pattern);
AssertThrow(p,
ExcMessage("I need a Map pattern to convert a string to "
"a Map compatible type."));
{
AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description()));
- auto p = dynamic_cast<const Patterns::Map *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::Map *>(&pattern);
AssertThrow(p,
ExcMessage("I need a Map pattern to convert a "
"string to a Map compatible type."));
const T & t,
const Patterns::PatternBase &pattern = *Convert<T>::to_pattern())
{
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a "
"string to a std::array."));
{
AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description()));
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a string "
"to a std::array."));
const T & t,
const Patterns::PatternBase &pattern = *Convert<T>::to_pattern())
{
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a string "
"to a List compatible type."));
{
AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description()));
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a string "
"to a List compatible type."));
const T & t,
const Patterns::PatternBase &pattern = *Convert<T>::to_pattern())
{
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a string "
"to a List compatible type."));
{
AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description()));
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a string "
"to a List compatible type."));
const T & t,
const Patterns::PatternBase &pattern = *Convert<T>::to_pattern())
{
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a string "
"to a List compatible type."));
{
AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description()));
- auto p = dynamic_cast<const Patterns::List *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::List *>(&pattern);
AssertThrow(p,
ExcMessage("I need a List pattern to convert a string "
"to a List compatible type."));
const T & t,
const Patterns::PatternBase &pattern = *Convert<T>::to_pattern())
{
- auto p = dynamic_cast<const Patterns::Tuple *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::Tuple *>(&pattern);
AssertThrow(p,
ExcMessage("I need a Tuple pattern to convert a tuple "
"to a string."));
{
AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description()));
- auto p = dynamic_cast<const Patterns::Tuple *>(&pattern);
+ const auto *p = dynamic_cast<const Patterns::Tuple *>(&pattern);
AssertThrow(p,
ExcMessage("I need a Tuple pattern to convert a string "
"to a tuple type."));
Tensor<rank_, dim, Number>::unroll_recursion(const Iterator current,
const Iterator end) const
{
- auto next = current;
+ Iterator next = current;
for (unsigned int i = 0; i < dim; ++i)
next = values[i].unroll_recursion(next, end);
return next;
object.clear();
if (vector_size > 0)
{
- const auto buffer_data_begin =
+ const auto *const buffer_data_begin =
reinterpret_cast<const T *>(&*cbegin + sizeof(vector_size));
- const auto buffer_data_end = buffer_data_begin + vector_size;
+ const auto *const buffer_data_end = buffer_data_begin + vector_size;
object.insert(object.end(), buffer_data_begin, buffer_data_end);
}
}
using ExecutionSpace =
MemorySpace::Default::kokkos_space::execution_space;
ExecutionSpace exec;
- auto local_values = vec.get_values();
+ auto * local_values = vec.get_values();
Kokkos::parallel_for(
"dealii::set_zero_parallel",
Kokkos::RangePolicy<ExecutionSpace>(exec, 0, n_constraints),
const LinearAlgebra::distributed::Vector<Number, MemorySpace::Host>
&diagonal)
{
- const auto dst_ptr = dst.begin();
- const auto src_ptr = src.begin();
- const auto diagonal_ptr = diagonal.begin();
+ auto *const dst_ptr = dst.begin();
+ const auto *const src_ptr = src.begin();
+ const auto *const diagonal_ptr = diagonal.begin();
DEAL_II_OPENMP_SIMD_PRAGMA
for (unsigned int i = 0; i < src.locally_owned_size(); ++i)
import_elements(
const ReadWriteVector<Number> &V,
VectorOperation::values operation,
- std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
- communication_pattern = {});
+ const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
+ &communication_pattern = {});
/**
* @deprecated Use import_elements() instead.
Vector<Number>::import_elements(
const ReadWriteVector<Number> &V,
VectorOperation::values operation,
- std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
- communication_pattern)
+ const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
+ &communication_pattern)
{
// If no communication pattern is given, create one. Otherwise, use the
// one given.
MPI_Comm
Vector<Number>::get_mpi_communicator() const
{
- const auto tpetra_comm = dynamic_cast<const Teuchos::MpiComm<int> *>(
- vector->getMap()->getComm().get());
+ const auto *const tpetra_comm =
+ dynamic_cast<const Teuchos::MpiComm<int> *>(
+ vector->getMap()->getComm().get());
Assert(tpetra_comm != nullptr, ExcInternalError());
return *(tpetra_comm->getRawMpiComm())();
}
const types::global_dof_index i)
{
// Extract local indices in the vector.
- Tpetra::Vector<NumberType, int, types::signed_global_dof_index> vector =
- V.trilinos_vector();
+ const Tpetra::Vector<NumberType, int, types::signed_global_dof_index>
+ & vector = V.trilinos_vector();
TrilinosWrappers::types::int_type trilinos_i =
vector.getMap()->getLocalElement(
static_cast<TrilinosWrappers::types::int_type>(i));
if (evaluation_flag & EvaluationFlags::values)
{
- const auto shape_values = shape_data.front().shape_values.data();
- auto values_quad_ptr = fe_eval.begin_values();
- auto values_dofs_actual_ptr = values_dofs_actual;
+ const auto *const shape_values = shape_data.front().shape_values.data();
+ auto * values_quad_ptr = fe_eval.begin_values();
+ const auto * values_dofs_actual_ptr = values_dofs_actual;
Eval eval(shape_values, nullptr, nullptr, n_dofs, n_q_points);
for (unsigned int c = 0; c < n_components; ++c)
if (evaluation_flag & EvaluationFlags::gradients)
{
- const auto shape_gradients = shape_data.front().shape_gradients.data();
- auto gradients_quad_ptr = fe_eval.begin_gradients();
- auto values_dofs_actual_ptr = values_dofs_actual;
+ const auto *const shape_gradients =
+ shape_data.front().shape_gradients.data();
+ auto * gradients_quad_ptr = fe_eval.begin_gradients();
+ const auto *values_dofs_actual_ptr = values_dofs_actual;
for (unsigned int c = 0; c < n_components; ++c)
{
if (integration_flag & EvaluationFlags::values)
{
- const auto shape_values = shape_data.front().shape_values.data();
- auto values_quad_ptr = fe_eval.begin_values();
- auto values_dofs_actual_ptr = values_dofs_actual;
+ const auto *const shape_values = shape_data.front().shape_values.data();
+ auto * values_quad_ptr = fe_eval.begin_values();
+ auto * values_dofs_actual_ptr = values_dofs_actual;
Eval eval(shape_values, nullptr, nullptr, n_dofs, n_q_points);
for (unsigned int c = 0; c < n_components; ++c)
if (integration_flag & EvaluationFlags::gradients)
{
- const auto shape_gradients = shape_data.front().shape_gradients.data();
- auto gradients_quad_ptr = fe_eval.begin_gradients();
- auto values_dofs_actual_ptr = values_dofs_actual;
+ const auto *const shape_gradients =
+ shape_data.front().shape_gradients.data();
+ auto *gradients_quad_ptr = fe_eval.begin_gradients();
+ auto *values_dofs_actual_ptr = values_dofs_actual;
for (unsigned int c = 0; c < n_components; ++c)
{
if (evaluation_flag & EvaluationFlags::values)
{
- const auto shape_values =
+ const auto *const shape_values =
&shape_data.shape_values_face(face_no, face_orientation, 0);
- auto values_quad_ptr = fe_eval.begin_values();
- auto values_dofs_actual_ptr = values_dofs;
+ auto *values_quad_ptr = fe_eval.begin_values();
+ auto *values_dofs_actual_ptr = values_dofs;
Eval eval(shape_values, nullptr, nullptr, n_dofs, n_q_points);
for (unsigned int c = 0; c < n_components; ++c)
if (evaluation_flag & EvaluationFlags::gradients)
{
- auto gradients_quad_ptr = fe_eval.begin_gradients();
- auto values_dofs_actual_ptr = values_dofs;
+ auto * gradients_quad_ptr = fe_eval.begin_gradients();
+ const auto *values_dofs_actual_ptr = values_dofs;
std::array<const Number2 *, dim> shape_gradients;
for (unsigned int d = 0; d < dim; ++d)
if (integration_flag & EvaluationFlags::values)
{
- const auto shape_values =
+ const auto *const shape_values =
&shape_data.shape_values_face(face_no, face_orientation, 0);
- auto values_quad_ptr = fe_eval.begin_values();
- auto values_dofs_actual_ptr = values_dofs;
+ auto *values_quad_ptr = fe_eval.begin_values();
+ auto *values_dofs_actual_ptr = values_dofs;
Eval eval(shape_values, nullptr, nullptr, n_dofs, n_q_points);
for (unsigned int c = 0; c < n_components; ++c)
if (integration_flag & EvaluationFlags::gradients)
{
- auto gradients_quad_ptr = fe_eval.begin_gradients();
- auto values_dofs_actual_ptr = values_dofs;
+ auto *gradients_quad_ptr = fe_eval.begin_gradients();
+ auto *values_dofs_actual_ptr = values_dofs;
std::array<const Number2 *, dim> shape_gradients;
for (unsigned int d = 0; d < dim; ++d)
const Number *in = in_array + d * n_q_points;
Number * out = out_array + d * dofs_per_component;
- auto temp_1 = do_inplace ? out : fe_eval.get_scratch_data().begin();
- auto temp_2 = do_inplace ?
- out :
- (temp_1 + std::max(n_q_points, dofs_per_component));
+ auto *temp_1 = do_inplace ? out : fe_eval.get_scratch_data().begin();
+ auto *temp_2 = do_inplace ?
+ out :
+ (temp_1 + std::max(n_q_points, dofs_per_component));
if (dim == 3)
{
if (ghosted_level_vector[level].size() > 0)
ghosted_vector = src[level];
- const auto ghosted_vector_ptr = (ghosted_level_vector[level].size() > 0) ?
- &ghosted_vector :
- &src[level];
+ const auto *const ghosted_vector_ptr =
+ (ghosted_level_vector[level].size() > 0) ? &ghosted_vector :
+ &src[level];
ghosted_vector_ptr->update_ghost_values();
LinearAlgebra::distributed::Vector<Number> & dst,
const LinearAlgebra::distributed::Vector<Number> &src) const
{
- const bool use_dst_inplace = this->vec_fine.size() == 0;
- const auto vec_fine_ptr = use_dst_inplace ? &dst : &this->vec_fine;
+ const bool use_dst_inplace = this->vec_fine.size() == 0;
+ auto *const vec_fine_ptr = use_dst_inplace ? &dst : &this->vec_fine;
Assert(vec_fine_ptr->get_partitioner().get() == this->partitioner_fine.get(),
ExcInternalError());
- const bool use_src_inplace = this->vec_coarse.size() == 0;
- const auto vec_coarse_ptr = use_src_inplace ? &src : &this->vec_coarse;
+ const bool use_src_inplace = this->vec_coarse.size() == 0;
+ const auto *const vec_coarse_ptr = use_src_inplace ? &src : &this->vec_coarse;
Assert(vec_coarse_ptr->get_partitioner().get() ==
this->partitioner_coarse.get(),
ExcInternalError());
restrict_and_add(LinearAlgebra::distributed::Vector<Number> & dst,
const LinearAlgebra::distributed::Vector<Number> &src) const
{
- const bool use_src_inplace = this->vec_fine.size() == 0;
- const auto vec_fine_ptr = use_src_inplace ? &src : &this->vec_fine;
+ const bool use_src_inplace = this->vec_fine.size() == 0;
+ const auto *const vec_fine_ptr = use_src_inplace ? &src : &this->vec_fine;
Assert(vec_fine_ptr->get_partitioner().get() == this->partitioner_fine.get(),
ExcInternalError());
- const bool use_dst_inplace = this->vec_coarse.size() == 0;
- const auto vec_coarse_ptr = use_dst_inplace ? &dst : &this->vec_coarse;
+ const bool use_dst_inplace = this->vec_coarse.size() == 0;
+ auto *const vec_coarse_ptr = use_dst_inplace ? &dst : &this->vec_coarse;
Assert(vec_coarse_ptr->get_partitioner().get() ==
this->partitioner_coarse.get(),
ExcInternalError());
{
const unsigned int n_lanes = VectorizedArrayType::size();
- const bool use_src_inplace = this->vec_fine.size() == 0;
- const auto vec_fine_ptr = use_src_inplace ? &src : &this->vec_fine;
+ const bool use_src_inplace = this->vec_fine.size() == 0;
+ const auto *const vec_fine_ptr = use_src_inplace ? &src : &this->vec_fine;
Assert(vec_fine_ptr->get_partitioner().get() == this->partitioner_fine.get(),
ExcInternalError());
- const bool use_dst_inplace = this->vec_coarse.size() == 0;
- const auto vec_coarse_ptr = use_dst_inplace ? &dst : &this->vec_coarse;
+ const bool use_dst_inplace = this->vec_coarse.size() == 0;
+ auto *const vec_coarse_ptr = use_dst_inplace ? &dst : &this->vec_coarse;
Assert(vec_coarse_ptr->get_partitioner().get() ==
this->partitioner_coarse.get(),
ExcInternalError());
if (dof_processed[local_dof_idx] == false)
{
if (!constraint.is_constrained(global_dof_idx))
- support_point_dofs.emplace_back(std::make_pair(
+ support_point_dofs.emplace_back(
partitioner_support_points.global_to_local(
support_point_indices[i]),
- global_dof_idx));
+ global_dof_idx);
dof_processed[local_dof_idx] = true;
}
static_cast<std::uint32_t>(
compressed_data_length)}; /* list of compressed sizes of blocks */
- const auto header_start =
+ const auto *const header_start =
reinterpret_cast<const unsigned char *>(&compression_header[0]);
return (Utilities::encode_base64(
// likely did not intend. As a consequence, filter out this specific
// flag.
std::vector<char *> argv_new;
- for (const auto arg : make_array_view(&argv[0], &argv[0] + argc))
+ for (auto *const arg : make_array_view(&argv[0], &argv[0] + argc))
if (strcmp(arg, "--help") != 0)
argv_new.push_back(arg);
#ifdef DEAL_II_WITH_MPI
// Before exiting, wait for nonblocking communication to complete:
- for (auto request : requests)
+ for (auto *request : requests)
{
const int ierr = MPI_Wait(request, MPI_STATUS_IGNORE);
AssertThrowMPI(ierr);
acceptor_it != class_list.rend();
++acceptor_it)
{
- const auto acceptor = *acceptor_it;
+ auto *const acceptor = *acceptor_it;
if (acceptor->get_acceptor_id() >= get_acceptor_id())
continue;
bool has_trailing = acceptor->get_section_name().back() == sep;
: counter(0)
, object_info(subscriptor.object_info)
{
- for (const auto validity_ptr : subscriptor.validity_pointers)
+ for (auto *const validity_ptr : subscriptor.validity_pointers)
*validity_ptr = false;
subscriptor.validity_pointers.clear();
}
Subscriptor::~Subscriptor()
{
- for (const auto validity_ptr : validity_pointers)
+ for (auto *const validity_ptr : validity_pointers)
*validity_ptr = false;
object_info = nullptr;
}
Subscriptor &
Subscriptor::operator=(Subscriptor &&s) noexcept
{
- for (const auto validity_ptr : s.validity_pointers)
+ for (auto *const validity_ptr : s.validity_pointers)
*validity_ptr = false;
s.validity_pointers.clear();
object_info = s.object_info;
Assert(tria != nullptr, ExcInternalError());
if (average_values)
- for (const auto vec : all_out)
+ for (auto *const vec : all_out)
*vec = 0.0;
VectorType valence;
(Number(1.0) / static_cast<Number>(valence[i])));
valence.compress(VectorOperation::insert);
- for (const auto vec : all_out)
+ for (auto *const vec : all_out)
{
// compress and weight with valence
vec->compress(VectorOperation::add);
}
else
{
- for (const auto vec : all_out)
+ for (auto *const vec : all_out)
vec->compress(VectorOperation::insert);
}
// we have to extract the correct slice out of the global
// vector of values:
- const auto begin =
+ const auto *const begin =
std::begin(point_values[n]) + current_vector_component;
- const auto end = begin + n_base_components;
+ const auto *const end = begin + n_base_components;
std::copy(begin, end, std::begin(base_point_values[j]));
}
std::sin(gamma) * edge_length);
// loop over vertices of all cells
- for (auto &cell : tria.cell_iterators())
+ for (const auto &cell : tria.cell_iterators())
for (const unsigned int v : GeometryInfo<2>::vertex_indices())
{
// vertex has been already processed: nothing to do
MeshGenerator mesh_generator(additional_data);
// Cast the triangulation to the right type so that the right
// specialization of the function create_triangulation is picked up.
- if (auto parallel_tria =
+ if (auto *parallel_tria =
dynamic_cast<dealii::parallel::distributed::Triangulation<2, 2> *>(
&tria))
mesh_generator.create_triangulation(*parallel_tria, periodic_faces);
- else if (auto parallel_tria = dynamic_cast<
+ else if (auto *parallel_tria = dynamic_cast<
dealii::parallel::fullydistributed::Triangulation<2, 2> *>(
&tria))
mesh_generator.create_triangulation(*parallel_tria, periodic_faces);
tria.reset_all_manifolds();
tria.set_all_manifold_ids(0);
- for (auto &cell : tria.cell_iterators())
+ for (const auto &cell : tria.cell_iterators())
{
// identify faces on torus surface and set manifold to 1
for (const unsigned int f : GeometryInfo<3>::face_indices())
PetscFunctionBeginUser;
PetscCall(PCShellGetContext(ppc, &ctx));
- auto user = static_cast<PreconditionShell *>(ctx);
+ auto *user = static_cast<PreconditionShell *>(ctx);
if (!user->vmult)
SETERRQ(
PetscObjectComm((PetscObject)ppc),
PetscFunctionBeginUser;
PetscCall(PCShellGetContext(ppc, &ctx));
- auto user = static_cast<PreconditionShell *>(ctx);
+ auto *user = static_cast<PreconditionShell *>(ctx);
if (!user->vmultT)
SETERRQ(
PetscObjectComm((PetscObject)ppc),
sorted_ids.reserve(ids.size());
sorted_properties.reserve(properties.size());
- for (auto &handle : handles_to_sort)
+ for (const auto &handle : handles_to_sort)
{
Assert(handle != invalid_handle,
ExcMessage(