ExcIndexRange(0, fe.n_dofs_per_cell(), index));
static std::vector<QGaussOneOverR<2>> 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],
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"
{
// 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;
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
// 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 =
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."));
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."));
// kernel launched. The indices are expanded the first time the function
// is called.
if ((std::is_same_v<MemorySpaceType, MemorySpace::Default>)&&(
- import_indices_plain_dev.size() == 0))
+ import_indices_plain_dev.empty()))
initialize_import_indices_plain_dev();
# endif
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."));
// kernel launched. The indices are expanded the first time the function
// is called.
if ((std::is_same_v<MemorySpaceType, MemorySpace::Default>)&&(
- import_indices_plain_dev.size() == 0))
+ import_indices_plain_dev.empty()))
initialize_import_indices_plain_dev();
# endif
"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];
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."));
{
// if the mask represents the all-block mask
// then always return true
- if (block_mask.size() == 0)
+ if (block_mask.empty())
return true;
else
{
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));
}
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
{
if ((n != numbers::invalid_unsigned_int) && (size() > 0))
AssertDimension(n, size());
- if (block_mask.size() == 0)
+ if (block_mask.empty())
return 0;
else
{
inline bool
BlockMask::represents_the_all_selected_mask() const
{
- return (block_mask.size() == 0);
+ return (block_mask.empty());
}
{
// 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
{
{
// 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
{
{
// if the mask represents the all-component mask
// then always return true
- if (component_mask.size() == 0)
+ if (component_mask.empty())
return true;
else
{
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));
}
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
{
if ((n != numbers::invalid_unsigned_int) && (size() > 0))
AssertDimension(n, size());
- if (component_mask.size() == 0)
+ if (component_mask.empty())
return 0;
else
{
inline bool
ComponentMask::represents_the_all_selected_mask() const
{
- return (component_mask.size() == 0);
+ return (component_mask.empty());
}
{
// 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
{
{
// 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
{
// 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
{
// 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
// 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')
// 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")));
// 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,
std::vector<CellData> &computed_cells,
std::vector<CellData> &new_needs)
{
- if (cells_to_compute.size() == 0)
+ if (cells_to_compute.empty())
return;
// check if this cell exists in the local p4est
// 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);
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;
// 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;
// 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;
}
// 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<std::mutex> lock(mutex);
const MatrixType & M = *this->A;
Vector<typename VectorType::value_type> 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();
bool
SparseMatrixEZ<number>::empty() const
{
- return ((n_columns == 0) && (row_info.size() == 0));
+ return ((n_columns == 0) && (row_info.empty()));
}
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);
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;
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(),
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];
TensorProductMatrixSymmetricSumCollection<dim, Number, n_rows_1d>::
storage_size() const
{
- if (matrix_ptr.size() == 0)
+ if (matrix_ptr.empty())
return 0; // if not initialized
return matrix_ptr.size() - 1;
copy_petsc_vector(const PETScWrappers::VectorBase &v,
::dealii::Vector<Number> & out)
{
- if (v.size() == 0)
+ if (v.empty())
{
out.reinit(0);
return;
const bool transpose,
AlignedVector<Number> &evaluation_data_coarse) const
{
- if (hanging_node_constraint_masks.size() == 0)
+ if (hanging_node_constraint_masks.empty())
return;
std::array<MatrixFreeFunctions::compressed_constraint_kind,
const TriaIterator<DoFCellAccessor<dim, dim, false>> &cell,
std::vector<types::global_dof_index> & 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
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
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;
{
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
inline unsigned int
MatrixFree<dim, Number, VectorizedArrayType>::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();
}
inline unsigned int
MatrixFree<dim, Number, VectorizedArrayType>::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();
inline unsigned int
MatrixFree<dim, Number, VectorizedArrayType>::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();
}
selected_rows.push_back(given_row_selection[i]);
}
}
- if (given_column_selection.size() == 0)
+ if (given_column_selection.empty())
selected_columns = selected_rows;
else
{
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
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
// 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;
// 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));
}
, 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;
// 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;
unsigned int fp,
bool force)
{
- if (force || cell_quadrature.size() == 0)
+ if (force || cell_quadrature.empty())
cell_quadrature = QGauss<dim>(cp);
- if (force || boundary_quadrature.size() == 0)
+ if (force || boundary_quadrature.empty())
boundary_quadrature = QGauss<dim - 1>(bp);
- if (force || face_quadrature.size() == 0)
+ if (force || face_quadrature.empty())
face_quadrature = QGauss<dim - 1>(fp);
}
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,
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)
{
// 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);
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)
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());
MGLevelObject<BlockVector<number>> &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)
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();
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();
}
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);
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];
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]);
DataOut_DoFData<dim, patch_dim, spacedim, patch_spacedim>::attach_dof_handler(
const DoFHandler<dim, spacedim> &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 =
DataOut_DoFData<dim, patch_dim, spacedim, patch_spacedim>::attach_triangulation(
const Triangulation<dim, spacedim> &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 =
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<T>(element);
coefficient->n_components == n_components,
ExcComponentMismatch());
- if (component_mapping.size() == 0)
+ if (component_mapping.empty())
{
AssertDimension(n_components,
boundary_functions.begin()->second->n_components);
coefficient->n_components == n_components,
ExcComponentMismatch());
- if (component_mapping.size() == 0)
+ if (component_mapping.empty())
{
AssertDimension(n_components,
boundary_functions.begin()->second->n_components);
// 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) ==
// 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;
// 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);
typename VectorType::value_type>>>
&evaluators)
{
- if (evaluators.size() == 0)
+ if (evaluators.empty())
evaluators.resize(dof_handler.get_fe_collection().size());
typename DoFHandler<dim>::active_cell_iterator cell = {
std::enable_if_t<dealii::is_serial_vector<VectorType>::value == true>
subtract_mean_value(VectorType &v, const std::vector<bool> &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());
subtract_mean_value(VectorType &v, const std::vector<bool> &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());
}
create_global_data_table(const std::vector<Patch<dim, spacedim>> &patches)
{
// If there is nothing to write, just return
- if (patches.size() == 0)
+ if (patches.empty())
return std::make_unique<Table<2, Number>>();
// unlike in the main function, we don't have here the data_names field,
// legit if there are no patches
Assert(patches.size() > 0, ExcNoPatches());
#else
- if (patches.size() == 0)
+ if (patches.empty())
return;
#endif
// 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
// are no patches
Assert(patches.size() > 0, ExcNoPatches());
#else
- if (patches.size() == 0)
+ if (patches.empty())
return;
#endif
// 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;
// legit if there are no patches
Assert(patches.size() > 0, ExcNoPatches());
#else
- if (patches.size() == 0)
+ if (patches.empty())
return;
#endif
// legit if there are no patches
Assert(patches.size() > 0, ExcNoPatches());
#else
- if (patches.size() == 0)
+ if (patches.empty())
return;
#endif
// legit if there are no patches
Assert(patches.size() > 0, ExcNoPatches());
#else
- if (patches.size() == 0)
+ if (patches.empty())
return;
#endif
// legit if there are no patches
Assert(patches.size() > 0, ExcNoPatches());
#else
- if (patches.size() == 0)
+ if (patches.empty())
return;
#endif
// 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
{
AssertThrow(out.fail() == false, ExcIO());
- if (piece_names.size() == 0)
+ if (piece_names.empty())
return;
const double nblocks = piece_names[0].size();
{
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();
// patches
Assert(patches.size() > 0, ExcNoPatches());
#else
- if (patches.size() == 0)
+ if (patches.empty())
return;
#endif
// 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
{
}
#else
- Assert(buffers.size() == 0, ExcInternalError());
+ Assert(buffers.empty(), ExcInternalError());
(void)comm;
(void)dic_local_received;
#endif
// 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
// 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)
// 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)
line = Utilities::trim(line);
// if line is now empty: leave
- if (line.size() == 0)
+ if (line.empty())
{
return;
}
line.erase(0, 1);
AssertThrow(
- line.size() == 0,
+ line.empty(),
ExcCannotParseLine(current_line_n,
input_filename,
"Invalid content after 'end' or 'END' statement."));
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 " +
{
// 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
{
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
{
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;
std::vector<Tensor<4, dim>> &third_derivatives,
std::vector<Tensor<5, dim>> &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();
// at once
std::lock_guard<std::mutex> 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)
{
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
std::vector<Tensor<3, dim>> &third_derivatives,
std::vector<Tensor<4, dim>> &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)
std::vector<Tensor<4, dim>> &third_derivatives,
std::vector<Tensor<5, dim>> &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();
{
std::lock_guard<std::mutex> 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.
std::vector<Tensor<4, dim>> &third_derivatives,
std::vector<Tensor<5, dim>> &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<double> Q_values;
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
std::vector<Tensor<4, dim>> &third_derivatives,
std::vector<Tensor<5, dim>> &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
// <tt>polynomial_space</tt> at
// <tt>unit_point</tt>
- const unsigned int n_basis = polynomial_space.n();
- const unsigned int my_degree = this->degree();
- std::vector<double> unit_point_values((values.size() == 0) ? 0 : n_basis);
- std::vector<Tensor<1, dim>> 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<double> unit_point_values((values.empty()) ? 0 : n_basis);
+ std::vector<Tensor<1, dim>> unit_point_grads((grads.empty()) ? 0 : n_basis);
std::vector<Tensor<2, dim>> unit_point_grad_grads(
- (grad_grads.size() == 0) ? 0 : n_basis);
+ (grad_grads.empty()) ? 0 : n_basis);
std::vector<Tensor<3, dim>> empty_vector_of_3rd_order_tensors;
std::vector<Tensor<4, dim>> empty_vector_of_4th_order_tensors;
p(0) = unit_point(1);
p(1) = unit_point(0);
- std::vector<double> p_values((values.size() == 0) ? 0 : n_basis);
- std::vector<Tensor<1, dim>> p_grads((grads.size() == 0) ? 0 :
- n_basis);
+ std::vector<double> p_values((values.empty()) ? 0 : n_basis);
+ std::vector<Tensor<1, dim>> p_grads((grads.empty()) ? 0 : n_basis);
std::vector<Tensor<2, dim>> p_grad_grads(
- (grad_grads.size() == 0) ? 0 : n_basis);
+ (grad_grads.empty()) ? 0 : n_basis);
polynomial_space.evaluate(p,
p_values,
// <tt>unit_point</tt> with coordinates
// shifted two steps in positive
// direction
- Point<dim> p1, p2;
- std::vector<double> p1_values((values.size() == 0) ? 0 : n_basis);
- std::vector<Tensor<1, dim>> p1_grads((grads.size() == 0) ? 0 :
- n_basis);
+ Point<dim> p1, p2;
+ std::vector<double> p1_values((values.empty()) ? 0 : n_basis);
+ std::vector<Tensor<1, dim>> p1_grads((grads.empty()) ? 0 : n_basis);
std::vector<Tensor<2, dim>> p1_grad_grads(
- (grad_grads.size() == 0) ? 0 : n_basis);
- std::vector<double> p2_values((values.size() == 0) ? 0 : n_basis);
- std::vector<Tensor<1, dim>> p2_grads((grads.size() == 0) ? 0 :
- n_basis);
+ (grad_grads.empty()) ? 0 : n_basis);
+ std::vector<double> p2_values((values.empty()) ? 0 : n_basis);
+ std::vector<Tensor<1, dim>> p2_grads((grads.empty()) ? 0 : n_basis);
std::vector<Tensor<2, dim>> 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);
std::vector<Tensor<4, dim>> &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)
std::vector<Tensor<4, dim>> &third_derivatives,
std::vector<Tensor<5, dim>> &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<double> p_values;
std::vector<Tensor<4, dim>> 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)
{
std::vector<Tensor<4, dim>> &third_derivatives,
std::vector<Tensor<5, dim>> &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();
static std::vector<Tensor<4, dim>> p_third_derivatives;
static std::vector<Tensor<5, dim>> 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,
std::visit([&ss](auto &v) { ss << v; }, value);
cached_value = ss.str();
- if (cached_value.size() == 0)
+ if (cached_value.empty())
cached_value = "\"\"";
}
unsigned int
TableHandler::n_rows() const
{
- if (columns.size() == 0)
+ if (columns.empty())
return 0;
std::map<std::string, Column>::const_iterator col_iter = columns.begin();
std::vector<Tensor<4, dim>> &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()),
std::vector<Tensor<3, dim>> &third_derivatives,
std::vector<Tensor<4, dim>> &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()),
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));
std::vector<Tensor<3, dim>> &third_derivatives,
std::vector<Tensor<4, dim>> &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));
using LongDouble = long double;
// return if there is nothing to do
- if (points.size() == 0)
+ if (points.empty())
return std::vector<std::array<std::uint64_t, dim>>();
// get bounding box:
// 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."));
// 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."));
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(),
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);
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();
// 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
enforce_mesh_balance_over_periodic_boundaries(
Triangulation<dim, spacedim> &tria)
{
- if (tria.get_periodic_face_map().size() == 0)
+ if (tria.get_periodic_face_map().empty())
return false;
std::vector<bool> flags_before[2];
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);
// 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(
// this processor
if (dof_handler.locally_owned_dofs().n_elements() == 0)
{
- Assert(new_indices.size() == 0, ExcInternalError());
+ Assert(new_indices.empty(), ExcInternalError());
return;
}
// 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);
// 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;
// If the empty vector was given as default argument, set up this
// vector as identity.
std::vector<unsigned int> 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)
const unsigned int n_blocks = fe_collection[0].n_blocks();
std::vector<unsigned int> 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)
numbers::invalid_dof_index);
// return if there is nothing to do
- if (boundary_ids.size() == 0)
+ if (boundary_ids.empty())
return;
std::vector<types::global_dof_index> dofs_on_face;
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
{
// 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(
{
// 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());
}
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
{
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
{
// 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;
{
// 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);
}
// 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());
{
// 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] =
// 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,
std::lock_guard<std::mutex> 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());
std::lock_guard<std::mutex> 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());
std::lock_guard<std::mutex> 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());
{
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<dim, spacedim>::ExcFEHasNoSupportPoints()));
// let's see whether we have the information pre-computed
(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<dim, spacedim>::ExcFEHasNoSupportPoints()));
// let's see whether we have the information pre-computed
// 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))
// 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))
// 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))
// 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))
const bool colorize)
{
std::vector<unsigned int> compute_subdivisions = subdivisions;
- if (compute_subdivisions.size() == 0)
+ if (compute_subdivisions.empty())
{
compute_subdivisions.resize(dim, 1);
}
{
// 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);
{
// 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);
{
// 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);
// 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."));
}
// No cells were read
- if (cells.size() == 0)
+ if (cells.empty())
return;
if (remove_duplicates)
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());
delete_duplicated_vertices(std::vector<Point<dim>> &vertices,
const double tol)
{
- if (vertices.size() == 0)
+ if (vertices.empty())
return;
// 1) map point to local vertex index
const std::vector<Point<spacedim>> &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()));
// 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(),
// 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<bool> &vertices_to_use = (marked_vertices.size() == 0) ?
- tria.get_used_vertices() :
- marked_vertices;
+ const std::vector<bool> &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.
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()));
// 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(),
// 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())
++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<spacedim> bbox;
return std::make_tuple(bbox, has_predicate);
// 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)
{
};
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 "
// 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());
};
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 "
// 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());
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<std::pair<
const std::vector<Point<spacedim>> &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()));
// (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(),
// could be the potentially closest
// vertex to the point, use it instead
// of used vertices
- const std::vector<bool> &used = (marked_vertices.size() == 0) ?
- tria.get_used_vertices() :
- marked_vertices;
+ const std::vector<bool> &used =
+ (marked_vertices.empty()) ? tria.get_used_vertices() : marked_vertices;
// At the beginning, the first
// used vertex is the closest one
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()));
// (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(),
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
(dynamic_cast<
const parallel::fullydistributed::Triangulation<dim, spacedim>
*>(&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"));
}
}
void
PersistentTriangulation<dim, spacedim>::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;
& 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();
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);
{
AssertDimension(obj.structdim, structdim);
- if (boundary_objects_in.size() == 0)
+ if (boundary_objects_in.empty())
return; // empty subcelldata -> nothing to do
// pre-sort subcelldata
void Triangulation<dim, spacedim>::copy_triangulation(
const Triangulation<dim, spacedim> &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),
const std::vector<CellData<dim>> & 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
// 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);
}
// 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)
{
// 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();
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;
}
// 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(),
}
#endif
- if (entries.size() == 0 || entries.back() < *begin)
+ if (entries.empty() || entries.back() < *begin)
{
entries.insert(entries.end(), begin, end);
return;
// 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;
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 "
}
max_row_length =
- (row_lengths.size() == 0 ?
+ (row_lengths.empty() ?
0 :
std::min(static_cast<size_type>(
*std::max_element(row_lengths.begin(), row_lengths.end())),
#else
Assert(
- cell_weights.size() == 0,
+ cell_weights.empty(),
ExcMessage(
"The cell weighting functionality for Zoltan has not yet been implemented."));
(void)cell_weights;
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]];
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];
}
++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())
unsigned int partition_counter = 0;
while (work)
{
- if (neighbor_list.size() == 0)
+ if (neighbor_list.empty())
{
work = false;
partition_counter = 0;
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];
}
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)
// 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)
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)
const unsigned int n_selected =
std::accumulate(selected.begin(), selected.end(), 0u);
- if (ndofs.size() == 0)
+ if (ndofs.empty())
{
std::vector<std::vector<types::global_dof_index>> new_dofs(
dof_handler.get_triangulation().n_levels(),
std::vector<bool> selected(n_blocks, false);
selected[selected_block] = true;
- if (ndofs.size() == 0)
+ if (ndofs.empty())
{
std::vector<std::vector<types::global_dof_index>> new_dofs(
dof_handler.get_triangulation().n_levels(),
ExcDimensionMismatch(sel.size(), n_blocks));
selected = sel;
}
- if (selected.size() == 0)
+ if (selected.empty())
selected = std::vector<bool>(n_blocks, true);
MGTransferBlockBase::build(dof_handler);
// 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)
// 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);
const unsigned int n_selected =
std::accumulate(selected.begin(), selected.end(), 0u);
- if (ndofs.size() == 0)
+ if (ndofs.empty())
{
std::vector<std::vector<types::global_dof_index>> new_dofs(
mg_dof.get_triangulation().n_levels(),
if (component_mask[i])
selected_block = target_component[i];
- if (ndofs.size() == 0)
+ if (ndofs.empty())
{
std::vector<std::vector<types::global_dof_index>> new_dofs(
mg_dof.get_triangulation().n_levels(),
// 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)
// 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)
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)
(dynamic_cast<const dealii::parallel::TriangulationBase<dim, spacedim>
*>(&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!"));
// 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 "
// 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<unsigned int> n_postprocessor_outputs(this->dof_data.size());
// 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
// if no boundary values are to be applied
// simply return
- if (boundary_values.size() == 0)
+ if (boundary_values.empty())
return;
// if no boundary values are to be applied
// simply return
- if (boundary_values.size() == 0)
+ if (boundary_values.empty())
return;
// 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
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(),
// run through maps in an orderly fashion, i.e., through the
// boundary in one cycle and add points to pointlist.
std::vector<TopoDS_Edge> 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)
{
std::vector<char> buffer;
- if (particles.size() == 0)
+ if (particles.empty())
return buffer;
buffer.resize(particles.size() *
const typename Triangulation<dim, spacedim>::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)
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;
// information
typename Triangulation<dim, spacedim>::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