From f21f5d48b777c313f0a1ab22ab868033e3c26704 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 12 Jul 2023 17:43:04 -0400 Subject: [PATCH] Use "empty()" instead of "size() == 0" --- examples/step-34/step-34.cc | 2 +- examples/step-50/step-50.cc | 2 +- include/deal.II/base/index_set.h | 2 +- include/deal.II/base/mpi.h | 6 +-- include/deal.II/base/partitioner.templates.h | 8 +-- include/deal.II/base/patterns.h | 2 +- .../deal.II/base/time_stepping.templates.h | 4 +- include/deal.II/fe/block_mask.h | 18 +++---- include/deal.II/fe/component_mask.h | 18 +++---- include/deal.II/fe/fe_tools.templates.h | 8 +-- .../fe/fe_tools_extrapolate.templates.h | 6 +-- .../deal.II/lac/dynamic_sparsity_pattern.h | 6 +-- .../lac/la_parallel_vector.templates.h | 2 +- .../deal.II/lac/relaxation_block.templates.h | 2 +- .../deal.II/lac/sparse_matrix_ez.templates.h | 2 +- include/deal.II/lac/sparse_matrix_tools.h | 8 +-- include/deal.II/lac/tensor_product_matrix.h | 2 +- include/deal.II/lac/vector.templates.h | 2 +- include/deal.II/matrix_free/constraint_info.h | 2 +- .../deal.II/matrix_free/dof_info.templates.h | 2 +- include/deal.II/matrix_free/fe_evaluation.h | 4 +- .../matrix_free/hanging_nodes_internal.h | 2 +- .../matrix_free/mapping_info.templates.h | 2 +- include/deal.II/matrix_free/matrix_free.h | 6 +-- include/deal.II/matrix_free/operators.h | 2 +- .../matrix_free/shape_info.templates.h | 4 +- .../matrix_free/tensor_product_kernels.h | 25 +++++----- include/deal.II/meshworker/integration_info.h | 6 +-- include/deal.II/meshworker/simple.h | 4 +- .../deal.II/multigrid/mg_constrained_dofs.h | 6 +-- .../deal.II/multigrid/mg_transfer.templates.h | 2 +- .../mg_transfer_global_coarsening.templates.h | 16 +++--- .../numerics/data_out_dof_data.templates.h | 8 +-- include/deal.II/numerics/history.h | 2 +- .../numerics/matrix_creator.templates.h | 4 +- .../vector_tools_boundary.templates.h | 6 +-- .../deal.II/numerics/vector_tools_evaluate.h | 2 +- .../vector_tools_mean_value.templates.h | 4 +- source/base/data_out_base.cc | 26 +++++----- source/base/mpi.cc | 2 +- .../base/mpi_compute_index_owner_internal.cc | 2 +- source/base/mu_parser_internal.cc | 7 ++- source/base/parameter_handler.cc | 6 +-- source/base/polynomial.cc | 6 +-- source/base/polynomial_space.cc | 11 ++--- source/base/polynomials_abf.cc | 21 ++++---- source/base/polynomials_adini.cc | 10 ++-- source/base/polynomials_barycentric.cc | 11 ++--- source/base/polynomials_bdm.cc | 21 ++++---- source/base/polynomials_bernardi_raugel.cc | 34 ++++++------- source/base/polynomials_nedelec.cc | 49 +++++++++---------- source/base/polynomials_rannacher_turek.cc | 10 ++-- source/base/polynomials_raviart_thomas.cc | 21 ++++---- source/base/polynomials_rt_bubbles.cc | 21 ++++---- source/base/table_handler.cc | 4 +- source/base/tensor_product_polynomials.cc | 22 ++++----- .../tensor_product_polynomials_bubbles.cc | 15 +++--- .../base/tensor_product_polynomials_const.cc | 10 ++-- source/base/utilities.cc | 6 +-- source/differentiation/ad/ad_helpers.cc | 2 +- .../differentiation/sd/symengine_optimizer.cc | 4 +- source/distributed/tria.cc | 6 +-- source/dofs/dof_handler.cc | 4 +- source/dofs/dof_handler_policy.cc | 2 +- source/dofs/dof_renumbering.cc | 6 +-- source/dofs/dof_tools.cc | 8 +-- source/dofs/dof_tools_constraints.cc | 4 +- source/fe/block_mask.cc | 2 +- source/fe/component_mask.cc | 2 +- source/fe/fe.cc | 9 ++-- source/fe/fe_bdm.cc | 2 +- source/fe/fe_enriched.cc | 2 +- source/fe/fe_poly_tensor.cc | 6 +-- source/fe/fe_system.cc | 4 +- source/fe/mapping_fe.cc | 4 +- source/fe/mapping_q.cc | 4 +- source/grid/grid_generator.cc | 2 +- source/grid/grid_in.cc | 12 ++--- source/grid/grid_tools.cc | 33 ++++++------- source/grid/grid_tools_dof_handlers.cc | 17 +++---- source/grid/persistent_tria.cc | 3 +- source/grid/tria.cc | 18 +++---- source/grid/tria_description.cc | 6 +-- source/lac/dynamic_sparsity_pattern.cc | 4 +- source/lac/sparse_direct.cc | 2 +- source/lac/sparsity_pattern.cc | 2 +- source/lac/sparsity_tools.cc | 2 +- source/matrix_free/dof_info.cc | 4 +- source/matrix_free/task_info.cc | 4 +- source/matrix_free/vector_data_exchange.cc | 2 +- source/multigrid/mg_tools.cc | 6 +-- source/multigrid/mg_transfer_block.cc | 6 +-- source/multigrid/mg_transfer_component.cc | 14 +++--- source/multigrid/mg_transfer_internal.cc | 2 +- source/non_matching/quadrature_generator.cc | 2 +- source/numerics/data_out_faces.cc | 2 +- source/numerics/data_out_stack.cc | 2 +- source/numerics/matrix_tools.cc | 6 +-- source/numerics/point_value_history.cc | 2 +- source/opencascade/utilities.cc | 2 +- source/particles/particle_handler.cc | 8 +-- 101 files changed, 369 insertions(+), 389 deletions(-) diff --git a/examples/step-34/step-34.cc b/examples/step-34/step-34.cc index 68ea989e12..97781e4178 100644 --- a/examples/step-34/step-34.cc +++ b/examples/step-34/step-34.cc @@ -869,7 +869,7 @@ namespace Step34 ExcIndexRange(0, fe.n_dofs_per_cell(), index)); static std::vector> quadratures; - if (quadratures.size() == 0) + if (quadratures.empty()) for (unsigned int i = 0; i < fe.n_dofs_per_cell(); ++i) quadratures.emplace_back(singular_quadrature_order, fe.get_unit_support_points()[i], diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index 5749c9a8bb..7d03b5b027 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -324,7 +324,7 @@ bool Settings::try_parse(const std::string &prm_filename) Patterns::Bool(), "Output graphical results."); - if (prm_filename.size() == 0) + if (prm_filename.empty()) { std::cout << "**** Error: No input file provided!\n" << "**** Error: Call this program as './step-50 input.prm\n" diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index eb7f6f03f0..6405ceec04 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -1705,7 +1705,7 @@ IndexSet::add_range(const size_type begin, const size_type end) { // the new index might be larger than the last index present in the // ranges. Then we can skip the binary search - if (ranges.size() == 0 || begin > ranges.back().end) + if (ranges.empty() || begin > ranges.back().end) ranges.emplace_back(begin, end); else if (begin == ranges.back().end) ranges.back().end = end; diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index af1e327252..5322eb144c 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -1865,7 +1865,7 @@ namespace Utilities Assert(objects_to_send.size() < 2, ExcMessage("Cannot send to more than one processor.")); Assert(objects_to_send.find(0) != objects_to_send.end() || - objects_to_send.size() == 0, + objects_to_send.empty(), ExcMessage("Can only send to myself or to nobody.")); return objects_to_send; # else @@ -1892,7 +1892,7 @@ namespace Utilities // processors, we need to visit one of the two scopes below. Otherwise, // no other action is required by this mpi process, and we can safely // return. - if (send_to.size() == 0 && n_expected_incoming_messages == 0) + if (send_to.empty() && n_expected_incoming_messages == 0) return received_objects; const int mpi_tag = @@ -2136,7 +2136,7 @@ namespace Utilities AssertIndexRange(root_process, n_procs); AssertThrow( - (my_rank != root_process && objects_to_send.size() == 0) || + (my_rank != root_process && objects_to_send.empty()) || objects_to_send.size() == n_procs, ExcMessage( "The number of objects to be scattered must correspond to the number processes.")); diff --git a/include/deal.II/base/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index 43b04893fe..41e4cf2bba 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -60,7 +60,7 @@ namespace Utilities if (n_import_targets > 0) AssertDimension(locally_owned_array.size(), locally_owned_size()); - Assert(requests.size() == 0, + Assert(requests.empty(), ExcMessage("Another operation seems to still be running. " "Call update_ghost_values_finish() first.")); @@ -112,7 +112,7 @@ namespace Utilities // kernel launched. The indices are expanded the first time the function // is called. if ((std::is_same_v)&&( - import_indices_plain_dev.size() == 0)) + import_indices_plain_dev.empty())) initialize_import_indices_plain_dev(); # endif @@ -326,7 +326,7 @@ namespace Utilities const unsigned int n_import_targets = import_targets_data.size(); const unsigned int n_ghost_targets = ghost_targets_data.size(); - Assert(requests.size() == 0, + Assert(requests.empty(), ExcMessage("Another compress operation seems to still be running. " "Call compress_finish() first.")); @@ -580,7 +580,7 @@ namespace Utilities // kernel launched. The indices are expanded the first time the function // is called. if ((std::is_same_v)&&( - import_indices_plain_dev.size() == 0)) + import_indices_plain_dev.empty())) initialize_import_indices_plain_dev(); # endif diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 0bfcd2d347..9aaf1ed478 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -2096,7 +2096,7 @@ namespace Patterns "to a List compatible type.")); const auto &expressions = t->get_expressions(); - if (expressions.size() == 0) + if (expressions.empty()) return std::string(); std::string s = expressions[0]; diff --git a/include/deal.II/base/time_stepping.templates.h b/include/deal.II/base/time_stepping.templates.h index 6add0c2d19..0b2af26ef2 100644 --- a/include/deal.II/base/time_stepping.templates.h +++ b/include/deal.II/base/time_stepping.templates.h @@ -48,11 +48,11 @@ namespace TimeStepping VectorType &y) { AssertThrow( - F.size() == 0, + F.empty(), ExcMessage( "RungeKutta methods cannot handle more that one function to integrate.")); AssertThrow( - J_inverse.size() == 0, + J_inverse.empty(), ExcMessage( "RungeKutta methods cannot handle more that one function to integrate.")); diff --git a/include/deal.II/fe/block_mask.h b/include/deal.II/fe/block_mask.h index b1d9c3ac34..a728880fbd 100644 --- a/include/deal.II/fe/block_mask.h +++ b/include/deal.II/fe/block_mask.h @@ -274,7 +274,7 @@ BlockMask::operator[](const unsigned int block_index) const { // if the mask represents the all-block mask // then always return true - if (block_mask.size() == 0) + if (block_mask.empty()) return true; else { @@ -289,7 +289,7 @@ BlockMask::operator[](const unsigned int block_index) const inline bool BlockMask::represents_n_blocks(const unsigned int n) const { - return ((block_mask.size() == 0) || (block_mask.size() == n)); + return ((block_mask.empty()) || (block_mask.size() == n)); } @@ -300,7 +300,7 @@ BlockMask::n_selected_blocks(const unsigned int n) const AssertDimension(n, size()); const unsigned int real_n = (n != numbers::invalid_unsigned_int ? n : size()); - if (block_mask.size() == 0) + if (block_mask.empty()) return real_n; else { @@ -318,7 +318,7 @@ BlockMask::first_selected_block(const unsigned int n) const if ((n != numbers::invalid_unsigned_int) && (size() > 0)) AssertDimension(n, size()); - if (block_mask.size() == 0) + if (block_mask.empty()) return 0; else { @@ -336,7 +336,7 @@ BlockMask::first_selected_block(const unsigned int n) const inline bool BlockMask::represents_the_all_selected_mask() const { - return (block_mask.size() == 0); + return (block_mask.empty()); } @@ -346,9 +346,9 @@ BlockMask::operator|(const BlockMask &mask) const { // if one of the two masks denotes the all-block mask, // then return the other one - if (block_mask.size() == 0) + if (block_mask.empty()) return mask; - else if (mask.block_mask.size() == 0) + else if (mask.block_mask.empty()) return *this; else { @@ -369,9 +369,9 @@ BlockMask::operator&(const BlockMask &mask) const { // if one of the two masks denotes the all-block mask, // then return the other one - if (block_mask.size() == 0) + if (block_mask.empty()) return mask; - else if (mask.block_mask.size() == 0) + else if (mask.block_mask.empty()) return *this; else { diff --git a/include/deal.II/fe/component_mask.h b/include/deal.II/fe/component_mask.h index 5ffb5d00be..c8f6833960 100644 --- a/include/deal.II/fe/component_mask.h +++ b/include/deal.II/fe/component_mask.h @@ -304,7 +304,7 @@ ComponentMask::operator[](const unsigned int component_index) const { // if the mask represents the all-component mask // then always return true - if (component_mask.size() == 0) + if (component_mask.empty()) return true; else { @@ -319,7 +319,7 @@ ComponentMask::operator[](const unsigned int component_index) const inline bool ComponentMask::represents_n_components(const unsigned int n) const { - return ((component_mask.size() == 0) || (component_mask.size() == n)); + return ((component_mask.empty()) || (component_mask.size() == n)); } @@ -330,7 +330,7 @@ ComponentMask::n_selected_components(const unsigned int n) const AssertDimension(n, size()); const unsigned int real_n = (n != numbers::invalid_unsigned_int ? n : size()); - if (component_mask.size() == 0) + if (component_mask.empty()) return real_n; else { @@ -348,7 +348,7 @@ ComponentMask::first_selected_component(const unsigned int n) const if ((n != numbers::invalid_unsigned_int) && (size() > 0)) AssertDimension(n, size()); - if (component_mask.size() == 0) + if (component_mask.empty()) return 0; else { @@ -366,7 +366,7 @@ ComponentMask::first_selected_component(const unsigned int n) const inline bool ComponentMask::represents_the_all_selected_mask() const { - return (component_mask.size() == 0); + return (component_mask.empty()); } @@ -376,9 +376,9 @@ ComponentMask::operator|(const ComponentMask &mask) const { // if one of the two masks denotes the all-component mask, // then return the other one - if (component_mask.size() == 0) + if (component_mask.empty()) return mask; - else if (mask.component_mask.size() == 0) + else if (mask.component_mask.empty()) return *this; else { @@ -399,9 +399,9 @@ ComponentMask::operator&(const ComponentMask &mask) const { // if one of the two masks denotes the all-component mask, // then return the other one - if (component_mask.size() == 0) + if (component_mask.empty()) return mask; - else if (mask.component_mask.size() == 0) + else if (mask.component_mask.empty()) return *this; else { diff --git a/include/deal.II/fe/fe_tools.templates.h b/include/deal.II/fe/fe_tools.templates.h index 4bfc3b9fef..d20c98b433 100644 --- a/include/deal.II/fe/fe_tools.templates.h +++ b/include/deal.II/fe/fe_tools.templates.h @@ -2364,7 +2364,7 @@ namespace FETools // Now, just the [...] // part should be left. - if (name.size() == 0 || name[0] != '[') + if (name.empty() || name[0] != '[') throw std::string("Invalid first character in ") + name; do { @@ -2418,7 +2418,7 @@ namespace FETools // list. make sure that // we actually had a ']' // there - if (name.size() == 0 || name[0] != ']') + if (name.empty() || name[0] != ']') throw std::string("Invalid first character in ") + name; name.erase(0, 1); // just one more sanity check @@ -2466,7 +2466,7 @@ namespace FETools // Now, just the (degree) // or (Quadrature<1>(degree+1)) // part should be left. - if (name.size() == 0 || name[0] != '(') + if (name.empty() || name[0] != '(') throw std::string("Invalid first character in ") + name; name.erase(0, 1); if (name[0] != 'Q') @@ -2638,7 +2638,7 @@ namespace FETools // Make sure the auxiliary function // ate up all characters of the name. - AssertThrow(name.size() == 0, + AssertThrow(name.empty(), ExcInvalidFEName(parameter_name + std::string(" extra characters after " "end of name"))); diff --git a/include/deal.II/fe/fe_tools_extrapolate.templates.h b/include/deal.II/fe/fe_tools_extrapolate.templates.h index 301c195939..9e7c0c516a 100644 --- a/include/deal.II/fe/fe_tools_extrapolate.templates.h +++ b/include/deal.II/fe/fe_tools_extrapolate.templates.h @@ -548,7 +548,7 @@ namespace FETools // at this point of // the procedure no new // needs should come up - Assert(new_needs.size() == 0, ExcInternalError()); + Assert(new_needs.empty(), ExcInternalError()); set_dof_values_by_interpolation(dealii_cell, p4est_cell, @@ -1036,7 +1036,7 @@ namespace FETools std::vector &computed_cells, std::vector &new_needs) { - if (cells_to_compute.size() == 0) + if (cells_to_compute.empty()) return; // check if this cell exists in the local p4est @@ -1077,7 +1077,7 @@ namespace FETools // store cell_data in the list of // computed cells and erase this cell // from the list of cells to compute - if (tmp.size() == 0) + if (tmp.empty()) { cell_data_insert(cells_to_compute[pos], computed_cells); cells_to_compute.erase(cells_to_compute.begin() + pos); diff --git a/include/deal.II/lac/dynamic_sparsity_pattern.h b/include/deal.II/lac/dynamic_sparsity_pattern.h index 7b032fbe94..4622aebb5b 100644 --- a/include/deal.II/lac/dynamic_sparsity_pattern.h +++ b/include/deal.II/lac/dynamic_sparsity_pattern.h @@ -978,7 +978,7 @@ inline void DynamicSparsityPattern::Line::add(const size_type j) { // first check the last element (or if line is still empty) - if ((entries.size() == 0) || (entries.back() < j)) + if ((entries.empty()) || (entries.back() < j)) { entries.push_back(j); return; @@ -1118,7 +1118,7 @@ DynamicSparsityPattern::begin(const size_type r) const // walking over this vector entry by entry anyways. size_type rowindex = rowset.index_within_set(*it); - while (it != rowset.end() && lines[rowindex].entries.size() == 0) + while (it != rowset.end() && lines[rowindex].entries.empty()) { ++it; ++rowindex; @@ -1135,7 +1135,7 @@ DynamicSparsityPattern::begin(const size_type r) const // directly instead of going through the slower row_length() function size_type row = r; - while (row < n_rows() && lines[row].entries.size() == 0) + while (row < n_rows() && lines[row].entries.empty()) { ++row; } diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index 546a2536c5..03368a5127 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -1052,7 +1052,7 @@ namespace LinearAlgebra // in order to zero ghost part of the vector, we need to call // import_from_ghosted_array_finish() regardless of - // compress_requests.size() == 0 + // compress_requests.empty() // make this function thread safe std::lock_guard lock(mutex); diff --git a/include/deal.II/lac/relaxation_block.templates.h b/include/deal.II/lac/relaxation_block.templates.h index c4a513c140..bc76f86fb4 100644 --- a/include/deal.II/lac/relaxation_block.templates.h +++ b/include/deal.II/lac/relaxation_block.templates.h @@ -230,7 +230,7 @@ RelaxationBlock::do_step( const MatrixType & M = *this->A; Vector b_cell, x_cell; - const bool permutation_empty = additional_data->order.size() == 0; + const bool permutation_empty = additional_data->order.empty(); const unsigned int n_permutations = (permutation_empty) ? 1U : additional_data->order.size(); const size_type n_blocks = additional_data->block_list.n_rows(); diff --git a/include/deal.II/lac/sparse_matrix_ez.templates.h b/include/deal.II/lac/sparse_matrix_ez.templates.h index 6bde55a1a4..58c39a9b7f 100644 --- a/include/deal.II/lac/sparse_matrix_ez.templates.h +++ b/include/deal.II/lac/sparse_matrix_ez.templates.h @@ -138,7 +138,7 @@ template bool SparseMatrixEZ::empty() const { - return ((n_columns == 0) && (row_info.size() == 0)); + return ((n_columns == 0) && (row_info.empty())); } diff --git a/include/deal.II/lac/sparse_matrix_tools.h b/include/deal.II/lac/sparse_matrix_tools.h index 9f2c240fe7..b7dbfa7de3 100644 --- a/include/deal.II/lac/sparse_matrix_tools.h +++ b/include/deal.II/lac/sparse_matrix_tools.h @@ -279,7 +279,7 @@ namespace SparseMatrixTools for (unsigned int i = 0; i < row_to_procs.size(); ++i) { - if (row_to_procs[i].size() == 0) + if (row_to_procs[i].empty()) continue; const auto row = locally_owned_dofs.nth_index_in_set(i); @@ -343,7 +343,7 @@ namespace SparseMatrixTools SparseMatrixType2 & system_matrix_out, SparsityPatternType2 &sparsity_pattern_out) { - Assert(index_set_1.size() == 0 || index_set_0.size() == index_set_1.size(), + Assert(index_set_1.empty() || index_set_0.size() == index_set_1.size(), ExcInternalError()); auto index_set_1_cleared = index_set_1; @@ -379,7 +379,7 @@ namespace SparseMatrixTools const unsigned int n_rows = index_set_union.n_elements(); const unsigned int n_cols = index_set_union.n_elements(); const unsigned int entries_per_row = - locally_relevant_matrix_entries.size() == 0 ? + locally_relevant_matrix_entries.empty() ? 0 : std::max_element(locally_relevant_matrix_entries.begin(), locally_relevant_matrix_entries.end(), @@ -521,7 +521,7 @@ namespace SparseMatrixTools for (unsigned int c = 0; c < indices.size(); ++c) { - if (indices[c].size() == 0) + if (indices[c].empty()) continue; const auto &local_dof_indices = indices[c]; diff --git a/include/deal.II/lac/tensor_product_matrix.h b/include/deal.II/lac/tensor_product_matrix.h index 0311a9229f..305a846b09 100644 --- a/include/deal.II/lac/tensor_product_matrix.h +++ b/include/deal.II/lac/tensor_product_matrix.h @@ -1583,7 +1583,7 @@ std::size_t TensorProductMatrixSymmetricSumCollection:: storage_size() const { - if (matrix_ptr.size() == 0) + if (matrix_ptr.empty()) return 0; // if not initialized return matrix_ptr.size() - 1; diff --git a/include/deal.II/lac/vector.templates.h b/include/deal.II/lac/vector.templates.h index 52cba5a014..ede5ac761f 100644 --- a/include/deal.II/lac/vector.templates.h +++ b/include/deal.II/lac/vector.templates.h @@ -87,7 +87,7 @@ namespace internal copy_petsc_vector(const PETScWrappers::VectorBase &v, ::dealii::Vector & out) { - if (v.size() == 0) + if (v.empty()) { out.reinit(0); return; diff --git a/include/deal.II/matrix_free/constraint_info.h b/include/deal.II/matrix_free/constraint_info.h index cd3faa5079..57eeea61e6 100644 --- a/include/deal.II/matrix_free/constraint_info.h +++ b/include/deal.II/matrix_free/constraint_info.h @@ -663,7 +663,7 @@ namespace internal const bool transpose, AlignedVector &evaluation_data_coarse) const { - if (hanging_node_constraint_masks.size() == 0) + if (hanging_node_constraint_masks.empty()) return; std::array> &cell, std::vector & dof_indices) { - if (this->hanging_node_constraint_masks_comp.size() == 0) + if (this->hanging_node_constraint_masks_comp.empty()) return false; // 2) determine the refinement configuration of the cell diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 2ee5c3696f..ee5b7ea18a 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -4251,8 +4251,8 @@ FEEvaluationBase:: apply_hanging_node_constraints(const bool transpose) const { if (this->dof_info == nullptr || - this->dof_info->hanging_node_constraint_masks.size() == 0 || - this->dof_info->hanging_node_constraint_masks_comp.size() == 0 || + this->dof_info->hanging_node_constraint_masks.empty() || + this->dof_info->hanging_node_constraint_masks_comp.empty() || this->dof_info->hanging_node_constraint_masks_comp [this->active_fe_index][this->first_selected_component] == false) return; // nothing to do with faces diff --git a/include/deal.II/matrix_free/hanging_nodes_internal.h b/include/deal.II/matrix_free/hanging_nodes_internal.h index 9c1a5809cb..6aab75c253 100644 --- a/include/deal.II/matrix_free/hanging_nodes_internal.h +++ b/include/deal.II/matrix_free/hanging_nodes_internal.h @@ -515,7 +515,7 @@ namespace internal const CellIterator &cell) const { // TODO: for simplex or mixed meshes: nothing to do - if ((dim == 3 && line_to_cells.size() == 0) || + if ((dim == 3 && line_to_cells.empty()) || (cell->reference_cell().is_hyper_cube() == false)) return ConstraintKinds::unconstrained; diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index 8e17a11433..8fb1dd5100 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -2422,7 +2422,7 @@ namespace internal { face_type.resize(faces.size(), general); - if (faces.size() == 0) + if (faces.empty()) return; // Create as many chunks of cells as we have threads and spawn the diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index d1e0f0ada1..7bee7b99fd 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -2509,7 +2509,7 @@ template inline unsigned int MatrixFree::n_inner_face_batches() const { - if (task_info.face_partition_data.size() == 0) + if (task_info.face_partition_data.empty()) return 0; return task_info.face_partition_data.back(); } @@ -2520,7 +2520,7 @@ template inline unsigned int MatrixFree::n_boundary_face_batches() const { - if (task_info.face_partition_data.size() == 0) + if (task_info.face_partition_data.empty()) return 0; return task_info.boundary_partition_data.back() - task_info.face_partition_data.back(); @@ -2532,7 +2532,7 @@ template inline unsigned int MatrixFree::n_ghost_inner_face_batches() const { - if (task_info.face_partition_data.size() == 0) + if (task_info.face_partition_data.empty()) return 0; return face_info.faces.size() - task_info.boundary_partition_data.back(); } diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index 4df398bed2..c8a77af809 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -1328,7 +1328,7 @@ namespace MatrixFreeOperators selected_rows.push_back(given_row_selection[i]); } } - if (given_column_selection.size() == 0) + if (given_column_selection.empty()) selected_columns = selected_rows; else { diff --git a/include/deal.II/matrix_free/shape_info.templates.h b/include/deal.II/matrix_free/shape_info.templates.h index 634800f15a..8f3c72cffa 100644 --- a/include/deal.II/matrix_free/shape_info.templates.h +++ b/include/deal.II/matrix_free/shape_info.templates.h @@ -436,7 +436,7 @@ namespace internal univariate_shape_data.fe_degree = fe.degree; univariate_shape_data.n_q_points_1d = quad.size(); - if ((fe.n_dofs_per_cell() == 0) || (quad.size() == 0)) + if ((fe.n_dofs_per_cell() == 0) || (quad.empty())) return; // grant write access to common univariate shape data @@ -606,7 +606,7 @@ namespace internal univariate_shape_data.fe_degree = fe.degree; univariate_shape_data.n_q_points_1d = quad.size(); - if ((fe.n_dofs_per_cell() == 0) || (quad.size() == 0)) + if ((fe.n_dofs_per_cell() == 0) || (quad.empty())) return; // grant write access to common univariate shape data diff --git a/include/deal.II/matrix_free/tensor_product_kernels.h b/include/deal.II/matrix_free/tensor_product_kernels.h index c2e638063e..98680df2e1 100644 --- a/include/deal.II/matrix_free/tensor_product_kernels.h +++ b/include/deal.II/matrix_free/tensor_product_kernels.h @@ -217,14 +217,14 @@ namespace internal // n_rows * n_columns entries or for the apply_face() path that only has // n_rows * 3 entries in the array. Since we cannot decide about the use // we must allow for both here. - Assert(shape_values.size() == 0 || + Assert(shape_values.empty() || shape_values.size() == n_rows * n_columns || shape_values.size() == 3 * n_rows, ExcDimensionMismatch(shape_values.size(), n_rows * n_columns)); - Assert(shape_gradients.size() == 0 || + Assert(shape_gradients.empty() || shape_gradients.size() == n_rows * n_columns, ExcDimensionMismatch(shape_gradients.size(), n_rows * n_columns)); - Assert(shape_hessians.size() == 0 || + Assert(shape_hessians.empty() || shape_hessians.size() == n_rows * n_columns, ExcDimensionMismatch(shape_hessians.size(), n_rows * n_columns)); (void)dummy1; @@ -641,14 +641,14 @@ namespace internal // n_rows * n_columns entries or for the apply_face() path that only has // n_rows * 3 entries in the array. Since we cannot decide about the use // we must allow for both here. - Assert(shape_values.size() == 0 || + Assert(shape_values.empty() || shape_values.size() == n_rows * n_columns || shape_values.size() == n_rows * 3, ExcDimensionMismatch(shape_values.size(), n_rows * n_columns)); - Assert(shape_gradients.size() == 0 || + Assert(shape_gradients.empty() || shape_gradients.size() == n_rows * n_columns, ExcDimensionMismatch(shape_gradients.size(), n_rows * n_columns)); - Assert(shape_hessians.size() == 0 || + Assert(shape_hessians.empty() || shape_hessians.size() == n_rows * n_columns, ExcDimensionMismatch(shape_hessians.size(), n_rows * n_columns)); } @@ -1062,13 +1062,12 @@ namespace internal , shape_gradients(shape_gradients.begin()) , shape_hessians(shape_hessians.begin()) { - Assert(shape_values.size() == 0 || - shape_values.size() == n_rows * n_columns, + Assert(shape_values.empty() || shape_values.size() == n_rows * n_columns, ExcDimensionMismatch(shape_values.size(), n_rows * n_columns)); - Assert(shape_gradients.size() == 0 || + Assert(shape_gradients.empty() || shape_gradients.size() == n_rows * n_columns, ExcDimensionMismatch(shape_gradients.size(), n_rows * n_columns)); - Assert(shape_hessians.size() == 0 || + Assert(shape_hessians.empty() || shape_hessians.size() == n_rows * n_columns, ExcDimensionMismatch(shape_hessians.size(), n_rows * n_columns)); (void)dummy1; @@ -2577,14 +2576,14 @@ namespace internal // n_rows * n_columns entries or for the apply_face() path that only has // n_rows * 3 entries in the array. Since we cannot decide about the use // we must allow for both here. - Assert(shape_values.size() == 0 || + Assert(shape_values.empty() || shape_values.size() == n_rows * n_columns || shape_values.size() == 3 * n_rows, ExcDimensionMismatch(shape_values.size(), n_rows * n_columns)); - Assert(shape_gradients.size() == 0 || + Assert(shape_gradients.empty() || shape_gradients.size() == n_rows * n_columns, ExcDimensionMismatch(shape_gradients.size(), n_rows * n_columns)); - Assert(shape_hessians.size() == 0 || + Assert(shape_hessians.empty() || shape_hessians.size() == n_rows * n_columns, ExcDimensionMismatch(shape_hessians.size(), n_rows * n_columns)); (void)dummy1; diff --git a/include/deal.II/meshworker/integration_info.h b/include/deal.II/meshworker/integration_info.h index ca194c786f..067a3666b3 100644 --- a/include/deal.II/meshworker/integration_info.h +++ b/include/deal.II/meshworker/integration_info.h @@ -738,11 +738,11 @@ namespace MeshWorker unsigned int fp, bool force) { - if (force || cell_quadrature.size() == 0) + if (force || cell_quadrature.empty()) cell_quadrature = QGauss(cp); - if (force || boundary_quadrature.size() == 0) + if (force || boundary_quadrature.empty()) boundary_quadrature = QGauss(bp); - if (force || face_quadrature.size() == 0) + if (force || face_quadrature.empty()) face_quadrature = QGauss(fp); } diff --git a/include/deal.II/meshworker/simple.h b/include/deal.II/meshworker/simple.h index ff7ab48d0b..08a6372472 100644 --- a/include/deal.II/meshworker/simple.h +++ b/include/deal.II/meshworker/simple.h @@ -1036,7 +1036,7 @@ namespace MeshWorker Assert(info.level_cell, ExcMessage("Cell must access level dofs")); const unsigned int level = info.cell->level(); - if (info.indices_by_block.size() == 0) + if (info.indices_by_block.empty()) { assemble((*matrix)[level], info.matrix(0, false).matrix, @@ -1097,7 +1097,7 @@ namespace MeshWorker const unsigned int level1 = info1.cell->level(); const unsigned int level2 = info2.cell->level(); - if (info1.indices_by_block.size() == 0) + if (info1.indices_by_block.empty()) { if (level1 == level2) { diff --git a/include/deal.II/multigrid/mg_constrained_dofs.h b/include/deal.II/multigrid/mg_constrained_dofs.h index 154e9322c9..9d0f2511d7 100644 --- a/include/deal.II/multigrid/mg_constrained_dofs.h +++ b/include/deal.II/multigrid/mg_constrained_dofs.h @@ -362,7 +362,7 @@ MGConstrainedDoFs::make_zero_boundary_constraints( // allocate an IndexSet for each global level. Contents will be // overwritten inside make_boundary_list. const unsigned int n_levels = dof.get_triangulation().n_global_levels(); - Assert(boundary_indices.size() == 0 || boundary_indices.size() == n_levels, + Assert(boundary_indices.empty() || boundary_indices.size() == n_levels, ExcInternalError()); boundary_indices.resize(n_levels); @@ -381,7 +381,7 @@ MGConstrainedDoFs::add_boundary_indices(const DoFHandler &dof, const IndexSet &level_boundary_indices) { const unsigned int n_levels = dof.get_triangulation().n_global_levels(); - if (boundary_indices.size() == 0) + if (boundary_indices.empty()) { boundary_indices.resize(n_levels); for (unsigned int i = 0; i < n_levels; ++i) @@ -489,7 +489,7 @@ inline bool MGConstrainedDoFs::is_boundary_index(const unsigned int level, const types::global_dof_index index) const { - if (boundary_indices.size() == 0) + if (boundary_indices.empty()) return false; AssertIndexRange(level, boundary_indices.size()); diff --git a/include/deal.II/multigrid/mg_transfer.templates.h b/include/deal.II/multigrid/mg_transfer.templates.h index d40f45cae6..e3f93eebbd 100644 --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@ -80,7 +80,7 @@ namespace internal MGLevelObject> &v) { const unsigned int n_blocks = dof_handler.get_fe().n_blocks(); - if (target_component.size() == 0) + if (target_component.empty()) { target_component.resize(n_blocks); for (unsigned int i = 0; i < n_blocks; ++i) diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index 10d136d34b..4b67862f64 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -2659,8 +2659,8 @@ MGTwoLevelTransfer>:: continue; const bool needs_interpolation = - (scheme.prolongation_matrix.size() == 0 && - scheme.prolongation_matrix_1d.size() == 0) == false; + (scheme.prolongation_matrix.empty() && + scheme.prolongation_matrix_1d.empty()) == false; evaluation_data_fine.clear(); evaluation_data_coarse.clear(); @@ -2835,8 +2835,8 @@ MGTwoLevelTransfer>:: continue; const bool needs_interpolation = - (scheme.prolongation_matrix.size() == 0 && - scheme.prolongation_matrix_1d.size() == 0) == false; + (scheme.prolongation_matrix.empty() && + scheme.prolongation_matrix_1d.empty()) == false; evaluation_data_fine.clear(); evaluation_data_coarse.clear(); @@ -2981,8 +2981,8 @@ MGTwoLevelTransfer>:: } const bool needs_interpolation = - (scheme.prolongation_matrix.size() == 0 && - scheme.prolongation_matrix_1d.size() == 0) == false; + (scheme.prolongation_matrix.empty() && + scheme.prolongation_matrix_1d.empty()) == false; // general case -> local restriction is needed evaluation_data_fine.resize(scheme.n_dofs_per_cell_fine); @@ -3997,7 +3997,7 @@ MGTwoLevelTransferNonNested>:: for (unsigned int j = 0; j < evaluation_point_results.size(); ++j) { - if (level_dof_indices_fine_ptrs.size() == 0) + if (level_dof_indices_fine_ptrs.empty()) { dst.local_element(this->level_dof_indices_fine[j]) += evaluation_point_results[j]; @@ -4029,7 +4029,7 @@ MGTwoLevelTransferNonNested>:: for (unsigned int j = 0; j < evaluation_point_results.size(); ++j) { - if (level_dof_indices_fine_ptrs.size() == 0) + if (level_dof_indices_fine_ptrs.empty()) { evaluation_point_results[j] = src.local_element(this->level_dof_indices_fine[j]); diff --git a/include/deal.II/numerics/data_out_dof_data.templates.h b/include/deal.II/numerics/data_out_dof_data.templates.h index 0b01dc0c89..8506cb24a9 100644 --- a/include/deal.II/numerics/data_out_dof_data.templates.h +++ b/include/deal.II/numerics/data_out_dof_data.templates.h @@ -1803,9 +1803,9 @@ void DataOut_DoFData::attach_dof_handler( const DoFHandler &d) { - Assert(dof_data.size() == 0, + Assert(dof_data.empty(), Exceptions::DataOutImplementation::ExcOldDataStillPresent()); - Assert(cell_data.size() == 0, + Assert(cell_data.empty(), Exceptions::DataOutImplementation::ExcOldDataStillPresent()); triangulation = @@ -1822,9 +1822,9 @@ void DataOut_DoFData::attach_triangulation( const Triangulation &tria) { - Assert(dof_data.size() == 0, + Assert(dof_data.empty(), Exceptions::DataOutImplementation::ExcOldDataStillPresent()); - Assert(cell_data.size() == 0, + Assert(cell_data.empty(), Exceptions::DataOutImplementation::ExcOldDataStillPresent()); triangulation = diff --git a/include/deal.II/numerics/history.h b/include/deal.II/numerics/history.h index 9ca08065e3..cbc5574b0e 100644 --- a/include/deal.II/numerics/history.h +++ b/include/deal.II/numerics/history.h @@ -169,7 +169,7 @@ FiniteSizeHistory::add(const T &element) if (data.size() < max_n_elements) // have not reached the maximum number of elements yet { - if (cache.size() == 0) + if (cache.empty()) // nothing is cached, just copy a given element { new_el = std::make_unique(element); diff --git a/include/deal.II/numerics/matrix_creator.templates.h b/include/deal.II/numerics/matrix_creator.templates.h index ae518e3f72..645f4239fe 100644 --- a/include/deal.II/numerics/matrix_creator.templates.h +++ b/include/deal.II/numerics/matrix_creator.templates.h @@ -1363,7 +1363,7 @@ namespace MatrixCreator coefficient->n_components == n_components, ExcComponentMismatch()); - if (component_mapping.size() == 0) + if (component_mapping.empty()) { AssertDimension(n_components, boundary_functions.begin()->second->n_components); @@ -1834,7 +1834,7 @@ namespace MatrixCreator coefficient->n_components == n_components, ExcComponentMismatch()); - if (component_mapping.size() == 0) + if (component_mapping.empty()) { AssertDimension(n_components, boundary_functions.begin()->second->n_components); diff --git a/include/deal.II/numerics/vector_tools_boundary.templates.h b/include/deal.II/numerics/vector_tools_boundary.templates.h index ac21b43dcf..4734b0cf5d 100644 --- a/include/deal.II/numerics/vector_tools_boundary.templates.h +++ b/include/deal.II/numerics/vector_tools_boundary.templates.h @@ -74,7 +74,7 @@ namespace VectorTools // if for whatever reason we were passed an empty map, return // immediately - if (function_map.size() == 0) + if (function_map.empty()) return; Assert(function_map.find(numbers::internal_face_boundary_id) == @@ -709,7 +709,7 @@ namespace VectorTools // in 1d, projection onto the 0d end points == interpolation if (dim == 1) { - Assert(component_mapping.size() == 0, ExcNotImplemented()); + Assert(component_mapping.empty(), ExcNotImplemented()); interpolate_boundary_values( mapping, dof, boundary_functions, boundary_values, ComponentMask()); return; @@ -721,7 +721,7 @@ namespace VectorTools // there are no constrained nodes on the boundary, but is not // acceptable for higher dimensions. Fix this. - if (component_mapping.size() == 0) + if (component_mapping.empty()) { AssertDimension(dof.get_fe(0).n_components(), boundary_functions.begin()->second->n_components); diff --git a/include/deal.II/numerics/vector_tools_evaluate.h b/include/deal.II/numerics/vector_tools_evaluate.h index 964bb96ccf..32a6e61a78 100644 --- a/include/deal.II/numerics/vector_tools_evaluate.h +++ b/include/deal.II/numerics/vector_tools_evaluate.h @@ -475,7 +475,7 @@ namespace VectorTools typename VectorType::value_type>>> &evaluators) { - if (evaluators.size() == 0) + if (evaluators.empty()) evaluators.resize(dof_handler.get_fe_collection().size()); typename DoFHandler::active_cell_iterator cell = { diff --git a/include/deal.II/numerics/vector_tools_mean_value.templates.h b/include/deal.II/numerics/vector_tools_mean_value.templates.h index 668258d07c..4d9934a277 100644 --- a/include/deal.II/numerics/vector_tools_mean_value.templates.h +++ b/include/deal.II/numerics/vector_tools_mean_value.templates.h @@ -51,7 +51,7 @@ namespace VectorTools std::enable_if_t::value == true> subtract_mean_value(VectorType &v, const std::vector &p_select) { - if (p_select.size() == 0) + if (p_select.empty()) { // In case of an empty boolean mask operate on the whole vector: v.add(-v.mean_value()); @@ -92,7 +92,7 @@ namespace VectorTools subtract_mean_value(VectorType &v, const std::vector &p_select) { (void)p_select; - Assert(p_select.size() == 0, ExcNotImplemented()); + Assert(p_select.empty(), ExcNotImplemented()); // In case of an empty boolean mask operate on the whole vector: v.add(-v.mean_value()); } diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 0fff50e0ec..04cab7e927 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -359,7 +359,7 @@ namespace DataOutBase create_global_data_table(const std::vector> &patches) { // If there is nothing to write, just return - if (patches.size() == 0) + if (patches.empty()) return std::make_unique>(); // unlike in the main function, we don't have here the data_names field, @@ -3199,7 +3199,7 @@ namespace DataOutBase // legit if there are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif @@ -3289,7 +3289,7 @@ namespace DataOutBase // legit if there are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif // Stream with special features for dx output @@ -3577,7 +3577,7 @@ namespace DataOutBase // are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif @@ -3977,7 +3977,7 @@ namespace DataOutBase // actually owns, and in that case it is legit if there are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif constexpr int dim = 2; @@ -4349,7 +4349,7 @@ namespace DataOutBase // legit if there are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif @@ -4674,7 +4674,7 @@ namespace DataOutBase // legit if there are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif @@ -4805,7 +4805,7 @@ namespace DataOutBase // legit if there are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif @@ -4954,7 +4954,7 @@ namespace DataOutBase // legit if there are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif @@ -5286,7 +5286,7 @@ namespace DataOutBase // legit if there are no patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) { // we still need to output a valid vtu file, because other CPUs might // output data. This is the minimal file that is accepted by paraview @@ -6310,7 +6310,7 @@ namespace DataOutBase { AssertThrow(out.fail() == false, ExcIO()); - if (piece_names.size() == 0) + if (piece_names.empty()) return; const double nblocks = piece_names[0].size(); @@ -6340,7 +6340,7 @@ namespace DataOutBase { AssertThrow(out.fail() == false, ExcIO()); - if (times_and_piece_names.size() == 0) + if (times_and_piece_names.empty()) return; const double nblocks = times_and_piece_names[0].second.size(); @@ -8554,7 +8554,7 @@ DataOutBase::write_filtered_data( // patches Assert(patches.size() > 0, ExcNoPatches()); #else - if (patches.size() == 0) + if (patches.empty()) return; #endif diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 619f40af33..04f7af7fa9 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -341,7 +341,7 @@ namespace Utilities // same number twice, we know that the destinations were not // unique const bool my_destinations_are_unique = [destinations]() { - if (destinations.size() == 0) + if (destinations.empty()) return true; else { diff --git a/source/base/mpi_compute_index_owner_internal.cc b/source/base/mpi_compute_index_owner_internal.cc index 778e92371b..72e35521d4 100644 --- a/source/base/mpi_compute_index_owner_internal.cc +++ b/source/base/mpi_compute_index_owner_internal.cc @@ -421,7 +421,7 @@ namespace Utilities } #else - Assert(buffers.size() == 0, ExcInternalError()); + Assert(buffers.empty(), ExcInternalError()); (void)comm; (void)dic_local_received; #endif diff --git a/source/base/mu_parser_internal.cc b/source/base/mu_parser_internal.cc index 5e9887a095..13538856f3 100644 --- a/source/base/mu_parser_internal.cc +++ b/source/base/mu_parser_internal.cc @@ -277,8 +277,7 @@ namespace internal // current thread, i.e., that the current function is only called // once per thread ParserData &data = this->parser_data.get(); - Assert(data.parsers.size() == 0 && data.vars.size() == 0, - ExcInternalError()); + Assert(data.parsers.empty() && data.vars.empty(), ExcInternalError()); const unsigned int n_components = expressions.size(); // initialize the objects for the current thread @@ -386,7 +385,7 @@ namespace internal // initialize the parser if that hasn't happened yet on the current // thread internal::FunctionParser::ParserData &data = this->parser_data.get(); - if (data.vars.size() == 0) + if (data.vars.empty()) init_muparser(); for (unsigned int i = 0; i < dim; ++i) @@ -434,7 +433,7 @@ namespace internal // initialize the parser if that hasn't happened yet on the current // thread internal::FunctionParser::ParserData &data = this->parser_data.get(); - if (data.vars.size() == 0) + if (data.vars.empty()) init_muparser(); for (unsigned int i = 0; i < dim; ++i) diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index 19d2ce7a97..15a91d6e1a 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -1864,7 +1864,7 @@ ParameterHandler::scan_line(std::string line, line = Utilities::trim(line); // if line is now empty: leave - if (line.size() == 0) + if (line.empty()) { return; } @@ -1896,7 +1896,7 @@ ParameterHandler::scan_line(std::string line, line.erase(0, 1); AssertThrow( - line.size() == 0, + line.empty(), ExcCannotParseLine(current_line_n, input_filename, "Invalid content after 'end' or 'END' statement.")); @@ -2109,7 +2109,7 @@ ParameterHandler::assert_that_entries_have_been_set() const list_of_missing_parameters += "\n"; AssertThrow( - entries_wrongly_not_set.size() == 0, + entries_wrongly_not_set.empty(), ExcMessage( "Not all entries of the parameter handler that were declared with " "`has_to_be_set = true` have been set. The following parameters " + diff --git a/source/base/polynomial.cc b/source/base/polynomial.cc index 8059c84512..6f629182ef 100644 --- a/source/base/polynomial.cc +++ b/source/base/polynomial.cc @@ -113,11 +113,11 @@ namespace Polynomials { // should only be called when the product form is active Assert(in_lagrange_product_form == true, ExcInternalError()); - Assert(coefficients.size() == 0, ExcInternalError()); + Assert(coefficients.empty(), ExcInternalError()); // compute coefficients by expanding the product (x-x_i) term by term coefficients.resize(lagrange_support_points.size() + 1); - if (lagrange_support_points.size() == 0) + if (lagrange_support_points.empty()) coefficients[0] = 1.; else { @@ -600,7 +600,7 @@ namespace Polynomials generate_equidistant_unit_points(n), support_point) { - Assert(coefficients.size() == 0, ExcInternalError()); + Assert(coefficients.empty(), ExcInternalError()); // For polynomial order up to 3, we have precomputed weights. Use these // weights instead of the product form diff --git a/source/base/polynomial_space.cc b/source/base/polynomial_space.cc index 330c3a95c8..32e6369456 100644 --- a/source/base/polynomial_space.cc +++ b/source/base/polynomial_space.cc @@ -212,16 +212,15 @@ PolynomialSpace::evaluate( { const unsigned int n_1d = polynomials.size(); - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch2(values.size(), this->n(), 0)); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch2(grads.size(), this->n(), 0)); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch2(grad_grads.size(), this->n(), 0)); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch2(third_derivatives.size(), this->n(), 0)); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch2(fourth_derivatives.size(), this->n(), 0)); unsigned int v_size = 0; diff --git a/source/base/polynomials_abf.cc b/source/base/polynomials_abf.cc index 6a951b6071..debe7c3101 100644 --- a/source/base/polynomials_abf.cc +++ b/source/base/polynomials_abf.cc @@ -69,16 +69,15 @@ PolynomialsABF::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch(values.size(), this->n())); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch(grads.size(), this->n())); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch(grad_grads.size(), this->n())); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch(third_derivatives.size(), this->n())); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch(fourth_derivatives.size(), this->n())); const unsigned int n_sub = polynomial_space.n(); @@ -89,11 +88,11 @@ PolynomialsABF::evaluate( // at once std::lock_guard lock(mutex); - p_values.resize((values.size() == 0) ? 0 : n_sub); - p_grads.resize((grads.size() == 0) ? 0 : n_sub); - p_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_sub); - p_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_sub); - p_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_sub); + p_values.resize((values.empty()) ? 0 : n_sub); + p_grads.resize((grads.empty()) ? 0 : n_sub); + p_grad_grads.resize((grad_grads.empty()) ? 0 : n_sub); + p_third_derivatives.resize((third_derivatives.empty()) ? 0 : n_sub); + p_fourth_derivatives.resize((fourth_derivatives.empty()) ? 0 : n_sub); for (unsigned int d = 0; d < dim; ++d) { diff --git a/source/base/polynomials_adini.cc b/source/base/polynomials_adini.cc index 3f59807fba..c505d656ef 100644 --- a/source/base/polynomials_adini.cc +++ b/source/base/polynomials_adini.cc @@ -146,17 +146,17 @@ PolynomialsAdini::evaluate( const unsigned int n_pols = this->n(); (void)n_pols; - Assert(values.size() == n_pols || values.size() == 0, + Assert(values.size() == n_pols || values.empty(), ExcDimensionMismatch(values.size(), n_pols)); - Assert(grads.size() == n_pols || grads.size() == 0, + Assert(grads.size() == n_pols || grads.empty(), ExcDimensionMismatch(grads.size(), n_pols)); - Assert(grad_grads.size() == n_pols || grad_grads.size() == 0, + Assert(grad_grads.size() == n_pols || grad_grads.empty(), ExcDimensionMismatch(grad_grads.size(), n_pols)); (void)third_derivatives; - Assert(third_derivatives.size() == n_pols || third_derivatives.size() == 0, + Assert(third_derivatives.size() == n_pols || third_derivatives.empty(), ExcDimensionMismatch(third_derivatives.size(), n_pols)); (void)fourth_derivatives; - Assert(fourth_derivatives.size() == n_pols || fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == n_pols || fourth_derivatives.empty(), ExcDimensionMismatch(fourth_derivatives.size(), n_pols)); if (values.empty() == false) // do not bother if empty diff --git a/source/base/polynomials_barycentric.cc b/source/base/polynomials_barycentric.cc index 24c3f202cf..3475053d50 100644 --- a/source/base/polynomials_barycentric.cc +++ b/source/base/polynomials_barycentric.cc @@ -154,16 +154,15 @@ BarycentricPolynomials::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch2(values.size(), this->n(), 0)); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch2(grads.size(), this->n(), 0)); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch2(grad_grads.size(), this->n(), 0)); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch2(third_derivatives.size(), this->n(), 0)); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch2(fourth_derivatives.size(), this->n(), 0)); for (std::size_t i = 0; i < polys.size(); ++i) diff --git a/source/base/polynomials_bdm.cc b/source/base/polynomials_bdm.cc index 6ac10576fb..0d9e03668d 100644 --- a/source/base/polynomials_bdm.cc +++ b/source/base/polynomials_bdm.cc @@ -61,23 +61,22 @@ PolynomialsBDM::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch(values.size(), this->n())); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch(grads.size(), this->n())); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch(grad_grads.size(), this->n())); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch(third_derivatives.size(), this->n())); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch(fourth_derivatives.size(), this->n())); // third and fourth derivatives not implemented (void)third_derivatives; - Assert(third_derivatives.size() == 0, ExcNotImplemented()); + Assert(third_derivatives.empty(), ExcNotImplemented()); (void)fourth_derivatives; - Assert(fourth_derivatives.size() == 0, ExcNotImplemented()); + Assert(fourth_derivatives.empty(), ExcNotImplemented()); const unsigned int n_sub = polynomial_space.n(); @@ -86,9 +85,9 @@ PolynomialsBDM::evaluate( { std::lock_guard lock(mutex); - p_values.resize((values.size() == 0) ? 0 : n_sub); - p_grads.resize((grads.size() == 0) ? 0 : n_sub); - p_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_sub); + p_values.resize((values.empty()) ? 0 : n_sub); + p_grads.resize((grads.empty()) ? 0 : n_sub); + p_grad_grads.resize((grad_grads.empty()) ? 0 : n_sub); // Compute values of complete space and insert into tensors. Result // will have first all polynomials in the x-component, then y and z. diff --git a/source/base/polynomials_bernardi_raugel.cc b/source/base/polynomials_bernardi_raugel.cc index ca10aa96af..c87cbc5407 100644 --- a/source/base/polynomials_bernardi_raugel.cc +++ b/source/base/polynomials_bernardi_raugel.cc @@ -76,16 +76,15 @@ PolynomialsBernardiRaugel::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch(values.size(), this->n())); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch(grads.size(), this->n())); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch(grad_grads.size(), this->n())); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch(third_derivatives.size(), this->n())); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch(fourth_derivatives.size(), this->n())); std::vector Q_values; @@ -104,18 +103,17 @@ PolynomialsBernardiRaugel::evaluate( constexpr int n_q = 1 << dim; // size for create_polynomials_q // don't resize if the provided vector has 0 length - Q_values.resize((values.size() == 0) ? 0 : n_q); - Q_grads.resize((grads.size() == 0) ? 0 : n_q); - Q_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_q); - Q_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_q); - Q_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_q); - bubble_values.resize((values.size() == 0) ? 0 : n_bubbles); - bubble_grads.resize((grads.size() == 0) ? 0 : n_bubbles); - bubble_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_bubbles); - bubble_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : - n_bubbles); - bubble_fourth_derivatives.resize( - (fourth_derivatives.size() == 0) ? 0 : n_bubbles); + Q_values.resize((values.empty()) ? 0 : n_q); + Q_grads.resize((grads.empty()) ? 0 : n_q); + Q_grad_grads.resize((grad_grads.empty()) ? 0 : n_q); + Q_third_derivatives.resize((third_derivatives.empty()) ? 0 : n_q); + Q_fourth_derivatives.resize((fourth_derivatives.empty()) ? 0 : n_q); + bubble_values.resize((values.empty()) ? 0 : n_bubbles); + bubble_grads.resize((grads.empty()) ? 0 : n_bubbles); + bubble_grad_grads.resize((grad_grads.empty()) ? 0 : n_bubbles); + bubble_third_derivatives.resize((third_derivatives.empty()) ? 0 : n_bubbles); + bubble_fourth_derivatives.resize((fourth_derivatives.empty()) ? 0 : + n_bubbles); // 1 normal vector per face, ordering consistent with GeometryInfo // Normal vectors point in the +x, +y, and +z directions for diff --git a/source/base/polynomials_nedelec.cc b/source/base/polynomials_nedelec.cc index 50af1cdca8..cb40917b3d 100644 --- a/source/base/polynomials_nedelec.cc +++ b/source/base/polynomials_nedelec.cc @@ -59,35 +59,33 @@ PolynomialsNedelec::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch(values.size(), this->n())); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch(grads.size(), this->n())); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch(grad_grads.size(), this->n())); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch(third_derivatives.size(), this->n())); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch(fourth_derivatives.size(), this->n())); // third and fourth derivatives not implemented (void)third_derivatives; - Assert(third_derivatives.size() == 0, ExcNotImplemented()); + Assert(third_derivatives.empty(), ExcNotImplemented()); (void)fourth_derivatives; - Assert(fourth_derivatives.size() == 0, ExcNotImplemented()); + Assert(fourth_derivatives.empty(), ExcNotImplemented()); // Declare the values, derivatives // and second derivatives vectors of // polynomial_space at // unit_point - const unsigned int n_basis = polynomial_space.n(); - const unsigned int my_degree = this->degree(); - std::vector unit_point_values((values.size() == 0) ? 0 : n_basis); - std::vector> unit_point_grads((grads.size() == 0) ? 0 : - n_basis); + const unsigned int n_basis = polynomial_space.n(); + const unsigned int my_degree = this->degree(); + std::vector unit_point_values((values.empty()) ? 0 : n_basis); + std::vector> unit_point_grads((grads.empty()) ? 0 : n_basis); std::vector> unit_point_grad_grads( - (grad_grads.size() == 0) ? 0 : n_basis); + (grad_grads.empty()) ? 0 : n_basis); std::vector> empty_vector_of_3rd_order_tensors; std::vector> empty_vector_of_4th_order_tensors; @@ -138,11 +136,10 @@ PolynomialsNedelec::evaluate( p(0) = unit_point(1); p(1) = unit_point(0); - std::vector p_values((values.size() == 0) ? 0 : n_basis); - std::vector> p_grads((grads.size() == 0) ? 0 : - n_basis); + std::vector p_values((values.empty()) ? 0 : n_basis); + std::vector> p_grads((grads.empty()) ? 0 : n_basis); std::vector> p_grad_grads( - (grad_grads.size() == 0) ? 0 : n_basis); + (grad_grads.empty()) ? 0 : n_basis); polynomial_space.evaluate(p, p_values, @@ -320,17 +317,15 @@ PolynomialsNedelec::evaluate( // unit_point with coordinates // shifted two steps in positive // direction - Point p1, p2; - std::vector p1_values((values.size() == 0) ? 0 : n_basis); - std::vector> p1_grads((grads.size() == 0) ? 0 : - n_basis); + Point p1, p2; + std::vector p1_values((values.empty()) ? 0 : n_basis); + std::vector> p1_grads((grads.empty()) ? 0 : n_basis); std::vector> p1_grad_grads( - (grad_grads.size() == 0) ? 0 : n_basis); - std::vector p2_values((values.size() == 0) ? 0 : n_basis); - std::vector> p2_grads((grads.size() == 0) ? 0 : - n_basis); + (grad_grads.empty()) ? 0 : n_basis); + std::vector p2_values((values.empty()) ? 0 : n_basis); + std::vector> p2_grads((grads.empty()) ? 0 : n_basis); std::vector> p2_grad_grads( - (grad_grads.size() == 0) ? 0 : n_basis); + (grad_grads.empty()) ? 0 : n_basis); p1(0) = unit_point(1); p1(1) = unit_point(2); diff --git a/source/base/polynomials_rannacher_turek.cc b/source/base/polynomials_rannacher_turek.cc index 9efd7aeeb9..ec134f71c6 100644 --- a/source/base/polynomials_rannacher_turek.cc +++ b/source/base/polynomials_rannacher_turek.cc @@ -153,15 +153,15 @@ PolynomialsRannacherTurek::evaluate( std::vector> &fourth_derivatives) const { const unsigned int n_pols = this->n(); - Assert(values.size() == n_pols || values.size() == 0, + Assert(values.size() == n_pols || values.empty(), ExcDimensionMismatch(values.size(), n_pols)); - Assert(grads.size() == n_pols || grads.size() == 0, + Assert(grads.size() == n_pols || grads.empty(), ExcDimensionMismatch(grads.size(), n_pols)); - Assert(grad_grads.size() == n_pols || grad_grads.size() == 0, + Assert(grad_grads.size() == n_pols || grad_grads.empty(), ExcDimensionMismatch(grad_grads.size(), n_pols)); - Assert(third_derivatives.size() == n_pols || third_derivatives.size() == 0, + Assert(third_derivatives.size() == n_pols || third_derivatives.empty(), ExcDimensionMismatch(third_derivatives.size(), n_pols)); - Assert(fourth_derivatives.size() == n_pols || fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == n_pols || fourth_derivatives.empty(), ExcDimensionMismatch(fourth_derivatives.size(), n_pols)); for (unsigned int i = 0; i < n_pols; ++i) diff --git a/source/base/polynomials_raviart_thomas.cc b/source/base/polynomials_raviart_thomas.cc index c76b8a5dbd..867bcba344 100644 --- a/source/base/polynomials_raviart_thomas.cc +++ b/source/base/polynomials_raviart_thomas.cc @@ -139,16 +139,15 @@ PolynomialsRaviartThomas::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch(values.size(), this->n())); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch(grads.size(), this->n())); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch(grad_grads.size(), this->n())); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch(third_derivatives.size(), this->n())); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch(fourth_derivatives.size(), this->n())); std::vector p_values; @@ -158,11 +157,11 @@ PolynomialsRaviartThomas::evaluate( std::vector> p_fourth_derivatives; const unsigned int n_sub = polynomial_space.n(); - p_values.resize((values.size() == 0) ? 0 : n_sub); - p_grads.resize((grads.size() == 0) ? 0 : n_sub); - p_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_sub); - p_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_sub); - p_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_sub); + p_values.resize((values.empty()) ? 0 : n_sub); + p_grads.resize((grads.empty()) ? 0 : n_sub); + p_grad_grads.resize((grad_grads.empty()) ? 0 : n_sub); + p_third_derivatives.resize((third_derivatives.empty()) ? 0 : n_sub); + p_fourth_derivatives.resize((fourth_derivatives.empty()) ? 0 : n_sub); for (unsigned int d = 0; d < dim; ++d) { diff --git a/source/base/polynomials_rt_bubbles.cc b/source/base/polynomials_rt_bubbles.cc index 367040222c..0487511b49 100644 --- a/source/base/polynomials_rt_bubbles.cc +++ b/source/base/polynomials_rt_bubbles.cc @@ -49,23 +49,22 @@ PolynomialsRT_Bubbles::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch(values.size(), this->n())); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch(grads.size(), this->n())); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch(grad_grads.size(), this->n())); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch(third_derivatives.size(), this->n())); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch(fourth_derivatives.size(), this->n())); // Third and fourth derivatives are not implemented (void)third_derivatives; - Assert(third_derivatives.size() == 0, ExcNotImplemented()); + Assert(third_derivatives.empty(), ExcNotImplemented()); (void)fourth_derivatives; - Assert(fourth_derivatives.size() == 0, ExcNotImplemented()); + Assert(fourth_derivatives.empty(), ExcNotImplemented()); const unsigned int n_sub = raviart_thomas_space.n(); const unsigned int my_degree = this->degree(); @@ -83,9 +82,9 @@ PolynomialsRT_Bubbles::evaluate( static std::vector> p_third_derivatives; static std::vector> p_fourth_derivatives; - p_values.resize((values.size() == 0) ? 0 : n_sub); - p_grads.resize((grads.size() == 0) ? 0 : n_sub); - p_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_sub); + p_values.resize((values.empty()) ? 0 : n_sub); + p_grads.resize((grads.empty()) ? 0 : n_sub); + p_grad_grads.resize((grad_grads.empty()) ? 0 : n_sub); // This is the Raviart-Thomas part of the space raviart_thomas_space.evaluate(unit_point, diff --git a/source/base/table_handler.cc b/source/base/table_handler.cc index f14dc7749b..8ec6713bb7 100644 --- a/source/base/table_handler.cc +++ b/source/base/table_handler.cc @@ -94,7 +94,7 @@ namespace internal std::visit([&ss](auto &v) { ss << v; }, value); cached_value = ss.str(); - if (cached_value.size() == 0) + if (cached_value.empty()) cached_value = "\"\""; } @@ -742,7 +742,7 @@ TableHandler::clear() unsigned int TableHandler::n_rows() const { - if (columns.size() == 0) + if (columns.empty()) return 0; std::map::const_iterator col_iter = columns.begin(); diff --git a/source/base/tensor_product_polynomials.cc b/source/base/tensor_product_polynomials.cc index 5aaad548d2..ba0f9a7057 100644 --- a/source/base/tensor_product_polynomials.cc +++ b/source/base/tensor_product_polynomials.cc @@ -314,16 +314,15 @@ TensorProductPolynomials::evaluate( std::vector> &fourth_derivatives) const { Assert(dim <= 3, ExcNotImplemented()); - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch2(values.size(), this->n(), 0)); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch2(grads.size(), this->n(), 0)); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch2(grad_grads.size(), this->n(), 0)); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch2(third_derivatives.size(), this->n(), 0)); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch2(fourth_derivatives.size(), this->n(), 0)); const bool update_values = (values.size() == this->n()), @@ -704,16 +703,15 @@ AnisotropicPolynomials::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == this->n() || values.size() == 0, + Assert(values.size() == this->n() || values.empty(), ExcDimensionMismatch2(values.size(), this->n(), 0)); - Assert(grads.size() == this->n() || grads.size() == 0, + Assert(grads.size() == this->n() || grads.empty(), ExcDimensionMismatch2(grads.size(), this->n(), 0)); - Assert(grad_grads.size() == this->n() || grad_grads.size() == 0, + Assert(grad_grads.size() == this->n() || grad_grads.empty(), ExcDimensionMismatch2(grad_grads.size(), this->n(), 0)); - Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0, + Assert(third_derivatives.size() == this->n() || third_derivatives.empty(), ExcDimensionMismatch2(third_derivatives.size(), this->n(), 0)); - Assert(fourth_derivatives.size() == this->n() || - fourth_derivatives.size() == 0, + Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(), ExcDimensionMismatch2(fourth_derivatives.size(), this->n(), 0)); const bool update_values = (values.size() == this->n()), diff --git a/source/base/tensor_product_polynomials_bubbles.cc b/source/base/tensor_product_polynomials_bubbles.cc index 3b95ad7671..c8d8c75e80 100644 --- a/source/base/tensor_product_polynomials_bubbles.cc +++ b/source/base/tensor_product_polynomials_bubbles.cc @@ -269,20 +269,21 @@ TensorProductPolynomialsBubbles::evaluate( const unsigned int max_q_indices = tensor_polys.n(); (void)max_q_indices; const unsigned int n_bubbles = ((q_degree <= 1) ? 1 : dim); - Assert(values.size() == max_q_indices + n_bubbles || values.size() == 0, + Assert(values.size() == max_q_indices + n_bubbles || values.empty(), ExcDimensionMismatch2(values.size(), max_q_indices + n_bubbles, 0)); - Assert(grads.size() == max_q_indices + n_bubbles || grads.size() == 0, + Assert(grads.size() == max_q_indices + n_bubbles || grads.empty(), ExcDimensionMismatch2(grads.size(), max_q_indices + n_bubbles, 0)); - Assert( - grad_grads.size() == max_q_indices + n_bubbles || grad_grads.size() == 0, - ExcDimensionMismatch2(grad_grads.size(), max_q_indices + n_bubbles, 0)); + Assert(grad_grads.size() == max_q_indices + n_bubbles || grad_grads.empty(), + ExcDimensionMismatch2(grad_grads.size(), + max_q_indices + n_bubbles, + 0)); Assert(third_derivatives.size() == max_q_indices + n_bubbles || - third_derivatives.size() == 0, + third_derivatives.empty(), ExcDimensionMismatch2(third_derivatives.size(), max_q_indices + n_bubbles, 0)); Assert(fourth_derivatives.size() == max_q_indices + n_bubbles || - fourth_derivatives.size() == 0, + fourth_derivatives.empty(), ExcDimensionMismatch2(fourth_derivatives.size(), max_q_indices + n_bubbles, 0)); diff --git a/source/base/tensor_product_polynomials_const.cc b/source/base/tensor_product_polynomials_const.cc index 98e5594d4b..94a7d7d435 100644 --- a/source/base/tensor_product_polynomials_const.cc +++ b/source/base/tensor_product_polynomials_const.cc @@ -134,19 +134,19 @@ TensorProductPolynomialsConst::evaluate( std::vector> &third_derivatives, std::vector> &fourth_derivatives) const { - Assert(values.size() == tensor_polys.n() + 1 || values.size() == 0, + Assert(values.size() == tensor_polys.n() + 1 || values.empty(), ExcDimensionMismatch2(values.size(), tensor_polys.n() + 1, 0)); - Assert(grads.size() == tensor_polys.n() + 1 || grads.size() == 0, + Assert(grads.size() == tensor_polys.n() + 1 || grads.empty(), ExcDimensionMismatch2(grads.size(), tensor_polys.n() + 1, 0)); - Assert(grad_grads.size() == tensor_polys.n() + 1 || grad_grads.size() == 0, + Assert(grad_grads.size() == tensor_polys.n() + 1 || grad_grads.empty(), ExcDimensionMismatch2(grad_grads.size(), tensor_polys.n() + 1, 0)); Assert(third_derivatives.size() == tensor_polys.n() + 1 || - third_derivatives.size() == 0, + third_derivatives.empty(), ExcDimensionMismatch2(third_derivatives.size(), tensor_polys.n() + 1, 0)); Assert(fourth_derivatives.size() == tensor_polys.n() + 1 || - fourth_derivatives.size() == 0, + fourth_derivatives.empty(), ExcDimensionMismatch2(fourth_derivatives.size(), tensor_polys.n() + 1, 0)); diff --git a/source/base/utilities.cc b/source/base/utilities.cc index 80874182bb..c1a36d0573 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -152,7 +152,7 @@ namespace Utilities using LongDouble = long double; // return if there is nothing to do - if (points.size() == 0) + if (points.empty()) return std::vector>(); // get bounding box: @@ -630,7 +630,7 @@ namespace Utilities // first part to something useful, but stopped converting short // of the terminating '\0' character. This happens, for example, // if the given string is "1234 abc". - AssertThrow(!((errno != 0) || (s.size() == 0) || + AssertThrow(!((errno != 0) || (s.empty()) || ((s.size() > 0) && (*p != '\0'))), ExcMessage("Can't convert <" + s + "> to an integer.")); @@ -678,7 +678,7 @@ namespace Utilities // first part to something useful, but stopped converting short // of the terminating '\0' character. This happens, for example, // if the given string is "1.234 abc". - AssertThrow(!((errno != 0) || (s.size() == 0) || + AssertThrow(!((errno != 0) || (s.empty()) || ((s.size() > 0) && (*p != '\0'))), ExcMessage("Can't convert <" + s + "> to a double.")); diff --git a/source/differentiation/ad/ad_helpers.cc b/source/differentiation/ad/ad_helpers.cc index b52b373895..52ec23430a 100644 --- a/source/differentiation/ad/ad_helpers.cc +++ b/source/differentiation/ad/ad_helpers.cc @@ -185,7 +185,7 @@ namespace Differentiation ExcMessage("Not all values of sensitivities have been recorded!")); // This should happen only once - if (this->independent_variables.size() == 0) + if (this->independent_variables.empty()) { this->independent_variables.resize( this->n_independent_variables(), diff --git a/source/differentiation/sd/symengine_optimizer.cc b/source/differentiation/sd/symengine_optimizer.cc index c56d9ff426..32ef8ebe2a 100644 --- a/source/differentiation/sd/symengine_optimizer.cc +++ b/source/differentiation/sd/symengine_optimizer.cc @@ -728,7 +728,7 @@ namespace Differentiation const SD::Expression &func) { Assert( - dependent_variables_output.size() == 0, + dependent_variables_output.empty(), ExcMessage( "Cannot register function as the optimizer has already been finalized.")); dependent_variables_output.reserve(n_dependent_variables() + 1); @@ -756,7 +756,7 @@ namespace Differentiation const SD::types::symbol_vector &funcs) { Assert( - dependent_variables_output.size() == 0, + dependent_variables_output.empty(), ExcMessage( "Cannot register function as the optimizer has already been finalized.")); const std::size_t n_dependents_old = n_dependent_variables(); diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index ad8f56a43c..1aea431acc 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -1934,9 +1934,9 @@ namespace parallel // at all, which is mandatory if one of our processes does not own // any quadrant. This bypasses the assertion from being triggered. // - see: https://github.com/cburstedde/p4est/issues/48 - if (this->data_serializer.src_sizes_variable.size() == 0) + if (this->data_serializer.src_sizes_variable.empty()) this->data_serializer.src_sizes_variable.resize(1); - if (this->data_serializer.dest_sizes_variable.size() == 0) + if (this->data_serializer.dest_sizes_variable.empty()) this->data_serializer.dest_sizes_variable.resize(1); # endif @@ -2523,7 +2523,7 @@ namespace parallel enforce_mesh_balance_over_periodic_boundaries( Triangulation &tria) { - if (tria.get_periodic_face_map().size() == 0) + if (tria.get_periodic_face_map().empty()) return false; std::vector flags_before[2]; diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 4372fd1904..168a7ae684 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -2816,8 +2816,8 @@ void DoFHandler::create_active_fe_table() for (unsigned int level = 0; level < this->hp_cell_future_fe_indices.size(); ++level) { - if (this->hp_cell_active_fe_indices[level].size() == 0 && - this->hp_cell_future_fe_indices[level].size() == 0) + if (this->hp_cell_active_fe_indices[level].empty() && + this->hp_cell_future_fe_indices[level].empty()) { this->hp_cell_active_fe_indices[level].resize( this->tria->n_raw_cells(level), 0); diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 0760b9992d..6affd59f2d 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -2709,7 +2709,7 @@ namespace internal // independently, and then unifies some located at vertices or faces; // this leaves us with fewer DoFs than there were before, so use the // largest index as the one to determine the size of the index space - if (new_numbers.size() == 0) + if (new_numbers.empty()) return NumberCache(); else return NumberCache( diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index 5374a2437f..f29f5b8886 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -403,7 +403,7 @@ namespace DoFRenumbering // this processor if (dof_handler.locally_owned_dofs().n_elements() == 0) { - Assert(new_indices.size() == 0, ExcInternalError()); + Assert(new_indices.empty(), ExcInternalError()); return; } @@ -783,7 +783,7 @@ namespace DoFRenumbering // empty vector, set up things to // store components in the order // found in the system. - if (component_order.size() == 0) + if (component_order.empty()) for (unsigned int i = 0; i < fe_collection.n_components(); ++i) component_order.push_back(i); @@ -2315,7 +2315,7 @@ namespace DoFRenumbering // At this point we have no more communication to do - simplify things by // returning early if possible - if (component_renumbering.size() == 0) + if (component_renumbering.empty()) { new_dof_indices.resize(0); return; diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 0d5ed1b930..184aac1d74 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -1932,7 +1932,7 @@ namespace DoFTools // If the empty vector was given as default argument, set up this // vector as identity. std::vector target_component = target_component_; - if (target_component.size() == 0) + if (target_component.empty()) { target_component.resize(n_components); for (unsigned int i = 0; i < n_components; ++i) @@ -2029,7 +2029,7 @@ namespace DoFTools const unsigned int n_blocks = fe_collection[0].n_blocks(); std::vector target_block = target_block_; - if (target_block.size() == 0) + if (target_block.empty()) { target_block.resize(fe_collection[0].n_blocks()); for (unsigned int i = 0; i < n_blocks; ++i) @@ -2156,7 +2156,7 @@ namespace DoFTools numbers::invalid_dof_index); // return if there is nothing to do - if (boundary_ids.size() == 0) + if (boundary_ids.empty()) return; std::vector dofs_on_face; @@ -2525,7 +2525,7 @@ namespace DoFTools for (types::global_dof_index j = 0; j < indices.size(); ++j) { - if (selected_dofs.size() == 0) + if (selected_dofs.empty()) block_list.add(i, indices[j] - offset); else { diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 1a8116242d..b25e939cd4 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -1532,7 +1532,7 @@ namespace DoFTools // break if the n_primary_dofs == 0, because we are // attempting to constrain to an element that has no // face dofs - if (primary_dofs.size() == 0) + if (primary_dofs.empty()) break; dependent_dofs.resize( @@ -3286,7 +3286,7 @@ namespace DoFTools { // consistency check: if this is no parameter dof on the coarse grid, // then the respective row must be empty! - Assert(weights[parameter_dof].size() == 0, ExcInternalError()); + Assert(weights[parameter_dof].empty(), ExcInternalError()); } diff --git a/source/fe/block_mask.cc b/source/fe/block_mask.cc index 6478b5655c..663b2f5033 100644 --- a/source/fe/block_mask.cc +++ b/source/fe/block_mask.cc @@ -24,7 +24,7 @@ DEAL_II_NAMESPACE_OPEN std::ostream & operator<<(std::ostream &out, const BlockMask &mask) { - if (mask.block_mask.size() == 0) + if (mask.block_mask.empty()) out << "[all blocks selected]"; else { diff --git a/source/fe/component_mask.cc b/source/fe/component_mask.cc index 1ef2c70c05..99cc384d67 100644 --- a/source/fe/component_mask.cc +++ b/source/fe/component_mask.cc @@ -24,7 +24,7 @@ DEAL_II_NAMESPACE_OPEN std::ostream & operator<<(std::ostream &out, const ComponentMask &mask) { - if (mask.component_mask.size() == 0) + if (mask.component_mask.empty()) out << "[all components selected]"; else { diff --git a/source/fe/fe.cc b/source/fe/fe.cc index b3d9ce1726..5d8bffb88d 100644 --- a/source/fe/fe.cc +++ b/source/fe/fe.cc @@ -1051,7 +1051,7 @@ FiniteElement::get_unit_support_points() const // support points, but only if // there are as many as there are // degrees of freedom - Assert((unit_support_points.size() == 0) || + Assert((unit_support_points.empty()) || (unit_support_points.size() == this->n_dofs_per_cell()), ExcInternalError()); return unit_support_points; @@ -1074,9 +1074,8 @@ FiniteElement::get_generalized_support_points() const { // If the finite element implements generalized support points, return // those. Otherwise fall back to unit support points. - return ((generalized_support_points.size() == 0) ? - unit_support_points : - generalized_support_points); + return ((generalized_support_points.empty()) ? unit_support_points : + generalized_support_points); } @@ -1112,7 +1111,7 @@ FiniteElement::get_unit_face_support_points( // there are as many as there are // degrees of freedom on a face Assert((unit_face_support_points[this->n_unique_faces() == 1 ? 0 : face_no] - .size() == 0) || + .empty()) || (unit_face_support_points[this->n_unique_faces() == 1 ? 0 : face_no] .size() == this->n_dofs_per_face(face_no)), ExcInternalError()); diff --git a/source/fe/fe_bdm.cc b/source/fe/fe_bdm.cc index 0d960f5c81..00737cfaae 100644 --- a/source/fe/fe_bdm.cc +++ b/source/fe/fe_bdm.cc @@ -178,7 +178,7 @@ FE_BDM::convert_generalized_support_point_values_to_dof_values( { // Old version with no moments in 2d. See comment below in // initialize_support_points() - if (test_values_face.size() == 0) + if (test_values_face.empty()) { for (unsigned int i = 0; i < this->n_dofs_per_face(f); ++i) nodal_values[dbase + i] = diff --git a/source/fe/fe_enriched.cc b/source/fe/fe_enriched.cc index c8fe09fc02..bb9a7caa0e 100644 --- a/source/fe/fe_enriched.cc +++ b/source/fe/fe_enriched.cc @@ -737,7 +737,7 @@ FE_Enriched::multiply_by_enrichment( // Avoid evaluating quadrature points if no dofs are assigned. This // happens when FE_Nothing is used together with other FE (i.e. FE_Q) // as enrichments. - if (base_no_mult_local_enriched_dofs[base_no][m].size() == 0) + if (base_no_mult_local_enriched_dofs[base_no][m].empty()) continue; Assert(enrichments[base_no - 1][m](cell) != nullptr, diff --git a/source/fe/fe_poly_tensor.cc b/source/fe/fe_poly_tensor.cc index a03ad8f818..4d46ab1895 100644 --- a/source/fe/fe_poly_tensor.cc +++ b/source/fe/fe_poly_tensor.cc @@ -308,7 +308,7 @@ FE_PolyTensor::shape_value_component( std::lock_guard lock(cache_mutex); - if (cached_point != p || cached_values.size() == 0) + if (cached_point != p || cached_values.empty()) { cached_point = p; cached_values.resize(poly_space->n()); @@ -353,7 +353,7 @@ FE_PolyTensor::shape_grad_component( std::lock_guard lock(cache_mutex); - if (cached_point != p || cached_grads.size() == 0) + if (cached_point != p || cached_grads.empty()) { cached_point = p; cached_grads.resize(poly_space->n()); @@ -399,7 +399,7 @@ FE_PolyTensor::shape_grad_grad_component( std::lock_guard lock(cache_mutex); - if (cached_point != p || cached_grad_grads.size() == 0) + if (cached_point != p || cached_grad_grads.empty()) { cached_point = p; cached_grad_grads.resize(poly_space->n()); diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index dfd97f7ddb..e77e5a64f2 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -2535,7 +2535,7 @@ FESystem::unit_support_point(const unsigned int index) const { AssertIndexRange(index, this->n_dofs_per_cell()); Assert((this->unit_support_points.size() == this->n_dofs_per_cell()) || - (this->unit_support_points.size() == 0), + (this->unit_support_points.empty()), (typename FiniteElement::ExcFEHasNoSupportPoints())); // let's see whether we have the information pre-computed @@ -2561,7 +2561,7 @@ FESystem::unit_face_support_point( (this->unit_face_support_points[this->n_unique_faces() == 1 ? 0 : face_no] .size() == this->n_dofs_per_face(face_no)) || (this->unit_face_support_points[this->n_unique_faces() == 1 ? 0 : face_no] - .size() == 0), + .empty()), (typename FiniteElement::ExcFEHasNoSupportPoints())); // let's see whether we have the information pre-computed diff --git a/source/fe/mapping_fe.cc b/source/fe/mapping_fe.cc index 6365c4bc2c..c2f9c78b9a 100644 --- a/source/fe/mapping_fe.cc +++ b/source/fe/mapping_fe.cc @@ -1601,7 +1601,7 @@ MappingFE::fill_fe_face_values( // cell (note that we need to first check the triangulation pointer, since // otherwise the second test might trigger an exception if the // triangulations are not the same) - if ((data.mapping_support_points.size() == 0) || + if ((data.mapping_support_points.empty()) || (&cell->get_triangulation() != &data.cell_of_current_support_points->get_triangulation()) || (cell != data.cell_of_current_support_points)) @@ -1648,7 +1648,7 @@ MappingFE::fill_fe_subface_values( // cell (note that we need to first check the triangulation pointer, since // otherwise the second test might trigger an exception if the // triangulations are not the same) - if ((data.mapping_support_points.size() == 0) || + if ((data.mapping_support_points.empty()) || (&cell->get_triangulation() != &data.cell_of_current_support_points->get_triangulation()) || (cell != data.cell_of_current_support_points)) diff --git a/source/fe/mapping_q.cc b/source/fe/mapping_q.cc index 222db2226f..5dcc16e8f2 100644 --- a/source/fe/mapping_q.cc +++ b/source/fe/mapping_q.cc @@ -1019,7 +1019,7 @@ MappingQ::fill_fe_face_values( // cell (note that we need to first check the triangulation pointer, since // otherwise the second test might trigger an exception if the // triangulations are not the same) - if ((data.mapping_support_points.size() == 0) || + if ((data.mapping_support_points.empty()) || (&cell->get_triangulation() != &data.cell_of_current_support_points->get_triangulation()) || (cell != data.cell_of_current_support_points)) @@ -1070,7 +1070,7 @@ MappingQ::fill_fe_subface_values( // cell (note that we need to first check the triangulation pointer, since // otherwise the second test might trigger an exception if the // triangulations are not the same) - if ((data.mapping_support_points.size() == 0) || + if ((data.mapping_support_points.empty()) || (&cell->get_triangulation() != &data.cell_of_current_support_points->get_triangulation()) || (cell != data.cell_of_current_support_points)) diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index ea614d9305..98c8143833 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -2255,7 +2255,7 @@ namespace GridGenerator const bool colorize) { std::vector compute_subdivisions = subdivisions; - if (compute_subdivisions.size() == 0) + if (compute_subdivisions.empty()) { compute_subdivisions.resize(dim, 1); } diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 94d7ff9899..0d07c4a4cd 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -269,8 +269,8 @@ GridIn::read_vtk(std::istream &in) { // we assume that the file contains first all cells, // and only then any faces or lines - AssertThrow(subcelldata.boundary_quads.size() == 0 && - subcelldata.boundary_lines.size() == 0, + AssertThrow(subcelldata.boundary_quads.empty() && + subcelldata.boundary_lines.empty(), ExcNotImplemented()); cells.emplace_back(n_vertices); @@ -296,7 +296,7 @@ GridIn::read_vtk(std::istream &in) { // we assume that the file contains first all cells, // then all faces, and finally all lines - AssertThrow(subcelldata.boundary_lines.size() == 0, + AssertThrow(subcelldata.boundary_lines.empty(), ExcNotImplemented()); subcelldata.boundary_quads.emplace_back(n_vertices); @@ -338,7 +338,7 @@ GridIn::read_vtk(std::istream &in) { // we assume that the file contains first all cells, // and only then any faces - AssertThrow(subcelldata.boundary_lines.size() == 0, + AssertThrow(subcelldata.boundary_lines.empty(), ExcNotImplemented()); cells.emplace_back(n_vertices); @@ -848,7 +848,7 @@ GridIn::read_unv(std::istream &in) // we need a call to std::getline() to retrieve it (it is logically // a line): std::getline(in, line); - AssertThrow(line.size() == 0, + AssertThrow(line.empty(), ExcMessage( "The line before the line containing an ID has too " "many entries. This is not a valid UNV file.")); @@ -3518,7 +3518,7 @@ GridIn::read_assimp(const std::string &filename, } // No cells were read - if (cells.size() == 0) + if (cells.empty()) return; if (remove_duplicates) diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index e2920086f7..55e4fd551e 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -771,7 +771,7 @@ namespace GridTools std::iota(new_vertex_numbers.begin(), new_vertex_numbers.end(), 0); // if the considered_vertices vector is empty, consider all vertices - if (considered_vertices.size() == 0) + if (considered_vertices.empty()) considered_vertices = new_vertex_numbers; Assert(considered_vertices.size() <= vertices.size(), ExcInternalError()); @@ -891,7 +891,7 @@ namespace GridTools delete_duplicated_vertices(std::vector> &vertices, const double tol) { - if (vertices.size() == 0) + if (vertices.empty()) return; // 1) map point to local vertex index @@ -2615,7 +2615,7 @@ namespace GridTools const std::vector> &vertices = tria.get_vertices(); Assert(tria.get_vertices().size() == marked_vertices.size() || - marked_vertices.size() == 0, + marked_vertices.empty(), ExcDimensionMismatch(tria.get_vertices().size(), marked_vertices.size())); @@ -2624,7 +2624,7 @@ namespace GridTools // the range used_vertices.begin() to used_vertices.end() the element in the // second range must be valid if the element in the first range is valid. Assert( - marked_vertices.size() == 0 || + marked_vertices.empty() || std::equal(marked_vertices.begin(), marked_vertices.end(), tria.get_used_vertices().begin(), @@ -2635,9 +2635,8 @@ namespace GridTools // If marked_indices is empty, consider all used_vertices for finding the // closest vertex to the point. Otherwise, marked_indices is used. - const std::vector &vertices_to_use = (marked_vertices.size() == 0) ? - tria.get_used_vertices() : - marked_vertices; + const std::vector &vertices_to_use = + (marked_vertices.empty()) ? tria.get_used_vertices() : marked_vertices; // At the beginning, the first used vertex is considered to be the closest // one. @@ -2687,7 +2686,7 @@ namespace GridTools auto vertices = extract_used_vertices(tria, mapping); Assert(tria.get_vertices().size() == marked_vertices.size() || - marked_vertices.size() == 0, + marked_vertices.empty(), ExcDimensionMismatch(tria.get_vertices().size(), marked_vertices.size())); @@ -2697,7 +2696,7 @@ namespace GridTools // in the second range must be valid if the element in the first range is // valid. Assert( - marked_vertices.size() == 0 || + marked_vertices.empty() || std::equal(marked_vertices.begin(), marked_vertices.end(), tria.get_used_vertices().begin(), @@ -2865,7 +2864,7 @@ namespace GridTools // check whether cell has at least one marked vertex const auto cell_marked = [&mesh, &marked_vertices](const auto &cell) { - if (marked_vertices.size() == 0) + if (marked_vertices.empty()) return true; if (cell != mesh.active_cell_iterators().end()) @@ -3112,7 +3111,7 @@ namespace GridTools ++i; // No active cells or no active cells with property - if (active_cells.size() == 0 || i == active_cells.size()) + if (active_cells.empty() || i == active_cells.size()) { BoundingBox bbox; return std::make_tuple(bbox, has_predicate); @@ -5502,7 +5501,7 @@ namespace GridTools // if no cells need to be added, then no regularization is necessary. // Restore things as they were before this function was called. - if (cells_to_add.size() == 0) + if (cells_to_add.empty()) { while (refinement_cycles > 0) { @@ -6212,7 +6211,7 @@ namespace GridTools }; Assert( - (marked_vertices.size() == 0) || + (marked_vertices.empty()) || (marked_vertices.size() == cache.get_triangulation().n_vertices()), ExcMessage( "The marked_vertices vector has to be either empty or its size has " @@ -6226,7 +6225,7 @@ namespace GridTools // any of the incoming points (and it will not send any data) so // that we can take a short cut. const bool has_relevant_vertices = - (marked_vertices.size() == 0) || + (marked_vertices.empty()) || (std::find(marked_vertices.begin(), marked_vertices.end(), true) != marked_vertices.end()); @@ -6598,7 +6597,7 @@ namespace GridTools }; Assert( - (marked_vertices.size() == 0) || + (marked_vertices.empty()) || (marked_vertices.size() == cache.get_triangulation().n_vertices()), ExcMessage( "The marked_vertices vector has to be either empty or its size has " @@ -6609,7 +6608,7 @@ namespace GridTools // any of the incoming points (and it will not send any data) so // that we can take a short cut. const bool has_relevant_vertices = - (marked_vertices.size() == 0) || + (marked_vertices.empty()) || (std::find(marked_vertices.begin(), marked_vertices.end(), true) != marked_vertices.end()); @@ -6655,7 +6654,7 @@ namespace GridTools const auto &boxes_and_cells = cache.get_locally_owned_cell_bounding_boxes_rtree(); - if (marked_verts.size() == 0) + if (marked_verts.empty()) return boxes_and_cells; std::vector> &vertices = tria.get_vertices(); Assert(tria.get_vertices().size() == marked_vertices.size() || - marked_vertices.size() == 0, + marked_vertices.empty(), ExcDimensionMismatch(tria.get_vertices().size(), marked_vertices.size())); @@ -79,7 +79,7 @@ namespace GridTools // (if p is false, q could be false or true). // p implies q logic is encapsulated in ~p|q. Assert( - marked_vertices.size() == 0 || + marked_vertices.empty() || std::equal(marked_vertices.begin(), marked_vertices.end(), tria.get_used_vertices().begin(), @@ -94,9 +94,8 @@ namespace GridTools // could be the potentially closest // vertex to the point, use it instead // of used vertices - const std::vector &used = (marked_vertices.size() == 0) ? - tria.get_used_vertices() : - marked_vertices; + const std::vector &used = + (marked_vertices.empty()) ? tria.get_used_vertices() : marked_vertices; // At the beginning, the first // used vertex is the closest one @@ -149,7 +148,7 @@ namespace GridTools auto vertices = extract_used_vertices(tria, mapping); Assert(tria.get_vertices().size() == marked_vertices.size() || - marked_vertices.size() == 0, + marked_vertices.empty(), ExcDimensionMismatch(tria.get_vertices().size(), marked_vertices.size())); @@ -161,7 +160,7 @@ namespace GridTools // (if p is false, q could be false or true). // p implies q logic is encapsulated in ~p|q. Assert( - marked_vertices.size() == 0 || + marked_vertices.empty() || std::equal(marked_vertices.begin(), marked_vertices.end(), tria.get_used_vertices().begin(), @@ -381,7 +380,7 @@ namespace GridTools adjacent_cells.clear(); adjacent_cells.insert(adjacent_cells_new.begin(), adjacent_cells_new.end()); - if (adjacent_cells.size() == 0) + if (adjacent_cells.empty()) { // we haven't found any other cell that would be a // neighbor of a previously found cell, but we know @@ -2139,7 +2138,7 @@ namespace GridTools (dynamic_cast< const parallel::fullydistributed::Triangulation *>(&pairs2.begin()->first->get_triangulation()) != nullptr)))) - AssertThrow(n_matches == pairs1.size() && pairs2.size() == 0, + AssertThrow(n_matches == pairs1.size() && pairs2.empty(), ExcMessage("Unmatched faces on periodic boundaries")); } } diff --git a/source/grid/persistent_tria.cc b/source/grid/persistent_tria.cc index a5913ee39e..81bd8818cd 100644 --- a/source/grid/persistent_tria.cc +++ b/source/grid/persistent_tria.cc @@ -190,8 +190,7 @@ template void PersistentTriangulation::read_flags(std::istream &in) { - Assert(refine_flags.size() == 0 && coarsen_flags.size() == 0, - ExcFlagsNotCleared()); + Assert(refine_flags.empty() && coarsen_flags.empty(), ExcFlagsNotCleared()); AssertThrow(in.fail() == false, ExcIO()); unsigned int magic_number; diff --git a/source/grid/tria.cc b/source/grid/tria.cc index a16274c878..09a5748f2f 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -147,9 +147,9 @@ namespace internal & pack_callbacks_variable, const MPI_Comm &mpi_communicator) { - Assert(src_data_fixed.size() == 0, + Assert(src_data_fixed.empty(), ExcMessage("Previously packed data has not been released yet!")); - Assert(src_sizes_variable.size() == 0, ExcInternalError()); + Assert(src_sizes_variable.empty(), ExcInternalError()); const unsigned int n_callbacks_fixed = pack_callbacks_fixed.size(); const unsigned int n_callbacks_variable = pack_callbacks_variable.size(); @@ -906,7 +906,7 @@ namespace internal const unsigned int n_attached_deserialize_variable, const MPI_Comm & mpi_communicator) { - Assert(dest_data_fixed.size() == 0, + Assert(dest_data_fixed.empty(), ExcMessage("Previously loaded data has not been released yet!")); variable_size_data_stored = (n_attached_deserialize_variable > 0); @@ -3506,7 +3506,7 @@ namespace internal { AssertDimension(obj.structdim, structdim); - if (boundary_objects_in.size() == 0) + if (boundary_objects_in.empty()) return; // empty subcelldata -> nothing to do // pre-sort subcelldata @@ -12472,7 +12472,7 @@ DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) void Triangulation::copy_triangulation( const Triangulation &other_tria) { - Assert((vertices.size() == 0) && (levels.size() == 0) && (faces == nullptr), + Assert((vertices.empty()) && (levels.empty()) && (faces == nullptr), ExcTriangulationNotEmpty(vertices.size(), levels.size())); Assert((other_tria.levels.size() != 0) && (other_tria.vertices.size() != 0) && (dim == 1 || other_tria.faces != nullptr), @@ -12566,7 +12566,7 @@ void Triangulation::create_triangulation( const std::vector> & cells, const SubCellData & subcelldata) { - Assert((vertices.size() == 0) && (levels.size() == 0) && (faces == nullptr), + Assert((vertices.empty()) && (levels.empty()) && (faces == nullptr), ExcTriangulationNotEmpty(vertices.size(), levels.size())); // check that no forbidden arrays // are used @@ -12605,7 +12605,7 @@ void Triangulation::create_triangulation( // throw the array (and fill the various location fields) if // there are distorted cells. otherwise, just fall off the end // of the function - AssertThrow(distorted_cells.distorted_cells.size() == 0, distorted_cells); + AssertThrow(distorted_cells.distorted_cells.empty(), distorted_cells); } @@ -12722,7 +12722,7 @@ void Triangulation::create_triangulation( // Before we quit let's check that if the triangulation is // disconnected that we still get all cells - if (next_round.size() == 0) + if (next_round.empty()) for (const auto &cell : this->active_cell_iterators()) if (cell->user_flag_set() == false) { @@ -15599,7 +15599,7 @@ void Triangulation::execute_coarsening_and_refinement() // Inform all listeners about end of refinement. signals.post_refinement(); - AssertThrow(cells_with_distorted_children.distorted_cells.size() == 0, + AssertThrow(cells_with_distorted_children.distorted_cells.empty(), cells_with_distorted_children); update_periodic_face_map(); diff --git a/source/grid/tria_description.cc b/source/grid/tria_description.cc index 67ba5c6b16..f386a3a2a3 100644 --- a/source/grid/tria_description.cc +++ b/source/grid/tria_description.cc @@ -71,9 +71,9 @@ SubCellData::check_consistency(const unsigned int dim) const switch (dim) { case 1: - return ((boundary_lines.size() == 0) && (boundary_quads.size() == 0)); + return ((boundary_lines.empty()) && (boundary_quads.empty())); case 2: - return (boundary_quads.size() == 0); + return (boundary_quads.empty()); } return true; } @@ -289,7 +289,7 @@ namespace TriangulationDescription // make cells unique for (unsigned int i = 0; i < this->cell_infos.size(); ++i) { - if (this->cell_infos[i].size() == 0) + if (this->cell_infos[i].empty()) continue; std::sort(this->cell_infos[i].begin(), diff --git a/source/lac/dynamic_sparsity_pattern.cc b/source/lac/dynamic_sparsity_pattern.cc index 7af9776a2f..6f8841f9f2 100644 --- a/source/lac/dynamic_sparsity_pattern.cc +++ b/source/lac/dynamic_sparsity_pattern.cc @@ -54,7 +54,7 @@ DynamicSparsityPattern::Line::add_entries(ForwardIterator begin, } #endif - if (entries.size() == 0 || entries.back() < *begin) + if (entries.empty() || entries.back() < *begin) { entries.insert(entries.end(), begin, end); return; @@ -151,7 +151,7 @@ DynamicSparsityPattern::Line::add_entries(ForwardIterator begin, // insert the first element as for one // entry only first check the last // element (or if line is still empty) - if ((entries.size() == 0) || (entries.back() < col)) + if ((entries.empty()) || (entries.back() < col)) { entries.push_back(col); it = entries.end() - 1; diff --git a/source/lac/sparse_direct.cc b/source/lac/sparse_direct.cc index 19cf5baea9..b4e9618255 100644 --- a/source/lac/sparse_direct.cc +++ b/source/lac/sparse_direct.cc @@ -383,7 +383,7 @@ SparseDirectUMFPACK::solve(Vector &rhs_and_solution, Assert(Ai.size() != 0, ExcNotInitialized()); Assert(Ai.size() == Ax.size(), ExcNotInitialized()); - Assert(Az.size() == 0, + Assert(Az.empty(), ExcMessage("You have previously factored a matrix using this class " "that had complex-valued entries. This then requires " "applying the factored matrix to a complex-valued " diff --git a/source/lac/sparsity_pattern.cc b/source/lac/sparsity_pattern.cc index 8b022eaa29..eecbfb61e2 100644 --- a/source/lac/sparsity_pattern.cc +++ b/source/lac/sparsity_pattern.cc @@ -251,7 +251,7 @@ SparsityPattern::reinit(const size_type m, } max_row_length = - (row_lengths.size() == 0 ? + (row_lengths.empty() ? 0 : std::min(static_cast( *std::max_element(row_lengths.begin(), row_lengths.end())), diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 013bbfe5af..f6844f0b7b 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -305,7 +305,7 @@ namespace SparsityTools #else Assert( - cell_weights.size() == 0, + cell_weights.empty(), ExcMessage( "The cell weighting functionality for Zoltan has not yet been implemented.")); (void)cell_weights; diff --git a/source/matrix_free/dof_info.cc b/source/matrix_free/dof_info.cc index 3997820e6c..82196c0e2e 100644 --- a/source/matrix_free/dof_info.cc +++ b/source/matrix_free/dof_info.cc @@ -239,7 +239,7 @@ namespace internal bool has_hanging_nodes = false; const unsigned int fe_index = - (cell_active_fe_index.size() == 0 || + (cell_active_fe_index.empty() || dofs_per_cell.size() == 1) ? 0 : cell_active_fe_index[boundary_cells[i]]; @@ -639,7 +639,7 @@ namespace internal AssertIndexRange(start_index, dof_indices.size()); dof_indices_contiguous[dof_access_cell] [i * vectorization_length + j] = - this->dof_indices.size() == 0 ? + this->dof_indices.empty() ? 0 : this->dof_indices[start_index]; } diff --git a/source/matrix_free/task_info.cc b/source/matrix_free/task_info.cc index 87fb1bb285..8bea792500 100644 --- a/source/matrix_free/task_info.cc +++ b/source/matrix_free/task_info.cc @@ -770,7 +770,7 @@ namespace internal ++bound_index; } while (fillup_needed > 0 && - (new_boundary_cells.size() == 0 || + (new_boundary_cells.empty() || new_boundary_cells.back() < n_active_cells - 1)) new_boundary_cells.push_back(new_boundary_cells.back() + 1); while (bound_index < boundary_cells.size()) @@ -1755,7 +1755,7 @@ namespace internal unsigned int partition_counter = 0; while (work) { - if (neighbor_list.size() == 0) + if (neighbor_list.empty()) { work = false; partition_counter = 0; diff --git a/source/matrix_free/vector_data_exchange.cc b/source/matrix_free/vector_data_exchange.cc index b5c04c61d8..2ce26db2c0 100644 --- a/source/matrix_free/vector_data_exchange.cc +++ b/source/matrix_free/vector_data_exchange.cc @@ -1345,7 +1345,7 @@ namespace internal unsigned int Full::n_import_indices() const { - if (import_targets_data.size() == 0) + if (import_targets_data.empty()) return 0; return import_targets_data.back()[1] + import_targets_data.back()[2]; } diff --git a/source/multigrid/mg_tools.cc b/source/multigrid/mg_tools.cc index b3915516cc..06932c4e39 100644 --- a/source/multigrid/mg_tools.cc +++ b/source/multigrid/mg_tools.cc @@ -1066,7 +1066,7 @@ namespace MGTools Assert(result.size() == nlevels, ExcDimensionMismatch(result.size(), nlevels)); - if (target_component.size() == 0) + if (target_component.empty()) { target_component.resize(n_components); for (unsigned int i = 0; i < n_components; ++i) @@ -1171,7 +1171,7 @@ namespace MGTools // If the empty vector was given as // default argument, set up this // vector as identity. - if (target_block.size() == 0) + if (target_block.empty()) { target_block.resize(n_blocks); for (unsigned int i = 0; i < n_blocks; ++i) @@ -1291,7 +1291,7 @@ namespace MGTools boundary_indices.resize(dof.get_triangulation().n_global_levels()); // if for whatever reason we were passed an empty set, return immediately - if (boundary_ids.size() == 0) + if (boundary_ids.empty()) return; for (unsigned int i = 0; i < dof.get_triangulation().n_global_levels(); ++i) diff --git a/source/multigrid/mg_transfer_block.cc b/source/multigrid/mg_transfer_block.cc index f7f87808b3..ff0057a3a7 100644 --- a/source/multigrid/mg_transfer_block.cc +++ b/source/multigrid/mg_transfer_block.cc @@ -62,7 +62,7 @@ namespace const unsigned int n_selected = std::accumulate(selected.begin(), selected.end(), 0u); - if (ndofs.size() == 0) + if (ndofs.empty()) { std::vector> new_dofs( dof_handler.get_triangulation().n_levels(), @@ -109,7 +109,7 @@ namespace std::vector selected(n_blocks, false); selected[selected_block] = true; - if (ndofs.size() == 0) + if (ndofs.empty()) { std::vector> new_dofs( dof_handler.get_triangulation().n_levels(), @@ -569,7 +569,7 @@ MGTransferBlock::build(const DoFHandler &dof_handler, ExcDimensionMismatch(sel.size(), n_blocks)); selected = sel; } - if (selected.size() == 0) + if (selected.empty()) selected = std::vector(n_blocks, true); MGTransferBlockBase::build(dof_handler); diff --git a/source/multigrid/mg_transfer_component.cc b/source/multigrid/mg_transfer_component.cc index 9d0b737327..082d1c34fc 100644 --- a/source/multigrid/mg_transfer_component.cc +++ b/source/multigrid/mg_transfer_component.cc @@ -98,7 +98,7 @@ namespace // directly after this function was // called, we use the arguments // directly. - if (target_component.size() == 0) + if (target_component.empty()) { target_component.resize(ncomp); for (unsigned int i = 0; i < ncomp; ++i) @@ -107,7 +107,7 @@ namespace // If selected is an empty vector, // all components are selected. - if (selected.size() == 0) + if (selected.empty()) { selected.resize(target_component.size()); std::fill_n(selected.begin(), ncomp, false); @@ -122,7 +122,7 @@ namespace const unsigned int n_selected = std::accumulate(selected.begin(), selected.end(), 0u); - if (ndofs.size() == 0) + if (ndofs.empty()) { std::vector> new_dofs( mg_dof.get_triangulation().n_levels(), @@ -192,7 +192,7 @@ namespace if (component_mask[i]) selected_block = target_component[i]; - if (ndofs.size() == 0) + if (ndofs.empty()) { std::vector> new_dofs( mg_dof.get_triangulation().n_levels(), @@ -259,7 +259,7 @@ MGTransferComponentBase::build(const DoFHandler &mg_dof) // Fill target component with // standard values (identity) if it // is empty - if (target_component.size() == 0) + if (target_component.empty()) { target_component.resize(mg_dof.get_fe(0).n_components()); for (unsigned int i = 0; i < target_component.size(); ++i) @@ -280,7 +280,7 @@ MGTransferComponentBase::build(const DoFHandler &mg_dof) // Do the same for the multilevel // components. These may be // different. - if (mg_target_component.size() == 0) + if (mg_target_component.empty()) { mg_target_component.resize(mg_dof.get_fe(0).n_components()); for (unsigned int i = 0; i < mg_target_component.size(); ++i) @@ -507,7 +507,7 @@ MGTransferComponentBase::build(const DoFHandler &mg_dof) mg_target_component); for (unsigned int level = 0; level < n_levels - 1; ++level) { - if (boundary_indices[level].size() == 0) + if (boundary_indices[level].empty()) continue; for (unsigned int iblock = 0; iblock < n_components; ++iblock) diff --git a/source/multigrid/mg_transfer_internal.cc b/source/multigrid/mg_transfer_internal.cc index 7d4be4e020..37409e6c55 100644 --- a/source/multigrid/mg_transfer_internal.cc +++ b/source/multigrid/mg_transfer_internal.cc @@ -202,7 +202,7 @@ namespace internal (dynamic_cast *>(&dof_handler.get_triangulation())); AssertThrow( - send_data_temp.size() == 0 || tria != nullptr, + send_data_temp.empty() || tria != nullptr, ExcMessage( "We should only be sending information with a parallel Triangulation!")); diff --git a/source/non_matching/quadrature_generator.cc b/source/non_matching/quadrature_generator.cc index df5e9bb56c..856e6d82de 100644 --- a/source/non_matching/quadrature_generator.cc +++ b/source/non_matching/quadrature_generator.cc @@ -1650,7 +1650,7 @@ namespace NonMatching // zero. If you call generate() with a ZeroFunction nothing good can be // done. You will end up here. Assert( - q_generator.get_quadratures().indefinite.size() == 0, + q_generator.get_quadratures().indefinite.empty(), ExcMessage( "Generation of quadrature rules failed. This can mean that the level " "set function is degenerate in some way, e.g. oscillating extremely " diff --git a/source/numerics/data_out_faces.cc b/source/numerics/data_out_faces.cc index f48209aaeb..5fa098659f 100644 --- a/source/numerics/data_out_faces.cc +++ b/source/numerics/data_out_faces.cc @@ -375,7 +375,7 @@ DataOutFaces::build_patches( // clear the patches array and allocate the right number of elements this->patches.clear(); this->patches.reserve(all_faces.size()); - Assert(this->patches.size() == 0, ExcInternalError()); + Assert(this->patches.empty(), ExcInternalError()); std::vector n_postprocessor_outputs(this->dof_data.size()); diff --git a/source/numerics/data_out_stack.cc b/source/numerics/data_out_stack.cc index db900d8f2b..6ed0616160 100644 --- a/source/numerics/data_out_stack.cc +++ b/source/numerics/data_out_stack.cc @@ -100,7 +100,7 @@ DataOutStack::declare_data_vector( // not called after some parameter // values have already been // processed - Assert(patches.size() == 0, ExcDataAlreadyAdded()); + Assert(patches.empty(), ExcDataAlreadyAdded()); // also make sure that no name is // used twice diff --git a/source/numerics/matrix_tools.cc b/source/numerics/matrix_tools.cc index e5057f0ddd..833e15f023 100644 --- a/source/numerics/matrix_tools.cc +++ b/source/numerics/matrix_tools.cc @@ -89,7 +89,7 @@ namespace MatrixTools // if no boundary values are to be applied // simply return - if (boundary_values.size() == 0) + if (boundary_values.empty()) return; @@ -260,7 +260,7 @@ namespace MatrixTools // if no boundary values are to be applied // simply return - if (boundary_values.size() == 0) + if (boundary_values.empty()) return; @@ -513,7 +513,7 @@ namespace MatrixTools // if there is nothing to do, then exit // right away - if (boundary_values.size() == 0) + if (boundary_values.empty()) return; // otherwise traverse all the dofs used in diff --git a/source/numerics/point_value_history.cc b/source/numerics/point_value_history.cc index 42389d6717..66ccc77558 100644 --- a/source/numerics/point_value_history.cc +++ b/source/numerics/point_value_history.cc @@ -1054,7 +1054,7 @@ PointValueHistory::write_gnuplot( if (have_dof_handler) { AssertThrow(have_dof_handler, ExcDoFHandlerRequired()); - AssertThrow(postprocessor_locations.size() == 0 || + AssertThrow(postprocessor_locations.empty() || postprocessor_locations.size() == point_geometry_data.size(), ExcDimensionMismatch(postprocessor_locations.size(), diff --git a/source/opencascade/utilities.cc b/source/opencascade/utilities.cc index 5ec92e4a55..d6287c5cb6 100644 --- a/source/opencascade/utilities.cc +++ b/source/opencascade/utilities.cc @@ -652,7 +652,7 @@ namespace OpenCASCADE // run through maps in an orderly fashion, i.e., through the // boundary in one cycle and add points to pointlist. std::vector interpolation_curves; - bool finished = (face_to_verts.size() == 0); + bool finished = (face_to_verts.empty()); face_index = finished ? 0 : face_to_verts.begin()->first; while (finished == false) diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index e6c489be0b..f583291c08 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -36,7 +36,7 @@ namespace Particles { std::vector buffer; - if (particles.size() == 0) + if (particles.empty()) return buffer; buffer.resize(particles.size() * @@ -411,7 +411,7 @@ namespace Particles const typename Triangulation::active_cell_iterator &cell) const { - if (cells_to_particle_cache.size() == 0) + if (cells_to_particle_cache.empty()) return 0; if (cell->is_artificial() == false) @@ -742,7 +742,7 @@ namespace Particles auto &missing_points = std::get<3>(point_locations); // If a point was not found, throwing an error, as the old // implementation of compute_point_locations would have done - AssertThrow(missing_points.size() == 0, + AssertThrow(missing_points.empty(), VectorTools::ExcPointNotAvailableHere()); (void)missing_points; @@ -1761,7 +1761,7 @@ namespace Particles // information typename Triangulation::active_cell_iterator cell; - if (send_cells.size() == 0) + if (send_cells.empty()) cell = particles_to_send.at(neighbors[i])[j] ->get_surrounding_cell(); else -- 2.39.5