AnyData::entry(const unsigned int i)
{
AssertIndexRange(i, size());
- type *p = std::any_cast<type>(&data[i]);
+ const type *p = std::any_cast<type>(&data[i]);
Assert(p != nullptr,
ExcTypeMismatch(typeid(type).name(), data[i].type().name()));
return *p;
AnyData::entry(const std::string &n)
{
const unsigned int i = find(n);
- type *p = std::any_cast<type>(&data[i]);
+ const type *p = std::any_cast<type>(&data[i]);
Assert(p != 0, ExcTypeMismatch(typeid(type).name(), data[i].type().name()));
return *p;
}
{
(*inverse_derivative)(out2, src2);
}
- catch (SolverControl::NoConvergence &e)
+ catch (const SolverControl::NoConvergence &e)
{
deallog << "Inner iteration failed after " << e.last_step
<< " steps with residual " << e.last_residual << std::endl;
* the parameters just read.
*/
void
- parse_parameters(ParameterHandler ¶m);
+ parse_parameters(const ParameterHandler ¶m);
/**
* Return the left end of the time interval.
* again.
*/
void
- release_one_partitioner(std::shared_ptr<tbb::affinity_partitioner> &p);
+ release_one_partitioner(
+ const std::shared_ptr<tbb::affinity_partitioner> &p);
private:
/**
while (columns[key].entries.size() + 1 < max_col_length)
{
columns[key].entries.push_back(internal::TableEntry(T()));
- internal::TableEntry &entry = columns[key].entries.back();
+ const internal::TableEntry &entry = columns[key].entries.back();
entry.cache_string(columns[key].scientific, columns[key].precision);
columns[key].max_length =
std::max(columns[key].max_length,
// now push the value given to this function
columns[key].entries.push_back(internal::TableEntry(value));
- internal::TableEntry &entry = columns[key].entries.back();
+ const internal::TableEntry &entry = columns[key].entries.back();
entry.cache_string(columns[key].scientific, columns[key].precision);
columns[key].max_length =
std::max(columns[key].max_length,
struct maybe_make_ref
{
static T
- act(T &t)
+ act(const T &t)
{
return t;
}
void
join_all() const
{
- for (auto &t : tasks)
+ for (const auto &t : tasks)
t.join();
}
cell_iterator &cell,
const CellStatus status,
const boost::iterator_range<std::vector<char>::const_iterator>
- &data_range,
- std::vector<VectorType *> &all_out);
+ &data_range,
+ const std::vector<VectorType *> &all_out);
};
} // namespace distributed
} // namespace parallel
cell_iterator &cell,
const CellStatus status,
const boost::iterator_range<std::vector<char>::const_iterator>
- &data_range,
- std::vector<VectorType *> &all_out)
+ &data_range,
+ const std::vector<VectorType *> &all_out)
{
std::vector<value_type> cell_data;
*/
FESystem(FESystem<dim, spacedim> &&other_fe_system) noexcept
: FiniteElement<dim, spacedim>(std::move(other_fe_system))
- {
- base_elements = std::move(other_fe_system.base_elements);
- generalized_support_points_index_table =
- std::move(other_fe_system.generalized_support_points_index_table);
- }
+ , base_elements(std::move(other_fe_system.base_elements))
+ , generalized_support_points_index_table(
+ std::move(other_fe_system.generalized_support_points_index_table))
+ {}
/**
* Destructor.
// they are easy enough to rebuild upon re-loading data. do
// this here. don't forget to first resize the fields appropriately
{
- for (auto &level : levels)
+ for (const auto &level : levels)
{
level->active_cell_indices.resize(level->refine_flags.size());
level->global_active_cell_indices.resize(level->refine_flags.size());
return false;
if (rows > 0)
- for (size_type i = 0; i < rows + 1; ++i)
- if (rowstart[i] != sp2.rowstart[i])
- return false;
+ {
+ for (size_type i = 0; i < rows + 1; ++i)
+ if (rowstart[i] != sp2.rowstart[i])
+ return false;
- if (rows > 0)
- for (size_type i = 0; i < rowstart[rows]; ++i)
- if (colnums[i] != sp2.colnums[i])
- return false;
+ for (size_type i = 0; i < rowstart[rows]; ++i)
+ if (colnums[i] != sp2.colnums[i])
+ return false;
+ }
return true;
}
void
- TimestepControl::parse_parameters(ParameterHandler ¶m)
+ TimestepControl::parse_parameters(const ParameterHandler ¶m)
{
start(param.get_double("Start"));
start_step(param.get_double("First step"));
// the top that don't yet exist
set_auto_fill_mode(false);
- std::vector<internal::TableEntry> &entries = columns[data_column_key].entries;
- std::vector<internal::TableEntry> &ref_entries =
+ const std::vector<internal::TableEntry> &entries =
+ columns[data_column_key].entries;
+ const std::vector<internal::TableEntry> &ref_entries =
columns[reference_column_key].entries;
std::string rate_key = data_column_key + "...";
// the top that don't yet exist
set_auto_fill_mode(false);
- std::vector<internal::TableEntry> &entries = columns[data_column_key].entries;
- std::string rate_key = data_column_key + "...";
+ const std::vector<internal::TableEntry> &entries =
+ columns[data_column_key].entries;
+ std::string rate_key = data_column_key + "...";
const unsigned int n = entries.size();
std::string functionname =
stacktrace_entry.substr(pos_start + 1, pos_end - pos_start - 1);
- stacktrace_entry = stacktrace_entry.substr(0, pos_start);
+ stacktrace_entry.resize(pos_start);
stacktrace_entry += ": ";
// demangle, and if successful replace old mangled string by
}
else
{
- if (data_map.find(index) == data_map.end())
- data_map[index] = invalid_index_value;
-
- return data_map[index];
+ return data_map.try_emplace(index, invalid_index_value)
+ .first->second;
}
}
// which is initialized with the seed itself
static std::map<double, std::mt19937> rng_map;
- if (rng_map.find(seed) == rng_map.end())
- rng_map[seed] = std::mt19937(static_cast<unsigned int>(seed));
-
- return uniform_distribution(rng_map[seed]);
+ return uniform_distribution(
+ rng_map.try_emplace(seed, std::mt19937(static_cast<unsigned int>(seed)))
+ .first->second);
}
void
TBBPartitioner::release_one_partitioner(
- std::shared_ptr<tbb::affinity_partitioner> &p)
+ const std::shared_ptr<tbb::affinity_partitioner> &p)
{
if (p.get() == my_partitioner.get())
{
ParameterAcceptor::~ParameterAcceptor()
{
std::lock_guard<std::mutex> l(class_list_mutex);
- // Notice that it is possible that the class is no longer in the static list.
- // This happens when the clear() method has been called. We must guard that
- // this is not the case, and therefore we only remove ourselves from the list
- // if we are actually there.
- if (class_list.find(this) != class_list.end())
- class_list.erase(this);
+ class_list.erase(this);
}
acceptor_it != class_list.rend();
++acceptor_it)
{
- auto *const acceptor = *acceptor_it;
+ const auto *const acceptor = *acceptor_it;
if (acceptor->get_acceptor_id() >= get_acceptor_id())
continue;
bool has_trailing = acceptor->get_section_name().back() == sep;
current_section.sort(compare);
// Now transverse subsections tree recursively.
- for (auto &p : current_section)
+ for (const auto &p : current_section)
{
if ((is_parameter_node(p.second) == false) &&
(is_alias_node(p.second) == false))
const std::vector<PolyType> &polynomials)
: ScalarPolynomialsBase<dim>(internal::get_degree<dim>(polynomials),
polynomials.size())
+ , polys(polynomials)
{
- polys = polynomials;
-
poly_grads.resize(polynomials.size());
poly_hessians.resize(polynomials.size());
poly_third_derivatives.resize(polynomials.size());
Assert(n > 0, ExcMessage("Need at least one point for quadrature rules."));
std::vector<double> points =
internal::QGaussRadauChebyshev::get_quadrature_points(n, end_point);
- std::vector<double> weights =
+ std::vector<double> new_weights =
internal::QGaussRadauChebyshev::get_quadrature_weights(n, end_point);
for (unsigned int i = 0; i < this->size(); ++i)
{
this->quadrature_points[i] = Point<1>(points[i]);
- this->weights[i] = weights[i];
+ this->weights[i] = new_weights[i];
}
}
else
ss.setf(std::ios::fixed, std::ios::floatfield);
- std::visit([&ss](auto &v) { ss << v; }, value);
+ std::visit([&ss](const auto &v) { ss << v; }, value);
cached_value = ss.str();
if (cached_value.empty())
while (entries.size() < size)
{
entries.push_back(entries.back().get_default_constructed_copy());
- internal::TableEntry &entry = entries.back();
+ const internal::TableEntry &entry = entries.back();
entry.cache_string(scientific, precision);
max_length =
std::max(max_length,
while (column.second.entries.size() < max_col_length)
{
column.second.entries.emplace_back("");
- internal::TableEntry &entry = column.second.entries.back();
+ const internal::TableEntry &entry = column.second.entries.back();
entry.cache_string(column.second.scientific, column.second.precision);
column.second.max_length =
std::max(column.second.max_length,
else
out.setf(std::ios::fixed, std::ios::floatfield);
- std::visit([&out](auto &v) { out << v; }, column.entries[i].value);
+ std::visit([&out](const auto &v) { out << v; },
+ column.entries[i].value);
if (j < n_cols - 1)
out << " & ";
std::string
get_time()
{
- std::time_t time1 = std::time(nullptr);
- std::tm *time = std::localtime(&time1);
+ std::time_t time1 = std::time(nullptr);
+ const std::tm *time = std::localtime(&time1);
std::ostringstream o;
o << time->tm_hour << ":" << (time->tm_min < 10 ? "0" : "")
std::string
get_date()
{
- std::time_t time1 = std::time(nullptr);
- std::tm *time = std::localtime(&time1);
+ std::time_t time1 = std::time(nullptr);
+ const std::tm *time = std::localtime(&time1);
std::ostringstream o;
o << time->tm_year + 1900 << "/" << time->tm_mon + 1 << "/"
{
std::string policy_name;
if (dynamic_cast<const typename dealii::internal::DoFHandlerImplementation::
- Policy::Sequential<dim, spacedim> *>(&policy) ||
- dynamic_cast<const typename dealii::internal::DoFHandlerImplementation::
Policy::Sequential<dim, spacedim> *>(&policy))
policy_name = "Policy::Sequential<";
else if (dynamic_cast<
- const typename dealii::internal::DoFHandlerImplementation::
- Policy::ParallelDistributed<dim, spacedim> *>(&policy) ||
- dynamic_cast<
const typename dealii::internal::DoFHandlerImplementation::
Policy::ParallelDistributed<dim, spacedim> *>(&policy))
policy_name = "Policy::ParallelDistributed<";
else if (dynamic_cast<
- const typename dealii::internal::DoFHandlerImplementation::
- Policy::ParallelShared<dim, spacedim> *>(&policy) ||
- dynamic_cast<
const typename dealii::internal::DoFHandlerImplementation::
Policy::ParallelShared<dim, spacedim> *>(&policy))
policy_name = "Policy::ParallelShared<";
index_per_comp[comp_i].add_index(
locally_owned_dofs.nth_index_in_set(i));
}
- for (auto &c : index_per_comp)
+ for (const auto &c : index_per_comp)
c.compress();
return index_per_comp;
}
bool equidistant = true;
std::vector<double> points(this->degree + 1);
- auto *const polynomial_space =
+ const auto *const polynomial_space =
dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
Assert(polynomial_space != nullptr, ExcInternalError());
std::vector<unsigned int> lexicographic =
{
// Construct a dummy quadrature formula containing the FE's nodes:
std::vector<Point<1>> qpoints(this->degree + 1);
- auto *const polynomial_space =
+ const auto *const polynomial_space =
dynamic_cast<TensorProductPolynomials<dim> *>(this->poly_space.get());
Assert(polynomial_space != nullptr, ExcInternalError());
std::vector<unsigned int> lexicographic =