// also make sure that no name is
// used twice
- for (std::vector<std::string>::const_iterator name = names.begin();
- name != names.end();
- ++name)
+ for (const auto &name : names)
{
- for (typename std::vector<DataVector>::const_iterator data_set =
- dof_data.begin();
- data_set != dof_data.end();
- ++data_set)
- for (unsigned int i = 0; i < data_set->names.size(); ++i)
- Assert(*name != data_set->names[i], ExcNameAlreadyUsed(*name));
-
- for (typename std::vector<DataVector>::const_iterator data_set =
- cell_data.begin();
- data_set != cell_data.end();
- ++data_set)
- for (unsigned int i = 0; i < data_set->names.size(); ++i)
- Assert(*name != data_set->names[i], ExcNameAlreadyUsed(*name));
+ (void)name;
+ for (const auto &data_set : dof_data)
+ for (const auto &data_set_name : data_set.names)
+ Assert(name != data_set_name, ExcNameAlreadyUsed(name));
+
+ for (const auto &data_set : cell_data)
+ for (const auto &data_set_name : data_set.names)
+ Assert(name != data_set_name, ExcNameAlreadyUsed(name));
}
switch (vector_type)
(names.size() == dof_handler->get_fe(0).n_components())),
Exceptions::DataOutImplementation::ExcInvalidNumberOfNames(
names.size(), dof_handler->get_fe(0).n_components()));
- for (unsigned int i = 0; i < names.size(); ++i)
- Assert(names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+ for (const auto &name : names)
+ {
+ (void)name;
+ Assert(name.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789_<>()") == std::string::npos,
+ Exceptions::DataOutImplementation::ExcInvalidCharacter(
+ name,
+ 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_<>()")));
+ "0123456789_<>()")));
+ }
if (vec.size() == dof_handler->n_dofs())
{
// figure out which rows of the matrix we
// have to eliminate on this processor
std::vector<types::global_dof_index> constrained_rows;
- for (std::map<types::global_dof_index, PetscScalar>::const_iterator
- dof = boundary_values.begin();
- dof != boundary_values.end();
- ++dof)
- if ((dof->first >= local_range.first) &&
- (dof->first < local_range.second))
- constrained_rows.push_back(dof->first);
+ for (const auto &boundary_value : boundary_values)
+ if ((boundary_value.first >= local_range.first) &&
+ (boundary_value.first < local_range.second))
+ constrained_rows.push_back(boundary_value.first);
// then eliminate these rows and set
// their diagonal entry to what we have
std::vector<types::global_dof_index> indices;
std::vector<PetscScalar> solution_values;
- for (std::map<types::global_dof_index, PetscScalar>::const_iterator
- dof = boundary_values.begin();
- dof != boundary_values.end();
- ++dof)
- if ((dof->first >= local_range.first) &&
- (dof->first < local_range.second))
+ for (const auto &boundary_value : boundary_values)
+ if ((boundary_value.first >= local_range.first) &&
+ (boundary_value.first < local_range.second))
{
- indices.push_back(dof->first);
- solution_values.push_back(dof->second);
+ indices.push_back(boundary_value.first);
+ solution_values.push_back(boundary_value.second);
}
solution.set(indices, solution_values);
// now also set appropriate values for
// the rhs
- for (unsigned int i = 0; i < solution_values.size(); ++i)
- solution_values[i] *= average_nonzero_diagonal_entry;
+ for (double &solution_value : solution_values)
+ solution_value *= average_nonzero_diagonal_entry;
right_hand_side.set(indices, solution_values);
}
{
int block = 0;
dealii::types::global_dof_index offset = 0;
- for (std::map<types::global_dof_index, PetscScalar>::const_iterator dof =
- boundary_values.begin();
- dof != boundary_values.end();
- ++dof)
+ for (const auto &boundary_value : boundary_values)
{
- if (dof->first >= matrix.block(block, 0).m() + offset)
+ if (boundary_value.first >= matrix.block(block, 0).m() + offset)
{
offset += matrix.block(block, 0).m();
block++;
}
- const types::global_dof_index index = dof->first - offset;
+ const types::global_dof_index index = boundary_value.first - offset;
block_boundary_values[block].insert(
- std::pair<types::global_dof_index, PetscScalar>(index,
- dof->second));
+ std::pair<types::global_dof_index, PetscScalar>(
+ index, boundary_value.second));
}
}
// figure out which rows of the matrix we
// have to eliminate on this processor
std::vector<types::global_dof_index> constrained_rows;
- for (std::map<types::global_dof_index,
- TrilinosScalar>::const_iterator dof =
- boundary_values.begin();
- dof != boundary_values.end();
- ++dof)
- if ((dof->first >= local_range.first) &&
- (dof->first < local_range.second))
- constrained_rows.push_back(dof->first);
+ for (const auto &boundary_value : boundary_values)
+ if ((boundary_value.first >= local_range.first) &&
+ (boundary_value.first < local_range.second))
+ constrained_rows.push_back(boundary_value.first);
// then eliminate these rows and
// set their diagonal entry to
std::vector<types::global_dof_index> indices;
std::vector<TrilinosScalar> solution_values;
- for (std::map<types::global_dof_index,
- TrilinosScalar>::const_iterator dof =
- boundary_values.begin();
- dof != boundary_values.end();
- ++dof)
- if ((dof->first >= local_range.first) &&
- (dof->first < local_range.second))
+ for (const auto &boundary_value : boundary_values)
+ if ((boundary_value.first >= local_range.first) &&
+ (boundary_value.first < local_range.second))
{
- indices.push_back(dof->first);
- solution_values.push_back(dof->second);
+ indices.push_back(boundary_value.first);
+ solution_values.push_back(boundary_value.second);
}
solution.set(indices, solution_values);
{
int block = 0;
types::global_dof_index offset = 0;
- for (std::map<types::global_dof_index, TrilinosScalar>::const_iterator
- dof = boundary_values.begin();
- dof != boundary_values.end();
- ++dof)
+ for (const auto &boundary_value : boundary_values)
{
- if (dof->first >= matrix.block(block, 0).m() + offset)
+ if (boundary_value.first >= matrix.block(block, 0).m() + offset)
{
offset += matrix.block(block, 0).m();
block++;
}
- const types::global_dof_index index = dof->first - offset;
+ const types::global_dof_index index =
+ boundary_value.first - offset;
block_boundary_values[block].insert(
std::pair<types::global_dof_index, TrilinosScalar>(
- index, dof->second));
+ index, boundary_value.second));
}
}