# ifdef DEBUG
const std::vector<unsigned int> index_set(
internal::extract_field_component_indices<dim>(extractor));
- for (unsigned int i = 0; i < index_set.size(); ++i)
+ for (const unsigned int index : index_set)
{
Assert(
- this->registered_independent_variable_values[index_set[i]] == false,
+ this->registered_independent_variable_values[index] == false,
ExcMessage(
"Overlapping indices for independent variables. "
"One or more indices associated with the field that "
<< "Constr rows " << n_constraints() << std::endl
<< "Inhom rows " << n_inhomogeneous_rows << std::endl
<< "Local: ";
- for (size_type i = 0; i < total_row_indices.size(); ++i)
- os << ' ' << std::setw(4) << total_row_indices[i].local_row;
+ for (const auto &total_row_index : total_row_indices)
+ os << ' ' << std::setw(4) << total_row_index.local_row;
os << std::endl << "Global:";
- for (size_type i = 0; i < total_row_indices.size(); ++i)
- os << ' ' << std::setw(4) << total_row_indices[i].global_row;
+ for (const auto &total_row_index : total_row_indices)
+ os << ' ' << std::setw(4) << total_row_index.global_row;
os << std::endl << "ConPos:";
- for (size_type i = 0; i < total_row_indices.size(); ++i)
- os << ' ' << std::setw(4) << total_row_indices[i].constraint_position;
+ for (const auto &total_row_index : total_row_indices)
+ os << ' ' << std::setw(4) << total_row_index.constraint_position;
os << std::endl;
}
Vector<Number, MemorySpaceType>::clear_mpi_requests()
{
#ifdef DEAL_II_WITH_MPI
- for (size_type j = 0; j < compress_requests.size(); j++)
+ for (auto &compress_request : compress_requests)
{
- const int ierr = MPI_Request_free(&compress_requests[j]);
+ const int ierr = MPI_Request_free(&compress_request);
AssertThrowMPI(ierr);
}
compress_requests.clear();
- for (size_type j = 0; j < update_ghost_values_requests.size(); j++)
+ for (auto &update_ghost_values_request : update_ghost_values_requests)
{
- const int ierr = MPI_Request_free(&update_ghost_values_requests[j]);
+ const int ierr = MPI_Request_free(&update_ghost_values_request);
AssertThrowMPI(ierr);
}
update_ghost_values_requests.clear();
RelaxationBlock<MatrixType, InverseNumberType, VectorType>::AdditionalData::
memory_consumption() const
{
- std::size_t result =
- sizeof(*this) + block_list.memory_consumption() - sizeof(block_list);
- for (unsigned int i = 0; i < order.size(); ++i)
- result += MemoryConsumption::memory_consumption(order[i]);
- return result;
+ return sizeof(*this) + block_list.memory_consumption() - sizeof(block_list) +
+ MemoryConsumption::memory_consumption(order);
}
std::size_t
SparseBlockVanka<number>::memory_consumption() const
{
- std::size_t mem = SparseVanka<number>::memory_consumption();
- for (size_type i = 0; i < dof_masks.size(); ++i)
- mem += MemoryConsumption::memory_consumption(dof_masks[i]);
- return mem;
+ return SparseVanka<number>::memory_consumption() +
+ MemoryConsumption::memory_consumption(dof_masks);
}
cells_close_to_boundary.end());
std::vector<unsigned int> final_cells;
final_cells.reserve(cells_close_to_boundary.size());
- for (unsigned int i = 0; i < cells_close_to_boundary.size(); ++i)
- if (at_processor_boundary[cells_close_to_boundary[i]] == false)
- final_cells.push_back(cells_close_to_boundary[i]);
+ for (const unsigned int cell : cells_close_to_boundary)
+ if (at_processor_boundary[cell] == false)
+ final_cells.push_back(cell);
cells_close_to_boundary = std::move(final_cells);
}
additional_data.cell_vectorization_categories_strict ||
dof_handlers.active_dof_handler == DoFHandlers::hp;
unsigned int dofs_per_cell = 0;
- for (unsigned int no = 0; no < dof_info.size(); ++no)
- dofs_per_cell = std::max(dofs_per_cell, dof_info[no].dofs_per_cell[0]);
+ for (const auto &info : dof_info)
+ dofs_per_cell = std::max(dofs_per_cell, info.dofs_per_cell[0]);
task_info.create_blocks_serial(subdomain_boundary_cells,
face_setup.cells_close_to_boundary,
dofs_per_cell,
Assert(data.get() != nullptr, ExcNotInitialized());
typename Base<dim, VectorType, VectorizedArrayType>::size_type total_size =
0;
- for (unsigned int i = 0; i < selected_rows.size(); ++i)
- total_size += data->get_vector_partitioner(selected_rows[i])->size();
+ for (const unsigned int selected_row : selected_rows)
+ total_size += data->get_vector_partitioner(selected_row)->size();
return total_size;
}
Assert(data.get() != nullptr, ExcNotInitialized());
typename Base<dim, VectorType, VectorizedArrayType>::size_type total_size =
0;
- for (unsigned int i = 0; i < selected_columns.size(); ++i)
- total_size += data->get_vector_partitioner(selected_columns[i])->size();
+ for (const unsigned int selected_column : selected_columns)
+ total_size += data->get_vector_partitioner(selected_column)->size();
return total_size;
}
const unsigned int nqp = fevalv[0]->n_quadrature_points;
values.resize(global_data->n_values());
- // For all selected finite
- // element functions
- for (unsigned int i = 0; i < values.size(); ++i)
+ // For all selected finite element functions
+ for (auto &function_values : values)
{
- values[i].resize(n_components);
+ function_values.resize(n_components);
// For all components
- for (unsigned int j = 0; j < values[i].size(); ++j)
+ for (auto &component_values : function_values)
{
- values[i][j].resize(nqp);
+ component_values.resize(nqp);
}
}
gradients.resize(global_data->n_gradients());
- // For all selected finite
- // element functions
- for (unsigned int i = 0; i < gradients.size(); ++i)
+ // For all selected finite element functions
+ for (auto &function_gradients : gradients)
{
- gradients[i].resize(n_components);
+ function_gradients.resize(n_components);
// For all components
- for (unsigned int j = 0; j < gradients[i].size(); ++j)
+ for (auto &component_gradients : function_gradients)
{
- gradients[i][j].resize(nqp);
+ component_gradients.resize(nqp);
}
}
hessians.resize(global_data->n_hessians());
- // For all selected finite
- // element functions
- for (unsigned int i = 0; i < hessians.size(); ++i)
+ // For all selected finite element functions
+ for (auto &function_hessians : hessians)
{
- hessians[i].resize(n_components);
+ function_hessians.resize(n_components);
// For all components
- for (unsigned int j = 0; j < hessians[i].size(); ++j)
+ for (auto &component_hessians : function_hessians)
{
- hessians[i][j].resize(nqp);
+ component_hessians.resize(nqp);
}
}
}
VectorType &dst_level = dst[level];
// first copy local unknowns
- for (dof_pair_iterator i = copy_indices[level].begin();
- i != copy_indices[level].end();
- ++i)
- dst_level(i->second) = src(i->first);
+ for (const auto ©_index : copy_indices[level])
+ dst_level(copy_index.second) = src(copy_index.first);
// Do the same for the indices where the global index is local, but the
// local index is not
- for (dof_pair_iterator i = copy_indices_global_mine[level].begin();
- i != copy_indices_global_mine[level].end();
- ++i)
- dst_level(i->second) = src(i->first);
+ for (const auto ©_index : copy_indices_global_mine[level])
+ dst_level(copy_index.second) = src(copy_index.first);
dst_level.compress(VectorOperation::insert);
const VectorType &src_level = src[level];
// First copy all indices local to this process
- for (dof_pair_iterator i = copy_indices[level].begin();
- i != copy_indices[level].end();
- ++i)
- dst(i->first) = src_level(i->second);
+ for (const auto ©_index : copy_indices[level])
+ dst(copy_index.first) = src_level(copy_index.second);
// Do the same for the indices where the level index is local, but the
// global index is not
- for (dof_pair_iterator i = copy_indices_level_mine[level].begin();
- i != copy_indices_level_mine[level].end();
- ++i)
- dst(i->first) = src_level(i->second);
+ for (const auto ©_index : copy_indices_level_mine[level])
+ dst(copy_index.first) = src_level(copy_index.second);
#ifdef DEBUG_OUTPUT
{
const VectorType &src_level = src[level];
// First add all indices local to this process
- for (dof_pair_iterator i = copy_indices[level].begin();
- i != copy_indices[level].end();
- ++i)
- dst(i->first) += src_level(i->second);
+ for (const auto ©_index : copy_indices[level])
+ dst(copy_index.first) += src_level(copy_index.second);
// Do the same for the indices where the level index is local, but the
// global index is not
- for (dof_pair_iterator i = copy_indices_level_mine[level].begin();
- i != copy_indices_level_mine[level].end();
- ++i)
- dst(i->first) += src_level(i->second);
+ for (const auto ©_index : copy_indices_level_mine[level])
+ dst(copy_index.first) += src_level(copy_index.second);
}
dst.compress(VectorOperation::add);
}
names.size()));
// check that the names use only allowed characters
- for (unsigned int i = 0; i < names.size(); ++i)
- Assert(names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789_<>()") ==
- std::string::npos,
+ for (const auto &name : names)
+ Assert(name.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789_<>()") == std::string::npos,
Exceptions::DataOutImplementation::ExcInvalidCharacter(
- names[i],
- names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789_<>()")));
+ name,
+ name.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789_<>()")));
}
data_postprocessor->get_data_component_interpretation().size()));
// check that the names use only allowed characters
- for (unsigned int i = 0; i < names.size(); ++i)
- Assert(names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789_<>()") ==
- std::string::npos,
+ for (const auto &name : names)
+ Assert(name.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789_<>()") == std::string::npos,
Exceptions::DataOutImplementation::ExcInvalidCharacter(
- names[i],
- names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789_<>()")));
+ name,
+ name.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789_<>()")));
}
HelperBase<ADNumberTypeCode,
ScalarType>::reset_registered_independent_variables()
{
- for (typename std::vector<bool>::iterator it =
- registered_independent_variable_values.begin();
- it != registered_independent_variable_values.end();
- ++it)
- *it = false;
+ for (auto &®istered_independent_variable_value :
+ registered_independent_variable_values)
+ registered_independent_variable_value = false;
}
HelperBase<ADNumberTypeCode, ScalarType>::
reset_registered_dependent_variables(const bool flag)
{
- for (typename std::vector<bool>::iterator it =
- registered_marked_dependent_variables.begin();
- it != registered_marked_dependent_variables.end();
- ++it)
- *it = flag;
+ for (auto &®istered_marked_dependent_variable :
+ registered_marked_dependent_variables)
+ registered_marked_dependent_variable = flag;
}
// Write out node numbers
// Loop over all nodes
- for (unsigned int ii = 0; ii < node_list.size(); ++ii)
+ for (const auto &node : node_list)
{
// Node number
- output << node_list[ii][0] << "\t";
+ output << node[0] << "\t";
// Node coordinates
output.setf(std::ios::scientific, std::ios::floatfield);
for (unsigned int jj = 1; jj < spacedim + 1; ++jj)
{
// invoke tolerance -> set points close to zero equal to zero
- if (std::abs(node_list[ii][jj]) > tolerance)
- output << static_cast<double>(node_list[ii][jj]) << "\t";
+ if (std::abs(node[jj]) > tolerance)
+ output << static_cast<double>(node[jj]) << "\t";
else
output << 0.0 << "\t";
}
MemoryConsumption::memory_consumption(number_cache) +
MemoryConsumption::memory_consumption(vertex_dofs) +
MemoryConsumption::memory_consumption(vertex_dof_offsets));
- for (unsigned int i = 0; i < levels.size(); ++i)
- mem += MemoryConsumption::memory_consumption(*levels[i]);
+ for (const auto &level : levels)
+ mem += MemoryConsumption::memory_consumption(*level);
mem += MemoryConsumption::memory_consumption(*faces);
return mem;
// check whether there is a renumbering of degrees of freedom on
// either the finest level or the global dofs, which means that we
// cannot apply a plain copy
- for (unsigned int i = 0; i < copy_indices.back().size(); ++i)
- if (copy_indices.back()[i].first != copy_indices.back()[i].second)
+ for (const auto ©_index : copy_indices.back())
+ if (copy_index.first != copy_index.second)
{
my_perform_plain_copy = false;
break;
new_point_geometry_data(location, current_points, new_solution_indices);
point_geometry_data.push_back(new_point_geometry_data);
- std::map<std::string, std::vector<std::vector<double>>>::iterator
- data_store_begin = data_store.begin();
- for (; data_store_begin != data_store.end(); ++data_store_begin)
+ for (auto &data_entry : data_store)
{
- // add an extra row to each vector
- // entry
+ // add an extra row to each vector entry
const ComponentMask ¤t_mask =
- (component_mask.find(data_store_begin->first))->second;
+ (component_mask.find(data_entry.first))->second;
unsigned int n_stored = current_mask.n_selected_components();
- data_store_begin->second.resize(data_store_begin->second.size() +
- n_stored);
+ data_entry.second.resize(data_entry.second.size() + n_stored);
}
}
point_geometry_data.push_back(new_point_geometry_data);
- std::map<std::string, std::vector<std::vector<double>>>::iterator
- data_store_begin = data_store.begin();
- for (; data_store_begin != data_store.end(); ++data_store_begin)
+ for (auto &data_entry : data_store)
{
- // add an extra row to each vector
- // entry
+ // add an extra row to each vector entry
const ComponentMask current_mask =
- (component_mask.find(data_store_begin->first))->second;
+ (component_mask.find(data_entry.first))->second;
unsigned int n_stored = current_mask.n_selected_components();
- data_store_begin->second.resize(data_store_begin->second.size() +
- n_stored);
+ data_entry.second.resize(data_entry.second.size() + n_stored);
}
}
}
if (indep_names.size() > 0)
{
- for (unsigned int name = 0; name < indep_names.size(); name++)
+ for (const auto &indep_name : indep_names)
{
- to_gnuplot << "<" << indep_names[name] << "> ";
+ to_gnuplot << "<" << indep_name << "> ";
}
to_gnuplot << "\n";
}
if (indep_names.size() > 0)
{
- for (unsigned int name = 0; name < indep_names.size(); name++)
+ for (const auto &indep_name : indep_names)
{
- to_gnuplot << "<" << indep_names[name] << "> ";
+ to_gnuplot << "<" << indep_name << "> ";
}
}
else
}
}
- for (std::map<std::string, std::vector<std::vector<double>>>::iterator
- data_store_begin = data_store.begin();
- data_store_begin != data_store.end();
- ++data_store_begin)
+ for (const auto &data_entry : data_store)
{
typename std::map<std::string, ComponentMask>::iterator mask =
- component_mask.find(data_store_begin->first);
+ component_mask.find(data_entry.first);
unsigned int n_stored = mask->second.n_selected_components();
std::vector<std::string> names =
- (component_names_map.find(data_store_begin->first))->second;
+ (component_names_map.find(data_entry.first))->second;
if (names.size() > 0)
{
for (unsigned int component = 0; component < n_stored;
component++)
{
- to_gnuplot << "<" << data_store_begin->first << "_"
- << component << "> ";
+ to_gnuplot << "<" << data_entry.first << "_" << component
+ << "> ";
}
}
}
to_gnuplot << " " << independent_values[component][key];
}
- for (std::map<std::string,
- std::vector<std::vector<double>>>::iterator
- data_store_begin = data_store.begin();
- data_store_begin != data_store.end();
- ++data_store_begin)
+ for (const auto &data_entry : data_store)
{
typename std::map<std::string, ComponentMask>::iterator mask =
- component_mask.find(data_store_begin->first);
+ component_mask.find(data_entry.first);
unsigned int n_stored = mask->second.n_selected_components();
for (unsigned int component = 0; component < n_stored;
{
to_gnuplot
<< " "
- << (data_store_begin
- ->second)[data_store_index * n_stored + component]
- [key];
+ << (data_entry.second)[data_store_index * n_stored +
+ component][key];
}
}
to_gnuplot << "\n";
if (indep_names.size() > 0)
{
out << "Names: ";
- for (unsigned int name = 0; name < indep_names.size(); name++)
+ for (const auto &indep_name : indep_names)
{
- out << "<" << indep_names[name] << "> ";
+ out << "<" << indep_name << "> ";
}
out << "\n";
}
out << "No independent values stored\n";
}
- std::map<std::string, std::vector<std::vector<double>>>::iterator
- data_store_begin = data_store.begin();
- if (data_store_begin != data_store.end())
+ if (data_store.begin() != data_store.end())
{
out
<< "Mnemonic: data set size (mask size, n true components) : n data sets\n";
}
- for (; data_store_begin != data_store.end(); ++data_store_begin)
+ for (const auto &data_entry : data_store)
{
// Find field mnemonic
- std::string vector_name = data_store_begin->first;
+ std::string vector_name = data_entry.first;
typename std::map<std::string, ComponentMask>::iterator mask =
component_mask.find(vector_name);
Assert(mask != component_mask.end(),
Assert(component_names != component_names_map.end(),
ExcMessage("vector_name not in class"));
- if (data_store_begin->second.size() != 0)
+ if (data_entry.second.size() != 0)
{
- out << data_store_begin->first << ": "
- << data_store_begin->second.size() << " (";
+ out << data_entry.first << ": " << data_entry.second.size() << " (";
out << mask->second.size() << ", "
<< mask->second.n_selected_components() << ") : ";
- out << (data_store_begin->second)[0].size() << "\n";
+ out << (data_entry.second)[0].size() << "\n";
}
else
{
- out << data_store_begin->first << ": "
- << data_store_begin->second.size() << " (";
+ out << data_entry.first << ": " << data_entry.second.size() << " (";
out << mask->second.size() << ", "
<< mask->second.n_selected_components() << ") : ";
out << "No points added"
return false;
}
}
- std::map<std::string, std::vector<std::vector<double>>>::iterator
- data_store_begin = data_store.begin();
if (have_dof_handler)
{
- for (; data_store_begin != data_store.end(); ++data_store_begin)
+ for (const auto &data_entry : data_store)
{
- Assert(data_store_begin->second.size() > 0, ExcInternalError());
- if ((data_store_begin->second)[0].size() != dataset_key.size())
+ Assert(data_entry.second.size() > 0, ExcInternalError());
+ if ((data_entry.second)[0].size() != dataset_key.size())
return false;
// this loop only tests one
// member for each name,
if (have_dof_handler)
{
- std::map<std::string, std::vector<std::vector<double>>>::iterator
- data_store_begin = data_store.begin();
- for (; data_store_begin != data_store.end(); ++data_store_begin)
+ for (const auto &data_entry : data_store)
{
- Assert(data_store_begin->second.size() > 0, ExcInternalError());
+ Assert(data_entry.second.size() > 0, ExcInternalError());
- if (std::abs(static_cast<int>((data_store_begin->second)[0].size()) -
+ if (std::abs(static_cast<int>((data_entry.second)[0].size()) -
static_cast<int>(dataset_key.size())) >= 2)
return false;
// this loop only tests one member