From bb84662fbdd967da82c140e8d13fddf229dd371d Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 20 May 2021 14:19:19 -0400 Subject: [PATCH] Avoid implicit bool conversions --- include/deal.II/base/geometry_info.h | 9 +- .../base/mpi_consensus_algorithms.templates.h | 6 +- include/deal.II/base/patterns.h | 3 +- include/deal.II/base/utilities.h | 2 +- include/deal.II/fe/fe_poly.h | 27 +++--- include/deal.II/fe/fe_poly.templates.h | 32 +++---- include/deal.II/fe/fe_poly_face.templates.h | 6 +- include/deal.II/fe/fe_poly_tensor.h | 17 ++-- include/deal.II/grid/reference_cell.h | 5 +- .../deal.II/grid/tria_accessor.templates.h | 4 +- include/deal.II/lac/affine_constraints.h | 4 +- .../lac/chunk_sparse_matrix.templates.h | 4 +- .../deal.II/lac/dynamic_sparsity_pattern.h | 2 +- include/deal.II/lac/full_matrix.templates.h | 4 +- .../lac/la_parallel_block_vector.templates.h | 2 +- .../lac/sparse_decomposition.templates.h | 2 +- include/deal.II/lac/sparse_matrix.templates.h | 4 +- .../deal.II/lac/sparse_matrix_ez.templates.h | 4 +- .../deal.II/matrix_free/evaluation_kernels.h | 90 +++++++++---------- include/deal.II/matrix_free/fe_evaluation.h | 16 ++-- .../deal.II/matrix_free/fe_point_evaluation.h | 54 +++++------ .../matrix_free/mapping_data_on_the_fly.h | 2 +- .../matrix_free/mapping_info.templates.h | 68 +++++++------- include/deal.II/meshworker/integration_info.h | 6 +- .../meshworker/integration_info.templates.h | 24 ++--- source/base/convergence_table.cc | 8 +- source/base/data_out_base.cc | 30 ++++--- source/base/exceptions.cc | 2 +- source/base/index_set.cc | 2 +- source/base/logstream.cc | 6 +- source/base/mpi.cc | 2 +- source/base/mu_parser_internal.cc | 8 +- source/base/parameter_handler.cc | 49 +++++----- source/base/patterns.cc | 8 +- source/base/qprojector.cc | 13 +-- source/base/table_handler.cc | 4 +- source/base/utilities.cc | 4 +- source/distributed/fully_distributed_tria.cc | 14 +-- source/distributed/tria.cc | 16 ++-- source/fe/fe.cc | 33 +++---- source/fe/fe_dgp_nonparametric.cc | 2 +- source/fe/fe_enriched.cc | 4 +- source/fe/fe_face.cc | 8 +- source/fe/fe_nedelec_sz.cc | 67 +++++++------- source/fe/fe_p1nc.cc | 26 +++--- source/fe/fe_poly_tensor.cc | 31 +++---- source/fe/fe_q_hierarchical.cc | 18 ++-- source/fe/fe_system.cc | 12 ++- source/fe/fe_values.cc | 50 +++++------ source/fe/mapping_cartesian.cc | 2 +- source/fe/mapping_fe.cc | 30 +++---- source/fe/mapping_fe_field.cc | 34 +++---- source/fe/mapping_manifold.cc | 28 +++--- source/fe/mapping_q.cc | 42 ++++----- source/grid/grid_generator.cc | 5 +- source/grid/grid_in.cc | 2 +- source/grid/grid_out.cc | 10 +-- source/grid/grid_tools_cache.cc | 14 +-- source/grid/tria.cc | 16 ++-- source/grid/tria_accessor.cc | 2 +- source/lac/dynamic_sparsity_pattern.cc | 2 +- source/lac/lapack_full_matrix.cc | 4 +- source/lac/sparsity_tools.cc | 6 +- source/lac/trilinos_precondition_ml.cc | 2 +- source/lac/trilinos_precondition_muelu.cc | 4 +- source/matrix_free/task_info.cc | 8 +- source/numerics/data_out.cc | 34 +++---- source/numerics/data_out_faces.cc | 20 ++--- source/numerics/data_out_rotation.cc | 16 ++-- source/numerics/solution_transfer.cc | 2 +- 70 files changed, 563 insertions(+), 534 deletions(-) diff --git a/include/deal.II/base/geometry_info.h b/include/deal.II/base/geometry_info.h index 7d249ae37a..fe4da3a3be 100644 --- a/include/deal.II/base/geometry_info.h +++ b/include/deal.II/base/geometry_info.h @@ -3827,7 +3827,7 @@ GeometryInfo<3>::line_refinement_case( const unsigned int direction[lines_per_cell] = { 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 2, 2}; - return ((cell_refinement_case & cut_one[direction[line_no]]) ? + return ((cell_refinement_case & cut_one[direction[line_no]]) != 0u ? RefinementCase<1>::cut_x : RefinementCase<1>::no_refinement); } @@ -3879,8 +3879,8 @@ GeometryInfo<2>::min_cell_refinement_case_for_face_refinement( AssertIndexRange(face_no, GeometryInfo::faces_per_cell); if (face_refinement_case == RefinementCase::cut_x) - return (face_no / 2) ? RefinementCase::cut_x : - RefinementCase::cut_y; + return (face_no / 2) != 0u ? RefinementCase::cut_x : + RefinementCase::cut_y; else return RefinementCase::no_refinement; } @@ -3975,7 +3975,8 @@ GeometryInfo<2>::min_cell_refinement_case_for_line_refinement( (void)dim; AssertIndexRange(line_no, GeometryInfo::lines_per_cell); - return (line_no / 2) ? RefinementCase<2>::cut_x : RefinementCase<2>::cut_y; + return (line_no / 2) != 0u ? RefinementCase<2>::cut_x : + RefinementCase<2>::cut_y; } diff --git a/include/deal.II/base/mpi_consensus_algorithms.templates.h b/include/deal.II/base/mpi_consensus_algorithms.templates.h index ac325d5c4a..b35bf3869b 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.templates.h +++ b/include/deal.II/base/mpi_consensus_algorithms.templates.h @@ -156,7 +156,7 @@ namespace Utilities MPI_STATUSES_IGNORE); AssertThrowMPI(ierr); - return all_receive_requests_are_done; + return all_receive_requests_are_done != 0; #else return true; #endif @@ -193,7 +193,7 @@ namespace Utilities &all_ranks_reached_barrier, MPI_STATUSES_IGNORE); AssertThrowMPI(ierr); - return all_ranks_reached_barrier; + return all_ranks_reached_barrier != 0; #else return true; #endif @@ -228,7 +228,7 @@ namespace Utilities &status); AssertThrowMPI(ierr); - if (request_is_pending) + if (request_is_pending != 0) { // Get the rank of the requesting process and add it to the // list of requesting processes (which may contain duplicates). diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index c0894c980e..b75b70bca9 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -2262,7 +2262,8 @@ namespace Patterns const auto string_array = Convert::to_string_internal_2(t, *p); std::string str; for (unsigned int i = 0; i < string_array.size(); ++i) - str += (i ? " " + p->get_separator() + " " : "") + string_array[i]; + str += + (i != 0u ? " " + p->get_separator() + " " : "") + string_array[i]; AssertThrow(p->match(str), ExcNoMatch(str, p->description())); return str; } diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 255b700959..09699322f7 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -1385,7 +1385,7 @@ namespace Utilities // source: // https://stackoverflow.com/questions/47981/how-do-you-set-clear-and-toggle-a-single-bit // "Checking a bit" - return (number >> n) & 1U; + return ((number >> n) & 1U) != 0u; } diff --git a/include/deal.II/fe/fe_poly.h b/include/deal.II/fe/fe_poly.h index ae682b12e3..b350e68754 100644 --- a/include/deal.II/fe/fe_poly.h +++ b/include/deal.II/fe/fe_poly.h @@ -281,13 +281,14 @@ protected: // polynomial to put the values and derivatives of shape functions // to put there, depending on what the user requested std::vector values( - update_flags & update_values ? this->n_dofs_per_cell() : 0); + (update_flags & update_values) != 0u ? this->n_dofs_per_cell() : 0); std::vector> grads( - update_flags & update_gradients ? this->n_dofs_per_cell() : 0); + (update_flags & update_gradients) != 0u ? this->n_dofs_per_cell() : 0); std::vector> grad_grads( - update_flags & update_hessians ? this->n_dofs_per_cell() : 0); + (update_flags & update_hessians) != 0u ? this->n_dofs_per_cell() : 0); std::vector> third_derivatives( - update_flags & update_3rd_derivatives ? this->n_dofs_per_cell() : 0); + (update_flags & update_3rd_derivatives) != 0u ? this->n_dofs_per_cell() : + 0); std::vector> fourth_derivatives; // won't be needed, so leave empty @@ -312,20 +313,20 @@ protected: (output_data.shape_values.n_cols() == n_q_points))) data.shape_values.reinit(this->n_dofs_per_cell(), n_q_points); - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) data.shape_gradients.reinit(this->n_dofs_per_cell(), n_q_points); - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) data.shape_hessians.reinit(this->n_dofs_per_cell(), n_q_points); - if (update_flags & update_3rd_derivatives) + if ((update_flags & update_3rd_derivatives) != 0u) data.shape_3rd_derivatives.reinit(this->n_dofs_per_cell(), n_q_points); // next already fill those fields of which we have information by // now. note that the shape gradients are only those on the unit // cell, and need to be transformed when visiting an actual cell - if (update_flags & (update_values | update_gradients | update_hessians | - update_3rd_derivatives)) + if ((update_flags & (update_values | update_gradients | update_hessians | + update_3rd_derivatives)) != 0u) for (unsigned int i = 0; i < n_q_points; ++i) { poly_space->evaluate(quadrature.point(i), @@ -342,7 +343,7 @@ protected: // faces and subfaces, but we later on copy only a portion of it // into the output object; in that case, copy the data from all // faces into the scratch object - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) if (output_data.shape_values.n_rows() > 0) { if (output_data.shape_values.n_cols() == n_q_points) @@ -356,15 +357,15 @@ protected: // for everything else, derivatives need to be transformed, // so we write them into our scratch space and only later // copy stuff into where FEValues wants it - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) data.shape_gradients[k][i] = grads[k]; - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) data.shape_hessians[k][i] = grad_grads[k]; - if (update_flags & update_3rd_derivatives) + if ((update_flags & update_3rd_derivatives) != 0u) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) data.shape_3rd_derivatives[k][i] = third_derivatives[k]; } diff --git a/include/deal.II/fe/fe_poly.templates.h b/include/deal.II/fe/fe_poly.templates.h index 90623fef91..b4792440c3 100644 --- a/include/deal.II/fe/fe_poly.templates.h +++ b/include/deal.II/fe/fe_poly.templates.h @@ -193,19 +193,19 @@ FE_Poly::requires_update_flags(const UpdateFlags flags) const { UpdateFlags out = update_default; - if (flags & update_values) + if ((flags & update_values) != 0u) out |= update_values; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients | update_covariant_transformation; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) out |= update_hessians | update_covariant_transformation | update_gradients | update_jacobian_pushed_forward_grads; - if (flags & update_3rd_derivatives) + if ((flags & update_3rd_derivatives) != 0u) out |= update_3rd_derivatives | update_covariant_transformation | update_hessians | update_gradients | update_jacobian_pushed_forward_grads | update_jacobian_pushed_forward_2nd_derivatives; - if (flags & update_normal_vectors) + if ((flags & update_normal_vectors) != 0u) out |= update_normal_vectors | update_JxW_values; return out; @@ -293,7 +293,7 @@ FE_Poly::fill_fe_values( // transform gradients and higher derivatives. there is nothing to do // for values since we already emplaced them into output_data when // we were in get_data() - if ((flags & update_gradients) && + if (((flags & update_gradients) != 0u) && (cell_similarity != CellSimilarity::translation)) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) mapping.transform(make_array_view(fe_data.shape_gradients, k), @@ -301,7 +301,7 @@ FE_Poly::fill_fe_values( mapping_internal, make_array_view(output_data.shape_gradients, k)); - if ((flags & update_hessians) && + if (((flags & update_hessians) != 0u) && (cell_similarity != CellSimilarity::translation)) { for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) @@ -314,7 +314,7 @@ FE_Poly::fill_fe_values( correct_hessians(output_data, mapping_data, quadrature.size()); } - if ((flags & update_3rd_derivatives) && + if (((flags & update_3rd_derivatives) != 0u) && (cell_similarity != CellSimilarity::translation)) { for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) @@ -381,12 +381,12 @@ FE_Poly::fill_fe_face_values( // transform gradients and higher derivatives. we also have to copy // the values (unlike in the case of fill_fe_values()) since // we need to take into account the offsets - if (flags & update_values) + if ((flags & update_values) != 0u) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) for (unsigned int i = 0; i < n_q_points; ++i) output_data.shape_values(k, i) = fe_data.shape_values[k][i + offset]; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) mapping.transform( make_array_view(fe_data.shape_gradients, k, offset, n_q_points), @@ -394,7 +394,7 @@ FE_Poly::fill_fe_face_values( mapping_internal, make_array_view(output_data.shape_gradients, k)); - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) { for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) mapping.transform( @@ -407,7 +407,7 @@ FE_Poly::fill_fe_face_values( correct_hessians(output_data, mapping_data, n_q_points); } - if (flags & update_3rd_derivatives) + if ((flags & update_3rd_derivatives) != 0u) { for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) mapping.transform( @@ -473,12 +473,12 @@ FE_Poly::fill_fe_subface_values( // transform gradients and higher derivatives. we also have to copy // the values (unlike in the case of fill_fe_values()) since // we need to take into account the offsets - if (flags & update_values) + if ((flags & update_values) != 0u) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) for (unsigned int i = 0; i < quadrature.size(); ++i) output_data.shape_values(k, i) = fe_data.shape_values[k][i + offset]; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) mapping.transform( make_array_view(fe_data.shape_gradients, k, offset, quadrature.size()), @@ -486,7 +486,7 @@ FE_Poly::fill_fe_subface_values( mapping_internal, make_array_view(output_data.shape_gradients, k)); - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) { for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) mapping.transform( @@ -499,7 +499,7 @@ FE_Poly::fill_fe_subface_values( correct_hessians(output_data, mapping_data, quadrature.size()); } - if (flags & update_3rd_derivatives) + if ((flags & update_3rd_derivatives) != 0u) { for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) mapping.transform(make_array_view(fe_data.shape_3rd_derivatives, diff --git a/include/deal.II/fe/fe_poly_face.templates.h b/include/deal.II/fe/fe_poly_face.templates.h index 35b862ca85..641f91c2dc 100644 --- a/include/deal.II/fe/fe_poly_face.templates.h +++ b/include/deal.II/fe/fe_poly_face.templates.h @@ -62,11 +62,11 @@ FE_PolyFace::requires_update_flags( const UpdateFlags flags) const { UpdateFlags out = flags & update_values; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients | update_covariant_transformation; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) out |= update_hessians | update_covariant_transformation; - if (flags & update_normal_vectors) + if ((flags & update_normal_vectors) != 0u) out |= update_normal_vectors | update_JxW_values; return out; diff --git a/include/deal.II/fe/fe_poly_tensor.h b/include/deal.II/fe/fe_poly_tensor.h index 002f1fbfa4..307fdeacac 100644 --- a/include/deal.II/fe/fe_poly_tensor.h +++ b/include/deal.II/fe/fe_poly_tensor.h @@ -301,7 +301,8 @@ protected: std::vector> third_derivatives(0); std::vector> fourth_derivatives(0); - if (update_flags & (update_values | update_gradients | update_hessians)) + if ((update_flags & (update_values | update_gradients | update_hessians)) != + 0u) data.dof_sign_change.resize(this->dofs_per_cell); // initialize fields only if really @@ -324,7 +325,7 @@ protected: const bool update_transformed_shape_hessian_tensors = update_transformed_shape_values; - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) { values.resize(this->n_dofs_per_cell()); data.shape_values.reinit(this->n_dofs_per_cell(), n_q_points); @@ -332,7 +333,7 @@ protected: data.transformed_shape_values.resize(n_q_points); } - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) { grads.resize(this->n_dofs_per_cell()); data.shape_grads.reinit(this->n_dofs_per_cell(), n_q_points); @@ -342,7 +343,7 @@ protected: data.untransformed_shape_grads.resize(n_q_points); } - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) { grad_grads.resize(this->n_dofs_per_cell()); data.shape_grad_grads.reinit(this->n_dofs_per_cell(), n_q_points); @@ -358,7 +359,7 @@ protected: // node values N_i holds // N_i(v_j)=\delta_ij for all basis // functions v_j - if (update_flags & (update_values | update_gradients)) + if ((update_flags & (update_values | update_gradients)) != 0u) for (unsigned int k = 0; k < n_q_points; ++k) { poly_space->evaluate(quadrature.point(k), @@ -368,7 +369,7 @@ protected: third_derivatives, fourth_derivatives); - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) { if (inverse_node_matrix.n_cols() == 0) for (unsigned int i = 0; i < this->n_dofs_per_cell(); ++i) @@ -383,7 +384,7 @@ protected: } } - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) { if (inverse_node_matrix.n_cols() == 0) for (unsigned int i = 0; i < this->n_dofs_per_cell(); ++i) @@ -398,7 +399,7 @@ protected: } } - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) { if (inverse_node_matrix.n_cols() == 0) for (unsigned int i = 0; i < this->n_dofs_per_cell(); ++i) diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index ee0a8add3e..bdcb4fb6b3 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -1366,7 +1366,7 @@ ReferenceCell::face_to_cell_vertices(const unsigned int face, static const ndarray table = { {{{0, 1}}, {{1, 2}}, {{2, 0}}}}; - return table[face][face_orientation ? vertex : (1 - vertex)]; + return table[face][face_orientation != 0u ? vertex : (1 - vertex)]; } else if (*this == ReferenceCells::Quadrilateral) { @@ -1451,7 +1451,8 @@ ReferenceCell::standard_to_real_face_vertex( else if (*this == ReferenceCells::Quadrilateral) { return GeometryInfo<2>::standard_to_real_line_vertex(vertex, - face_orientation); + face_orientation != + 0u); } else if (*this == ReferenceCells::Tetrahedron) { diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 70ad55af02..7a11b7c353 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -845,7 +845,9 @@ namespace internal return accessor.reference_cell().standard_vs_true_line_orientation( pair[1], face_orientation_raw(accessor, quad_index), - accessor.quad(quad_index)->line_orientation(line_within_face_index)); + static_cast( + accessor.quad(quad_index) + ->line_orientation(line_within_face_index))); } diff --git a/include/deal.II/lac/affine_constraints.h b/include/deal.II/lac/affine_constraints.h index cc98101202..fd182c15bc 100644 --- a/include/deal.II/lac/affine_constraints.h +++ b/include/deal.II/lac/affine_constraints.h @@ -2226,7 +2226,7 @@ inline types::global_dof_index AffineConstraints::calculate_line_index(const size_type line_n) const { // IndexSet is unused (serial case) - if (!local_lines.size()) + if (local_lines.size() == 0) return line_n; Assert(local_lines.is_element(line_n), ExcRowNotStoredHere(line_n)); @@ -2238,7 +2238,7 @@ template inline bool AffineConstraints::can_store_line(size_type line_n) const { - return !local_lines.size() || local_lines.is_element(line_n); + return local_lines.size() == 0 || local_lines.is_element(line_n); } template diff --git a/include/deal.II/lac/chunk_sparse_matrix.templates.h b/include/deal.II/lac/chunk_sparse_matrix.templates.h index 184a28d194..82c175867d 100644 --- a/include/deal.II/lac/chunk_sparse_matrix.templates.h +++ b/include/deal.II/lac/chunk_sparse_matrix.templates.h @@ -1490,13 +1490,13 @@ ChunkSparseMatrix::print_formatted(std::ostream & out, if (scientific) { out.setf(std::ios::scientific, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 7; } else { out.setf(std::ios::fixed, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 2; } diff --git a/include/deal.II/lac/dynamic_sparsity_pattern.h b/include/deal.II/lac/dynamic_sparsity_pattern.h index 8fe7a38671..a6a2a8fdcf 100644 --- a/include/deal.II/lac/dynamic_sparsity_pattern.h +++ b/include/deal.II/lac/dynamic_sparsity_pattern.h @@ -1093,7 +1093,7 @@ DynamicSparsityPattern::column_number(const size_type row, Assert(rowset.size() == 0 || rowset.is_element(row), ExcInternalError()); const size_type local_row = - rowset.size() ? rowset.index_within_set(row) : row; + rowset.size() != 0u ? rowset.index_within_set(row) : row; AssertIndexRange(index, lines[local_row].entries.size()); return lines[local_row].entries[index]; } diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index de60920244..eb6c714b4d 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -1769,13 +1769,13 @@ FullMatrix::print_formatted(std::ostream & out, if (scientific) { out.setf(std::ios::scientific, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 7; } else { out.setf(std::ios::fixed, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 2; } diff --git a/include/deal.II/lac/la_parallel_block_vector.templates.h b/include/deal.II/lac/la_parallel_block_vector.templates.h index 805e2c07e2..8a8674f83d 100644 --- a/include/deal.II/lac/la_parallel_block_vector.templates.h +++ b/include/deal.II/lac/la_parallel_block_vector.templates.h @@ -635,7 +635,7 @@ namespace LinearAlgebra return -Utilities::MPI::max( local_result, this->block(0).partitioner->get_mpi_communicator()); else - return local_result; + return local_result != 0; } diff --git a/include/deal.II/lac/sparse_decomposition.templates.h b/include/deal.II/lac/sparse_decomposition.templates.h index 4627481cd4..1736aea64e 100644 --- a/include/deal.II/lac/sparse_decomposition.templates.h +++ b/include/deal.II/lac/sparse_decomposition.templates.h @@ -59,7 +59,7 @@ SparseLUDecomposition::clear() SparseMatrix::clear(); - if (own_sparsity) + if (own_sparsity != nullptr) { delete own_sparsity; own_sparsity = nullptr; diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 458b527632..9e62e33f9c 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -1916,13 +1916,13 @@ SparseMatrix::print_formatted(std::ostream & out, if (scientific) { out.setf(std::ios::scientific, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 7; } else { out.setf(std::ios::fixed, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 2; } diff --git a/include/deal.II/lac/sparse_matrix_ez.templates.h b/include/deal.II/lac/sparse_matrix_ez.templates.h index 3d39a3b582..61d50b2a1b 100644 --- a/include/deal.II/lac/sparse_matrix_ez.templates.h +++ b/include/deal.II/lac/sparse_matrix_ez.templates.h @@ -499,13 +499,13 @@ SparseMatrixEZ::print_formatted(std::ostream & out, if (scientific) { out.setf(std::ios::scientific, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 7; } else { out.setf(std::ios::fixed, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 2; } diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index a2aed71703..aee881a322 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -279,12 +279,12 @@ namespace internal case 1: for (unsigned int c = 0; c < n_components; ++c) { - if (evaluation_flag & EvaluationFlags::values) + if ((evaluation_flag & EvaluationFlags::values) != 0u) eval0.template values<0, true, false>(values_dofs, values_quad); - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) eval0.template gradients<0, true, false>(values_dofs, gradients_quad); - if (evaluation_flag & EvaluationFlags::hessians) + if ((evaluation_flag & EvaluationFlags::hessians) != 0u) eval0.template hessians<0, true, false>(values_dofs, hessians_quad); @@ -300,15 +300,15 @@ namespace internal for (unsigned int c = 0; c < n_components; ++c) { // grad x - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) { eval0.template gradients<0, true, false>(values_dofs, temp1); eval1.template values<1, true, false>(temp1, gradients_quad); } - if (evaluation_flag & EvaluationFlags::hessians) + if ((evaluation_flag & EvaluationFlags::hessians) != 0u) { // grad xy - if (!(evaluation_flag & EvaluationFlags::gradients)) + if ((evaluation_flag & EvaluationFlags::gradients) == 0u) eval0.template gradients<0, true, false>(values_dofs, temp1); eval1.template gradients<1, true, false>(temp1, @@ -322,19 +322,19 @@ namespace internal // grad y eval0.template values<0, true, false>(values_dofs, temp1); - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) eval1.template gradients<1, true, false>(temp1, gradients_quad + n_q_points); // grad yy - if (evaluation_flag & EvaluationFlags::hessians) + if ((evaluation_flag & EvaluationFlags::hessians) != 0u) eval1.template hessians<1, true, false>(temp1, hessians_quad + n_q_points); // val: can use values applied in x - if (evaluation_flag & EvaluationFlags::values) + if ((evaluation_flag & EvaluationFlags::values) != 0u) eval1.template values<1, true, false>(temp1, values_quad); // advance to the next component in 1D array @@ -348,7 +348,7 @@ namespace internal case 3: for (unsigned int c = 0; c < n_components; ++c) { - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) { // grad x eval0.template gradients<0, true, false>(values_dofs, temp1); @@ -356,10 +356,10 @@ namespace internal eval2.template values<2, true, false>(temp2, gradients_quad); } - if (evaluation_flag & EvaluationFlags::hessians) + if ((evaluation_flag & EvaluationFlags::hessians) != 0u) { // grad xz - if (!(evaluation_flag & EvaluationFlags::gradients)) + if ((evaluation_flag & EvaluationFlags::gradients) == 0u) { eval0.template gradients<0, true, false>(values_dofs, temp1); @@ -383,7 +383,7 @@ namespace internal // grad y eval0.template values<0, true, false>(values_dofs, temp1); - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) { eval1.template gradients<1, true, false>(temp1, temp2); eval2.template values<2, true, false>(temp2, @@ -391,10 +391,10 @@ namespace internal n_q_points); } - if (evaluation_flag & EvaluationFlags::hessians) + if ((evaluation_flag & EvaluationFlags::hessians) != 0u) { // grad yz - if (!(evaluation_flag & EvaluationFlags::gradients)) + if ((evaluation_flag & EvaluationFlags::gradients) == 0u) eval1.template gradients<1, true, false>(temp1, temp2); eval2.template gradients<2, true, false>(temp2, hessians_quad + @@ -410,21 +410,21 @@ namespace internal // grad z: can use the values applied in x direction stored in // temp1 eval1.template values<1, true, false>(temp1, temp2); - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) eval2.template gradients<2, true, false>(temp2, gradients_quad + 2 * n_q_points); // grad zz: can use the values applied in x and y direction stored // in temp2 - if (evaluation_flag & EvaluationFlags::hessians) + if ((evaluation_flag & EvaluationFlags::hessians) != 0u) eval2.template hessians<2, true, false>(temp2, hessians_quad + 2 * n_q_points); // val: can use the values applied in x & y direction stored in // temp2 - if (evaluation_flag & EvaluationFlags::values) + if ((evaluation_flag & EvaluationFlags::values) != 0u) eval2.template values<2, true, false>(temp2, values_quad); // advance to the next component in 1D array @@ -442,7 +442,7 @@ namespace internal // case additional dof for FE_Q_DG0: add values; gradients and second // derivatives evaluate to zero if (type == MatrixFreeFunctions::tensor_symmetric_plus_dg0 && - (evaluation_flag & EvaluationFlags::values)) + ((evaluation_flag & EvaluationFlags::values) != 0u)) { values_quad -= n_components * n_q_points; values_dofs -= n_components * dofs_per_comp; @@ -526,7 +526,7 @@ namespace internal case 1: for (unsigned int c = 0; c < n_components; ++c) { - if (integration_flag & EvaluationFlags::values) + if ((integration_flag & EvaluationFlags::values) != 0u) { if (add_into_values_array == false) eval0.template values<0, false, false>(values_quad, @@ -535,9 +535,9 @@ namespace internal eval0.template values<0, false, true>(values_quad, values_dofs); } - if (integration_flag & EvaluationFlags::gradients) + if ((integration_flag & EvaluationFlags::gradients) != 0u) { - if (integration_flag & EvaluationFlags::values || + if (((integration_flag & EvaluationFlags::values) != 0u) || add_into_values_array == true) eval0.template gradients<0, false, true>(gradients_quad, values_dofs); @@ -568,8 +568,8 @@ namespace internal case 2: for (unsigned int c = 0; c < n_components; ++c) { - if ((integration_flag & EvaluationFlags::values) && - !(integration_flag & EvaluationFlags::gradients)) + if (((integration_flag & EvaluationFlags::values) != 0u) && + ((integration_flag & EvaluationFlags::gradients) == 0u)) { eval1.template values<1, false, false>(values_quad, temp1); if (add_into_values_array == false) @@ -577,12 +577,12 @@ namespace internal else eval0.template values<0, false, true>(temp1, values_dofs); } - if (integration_flag & EvaluationFlags::gradients) + if ((integration_flag & EvaluationFlags::gradients) != 0u) { eval1.template gradients<1, false, false>(gradients_quad + n_q_points, temp1); - if (integration_flag & EvaluationFlags::values) + if ((integration_flag & EvaluationFlags::values) != 0u) eval1.template values<1, false, true>(values_quad, temp1); if (add_into_values_array == false) eval0.template values<0, false, false>(temp1, values_dofs); @@ -628,8 +628,8 @@ namespace internal case 3: for (unsigned int c = 0; c < n_components; ++c) { - if ((integration_flag & EvaluationFlags::values) && - !(integration_flag & EvaluationFlags::gradients)) + if (((integration_flag & EvaluationFlags::values) != 0u) && + ((integration_flag & EvaluationFlags::gradients) == 0u)) { eval2.template values<2, false, false>(values_quad, temp1); eval1.template values<1, false, false>(temp1, temp2); @@ -638,12 +638,12 @@ namespace internal else eval0.template values<0, false, true>(temp2, values_dofs); } - if (integration_flag & EvaluationFlags::gradients) + if ((integration_flag & EvaluationFlags::gradients) != 0u) { eval2.template gradients<2, false, false>(gradients_quad + 2 * n_q_points, temp1); - if (integration_flag & EvaluationFlags::values) + if ((integration_flag & EvaluationFlags::values) != 0u) eval2.template values<2, false, true>(values_quad, temp1); eval1.template values<1, false, false>(temp1, temp2); eval2.template values<2, false, false>(gradients_quad + @@ -725,7 +725,7 @@ namespace internal { values_dofs -= n_components * dofs_per_comp - dofs_per_comp + 1; values_quad -= n_components * n_q_points; - if (integration_flag & EvaluationFlags::values) + if ((integration_flag & EvaluationFlags::values) != 0u) for (unsigned int c = 0; c < n_components; ++c) { values_dofs[0] = values_quad[0]; @@ -790,7 +790,7 @@ namespace internal using Eval = EvaluatorTensorProduct; - if (evaluation_flag & EvaluationFlags::values) + if ((evaluation_flag & EvaluationFlags::values) != 0u) { const auto shape_values = shape_data.front().shape_values.data(); auto values_quad_ptr = fe_eval.begin_values(); @@ -807,7 +807,7 @@ namespace internal } } - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) { const auto shape_gradients = shape_data.front().shape_gradients.data(); auto gradients_quad_ptr = fe_eval.begin_gradients(); @@ -832,7 +832,7 @@ namespace internal } } - if (evaluation_flag & EvaluationFlags::hessians) + if ((evaluation_flag & EvaluationFlags::hessians) != 0u) Assert(false, ExcNotImplemented()); } @@ -864,7 +864,7 @@ namespace internal using Eval = EvaluatorTensorProduct; - if (integration_flag & EvaluationFlags::values) + if ((integration_flag & EvaluationFlags::values) != 0u) { const auto shape_values = shape_data.front().shape_values.data(); auto values_quad_ptr = fe_eval.begin_values(); @@ -885,7 +885,7 @@ namespace internal } } - if (integration_flag & EvaluationFlags::gradients) + if ((integration_flag & EvaluationFlags::gradients) != 0u) { const auto shape_gradients = shape_data.front().shape_gradients.data(); auto gradients_quad_ptr = fe_eval.begin_gradients(); @@ -902,7 +902,7 @@ namespace internal n_q_points); if ((add_into_values_array == false && - (integration_flag & EvaluationFlags::values) == false) && + (integration_flag & EvaluationFlags::values) == 0) && d == 0) eval.template gradients<0, false, false>( gradients_quad_ptr, values_dofs_actual_ptr); @@ -1426,7 +1426,7 @@ namespace internal gradients_quad + 2 * n_points); } - if (evaluation_flag & EvaluationFlags::hessians) + if ((evaluation_flag & EvaluationFlags::hessians) != 0u) { eval.template hessians<0, true, false>(values_dofs, hessians_quad); if (dim > 1) @@ -1535,7 +1535,7 @@ namespace internal if (dim == 2) { // grad xy, queue into gradient - if (integration_flag & EvaluationFlags::gradients) + if ((integration_flag & EvaluationFlags::gradients) != 0u) eval.template gradients<1, false, true>(hessians_quad + 2 * n_points, gradients_quad); @@ -1547,7 +1547,7 @@ namespace internal if (dim == 3) { // grad xy, queue into gradient - if (integration_flag & EvaluationFlags::gradients) + if ((integration_flag & EvaluationFlags::gradients) != 0u) eval.template gradients<1, false, true>(hessians_quad + 3 * n_points, gradients_quad); @@ -1562,7 +1562,7 @@ namespace internal gradients_quad); // grad yz - if (integration_flag & EvaluationFlags::gradients) + if ((integration_flag & EvaluationFlags::gradients) != 0u) eval.template gradients<2, false, true>( hessians_quad + 5 * n_points, gradients_quad + n_points); else @@ -1662,8 +1662,8 @@ namespace internal fe_eval.begin_values() + c * n_q_points); // apply derivatives in the collocation space - if (evaluation_flag & - (EvaluationFlags::gradients | EvaluationFlags::hessians)) + if ((evaluation_flag & + (EvaluationFlags::gradients | EvaluationFlags::hessians)) != 0u) FEEvaluationImplCollocation:: do_evaluate(shape_data, evaluation_flag & (EvaluationFlags::gradients | @@ -1701,8 +1701,8 @@ namespace internal for (unsigned int c = 0; c < n_components; ++c) { // apply derivatives in collocation space - if (integration_flag & - (EvaluationFlags::gradients | EvaluationFlags::hessians)) + if ((integration_flag & + (EvaluationFlags::gradients | EvaluationFlags::hessians)) != 0u) FEEvaluationImplCollocation:: do_integrate(shape_data, integration_flag & (EvaluationFlags::gradients | diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 0ffa439964..2de3e862bc 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -7107,11 +7107,11 @@ FEEvaluationvalues_quad_initialized = true; - if (evaluation_flag_actual & EvaluationFlags::gradients) + if ((evaluation_flag_actual & EvaluationFlags::gradients) != 0u) this->gradients_quad_initialized = true; - if (evaluation_flag_actual & EvaluationFlags::hessians) + if ((evaluation_flag_actual & EvaluationFlags::hessians) != 0u) this->hessians_quad_initialized = true; # endif } @@ -7343,10 +7343,10 @@ FEEvaluationvalues_quad_submitted == true, internal::ExcAccessToUninitializedField()); - if (integration_flag & EvaluationFlags::gradients) + if ((integration_flag & EvaluationFlags::gradients) != 0u) Assert(this->gradients_quad_submitted == true, internal::ExcAccessToUninitializedField()); if (integration_flag & EvaluationFlags::hessians) @@ -7853,9 +7853,9 @@ FEFaceEvaluationvalues_quad_initialized = true; - if (evaluation_flag_actual & EvaluationFlags::gradients) + if ((evaluation_flag_actual & EvaluationFlags::gradients) != 0u) this->gradients_quad_initialized = true; if (evaluation_flag_actual & EvaluationFlags::hessians) this->hessians_quad_initialized = true; @@ -7962,7 +7962,7 @@ FEFaceEvaluationcell_type > internal::MatrixFreeFunctions::affine)) { unsigned int size = n_components * dim * n_q_points; diff --git a/include/deal.II/matrix_free/fe_point_evaluation.h b/include/deal.II/matrix_free/fe_point_evaluation.h index 32aadd9e0a..6f26a70e8f 100644 --- a/include/deal.II/matrix_free/fe_point_evaluation.h +++ b/include/deal.II/matrix_free/fe_point_evaluation.h @@ -800,12 +800,12 @@ FEPointEvaluation::FEPointEvaluation( } // translate update flags - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) update_flags_mapping |= update_jacobians; - if (update_flags & update_gradients || - update_flags & update_inverse_jacobians) + if (((update_flags & update_gradients) != 0u) || + ((update_flags & update_inverse_jacobians) != 0u)) update_flags_mapping |= update_inverse_jacobians; - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) update_flags_mapping |= update_quadrature_points; } @@ -835,20 +835,20 @@ FEPointEvaluation::reinit( update_flags | update_flags_mapping); fe_values->reinit(cell); mapping_data.initialize(unit_points.size(), update_flags_mapping); - if (update_flags_mapping & update_jacobians) + if ((update_flags_mapping & update_jacobians) != 0) for (unsigned int q = 0; q < unit_points.size(); ++q) mapping_data.jacobians[q] = fe_values->jacobian(q); - if (update_flags_mapping & update_inverse_jacobians) + if ((update_flags_mapping & update_inverse_jacobians) != 0) for (unsigned int q = 0; q < unit_points.size(); ++q) mapping_data.inverse_jacobians[q] = fe_values->inverse_jacobian(q); - if (update_flags_mapping & update_quadrature_points) + if ((update_flags_mapping & update_quadrature_points) != 0) for (unsigned int q = 0; q < unit_points.size(); ++q) mapping_data.quadrature_points[q] = fe_values->quadrature_point(q); } - if (update_flags & update_values) + if ((update_flags & update_values) != 0) values.resize(unit_points.size(), numbers::signaling_nan()); - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0) gradients.resize(unit_points.size(), numbers::signaling_nan()); } @@ -865,8 +865,8 @@ FEPointEvaluation::evaluate( return; AssertDimension(solution_values.size(), fe->dofs_per_cell); - if (((evaluation_flag & EvaluationFlags::values) || - (evaluation_flag & EvaluationFlags::gradients)) && + if ((((evaluation_flag & EvaluationFlags::values) != 0u) || + ((evaluation_flag & EvaluationFlags::gradients) != 0u)) && !poly.empty()) { // fast path with tensor product evaluation @@ -906,12 +906,12 @@ FEPointEvaluation::evaluate( polynomials_are_hat_functions); // convert back to standard format - if (evaluation_flag & EvaluationFlags::values) + if ((evaluation_flag & EvaluationFlags::values) != 0u) for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j) internal::FEPointEvaluation:: EvaluatorTypeTraits::set_value( val_and_grad.first, j, values[i + j]); - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) { Assert(update_flags & update_gradients || update_flags & update_inverse_jacobians, @@ -933,15 +933,15 @@ FEPointEvaluation::evaluate( } } } - else if ((evaluation_flag & EvaluationFlags::values) || - (evaluation_flag & EvaluationFlags::gradients)) + else if (((evaluation_flag & EvaluationFlags::values) != 0u) || + ((evaluation_flag & EvaluationFlags::gradients) != 0u)) { // slow path with FEValues Assert(fe_values.get() != nullptr, ExcMessage( "Not initialized. Please call FEPointEvaluation::reinit()!")); - if (evaluation_flag & EvaluationFlags::values) + if ((evaluation_flag & EvaluationFlags::values) != 0u) { values.resize(unit_points.size()); std::fill(values.begin(), values.end(), value_type()); @@ -964,7 +964,7 @@ FEPointEvaluation::evaluate( } } - if (evaluation_flag & EvaluationFlags::gradients) + if ((evaluation_flag & EvaluationFlags::gradients) != 0u) { gradients.resize(unit_points.size()); std::fill(gradients.begin(), gradients.end(), gradient_type()); @@ -1004,15 +1004,15 @@ FEPointEvaluation::integrate( } AssertDimension(solution_values.size(), fe->dofs_per_cell); - if (((integration_flags & EvaluationFlags::values) || - (integration_flags & EvaluationFlags::gradients)) && + if ((((integration_flags & EvaluationFlags::values) != 0u) || + ((integration_flags & EvaluationFlags::gradients) != 0u)) && !poly.empty()) { // fast path with tensor product integration - if (integration_flags & EvaluationFlags::values) + if ((integration_flags & EvaluationFlags::values) != 0u) AssertIndexRange(unit_points.size(), values.size() + 1); - if (integration_flags & EvaluationFlags::gradients) + if ((integration_flags & EvaluationFlags::gradients) != 0u) AssertIndexRange(unit_points.size(), gradients.size() + 1); if (solution_renumbered_vectorized.size() != dofs_per_component) @@ -1044,12 +1044,12 @@ FEPointEvaluation::integrate( VectorizedArray>::type> gradient; - if (integration_flags & EvaluationFlags::values) + if ((integration_flags & EvaluationFlags::values) != 0u) for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j) internal::FEPointEvaluation:: EvaluatorTypeTraits::get_value( value, j, values[i + j]); - if (integration_flags & EvaluationFlags::gradients) + if ((integration_flags & EvaluationFlags::gradients) != 0u) for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j) { Assert(update_flags_mapping & update_inverse_jacobians, @@ -1087,8 +1087,8 @@ FEPointEvaluation::integrate( result[0]; } } - else if ((integration_flags & EvaluationFlags::values) || - (integration_flags & EvaluationFlags::gradients)) + else if (((integration_flags & EvaluationFlags::values) != 0u) || + ((integration_flags & EvaluationFlags::gradients) != 0u)) { // slow path with FEValues @@ -1097,7 +1097,7 @@ FEPointEvaluation::integrate( "Not initialized. Please call FEPointEvaluation::reinit()!")); std::fill(solution_values.begin(), solution_values.end(), 0.0); - if (integration_flags & EvaluationFlags::values) + if ((integration_flags & EvaluationFlags::values) != 0u) { AssertIndexRange(unit_points.size(), values.size() + 1); for (unsigned int i = 0; i < fe->n_dofs_per_cell(); ++i) @@ -1121,7 +1121,7 @@ FEPointEvaluation::integrate( } } - if (integration_flags & EvaluationFlags::gradients) + if ((integration_flags & EvaluationFlags::gradients) != 0u) { AssertIndexRange(unit_points.size(), gradients.size() + 1); for (unsigned int i = 0; i < fe->n_dofs_per_cell(); ++i) diff --git a/include/deal.II/matrix_free/mapping_data_on_the_fly.h b/include/deal.II/matrix_free/mapping_data_on_the_fly.h index 822a4c66f2..ebefb06f1f 100644 --- a/include/deal.II/matrix_free/mapping_data_on_the_fly.h +++ b/include/deal.II/matrix_free/mapping_data_on_the_fly.h @@ -171,7 +171,7 @@ namespace internal mapping_info_storage.data_index_offsets.resize(1); mapping_info_storage.JxW_values.resize(fe_values.n_quadrature_points); mapping_info_storage.jacobians[0].resize(fe_values.n_quadrature_points); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) { mapping_info_storage.quadrature_point_offsets.resize(1, 0); mapping_info_storage.quadrature_points.resize( diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index 99d23c9ead..42627038f6 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -88,8 +88,8 @@ namespace internal update_flags_cells, quad); this->update_flags_boundary_faces = - ((update_flags_inner_faces | update_flags_boundary_faces) & - update_quadrature_points ? + (((update_flags_inner_faces | update_flags_boundary_faces) & + update_quadrature_points) != 0u ? update_quadrature_points : update_default) | ((update_flags_inner_faces | update_flags_boundary_faces) & @@ -1359,10 +1359,10 @@ namespace internal data_cells_local.back().first[my_q].JxW_values.size()); cell_data[my_q].jacobians[0].resize_fast( cell_data[my_q].JxW_values.size()); - if (update_flags_cells & update_jacobian_grads) + if ((update_flags_cells & update_jacobian_grads) != 0) cell_data[my_q].jacobian_gradients[0].resize_fast( cell_data[my_q].JxW_values.size()); - if (update_flags_cells & update_quadrature_points) + if ((update_flags_cells & update_quadrature_points) != 0) { cell_data[my_q].quadrature_point_offsets.resize(cell_type.size()); cell_data[my_q].quadrature_points.resize_fast( @@ -2402,7 +2402,7 @@ namespace internal face_data[my_q].JxW_values.size()); face_data[my_q].jacobians[1].resize_fast( face_data[my_q].JxW_values.size()); - if (update_flags_common & update_jacobian_grads) + if ((update_flags_common & update_jacobian_grads) != 0u) { face_data[my_q].jacobian_gradients[0].resize_fast( face_data[my_q].JxW_values.size()); @@ -2413,7 +2413,7 @@ namespace internal face_data[my_q].JxW_values.size()); face_data[my_q].normals_times_jacobians[1].resize_fast( face_data[my_q].JxW_values.size()); - if (update_flags_common & update_quadrature_points) + if ((update_flags_common & update_quadrature_points) != 0u) { face_data[my_q].quadrature_point_offsets.resize(face_type.size()); face_data[my_q].quadrature_points.resize_fast( @@ -2645,10 +2645,10 @@ namespace internal my_data.JxW_values.resize_fast(max_size); my_data.jacobians[0].resize_fast(max_size); - if (update_flags_cells & update_jacobian_grads) + if ((update_flags_cells & update_jacobian_grads) != 0) my_data.jacobian_gradients[0].resize_fast(max_size); - if (update_flags_cells & update_quadrature_points) + if ((update_flags_cells & update_quadrature_points) != 0) { my_data.quadrature_point_offsets.resize(cell_type.size()); for (unsigned int cell = 1; cell < cell_type.size(); ++cell) @@ -2772,7 +2772,7 @@ namespace internal my_data.normal_vectors.resize_fast(max_size); my_data.jacobians[0].resize_fast(max_size); my_data.jacobians[1].resize_fast(max_size); - if (update_flags_common & update_jacobian_grads) + if ((update_flags_common & update_jacobian_grads) != 0u) { my_data.jacobian_gradients[0].resize_fast(max_size); my_data.jacobian_gradients[1].resize_fast(max_size); @@ -2780,7 +2780,7 @@ namespace internal my_data.normals_times_jacobians[0].resize_fast(max_size); my_data.normals_times_jacobians[1].resize_fast(max_size); - if (update_flags_common & update_quadrature_points) + if ((update_flags_common & update_quadrature_points) != 0u) { my_data.quadrature_point_offsets.resize(face_type.size()); my_data.quadrature_point_offsets[0] = 0; @@ -2876,7 +2876,7 @@ namespace internal const unsigned int n_quads = face_data_by_cells.size(); const unsigned int n_lanes = VectorizedArrayType::size(); UpdateFlags update_flags = - (update_flags_faces_by_cells & update_quadrature_points ? + ((update_flags_faces_by_cells & update_quadrature_points) != 0 ? update_quadrature_points : update_default) | update_normal_vectors | update_JxW_values | update_jacobians; @@ -2889,7 +2889,7 @@ namespace internal AssertDimension(cell_type.size(), cells.size() / n_lanes); face_data_by_cells[my_q].data_index_offsets.resize( cell_type.size() * GeometryInfo::faces_per_cell); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0) face_data_by_cells[my_q].quadrature_point_offsets.resize( cell_type.size() * GeometryInfo::faces_per_cell); std::size_t storage_length = 0; @@ -2911,7 +2911,7 @@ namespace internal storage_length += face_data_by_cells[my_q].descriptor[0].n_q_points; } - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) face_data_by_cells[my_q].quadrature_point_offsets [i * GeometryInfo::faces_per_cell + face] = (i * GeometryInfo::faces_per_cell + face) * @@ -2923,22 +2923,22 @@ namespace internal storage_length * GeometryInfo::faces_per_cell); face_data_by_cells[my_q].jacobians[1].resize_fast( storage_length * GeometryInfo::faces_per_cell); - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) face_data_by_cells[my_q].normal_vectors.resize_fast( storage_length * GeometryInfo::faces_per_cell); - if (update_flags & update_normal_vectors && - update_flags & update_jacobians) + if (((update_flags & update_normal_vectors) != 0u) && + ((update_flags & update_jacobians) != 0u)) face_data_by_cells[my_q].normals_times_jacobians[0].resize_fast( storage_length * GeometryInfo::faces_per_cell); - if (update_flags & update_normal_vectors && - update_flags & update_jacobians) + if (((update_flags & update_normal_vectors) != 0u) && + ((update_flags & update_jacobians) != 0u)) face_data_by_cells[my_q].normals_times_jacobians[1].resize_fast( storage_length * GeometryInfo::faces_per_cell); - if (update_flags & update_jacobian_grads) + if ((update_flags & update_jacobian_grads) != 0u) face_data_by_cells[my_q].jacobian_gradients[0].resize_fast( storage_length * GeometryInfo::faces_per_cell); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) face_data_by_cells[my_q].quadrature_points.resize_fast( cell_type.size() * GeometryInfo::faces_per_cell * face_data_by_cells[my_q].descriptor[0].n_q_points); @@ -3012,10 +3012,10 @@ namespace internal // copy data for affine data type if (cell_type[cell] <= affine) { - if (update_flags & update_JxW_values) + if ((update_flags & update_JxW_values) != 0u) face_data_by_cells[my_q].JxW_values[offset][v] = fe_val.JxW(0) / fe_val.get_quadrature().weight(0); - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) { DerivativeForm<1, dim, dim> inv_jac = fe_val.jacobian(0).covariant_form(); @@ -3029,7 +3029,7 @@ namespace internal inv_jac[d][ee]; } } - if (is_local && (update_flags & update_jacobians)) + if (is_local && ((update_flags & update_jacobians) != 0u)) for (unsigned int q = 0; q < fe_val.n_quadrature_points; ++q) { @@ -3046,11 +3046,11 @@ namespace internal inv_jac[d][ee]; } } - if (update_flags & update_jacobian_grads) + if ((update_flags & update_jacobian_grads) != 0u) { Assert(false, ExcNotImplemented()); } - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) for (unsigned int d = 0; d < dim; ++d) face_data_by_cells[my_q] .normal_vectors[offset][d][v] = @@ -3059,12 +3059,12 @@ namespace internal // copy data for general data type else { - if (update_flags & update_JxW_values) + if ((update_flags & update_JxW_values) != 0u) for (unsigned int q = 0; q < fe_val.n_quadrature_points; ++q) face_data_by_cells[my_q].JxW_values[offset + q][v] = fe_val.JxW(q); - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) for (unsigned int q = 0; q < fe_val.n_quadrature_points; ++q) { @@ -3081,11 +3081,11 @@ namespace internal inv_jac[d][ee]; } } - if (update_flags & update_jacobian_grads) + if ((update_flags & update_jacobian_grads) != 0u) { Assert(false, ExcNotImplemented()); } - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) for (unsigned int q = 0; q < fe_val.n_quadrature_points; ++q) for (unsigned int d = 0; d < dim; ++d) @@ -3093,7 +3093,7 @@ namespace internal .normal_vectors[offset + q][d][v] = fe_val.normal_vector(q)[d]; } - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) for (unsigned int q = 0; q < fe_val.n_quadrature_points; ++q) for (unsigned int d = 0; d < dim; ++d) @@ -3102,8 +3102,8 @@ namespace internal [cell * GeometryInfo::faces_per_cell + face] + q][d][v] = fe_val.quadrature_point(q)[d]; } - if (update_flags & update_normal_vectors && - update_flags & update_jacobians) + if (((update_flags & update_normal_vectors) != 0u) && + ((update_flags & update_jacobians) != 0u)) for (unsigned int q = 0; q < (cell_type[cell] <= affine ? 1 : fe_val.n_quadrature_points); @@ -3112,8 +3112,8 @@ namespace internal .normals_times_jacobians[0][offset + q] = face_data_by_cells[my_q].normal_vectors[offset + q] * face_data_by_cells[my_q].jacobians[0][offset + q]; - if (update_flags & update_normal_vectors && - update_flags & update_jacobians) + if (((update_flags & update_normal_vectors) != 0u) && + ((update_flags & update_jacobians) != 0u)) for (unsigned int q = 0; q < (cell_type[cell] <= affine ? 1 : fe_val.n_quadrature_points); diff --git a/include/deal.II/meshworker/integration_info.h b/include/deal.II/meshworker/integration_info.h index 494cc8d4c7..b8260d13d3 100644 --- a/include/deal.II/meshworker/integration_info.h +++ b/include/deal.II/meshworker/integration_info.h @@ -786,13 +786,13 @@ namespace MeshWorker const BlockInfo *block_info) { initialize_update_flags(); - initialize_gauss_quadrature((cell_flags & update_values) ? + initialize_gauss_quadrature(((cell_flags & update_values) != 0) ? (el.tensor_degree() + 1) : el.tensor_degree(), - (boundary_flags & update_values) ? + ((boundary_flags & update_values) != 0) ? (el.tensor_degree() + 1) : el.tensor_degree(), - (face_flags & update_values) ? + ((face_flags & update_values) != 0) ? (el.tensor_degree() + 1) : el.tensor_degree(), false); diff --git a/include/deal.II/meshworker/integration_info.templates.h b/include/deal.II/meshworker/integration_info.templates.h index e88bd2f749..d1b5aaabdd 100644 --- a/include/deal.II/meshworker/integration_info.templates.h +++ b/include/deal.II/meshworker/integration_info.templates.h @@ -191,32 +191,32 @@ namespace MeshWorker face_flags |= boundary_flags; neighbor_flags |= neighbor_geometry ? boundary_flags : update_default; - if (cell_selector.has_values() != 0) + if (cell_selector.has_values()) cell_flags |= update_values; - if (cell_selector.has_gradients() != 0) + if (cell_selector.has_gradients()) cell_flags |= update_gradients; - if (cell_selector.has_hessians() != 0) + if (cell_selector.has_hessians()) cell_flags |= update_hessians; - if (boundary_selector.has_values() != 0) + if (boundary_selector.has_values()) boundary_flags |= update_values; - if (boundary_selector.has_gradients() != 0) + if (boundary_selector.has_gradients()) boundary_flags |= update_gradients; - if (boundary_selector.has_hessians() != 0) + if (boundary_selector.has_hessians()) boundary_flags |= update_hessians; - if (face_selector.has_values() != 0) + if (face_selector.has_values()) face_flags |= update_values; - if (face_selector.has_gradients() != 0) + if (face_selector.has_gradients()) face_flags |= update_gradients; - if (face_selector.has_hessians() != 0) + if (face_selector.has_hessians()) face_flags |= update_hessians; - if (face_selector.has_values() != 0) + if (face_selector.has_values()) neighbor_flags |= update_values; - if (face_selector.has_gradients() != 0) + if (face_selector.has_gradients()) neighbor_flags |= update_gradients; - if (face_selector.has_hessians() != 0) + if (face_selector.has_hessians()) neighbor_flags |= update_hessians; } diff --git a/source/base/convergence_table.cc b/source/base/convergence_table.cc index ae77d7ac67..bc41d16bf8 100644 --- a/source/base/convergence_table.cc +++ b/source/base/convergence_table.cc @@ -108,7 +108,7 @@ ConvergenceTable::evaluate_convergence_rates( set_precision(rate_key, 2); const std::string &superkey = data_column_key; - if (!supercolumns.count(superkey)) + if (supercolumns.count(superkey) == 0u) { add_column_to_supercolumn(data_column_key, superkey); set_tex_supercaption(superkey, columns[data_column_key].tex_caption); @@ -199,7 +199,7 @@ ConvergenceTable::evaluate_convergence_rates(const std::string &data_column_key, const std::string &superkey = data_column_key; // and set the tex caption of the supercolumn to the tex caption of the // data_column. - if (!supercolumns.count(superkey)) + if (supercolumns.count(superkey) == 0u) { add_column_to_supercolumn(data_column_key, superkey); set_tex_supercaption(superkey, columns[data_column_key].tex_caption); @@ -234,7 +234,7 @@ ConvergenceTable::evaluate_all_convergence_rates( for (std::map::const_iterator col_iter = columns.begin(); col_iter != columns.end(); ++col_iter) - if (!col_iter->second.flag) + if (col_iter->second.flag == 0u) evaluate_convergence_rates(col_iter->first, reference_column_key, rate_mode); @@ -248,7 +248,7 @@ ConvergenceTable::evaluate_all_convergence_rates(const RateMode rate_mode) for (std::map::const_iterator col_iter = columns.begin(); col_iter != columns.end(); ++col_iter) - if (!col_iter->second.flag) + if (col_iter->second.flag == 0u) evaluate_convergence_rates(col_iter->first, rate_mode); } diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 5ded5afceb..d84b3b815b 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -860,7 +860,7 @@ namespace if (nbdy == 2) // Vertex DOF { // ijk is a corner node. Return the proper index (somewhere in [0,3]): - return (i ? (j ? 2 : 1) : (j ? 3 : 0)); + return (i != 0u ? (j != 0u ? 2 : 1) : (j != 0u ? 3 : 0)); } int offset = 4; @@ -868,13 +868,15 @@ namespace { if (!ibdy) { // On i axis - return (i - 1) + (j ? order[0] - 1 + order[1] - 1 : 0) + offset; + return (i - 1) + (j != 0u ? order[0] - 1 + order[1] - 1 : 0) + + offset; } if (!jbdy) { // On j axis return (j - 1) + - (i ? order[0] - 1 : 2 * (order[0] - 1) + order[1] - 1) + + (i != 0u ? order[0] - 1 : + 2 * (order[0] - 1) + order[1] - 1) + offset; } } @@ -907,7 +909,8 @@ namespace if (nbdy == 3) // Vertex DOF { // ijk is a corner node. Return the proper index (somewhere in [0,7]): - return (i ? (j ? 2 : 1) : (j ? 3 : 0)) + (k ? 4 : 0); + return (i != 0u ? (j != 0u ? 2 : 1) : (j != 0u ? 3 : 0)) + + (k != 0u ? 4 : 0); } int offset = 8; @@ -915,18 +918,21 @@ namespace { if (!ibdy) { // On i axis - return (i - 1) + (j ? order[0] - 1 + order[1] - 1 : 0) + - (k ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset; + return (i - 1) + (j != 0u ? order[0] - 1 + order[1] - 1 : 0) + + (k != 0u ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset; } if (!jbdy) { // On j axis return (j - 1) + - (i ? order[0] - 1 : 2 * (order[0] - 1) + order[1] - 1) + - (k ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset; + (i != 0u ? order[0] - 1 : + 2 * (order[0] - 1) + order[1] - 1) + + (k != 0u ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset; } // !kbdy, On k axis offset += 4 * (order[0] - 1) + 4 * (order[1] - 1); - return (k - 1) + (order[2] - 1) * (i ? (j ? 3 : 1) : (j ? 2 : 0)) + + return (k - 1) + + (order[2] - 1) * + (i != 0u ? (j != 0u ? 3 : 1) : (j != 0u ? 2 : 0)) + offset; } @@ -936,18 +942,18 @@ namespace if (ibdy) // On i-normal face { return (j - 1) + ((order[1] - 1) * (k - 1)) + - (i ? (order[1] - 1) * (order[2] - 1) : 0) + offset; + (i != 0u ? (order[1] - 1) * (order[2] - 1) : 0) + offset; } offset += 2 * (order[1] - 1) * (order[2] - 1); if (jbdy) // On j-normal face { return (i - 1) + ((order[0] - 1) * (k - 1)) + - (j ? (order[2] - 1) * (order[0] - 1) : 0) + offset; + (j != 0u ? (order[2] - 1) * (order[0] - 1) : 0) + offset; } offset += 2 * (order[2] - 1) * (order[0] - 1); // kbdy, On k-normal face return (i - 1) + ((order[0] - 1) * (j - 1)) + - (k ? (order[0] - 1) * (order[1] - 1) : 0) + offset; + (k != 0u ? (order[0] - 1) * (order[1] - 1) : 0) + offset; } // nbdy == 0: Body DOF diff --git a/source/base/exceptions.cc b/source/base/exceptions.cc index 37c85104b9..8df4e1d597 100644 --- a/source/base/exceptions.cc +++ b/source/base/exceptions.cc @@ -469,7 +469,7 @@ namespace deal_II_exceptions #ifdef DEAL_II_WITH_MPI int is_initialized; MPI_Initialized(&is_initialized); - if (is_initialized) + if (is_initialized != 0) { // do the same as in Utilities::MPI::n_mpi_processes() here, // but without error checking to not throw again. diff --git a/source/base/index_set.cc b/source/base/index_set.cc index 774ddfacb6..51b3e2759c 100644 --- a/source/base/index_set.cc +++ b/source/base/index_set.cc @@ -499,7 +499,7 @@ IndexSet::block_read(std::istream &in) ranges.clear(); set_size(size); ranges.resize(n_ranges, Range(0, 0)); - if (n_ranges) + if (n_ranges != 0u) in.read(reinterpret_cast(&*ranges.begin()), ranges.size() * sizeof(Range)); diff --git a/source/base/logstream.cc b/source/base/logstream.cc index 29c72e5edb..76bbc402da 100644 --- a/source/base/logstream.cc +++ b/source/base/logstream.cc @@ -107,7 +107,7 @@ LogStream::~LogStream() // (note that we can't issue an assertion here either since Assert // may want to write to 'deallog' itself, and AssertThrow will // throw an exception that can't be caught) - if ((this == &deallog) && file) + if ((this == &deallog) && (file != nullptr)) *std_out << ("You still have content that was written to 'deallog' " "but not flushed to the screen or a file while the " "program is being terminated. This would lead to a " @@ -204,7 +204,7 @@ LogStream::operator<<(std::ostream &(*p)(std::ostream &)) if (get_prefixes().size() <= std_depth) *std_out << stream.str(); - if (file && (get_prefixes().size() <= file_depth)) + if ((file != nullptr) && (get_prefixes().size() <= file_depth)) *file << stream.str() << std::flush; // Start a new string: @@ -414,7 +414,7 @@ LogStream::print_line_head() *std_out << head << ':'; } - if (file && (get_prefixes().size() <= file_depth)) + if ((file != nullptr) && (get_prefixes().size() <= file_depth)) { if (print_thread_id) *file << '[' << thread << ']'; diff --git a/source/base/mpi.cc b/source/base/mpi.cc index bd639b9e45..e99fbad756 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -734,7 +734,7 @@ namespace Utilities int ierr = MPI_Op_create(reinterpret_cast(&max_reduce), - true, + static_cast(true), &op); AssertThrowMPI(ierr); diff --git a/source/base/mu_parser_internal.cc b/source/base/mu_parser_internal.cc index 74b9890d6e..44ce4621cb 100644 --- a/source/base/mu_parser_internal.cc +++ b/source/base/mu_parser_internal.cc @@ -43,7 +43,7 @@ namespace internal double mu_if(double condition, double thenvalue, double elsevalue) { - if (mu_round(condition)) + if (mu_round(condition) != 0) return thenvalue; else return elsevalue; @@ -52,13 +52,15 @@ namespace internal double mu_or(double left, double right) { - return (mu_round(left)) || (mu_round(right)); + return static_cast((mu_round(left) != 0) || + (mu_round(right) != 0)); } double mu_and(double left, double right) { - return (mu_round(left)) && (mu_round(right)); + return static_cast((mu_round(left) != 0) && + (mu_round(right) != 0)); } double diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index 5245cf7f9b..5862181ce7 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -1260,7 +1260,7 @@ ParameterHandler::print_parameters(std::ostream & out, boost::property_tree::ptree current_entries = *entries.get(); // Sort parameters alphabetically, if needed. - if (!(style & KeepDeclarationOrder)) + if ((style & KeepDeclarationOrder) == 0) { // Dive recursively into the subsections, // starting from the top level. @@ -1282,13 +1282,13 @@ ParameterHandler::print_parameters(std::ostream & out, // first // explicitly compress the tree if requested - if ((style & Short) && (style & (XML | JSON))) + if (((style & Short) != 0) && ((style & (XML | JSON)) != 0)) { // modify the copy of the tree recursively_compress_tree(current_entries); } - if (style & XML) + if ((style & XML) != 0) { // call the writer function and exit as there is nothing // further to do down in this function @@ -1306,29 +1306,29 @@ ParameterHandler::print_parameters(std::ostream & out, return out; } - if (style & JSON) + if ((style & JSON) != 0) { write_json(out, current_entries); return out; } // for all of the other formats, print a preamble: - if ((style & Short) && (style & Text)) + if (((style & Short) != 0) && ((style & Text) != 0)) { // nothing to do } - else if (style & Text) + else if ((style & Text) != 0) { out << "# Listing of Parameters" << std::endl << "# ---------------------" << std::endl; } - else if (style & LaTeX) + else if ((style & LaTeX) != 0) { out << "\\subsection{Global parameters}" << std::endl; out << "\\label{parameters:global}" << std::endl; out << std::endl << std::endl; } - else if (style & Description) + else if ((style & Description) != 0) { out << "Listing of Parameters:" << std::endl << std::endl; } @@ -1393,9 +1393,9 @@ ParameterHandler::recursively_print_parameters( unsigned int overall_indent_level = indent_level; - const bool is_short = style & Short; + const bool is_short = (style & Short) != 0; - if (style & Text) + if ((style & Text) != 0) { // first find out the longest entry name to be able to align the // equal signs to do this loop over all nodes of the current @@ -1466,7 +1466,7 @@ ParameterHandler::recursively_print_parameters( out << '\n'; } } - else if (style & LaTeX) + else if ((style & LaTeX) != 0) { auto escape = [](const std::string &input) { return Patterns::internal::escape(input, Patterns::PatternBase::LaTeX); @@ -1598,7 +1598,7 @@ ParameterHandler::recursively_print_parameters( out << "\\end{itemize}" << '\n'; } } - else if (style & Description) + else if ((style & Description) != 0) { // first find out the longest entry name to be able to align the // equal signs @@ -1664,8 +1664,9 @@ ParameterHandler::recursively_print_parameters( else if (is_alias_node(p.second) == false) ++n_sections; - if (!(style & Description) && (!((style & Text) && is_short)) && - (n_parameters != 0) && (n_sections != 0)) + if (((style & Description) == 0) && + (!(((style & Text) != 0) && is_short)) && (n_parameters != 0) && + (n_sections != 0)) out << "\n\n"; } @@ -1675,12 +1676,12 @@ ParameterHandler::recursively_print_parameters( (is_alias_node(p.second) == false)) { // first print the subsection header - if ((style & Text) || (style & Description)) + if (((style & Text) != 0) || ((style & Description) != 0)) { out << std::setw(overall_indent_level * 2) << "" << "subsection " << demangle(p.first) << '\n'; } - else if (style & LaTeX) + else if ((style & LaTeX) != 0) { auto escape = [](const std::string &input) { return Patterns::internal::escape(input, @@ -1717,13 +1718,13 @@ ParameterHandler::recursively_print_parameters( recursively_print_parameters( tree, directory_path, style, overall_indent_level + 1, out); - if (is_short && (style & Text)) + if (is_short && ((style & Text) != 0)) { // write end of subsection. out << std::setw(overall_indent_level * 2) << "" << "end" << '\n'; } - else if (style & Text) + else if ((style & Text) != 0) { // write end of subsection. one blank line after each // subsection @@ -1736,11 +1737,11 @@ ParameterHandler::recursively_print_parameters( if (overall_indent_level == 0) out << '\n'; } - else if (style & Description) + else if ((style & Description) != 0) { // nothing to do } - else if (style & LaTeX) + else if ((style & LaTeX) != 0) { // nothing to do } @@ -1775,7 +1776,7 @@ ParameterHandler::log_parameters_section(LogStream & out, boost::property_tree::ptree *current_entries = entries.get(); // Sort parameters alphabetically, if needed. - if (!(style & KeepDeclarationOrder)) + if ((style & KeepDeclarationOrder) == 0) { sorted_entries = *entries; current_entries = &sorted_entries; @@ -1859,7 +1860,7 @@ ParameterHandler::scan_line(std::string line, Utilities::match_at_string_start(line, "end")) { line.erase(0, 3); - while ((line.size() > 0) && (std::isspace(line[0]))) + while ((line.size() > 0) && ((std::isspace(line[0])) != 0)) line.erase(0, 1); AssertThrow( @@ -2291,9 +2292,9 @@ MultipleParameterLoop::Entry::split_different_values() multiple.erase(multiple.size() - 1, 1); // erase leading and trailing spaces // in multiple - while (std::isspace(multiple[0])) + while (std::isspace(multiple[0]) != 0) multiple.erase(0, 1); - while (std::isspace(multiple[multiple.size() - 1])) + while (std::isspace(multiple[multiple.size() - 1]) != 0) multiple.erase(multiple.size() - 1, 1); // delete spaces around '|' diff --git a/source/base/patterns.cc b/source/base/patterns.cc index eaf7063c2e..1b4fbede05 100644 --- a/source/base/patterns.cc +++ b/source/base/patterns.cc @@ -548,7 +548,7 @@ namespace Patterns std::string tmp(sequence); // remove whitespace at beginning - while ((tmp.length() != 0) && (std::isspace(tmp[0]))) + while ((tmp.length() != 0) && ((std::isspace(tmp[0])) != 0)) tmp.erase(0, 1); // check the different possibilities @@ -561,7 +561,7 @@ namespace Patterns } // remove whitespace at the end - while ((tmp.length() != 0) && (std::isspace(*(tmp.end() - 1)))) + while ((tmp.length() != 0) && ((std::isspace(*(tmp.end() - 1))) != 0)) tmp.erase(tmp.end() - 1); // check last choice, not finished by | @@ -1272,9 +1272,9 @@ namespace Patterns else tmp = ""; - while ((name.length() != 0) && (std::isspace(name[0]))) + while ((name.length() != 0) && ((std::isspace(name[0])) != 0)) name.erase(0, 1); - while (std::isspace(name[name.length() - 1])) + while (std::isspace(name[name.length() - 1]) != 0) name.erase(name.length() - 1, 1); split_names.push_back(name); diff --git a/source/base/qprojector.cc b/source/base/qprojector.cc index 5344e007fc..85ce6dea46 100644 --- a/source/base/qprojector.cc +++ b/source/base/qprojector.cc @@ -1391,11 +1391,13 @@ QProjector::DataSetDescriptor::face(const ReferenceCell reference_cell, reference_cell == ReferenceCells::Tetrahedron) { if (dim == 2) - return {(2 * face_no + face_orientation) * n_quadrature_points}; + return {(2 * face_no + (face_orientation ? 1 : 0)) * + n_quadrature_points}; else if (dim == 3) { - const unsigned int orientation = - (face_flip * 2 + face_rotation) * 2 + face_orientation; + const unsigned int orientation = (face_flip ? 4 : 0) + + (face_rotation ? 2 : 0) + + (face_orientation ? 1 : 0); return {(6 * face_no + orientation) * n_quadrature_points}; } } @@ -1509,8 +1511,9 @@ QProjector::DataSetDescriptor::face( quadrature[quadrature.size() == 1 ? 0 : face_no].size()}; else if (dim == 3) { - const unsigned int orientation = - (face_flip * 2 + face_rotation) * 2 + face_orientation; + const unsigned int orientation = (face_flip ? 4 : 0) + + (face_rotation ? 2 : 0) + + (face_orientation ? 1 : 0); return {offset + orientation * diff --git a/source/base/table_handler.cc b/source/base/table_handler.cc index b62bf9b315..61aecfadda 100644 --- a/source/base/table_handler.cc +++ b/source/base/table_handler.cc @@ -254,7 +254,7 @@ TableHandler::add_column_to_supercolumn(const std::string &key, { Assert(columns.count(key), ExcColumnNotExistent(key)); - if (!supercolumns.count(superkey)) + if (supercolumns.count(superkey) == 0u) { std::pair> new_column( superkey, std::vector()); @@ -277,7 +277,7 @@ TableHandler::add_column_to_supercolumn(const std::string &key, column_order.erase(order_iter); } - if (supercolumns.count(superkey)) + if (supercolumns.count(superkey) != 0u) { supercolumns[superkey].push_back(key); // By default set the diff --git a/source/base/utilities.cc b/source/base/utilities.cc index 9721503193..3d2237f094 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -535,7 +535,7 @@ namespace Utilities for (; left < input.size(); ++left) { - if (!std::isspace(input[left])) + if (std::isspace(input[left]) == 0) { break; } @@ -543,7 +543,7 @@ namespace Utilities for (; right >= left; --right) { - if (!std::isspace(input[right])) + if (std::isspace(input[right]) == 0) { break; } diff --git a/source/distributed/fully_distributed_tria.cc b/source/distributed/fully_distributed_tria.cc index ed8766a55f..5c8a006b21 100644 --- a/source/distributed/fully_distributed_tria.cc +++ b/source/distributed/fully_distributed_tria.cc @@ -73,8 +73,9 @@ namespace parallel settings = construction_data.settings; // set the smoothing properties - if (settings & - TriangulationDescription::Settings::construct_multigrid_hierarchy) + if ((settings & + TriangulationDescription::Settings::construct_multigrid_hierarchy) != + 0) this->set_mesh_smoothing( static_cast< typename dealii::Triangulation::MeshSmoothing>( @@ -202,8 +203,8 @@ namespace parallel cell->set_subdomain_id(cell_info->subdomain_id); // level subdomain id - if (settings & TriangulationDescription::Settings:: - construct_multigrid_hierarchy) + if ((settings & TriangulationDescription::Settings:: + construct_multigrid_hierarchy) != 0) cell->set_level_subdomain_id(cell_info->level_subdomain_id); } } @@ -404,9 +405,8 @@ namespace parallel bool Triangulation::is_multilevel_hierarchy_constructed() const { - return ( - settings & - TriangulationDescription::Settings::construct_multigrid_hierarchy); + return (settings & TriangulationDescription::Settings:: + construct_multigrid_hierarchy) != 0; } diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index c66a0fbfdf..39f76f1e9f 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -1342,7 +1342,7 @@ namespace // if there are no more cells in our list the current cell can't be // flagged for refinement if (this_object->current_refine_pointer == this_object->refine_list.end()) - return false; + return 0; Assert(coarse_cell_index <= this_object->current_refine_pointer->p.which_tree, @@ -1351,7 +1351,7 @@ namespace // if p4est hasn't yet reached the tree of the next flagged cell the // current cell can't be flagged for refinement if (coarse_cell_index < this_object->current_refine_pointer->p.which_tree) - return false; + return 0; // now we're in the right tree in the forest Assert(coarse_cell_index <= @@ -1369,11 +1369,11 @@ namespace quadrant, &*this_object->current_refine_pointer)) { ++this_object->current_refine_pointer; - return true; + return 1; } // p4est cell is not in list - return false; + return 0; } @@ -1392,7 +1392,7 @@ namespace // if there are no more cells in our list the current cell can't be // flagged for coarsening if (this_object->current_coarsen_pointer == this_object->coarsen_list.end()) - return false; + return 0; Assert(coarse_cell_index <= this_object->current_coarsen_pointer->p.which_tree, @@ -1401,7 +1401,7 @@ namespace // if p4est hasn't yet reached the tree of the next flagged cell the // current cell can't be flagged for coarsening if (coarse_cell_index < this_object->current_coarsen_pointer->p.which_tree) - return false; + return 0; // now we're in the right tree in the forest Assert(coarse_cell_index <= @@ -1433,11 +1433,11 @@ namespace ++this_object->current_coarsen_pointer; } - return true; + return 1; } // p4est cell is not in list - return false; + return 0; } diff --git a/source/fe/fe.cc b/source/fe/fe.cc index e58b252a73..1ead74729e 100644 --- a/source/fe/fe.cc +++ b/source/fe/fe.cc @@ -609,11 +609,11 @@ FiniteElement::face_to_cell_index(const unsigned int face_index, // then get the number of this vertex on the cell and translate // this to a DoF number on the cell - return (this->reference_cell().face_to_cell_vertices(face, - face_vertex, - face_orientation + - 2 * face_rotation + - 4 * face_flip) * + return (this->reference_cell().face_to_cell_vertices( + face, + face_vertex, + (face_orientation ? 1 : 0) + (face_rotation ? 2 : 0) + + (face_flip ? 4 : 0)) * this->n_dofs_per_vertex() + dof_index_on_vertex); } @@ -628,14 +628,15 @@ FiniteElement::face_to_cell_index(const unsigned int face_index, const unsigned int face_line = index / this->n_dofs_per_line(); const unsigned int dof_index_on_line = index % this->n_dofs_per_line(); - return (this->get_first_line_index() + - this->reference_cell().face_to_cell_lines(face, - face_line, - face_orientation + - 2 * face_rotation + - 4 * face_flip) * - this->n_dofs_per_line() + - dof_index_on_line); + return ( + this->get_first_line_index() + + this->reference_cell().face_to_cell_lines(face, + face_line, + (face_orientation ? 1 : 0) + + (face_rotation ? 2 : 0) + + (face_flip ? 4 : 0)) * + this->n_dofs_per_line() + + dof_index_on_line); } else // DoF is on a quad @@ -689,8 +690,10 @@ FiniteElement::adjust_quad_dof_index_for_face_orientation( ExcInternalError()); return index + adjust_quad_dof_index_for_face_orientation_table - [this->n_unique_quads() == 1 ? 0 : face]( - index, 4 * face_orientation + 2 * face_flip + face_rotation); + [this->n_unique_quads() == 1 ? 0 : face](index, + (face_orientation ? 4 : 0) + + (face_flip ? 2 : 0) + + (face_rotation ? 1 : 0)); } diff --git a/source/fe/fe_dgp_nonparametric.cc b/source/fe/fe_dgp_nonparametric.cc index 1505510170..2ce83530c6 100644 --- a/source/fe/fe_dgp_nonparametric.cc +++ b/source/fe/fe_dgp_nonparametric.cc @@ -262,7 +262,7 @@ FE_DGPNonparametric::requires_update_flags( { UpdateFlags out = flags; - if (flags & (update_values | update_gradients | update_hessians)) + if ((flags & (update_values | update_gradients | update_hessians)) != 0u) out |= update_quadrature_points; return out; diff --git a/source/fe/fe_enriched.cc b/source/fe/fe_enriched.cc index 707168479f..3298acc8c7 100644 --- a/source/fe/fe_enriched.cc +++ b/source/fe/fe_enriched.cc @@ -305,11 +305,11 @@ FE_Enriched::requires_update_flags(const UpdateFlags flags) const if (is_enriched) { // if we ask for values or gradients, then we would need quadrature points - if (flags & (update_values | update_gradients)) + if ((flags & (update_values | update_gradients)) != 0u) out |= update_quadrature_points; // if need gradients, add update_values due to product rule - if (out & update_gradients) + if ((out & update_gradients) != 0u) out |= update_values; } diff --git a/source/fe/fe_face.cc b/source/fe/fe_face.cc index dd66427daa..bed160f792 100644 --- a/source/fe/fe_face.cc +++ b/source/fe/fe_face.cc @@ -677,11 +677,11 @@ UpdateFlags FE_FaceQ<1, spacedim>::requires_update_flags(const UpdateFlags flags) const { UpdateFlags out = flags & update_values; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients | update_covariant_transformation; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) out |= update_hessians | update_covariant_transformation; - if (flags & update_normal_vectors) + if ((flags & update_normal_vectors) != 0u) out |= update_normal_vectors | update_JxW_values; return out; @@ -956,7 +956,7 @@ FE_FaceP::get_subface_interpolation_matrix( for (unsigned int k = 0; k < face_quadrature.size(); ++k) { const Point p = - numbers::invalid_unsigned_int ? + numbers::invalid_unsigned_int != 0u ? face_quadrature.point(k) : GeometryInfo::child_to_cell_coordinates( face_quadrature.point(k), subface); diff --git a/source/fe/fe_nedelec_sz.cc b/source/fe/fe_nedelec_sz.cc index 32e141c341..3e80a41035 100644 --- a/source/fe/fe_nedelec_sz.cc +++ b/source/fe/fe_nedelec_sz.cc @@ -165,20 +165,20 @@ FE_NedelecSZ::get_data( vertices_per_cell, std::vector(dim))); // Resize shape function arrays according to update flags: - if (flags & update_values) + if ((flags & update_values) != 0u) { data.shape_values.resize(this->n_dofs_per_cell(), std::vector>(n_q_points)); } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { data.shape_grads.resize(this->n_dofs_per_cell(), std::vector>( n_q_points)); } // Not implementing second derivatives yet: - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) { Assert(false, ExcNotImplemented()); } @@ -401,7 +401,7 @@ FE_NedelecSZ::get_data( cell_type2_offset + degree * degree; const unsigned int cell_type3_offset2 = cell_type3_offset1 + degree; - if (flags & (update_values | update_gradients)) + if ((flags & (update_values | update_gradients)) != 0u) { // compute all points we must evaluate the 1d polynomials at: std::vector> cell_points(n_q_points); @@ -429,7 +429,7 @@ FE_NedelecSZ::get_data( // Note that this will need to be updated if we're supporting // update_hessians. const unsigned int poly_length( - (flags & update_gradients) ? 3 : 2); + (flags & update_gradients) != 0u ? 3 : 2); std::vector> polyx( degree, std::vector(poly_length)); @@ -446,7 +446,7 @@ FE_NedelecSZ::get_data( cell_points[q][1], polyy[i]); } // Now use these to compute the shape functions: - if (flags & update_values) + if ((flags & update_values) != 0u) { for (unsigned int j = 0; j < degree; ++j) { @@ -483,7 +483,7 @@ FE_NedelecSZ::get_data( data.shape_values[dof_index3_2][q][1] = polyx[j][0]; } } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { for (unsigned int j = 0; j < degree; ++j) { @@ -799,7 +799,7 @@ FE_NedelecSZ::get_data( // for cell-based shape functions: // these don't depend on the cell, so can precompute all here: - if (flags & (update_values | update_gradients)) + if ((flags & (update_values | update_gradients)) != 0u) { // Cell-based shape functions: // @@ -855,7 +855,7 @@ FE_NedelecSZ::get_data( // only need poly values and 1st derivative for update_values, // but need 2nd derivative too for update_gradients. const unsigned int poly_length( - (flags & update_gradients) ? 3 : 2); + (flags & update_gradients) != 0u ? 3 : 2); // Loop through quad points: for (unsigned int q = 0; q < n_q_points; ++q) { @@ -882,7 +882,7 @@ FE_NedelecSZ::get_data( cell_points[q][2], polyz[i]); } // Now use these to compute the shape functions: - if (flags & update_values) + if ((flags & update_values) != 0u) { for (unsigned int k = 0; k < degree; ++k) { @@ -965,7 +965,7 @@ FE_NedelecSZ::get_data( } } } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { for (unsigned int k = 0; k < degree; ++k) { @@ -1155,7 +1155,7 @@ FE_NedelecSZ::fill_edge_values( { case 2: { - if (flags & (update_values | update_gradients)) + if ((flags & (update_values | update_gradients)) != 0u) { // Define an edge numbering so that each edge, E_{m} = [e^{m}_{1}, // e^{m}_{2}] e1 = higher global numbering of the two local @@ -1248,8 +1248,8 @@ FE_NedelecSZ::fill_edge_values( // If we want to generate shape gradients then we need second // derivatives of the 1d polynomials, but only first derivatives // for the shape values. - const unsigned int poly_length((flags & update_gradients) ? 3 : - 2); + const unsigned int poly_length( + (flags & update_gradients) != 0u ? 3 : 2); for (unsigned int m = 0; m < lines_per_cell; ++m) { @@ -1267,7 +1267,7 @@ FE_NedelecSZ::fill_edge_values( IntegratedLegendrePolynomials[i + 1].value( edge_sigma_values[m][q], poly[i - 1]); } - if (flags & update_values) + if ((flags & update_values) != 0u) { // Lowest order edge shape functions: for (unsigned int d = 0; d < dim; ++d) @@ -1292,7 +1292,7 @@ FE_NedelecSZ::fill_edge_values( } } } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { // Lowest order edge shape functions: for (unsigned int d1 = 0; d1 < dim; ++d1) @@ -1340,7 +1340,7 @@ FE_NedelecSZ::fill_edge_values( } case 3: { - if (flags & (update_values | update_gradients)) + if ((flags & (update_values | update_gradients)) != 0u) { // Define an edge numbering so that each edge, E_{m} = [e^{m}_{1}, // e^{m}_{2}] e1 = higher global numbering of the two local @@ -1436,8 +1436,8 @@ FE_NedelecSZ::fill_edge_values( // If we want to generate shape gradients then we need second // derivatives of the 1d polynomials, but only first derivatives // for the shape values. - const unsigned int poly_length((flags & update_gradients) ? 3 : - 2); + const unsigned int poly_length( + (flags & update_gradients) != 0u ? 3 : 2); std::vector> poly( degree, std::vector(poly_length)); for (unsigned int m = 0; m < lines_per_cell; ++m) @@ -1454,7 +1454,7 @@ FE_NedelecSZ::fill_edge_values( edge_sigma_values[m][q], poly[i]); } } - if (flags & update_values) + if ((flags & update_values) != 0u) { // Lowest order shape functions: for (unsigned int d = 0; d < dim; ++d) @@ -1478,7 +1478,7 @@ FE_NedelecSZ::fill_edge_values( } } } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { // Lowest order shape functions: for (unsigned int d1 = 0; d1 < dim; ++d1) @@ -1562,7 +1562,7 @@ FE_NedelecSZ::fill_face_values( { const UpdateFlags flags(fe_data.update_each); - if (flags & (update_values | update_gradients)) + if ((flags & (update_values | update_gradients)) != 0u) { const unsigned int n_q_points = quadrature.size(); @@ -1688,7 +1688,8 @@ FE_NedelecSZ::fill_face_values( } } // Now can generate the basis - const unsigned int poly_length((flags & update_gradients) ? 3 : 2); + const unsigned int poly_length((flags & update_gradients) != 0u ? 3 : + 2); std::vector> polyxi( degree, std::vector(poly_length)); std::vector> polyeta( @@ -1752,7 +1753,7 @@ FE_NedelecSZ::fill_face_values( face_eta_values[m][q], polyeta[i]); } // Now use these to compute the shape functions: - if (flags & update_values) + if ((flags & update_values) != 0u) { for (unsigned int j = 0; j < degree; ++j) { @@ -1804,7 +1805,7 @@ FE_NedelecSZ::fill_face_values( } } } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { for (unsigned int j = 0; j < degree; ++j) { @@ -1901,7 +1902,7 @@ FE_NedelecSZ::fill_face_values( } } } - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) { Assert(false, ExcNotImplemented()); } @@ -1949,7 +1950,7 @@ FE_NedelecSZ::fill_fe_values( fe_data.shape_values[0].size() == n_q_points, ExcDimensionMismatch(fe_data.shape_values[0].size(), n_q_points)); - if (flags & update_values) + if ((flags & update_values) != 0u) { // Now have all shape_values stored on the reference cell. // Must now transform to the physical cell. @@ -1975,7 +1976,7 @@ FE_NedelecSZ::fill_fe_values( } } } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { // Now have all shape_grads stored on the reference cell. // Must now transform to the physical cell. @@ -2082,7 +2083,7 @@ FE_NedelecSZ::fill_fe_face_values( cell->face_rotation(face_no), n_q_points); - if (flags & update_values) + if ((flags & update_values) != 0u) { // Now have all shape_values stored on the reference cell. // Must now transform to the physical cell. @@ -2111,7 +2112,7 @@ FE_NedelecSZ::fill_fe_face_values( } } } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { // Now have all shape_grads stored on the reference cell. // Must now transform to the physical cell. @@ -2187,15 +2188,15 @@ FE_NedelecSZ::requires_update_flags( { UpdateFlags out = update_default; - if (flags & update_values) + if ((flags & update_values) != 0u) out |= update_values | update_covariant_transformation; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients | update_values | update_jacobian_pushed_forward_grads | update_covariant_transformation; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) // Assert (false, ExcNotImplemented()); out |= update_hessians | update_values | update_gradients | update_jacobian_pushed_forward_grads | diff --git a/source/fe/fe_p1nc.cc b/source/fe/fe_p1nc.cc index e3033db056..efaab81100 100644 --- a/source/fe/fe_p1nc.cc +++ b/source/fe/fe_p1nc.cc @@ -51,13 +51,13 @@ FE_P1NC::requires_update_flags(const UpdateFlags flags) const { UpdateFlags out = update_default; - if (flags & update_values) + if ((flags & update_values) != 0u) out |= update_values | update_quadrature_points; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients; - if (flags & update_normal_vectors) + if ((flags & update_normal_vectors) != 0u) out |= update_normal_vectors | update_JxW_values; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) out |= update_hessians; return out; @@ -148,7 +148,7 @@ FE_P1NC::get_data( output_data.initialize(n_q_points, FE_P1NC(), data_ptr->update_each); // this is a linear element, so its second derivatives are zero - if (data_ptr->update_each & update_hessians) + if ((data_ptr->update_each & update_hessians) != 0u) output_data.shape_hessians.fill(Tensor<2, 2>()); return data_ptr; @@ -174,7 +174,7 @@ FE_P1NC::get_face_data( output_data.initialize(n_q_points, FE_P1NC(), data_ptr->update_each); // this is a linear element, so its second derivatives are zero - if (data_ptr->update_each & update_hessians) + if ((data_ptr->update_each & update_hessians) != 0u) output_data.shape_hessians.fill(Tensor<2, 2>()); return data_ptr; @@ -198,7 +198,7 @@ FE_P1NC::get_subface_data( output_data.initialize(n_q_points, FE_P1NC(), data_ptr->update_each); // this is a linear element, so its second derivatives are zero - if (data_ptr->update_each & update_hessians) + if ((data_ptr->update_each & update_hessians) != 0u) output_data.shape_hessians.fill(Tensor<2, 2>()); return data_ptr; @@ -227,14 +227,14 @@ FE_P1NC::fill_fe_values( ndarray coeffs = get_linear_shape_coefficients(cell); // compute on the cell - if (flags & update_values) + if ((flags & update_values) != 0u) for (unsigned int i = 0; i < n_q_points; ++i) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) output_data.shape_values[k][i] = (coeffs[k][0] * mapping_data.quadrature_points[i](0) + coeffs[k][1] * mapping_data.quadrature_points[i](1) + coeffs[k][2]); - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) for (unsigned int i = 0; i < n_q_points; ++i) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) output_data.shape_gradients[k][i] = @@ -268,7 +268,7 @@ FE_P1NC::fill_fe_face_values( quadrature[0], face_no); - if (flags & update_values) + if ((flags & update_values) != 0u) for (unsigned int i = 0; i < quadrature_on_face.size(); ++i) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) { @@ -281,7 +281,7 @@ FE_P1NC::fill_fe_face_values( coeffs[k][1] * quadrature_point(1) + coeffs[k][2]); } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) for (unsigned int i = 0; i < quadrature_on_face.size(); ++i) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) output_data.shape_gradients[k][i] = @@ -312,7 +312,7 @@ FE_P1NC::fill_fe_subface_values( const Quadrature<2> quadrature_on_subface = QProjector<2>::project_to_subface( this->reference_cell(), quadrature, face_no, sub_no); - if (flags & update_values) + if ((flags & update_values) != 0u) for (unsigned int i = 0; i < quadrature_on_subface.size(); ++i) { for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) @@ -327,7 +327,7 @@ FE_P1NC::fill_fe_subface_values( } } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) for (unsigned int i = 0; i < quadrature_on_subface.size(); ++i) for (unsigned int k = 0; k < this->n_dofs_per_cell(); ++k) output_data.shape_gradients[k][i] = diff --git a/source/fe/fe_poly_tensor.cc b/source/fe/fe_poly_tensor.cc index ca8179d472..f09ff7d157 100644 --- a/source/fe/fe_poly_tensor.cc +++ b/source/fe/fe_poly_tensor.cc @@ -267,9 +267,10 @@ FE_PolyTensor::adjust_quad_dof_sign_for_face_orientation( ExcInternalError()); return adjust_quad_dof_sign_for_face_orientation_table - [this->n_unique_quads() == 1 ? 0 : face](index, - 4 * face_orientation + - 2 * face_flip + face_rotation); + [this->n_unique_quads() == 1 ? 0 : face]( + index, + 4 * static_cast(face_orientation) + 2 * static_cast(face_flip) + + static_cast(face_rotation)); } @@ -2424,14 +2425,14 @@ FE_PolyTensor::requires_update_flags( { case mapping_none: { - if (flags & update_values) + if ((flags & update_values) != 0u) out |= update_values; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients | update_values | update_jacobian_pushed_forward_grads; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) out |= update_hessians | update_values | update_gradients | update_jacobian_pushed_forward_grads | update_jacobian_pushed_forward_2nd_derivatives; @@ -2440,16 +2441,16 @@ FE_PolyTensor::requires_update_flags( case mapping_raviart_thomas: case mapping_piola: { - if (flags & update_values) + if ((flags & update_values) != 0u) out |= update_values | update_piola; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients | update_values | update_piola | update_jacobian_pushed_forward_grads | update_covariant_transformation | update_contravariant_transformation; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) out |= update_hessians | update_piola | update_values | update_gradients | update_jacobian_pushed_forward_grads | update_jacobian_pushed_forward_2nd_derivatives | @@ -2461,16 +2462,16 @@ FE_PolyTensor::requires_update_flags( case mapping_contravariant: { - if (flags & update_values) + if ((flags & update_values) != 0u) out |= update_values | update_piola; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients | update_values | update_jacobian_pushed_forward_grads | update_covariant_transformation | update_contravariant_transformation; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) out |= update_hessians | update_piola | update_values | update_gradients | update_jacobian_pushed_forward_grads | update_jacobian_pushed_forward_2nd_derivatives | @@ -2482,15 +2483,15 @@ FE_PolyTensor::requires_update_flags( case mapping_nedelec: case mapping_covariant: { - if (flags & update_values) + if ((flags & update_values) != 0u) out |= update_values | update_covariant_transformation; - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) out |= update_gradients | update_values | update_jacobian_pushed_forward_grads | update_covariant_transformation; - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) out |= update_hessians | update_values | update_gradients | update_jacobian_pushed_forward_grads | update_jacobian_pushed_forward_2nd_derivatives | diff --git a/source/fe/fe_q_hierarchical.cc b/source/fe/fe_q_hierarchical.cc index 30f8568a43..da980aa82c 100644 --- a/source/fe/fe_q_hierarchical.cc +++ b/source/fe/fe_q_hierarchical.cc @@ -1094,7 +1094,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( factorial_ij *= j - i; factorial_j *= j; - if ((i + j) & 1) + if (((i + j) & 1) != 0u) interpolation_matrix(i, j) = -1.0 * std::pow(0.5, j) * factorial_j / (factorial_i * factorial_ij); @@ -1237,7 +1237,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( factorial_kl *= k - j; factorial_l *= k; - if ((j + k) & 1) + if (((j + k) & 1) != 0u) interpolation_matrix( i + (j + 2) * source_fe.degree - j, i + (k + 2) * this->degree - k) = @@ -1262,7 +1262,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( factorial_ij *= j - i; factorial_j *= j; - if ((i + j) & 1) + if (((i + j) & 1) != 0u) { tmp = -1.0 * std::pow(0.5, j) * factorial_j / (factorial_i * factorial_ij); @@ -1288,7 +1288,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( factorial_kl *= l - k; factorial_l *= l; - if ((k + l) & 1) + if (((k + l) & 1) != 0u) interpolation_matrix( i + (k + 2) * source_fe.degree - k, j + (l + 2) * this->degree - l) = @@ -1354,7 +1354,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( factorial_kl *= l - k; factorial_l *= l; - if ((k + l) & 1) + if (((k + l) & 1) != 0u) interpolation_matrix( i + (k + 2) * source_fe.degree - k, j + (l + 2) * this->degree - l) = @@ -1495,7 +1495,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( factorial_kl *= l - k; factorial_l *= l; - if ((k + l) & 1) + if (((k + l) & 1) != 0u) interpolation_matrix( i + (k + 2) * source_fe.degree - k, j + (l + 2) * this->degree - l) = @@ -1528,7 +1528,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( interpolation_matrix(i + 3 * source_fe.degree - 1, j + 3 * this->degree - 1) = tmp; - if ((i + j) & 1) + if (((i + j) & 1) != 0u) tmp *= -1.0; interpolation_matrix(i + 2, j + 2) = tmp; @@ -1565,7 +1565,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( factorial_kl *= k - j; factorial_l *= k; - if ((j + k) & 1) + if (((j + k) & 1) != 0u) interpolation_matrix( i + (j + 2) * source_fe.degree - j, i + (k + 2) * this->degree - k) = @@ -1701,7 +1701,7 @@ FE_Q_Hierarchical::get_subface_interpolation_matrix( interpolation_matrix(i + source_fe.degree + 1, j + this->degree + 1) = tmp; - if ((i + j) & 1) + if (((i + j) & 1) != 0u) tmp *= -1.0; interpolation_matrix(i + 2 * source_fe.degree, diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index e50998897c..c105825f55 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -135,7 +135,7 @@ FESystem::FESystem(const FiniteElement &fe1, &fe2, n2), FETools::Compositing::compute_nonzero_components(&fe1, n1, &fe2, n2)) - , base_elements((n1 > 0) + (n2 > 0)) + , base_elements(static_cast(n1 > 0) + static_cast(n2 > 0)) { std::vector *> fes; fes.push_back(&fe1); @@ -169,7 +169,8 @@ FESystem::FESystem(const FiniteElement &fe1, n2, &fe3, n3)) - , base_elements((n1 > 0) + (n2 > 0) + (n3 > 0)) + , base_elements(static_cast(n1 > 0) + static_cast(n2 > 0) + + static_cast(n3 > 0)) { std::vector *> fes; fes.push_back(&fe1); @@ -218,7 +219,8 @@ FESystem::FESystem(const FiniteElement &fe1, n3, &fe4, n4)) - , base_elements((n1 > 0) + (n2 > 0) + (n3 > 0) + (n4 > 0)) + , base_elements(static_cast(n1 > 0) + static_cast(n2 > 0) + + static_cast(n3 > 0) + static_cast(n4 > 0)) { std::vector *> fes; fes.push_back(&fe1); @@ -269,7 +271,9 @@ FESystem::FESystem(const FiniteElement &fe1, n4, &fe5, n5)) - , base_elements((n1 > 0) + (n2 > 0) + (n3 > 0) + (n4 > 0) + (n5 > 0)) + , base_elements(static_cast(n1 > 0) + static_cast(n2 > 0) + + static_cast(n3 > 0) + static_cast(n4 > 0) + + static_cast(n5 > 0)) { std::vector *> fes; fes.push_back(&fe1); diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 7f555928cd..202e423e1f 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -2705,55 +2705,55 @@ namespace internal const unsigned int n_quadrature_points, const UpdateFlags flags) { - if (flags & update_quadrature_points) + if ((flags & update_quadrature_points) != 0u) this->quadrature_points.resize( n_quadrature_points, Point(numbers::signaling_nan>())); - if (flags & update_JxW_values) + if ((flags & update_JxW_values) != 0u) this->JxW_values.resize(n_quadrature_points, numbers::signaling_nan()); - if (flags & update_jacobians) + if ((flags & update_jacobians) != 0u) this->jacobians.resize( n_quadrature_points, numbers::signaling_nan>()); - if (flags & update_jacobian_grads) + if ((flags & update_jacobian_grads) != 0u) this->jacobian_grads.resize( n_quadrature_points, numbers::signaling_nan>()); - if (flags & update_jacobian_pushed_forward_grads) + if ((flags & update_jacobian_pushed_forward_grads) != 0u) this->jacobian_pushed_forward_grads.resize( n_quadrature_points, numbers::signaling_nan>()); - if (flags & update_jacobian_2nd_derivatives) + if ((flags & update_jacobian_2nd_derivatives) != 0u) this->jacobian_2nd_derivatives.resize( n_quadrature_points, numbers::signaling_nan>()); - if (flags & update_jacobian_pushed_forward_2nd_derivatives) + if ((flags & update_jacobian_pushed_forward_2nd_derivatives) != 0u) this->jacobian_pushed_forward_2nd_derivatives.resize( n_quadrature_points, numbers::signaling_nan>()); - if (flags & update_jacobian_3rd_derivatives) + if ((flags & update_jacobian_3rd_derivatives) != 0u) this->jacobian_3rd_derivatives.resize(n_quadrature_points); - if (flags & update_jacobian_pushed_forward_3rd_derivatives) + if ((flags & update_jacobian_pushed_forward_3rd_derivatives) != 0u) this->jacobian_pushed_forward_3rd_derivatives.resize( n_quadrature_points, numbers::signaling_nan>()); - if (flags & update_inverse_jacobians) + if ((flags & update_inverse_jacobians) != 0u) this->inverse_jacobians.resize( n_quadrature_points, numbers::signaling_nan>()); - if (flags & update_boundary_forms) + if ((flags & update_boundary_forms) != 0u) this->boundary_forms.resize( n_quadrature_points, numbers::signaling_nan>()); - if (flags & update_normal_vectors) + if ((flags & update_normal_vectors) != 0u) this->normal_vectors.resize( n_quadrature_points, numbers::signaling_nan>()); } @@ -2806,14 +2806,14 @@ namespace internal // with the number of rows now known, initialize those fields // that we will need to their correct size - if (flags & update_values) + if ((flags & update_values) != 0u) { this->shape_values.reinit(n_nonzero_shape_components, n_quadrature_points); this->shape_values.fill(numbers::signaling_nan()); } - if (flags & update_gradients) + if ((flags & update_gradients) != 0u) { this->shape_gradients.reinit(n_nonzero_shape_components, n_quadrature_points); @@ -2821,7 +2821,7 @@ namespace internal numbers::signaling_nan>()); } - if (flags & update_hessians) + if ((flags & update_hessians) != 0u) { this->shape_hessians.reinit(n_nonzero_shape_components, n_quadrature_points); @@ -2829,7 +2829,7 @@ namespace internal numbers::signaling_nan>()); } - if (flags & update_3rd_derivatives) + if ((flags & update_3rd_derivatives) != 0u) { this->shape_3rd_derivatives.reinit(n_nonzero_shape_components, n_quadrature_points); @@ -4235,7 +4235,7 @@ FEValues::initialize(const UpdateFlags update_flags) const UpdateFlags flags = this->compute_update_flags(update_flags); // initialize the base classes - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) this->mapping_output.initialize(this->max_n_quadrature_points, flags); this->finite_element_output.initialize(this->max_n_quadrature_points, *this->fe, @@ -4255,7 +4255,7 @@ FEValues::initialize(const UpdateFlags update_flags) Threads::Task< std::unique_ptr::InternalDataBase>> mapping_get_data; - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) mapping_get_data = Threads::new_task( [&]() { return this->mapping->get_data(flags, quadrature); }); @@ -4263,7 +4263,7 @@ FEValues::initialize(const UpdateFlags update_flags) // then collect answers from the two task above this->fe_data = std::move(fe_get_data.return_value()); - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) this->mapping_data = std::move(mapping_get_data.return_value()); else this->mapping_data = @@ -4515,7 +4515,7 @@ FEFaceValues::initialize(const UpdateFlags update_flags) const UpdateFlags flags = this->compute_update_flags(update_flags); // initialize the base classes - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) this->mapping_output.initialize(this->max_n_quadrature_points, flags); this->finite_element_output.initialize(this->max_n_quadrature_points, *this->fe, @@ -4550,7 +4550,7 @@ FEFaceValues::initialize(const UpdateFlags update_flags) Threads::Task< std::unique_ptr::InternalDataBase>> mapping_get_data; - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) mapping_get_data = Threads::new_task(mapping_get_face_data, *this->mapping, flags, @@ -4560,7 +4560,7 @@ FEFaceValues::initialize(const UpdateFlags update_flags) // then collect answers from the two task above this->fe_data = std::move(fe_get_data.return_value()); - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) this->mapping_data = std::move(mapping_get_data.return_value()); else this->mapping_data = @@ -4753,7 +4753,7 @@ FESubfaceValues::initialize(const UpdateFlags update_flags) const UpdateFlags flags = this->compute_update_flags(update_flags); // initialize the base classes - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) this->mapping_output.initialize(this->max_n_quadrature_points, flags); this->finite_element_output.initialize(this->max_n_quadrature_points, *this->fe, @@ -4774,7 +4774,7 @@ FESubfaceValues::initialize(const UpdateFlags update_flags) Threads::Task< std::unique_ptr::InternalDataBase>> mapping_get_data; - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) mapping_get_data = Threads::new_task(&Mapping::get_subface_data, *this->mapping, @@ -4785,7 +4785,7 @@ FESubfaceValues::initialize(const UpdateFlags update_flags) // then collect answers from the two task above this->fe_data = std::move(fe_get_data.return_value()); - if (flags & update_mapping) + if ((flags & update_mapping) != 0u) this->mapping_data = std::move(mapping_get_data.return_value()); else this->mapping_data = diff --git a/source/fe/mapping_cartesian.cc b/source/fe/mapping_cartesian.cc index 84cc8a3ddc..92fe6b954f 100644 --- a/source/fe/mapping_cartesian.cc +++ b/source/fe/mapping_cartesian.cc @@ -98,7 +98,7 @@ MappingCartesian::requires_update_flags( // since they can be computed from the normal vectors without much // further ado UpdateFlags out = in; - if (out & update_boundary_forms) + if ((out & update_boundary_forms) != 0u) out |= update_normal_vectors; return out; diff --git a/source/fe/mapping_fe.cc b/source/fe/mapping_fe.cc index 7a19a1b6c3..46ced41250 100644 --- a/source/fe/mapping_fe.cc +++ b/source/fe/mapping_fe.cc @@ -1022,18 +1022,18 @@ MappingFE::requires_update_flags(const UpdateFlags in) const // update_boundary_forms is simply // ignored for the interior of a // cell. - if (out & (update_JxW_values | update_normal_vectors)) + if ((out & (update_JxW_values | update_normal_vectors)) != 0u) out |= update_boundary_forms; - if (out & (update_covariant_transformation | update_JxW_values | - update_jacobians | update_jacobian_grads | - update_boundary_forms | update_normal_vectors)) + if ((out & (update_covariant_transformation | update_JxW_values | + update_jacobians | update_jacobian_grads | + update_boundary_forms | update_normal_vectors)) != 0u) out |= update_contravariant_transformation; - if (out & - (update_inverse_jacobians | update_jacobian_pushed_forward_grads | - update_jacobian_pushed_forward_2nd_derivatives | - update_jacobian_pushed_forward_3rd_derivatives)) + if ((out & + (update_inverse_jacobians | update_jacobian_pushed_forward_grads | + update_jacobian_pushed_forward_2nd_derivatives | + update_jacobian_pushed_forward_3rd_derivatives)) != 0u) out |= update_covariant_transformation; // The contravariant transformation is used in the Piola @@ -1042,12 +1042,12 @@ MappingFE::requires_update_flags(const UpdateFlags in) const // knowing here whether the finite element wants to use the // contravariant or the Piola transforms, we add the JxW values // to the list of flags to be updated for each cell. - if (out & update_contravariant_transformation) + if ((out & update_contravariant_transformation) != 0u) out |= update_volume_elements; // the same is true when computing normal vectors: they require // the determinant of the Jacobian - if (out & update_normal_vectors) + if ((out & update_normal_vectors) != 0u) out |= update_volume_elements; } @@ -1211,7 +1211,7 @@ MappingFE::fill_fe_values( // Multiply quadrature weights by absolute value of Jacobian determinants or // the area element g=sqrt(DX^t DX) in case of codim > 0 - if (update_flags & (update_normal_vectors | update_JxW_values)) + if ((update_flags & (update_normal_vectors | update_JxW_values)) != 0u) { AssertDimension(output_data.JxW_values.size(), n_q_points); @@ -1263,12 +1263,12 @@ MappingFE::fill_fe_values( CellSimilarity::inverted_translation) { // we only need to flip the normal - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) output_data.normal_vectors[point] *= -1.; } else { - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) { Assert(spacedim == dim + 1, ExcMessage( @@ -1301,7 +1301,7 @@ MappingFE::fill_fe_values( // copy values from InternalData to vector given by reference - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) { AssertDimension(output_data.jacobians.size(), n_q_points); if (computed_cell_similarity != CellSimilarity::translation) @@ -1310,7 +1310,7 @@ MappingFE::fill_fe_values( } // copy values from InternalData to vector given by reference - if (update_flags & update_inverse_jacobians) + if ((update_flags & update_inverse_jacobians) != 0u) { AssertDimension(output_data.inverse_jacobians.size(), n_q_points); if (computed_cell_similarity != CellSimilarity::translation) diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index 38f04aae0b..ef86e2e1f7 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -201,7 +201,7 @@ MappingFEField::MappingFEField( , uses_level_dofs(false) , euler_vector({&euler_vector}) , euler_dof_handler(&euler_dof_handler) - , fe_mask(mask.size() ? + , fe_mask(mask.size() != 0u ? mask : ComponentMask( euler_dof_handler.get_fe().get_nonzero_components(0).size(), @@ -230,7 +230,7 @@ MappingFEField::MappingFEField( : reference_cell(euler_dof_handler.get_fe().reference_cell()) , uses_level_dofs(true) , euler_dof_handler(&euler_dof_handler) - , fe_mask(mask.size() ? + , fe_mask(mask.size() != 0u ? mask : ComponentMask( euler_dof_handler.get_fe().get_nonzero_components(0).size(), @@ -270,7 +270,7 @@ MappingFEField::MappingFEField( : reference_cell(euler_dof_handler.get_fe().reference_cell()) , uses_level_dofs(true) , euler_dof_handler(&euler_dof_handler) - , fe_mask(mask.size() ? + , fe_mask(mask.size() != 0u ? mask : ComponentMask( euler_dof_handler.get_fe().get_nonzero_components(0).size(), @@ -483,18 +483,18 @@ MappingFEField::requires_update_flags( // update_boundary_forms is simply // ignored for the interior of a // cell. - if (out & (update_JxW_values | update_normal_vectors)) + if ((out & (update_JxW_values | update_normal_vectors)) != 0u) out |= update_boundary_forms; - if (out & (update_covariant_transformation | update_JxW_values | - update_jacobians | update_jacobian_grads | - update_boundary_forms | update_normal_vectors)) + if ((out & (update_covariant_transformation | update_JxW_values | + update_jacobians | update_jacobian_grads | + update_boundary_forms | update_normal_vectors)) != 0u) out |= update_contravariant_transformation; - if (out & - (update_inverse_jacobians | update_jacobian_pushed_forward_grads | - update_jacobian_pushed_forward_2nd_derivatives | - update_jacobian_pushed_forward_3rd_derivatives)) + if ((out & + (update_inverse_jacobians | update_jacobian_pushed_forward_grads | + update_jacobian_pushed_forward_2nd_derivatives | + update_jacobian_pushed_forward_3rd_derivatives)) != 0u) out |= update_covariant_transformation; // The contravariant transformation @@ -503,10 +503,10 @@ MappingFEField::requires_update_flags( // Jacobi matrix of the transformation. // Therefore these values have to be // updated for each cell. - if (out & update_contravariant_transformation) + if ((out & update_contravariant_transformation) != 0u) out |= update_JxW_values; - if (out & update_normal_vectors) + if ((out & update_normal_vectors) != 0u) out |= update_JxW_values; } @@ -1529,7 +1529,7 @@ MappingFEField::fill_fe_values( // Multiply quadrature weights by absolute value of Jacobian determinants or // the area element g=sqrt(DX^t DX) in case of codim > 0 - if (update_flags & (update_normal_vectors | update_JxW_values)) + if ((update_flags & (update_normal_vectors | update_JxW_values)) != 0u) { AssertDimension(output_data.JxW_values.size(), n_q_points); @@ -1574,7 +1574,7 @@ MappingFEField::fill_fe_values( output_data.JxW_values[point] = std::sqrt(determinant(G)) * weights[point]; - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) { Assert(spacedim - dim == 1, ExcMessage("There is no cell normal in codim 2.")); @@ -1603,7 +1603,7 @@ MappingFEField::fill_fe_values( } // copy values from InternalData to vector given by reference - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) { AssertDimension(output_data.jacobians.size(), n_q_points); for (unsigned int point = 0; point < n_q_points; ++point) @@ -1611,7 +1611,7 @@ MappingFEField::fill_fe_values( } // copy values from InternalData to vector given by reference - if (update_flags & update_inverse_jacobians) + if ((update_flags & update_inverse_jacobians) != 0u) { AssertDimension(output_data.inverse_jacobians.size(), n_q_points); for (unsigned int point = 0; point < n_q_points; ++point) diff --git a/source/fe/mapping_manifold.cc b/source/fe/mapping_manifold.cc index 28bf83fdc9..bd38a7ffb7 100644 --- a/source/fe/mapping_manifold.cc +++ b/source/fe/mapping_manifold.cc @@ -225,18 +225,18 @@ MappingManifold::requires_update_flags( // update_boundary_forms is simply // ignored for the interior of a // cell. - if (out & (update_JxW_values | update_normal_vectors)) + if ((out & (update_JxW_values | update_normal_vectors)) != 0u) out |= update_boundary_forms; - if (out & (update_covariant_transformation | update_JxW_values | - update_jacobians | update_jacobian_grads | - update_boundary_forms | update_normal_vectors)) + if ((out & (update_covariant_transformation | update_JxW_values | + update_jacobians | update_jacobian_grads | + update_boundary_forms | update_normal_vectors)) != 0u) out |= update_contravariant_transformation; - if (out & - (update_inverse_jacobians | update_jacobian_pushed_forward_grads | - update_jacobian_pushed_forward_2nd_derivatives | - update_jacobian_pushed_forward_3rd_derivatives)) + if ((out & + (update_inverse_jacobians | update_jacobian_pushed_forward_grads | + update_jacobian_pushed_forward_2nd_derivatives | + update_jacobian_pushed_forward_3rd_derivatives)) != 0u) out |= update_covariant_transformation; // The contravariant transformation used in the Piola @@ -245,10 +245,10 @@ MappingManifold::requires_update_flags( // knowing here whether the finite elements wants to use the // contravariant of the Piola transforms, we add the JxW values // to the list of flags to be updated for each cell. - if (out & update_contravariant_transformation) + if ((out & update_contravariant_transformation) != 0u) out |= update_JxW_values; - if (out & update_normal_vectors) + if ((out & update_normal_vectors) != 0u) out |= update_JxW_values; } @@ -497,7 +497,7 @@ MappingManifold::fill_fe_values( // Multiply quadrature weights by absolute value of Jacobian determinants or // the area element g=sqrt(DX^t DX) in case of codim > 0 - if (update_flags & (update_normal_vectors | update_JxW_values)) + if ((update_flags & (update_normal_vectors | update_JxW_values)) != 0u) { AssertDimension(output_data.JxW_values.size(), n_q_points); @@ -543,7 +543,7 @@ MappingManifold::fill_fe_values( output_data.JxW_values[point] = std::sqrt(determinant(G)) * weights[point]; - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) { Assert(spacedim == dim + 1, ExcMessage( @@ -575,7 +575,7 @@ MappingManifold::fill_fe_values( // copy values from InternalData to vector given by reference - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) { AssertDimension(output_data.jacobians.size(), n_q_points); for (unsigned int point = 0; point < n_q_points; ++point) @@ -583,7 +583,7 @@ MappingManifold::fill_fe_values( } // copy values from InternalData to vector given by reference - if (update_flags & update_inverse_jacobians) + if ((update_flags & update_inverse_jacobians) != 0u) { AssertDimension(output_data.inverse_jacobians.size(), n_q_points); for (unsigned int point = 0; point < n_q_points; ++point) diff --git a/source/fe/mapping_q.cc b/source/fe/mapping_q.cc index ed4bfe9d0e..a1f6379e68 100644 --- a/source/fe/mapping_q.cc +++ b/source/fe/mapping_q.cc @@ -851,18 +851,18 @@ MappingQ::requires_update_flags(const UpdateFlags in) const // update_boundary_forms is simply // ignored for the interior of a // cell. - if (out & (update_JxW_values | update_normal_vectors)) + if ((out & (update_JxW_values | update_normal_vectors)) != 0u) out |= update_boundary_forms; - if (out & (update_covariant_transformation | update_JxW_values | - update_jacobians | update_jacobian_grads | - update_boundary_forms | update_normal_vectors)) + if ((out & (update_covariant_transformation | update_JxW_values | + update_jacobians | update_jacobian_grads | + update_boundary_forms | update_normal_vectors)) != 0u) out |= update_contravariant_transformation; - if (out & - (update_inverse_jacobians | update_jacobian_pushed_forward_grads | - update_jacobian_pushed_forward_2nd_derivatives | - update_jacobian_pushed_forward_3rd_derivatives)) + if ((out & + (update_inverse_jacobians | update_jacobian_pushed_forward_grads | + update_jacobian_pushed_forward_2nd_derivatives | + update_jacobian_pushed_forward_3rd_derivatives)) != 0u) out |= update_covariant_transformation; // The contravariant transformation is used in the Piola @@ -871,12 +871,12 @@ MappingQ::requires_update_flags(const UpdateFlags in) const // knowing here whether the finite element wants to use the // contravariant or the Piola transforms, we add the JxW values // to the list of flags to be updated for each cell. - if (out & update_contravariant_transformation) + if ((out & update_contravariant_transformation) != 0u) out |= update_volume_elements; // the same is true when computing normal vectors: they require // the determinant of the Jacobian - if (out & update_normal_vectors) + if ((out & update_normal_vectors) != 0u) out |= update_volume_elements; } @@ -1047,7 +1047,7 @@ MappingQ::fill_fe_values( // Multiply quadrature weights by absolute value of Jacobian determinants or // the area element g=sqrt(DX^t DX) in case of codim > 0 - if (update_flags & (update_normal_vectors | update_JxW_values)) + if ((update_flags & (update_normal_vectors | update_JxW_values)) != 0u) { AssertDimension(output_data.JxW_values.size(), n_q_points); @@ -1099,12 +1099,12 @@ MappingQ::fill_fe_values( CellSimilarity::inverted_translation) { // we only need to flip the normal - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) output_data.normal_vectors[point] *= -1.; } else { - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) { Assert(spacedim == dim + 1, ExcMessage( @@ -1137,7 +1137,7 @@ MappingQ::fill_fe_values( // copy values from InternalData to vector given by reference - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) { AssertDimension(output_data.jacobians.size(), n_q_points); if (computed_cell_similarity != CellSimilarity::translation) @@ -1146,7 +1146,7 @@ MappingQ::fill_fe_values( } // copy values from InternalData to vector given by reference - if (update_flags & update_inverse_jacobians) + if ((update_flags & update_inverse_jacobians) != 0u) { AssertDimension(output_data.inverse_jacobians.size(), n_q_points); if (computed_cell_similarity != CellSimilarity::translation) @@ -1438,18 +1438,18 @@ MappingQ::fill_mapping_data_for_generic_points( polynomial_degree == 1, renumber_lexicographic_to_hierarchic); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j) for (unsigned int d = 0; d < spacedim; ++d) output_data.quadrature_points[i + j][d] = result.first[d][j]; - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j) for (unsigned int d = 0; d < spacedim; ++d) for (unsigned int e = 0; e < dim; ++e) output_data.jacobians[i + j][d][e] = result.second[e][d][j]; - if (update_flags & update_inverse_jacobians) + if ((update_flags & update_inverse_jacobians) != 0u) { DerivativeForm<1, spacedim, dim, VectorizedArray> jac( result.second); @@ -1471,16 +1471,16 @@ MappingQ::fill_mapping_data_for_generic_points( polynomial_degree == 1, renumber_lexicographic_to_hierarchic); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) output_data.quadrature_points[i] = result.first; - if (update_flags & update_jacobians) + if ((update_flags & update_jacobians) != 0u) { DerivativeForm<1, spacedim, dim> jac = result.second; output_data.jacobians[i] = jac.transpose(); } - if (update_flags & update_inverse_jacobians) + if ((update_flags & update_inverse_jacobians) != 0u) { DerivativeForm<1, spacedim, dim> jac(result.second); DerivativeForm<1, spacedim, dim> inv_jac = jac.covariant_form(); diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 2bb3ebbc2d..6b4808384d 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -5222,8 +5222,9 @@ namespace GridGenerator {1, 8, 3, 9, 5, 10, 7, 11}}; // shifted cube // binary to case number - const unsigned int this_case = - 4 * face_orientation + 2 * face_flip + face_rotation; + const unsigned int this_case = 4 * static_cast(face_orientation) + + 2 * static_cast(face_flip) + + static_cast(face_rotation); if (manipulate_left_cube) { diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 67601396ee..93cd7365c2 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -4369,7 +4369,7 @@ namespace std::string tmp; for (const char c : s) { - if (isdigit(c)) + if (isdigit(c) != 0) { tmp += c; } diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index fc75c16a9c..1d1c84b7bf 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -2066,7 +2066,7 @@ GridOut::write_svg(const Triangulation<2, 2> &tria, std::ostream &out) const additional_width = static_cast( .5 + height * .4); // additional width for legend } - else if (svg_flags.draw_colorbar && svg_flags.coloring) + else if (svg_flags.draw_colorbar && (svg_flags.coloring != 0u)) { additional_width = static_cast( .5 + height * .175); // additional width for colorbar @@ -2123,7 +2123,7 @@ GridOut::write_svg(const Triangulation<2, 2> &tria, std::ostream &out) const << '\n'; // polygon styles with respect to the chosen cell coloring - if (svg_flags.coloring) + if (svg_flags.coloring != 0u) { unsigned int labeling_index = 0; auto materials_it = materials.begin(); @@ -2267,7 +2267,7 @@ GridOut::write_svg(const Triangulation<2, 2> &tria, std::ostream &out) const // draw the current cell out << " &tria, std::ostream &out) const // if the current cell lies at the boundary of the triangulation, draw // the additional boundary line - if (svg_flags.boundary_line_thickness) + if (svg_flags.boundary_line_thickness != 0u) { for (auto faceIndex : cell->face_indices()) { @@ -2863,7 +2863,7 @@ GridOut::write_svg(const Triangulation<2, 2> &tria, std::ostream &out) const // draw the colorbar - if (svg_flags.draw_colorbar && svg_flags.coloring) + if (svg_flags.draw_colorbar && (svg_flags.coloring != 0u)) { out << '\n' << " " << '\n'; diff --git a/source/grid/grid_tools_cache.cc b/source/grid/grid_tools_cache.cc index 470a8271ac..7043337370 100644 --- a/source/grid/grid_tools_cache.cc +++ b/source/grid/grid_tools_cache.cc @@ -60,7 +60,7 @@ namespace GridTools std::set::active_cell_iterator>> & Cache::get_vertex_to_cell_map() const { - if (update_flags & update_vertex_to_cell_map) + if ((update_flags & update_vertex_to_cell_map) != 0) { vertex_to_cells = GridTools::vertex_to_cell_map(*tria); update_flags = update_flags & ~update_vertex_to_cell_map; @@ -74,7 +74,7 @@ namespace GridTools const std::vector>> & Cache::get_vertex_to_cell_centers_directions() const { - if (update_flags & update_vertex_to_cell_centers_directions) + if ((update_flags & update_vertex_to_cell_centers_directions) != 0) { vertex_to_cell_centers = GridTools::vertex_to_cell_centers_directions( *tria, get_vertex_to_cell_map()); @@ -89,7 +89,7 @@ namespace GridTools const std::map> & Cache::get_used_vertices() const { - if (update_flags & update_used_vertices) + if ((update_flags & update_used_vertices) != 0) { used_vertices = GridTools::extract_used_vertices(*tria, *mapping); update_flags = update_flags & ~update_used_vertices; @@ -103,7 +103,7 @@ namespace GridTools const RTree, unsigned int>> & Cache::get_used_vertices_rtree() const { - if (update_flags & update_used_vertices_rtree) + if ((update_flags & update_used_vertices_rtree) != 0) { const auto &used_vertices = get_used_vertices(); std::vector, unsigned int>> vertices( @@ -125,7 +125,7 @@ namespace GridTools typename Triangulation::active_cell_iterator>> & Cache::get_cell_bounding_boxes_rtree() const { - if (update_flags & update_cell_bounding_boxes_rtree) + if ((update_flags & update_cell_bounding_boxes_rtree) != 0) { std::vector, @@ -149,7 +149,7 @@ namespace GridTools typename Triangulation::active_cell_iterator>> & Cache::get_locally_owned_cell_bounding_boxes_rtree() const { - if (update_flags & update_locally_owned_cell_bounding_boxes_rtree) + if ((update_flags & update_locally_owned_cell_bounding_boxes_rtree) != 0) { std::vector, @@ -203,7 +203,7 @@ namespace GridTools const std::vector> & Cache::get_vertex_to_neighbor_subdomain() const { - if (update_flags & update_vertex_to_neighbor_subdomain) + if ((update_flags & update_vertex_to_neighbor_subdomain) != 0) { vertex_to_neighbor_subdomain.clear(); vertex_to_neighbor_subdomain.resize(tria->n_vertices()); diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 2c2aa84840..203a31d9d1 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -1177,7 +1177,7 @@ namespace internal tria_faces.quads_line_orientations.end(), new_size * GeometryInfo<2>::lines_per_cell - tria_faces.quads_line_orientations.size(), - true); + 1u); tria_faces.quad_reference_cell.reserve(new_size); tria_faces.quad_reference_cell.insert( @@ -1290,7 +1290,7 @@ namespace internal tria_level.face_orientations.end(), total_cells * max_faces_per_cell - tria_level.face_orientations.size(), - true); + 1u); tria_level.reference_cell.reserve(total_cells); tria_level.reference_cell.insert( @@ -2678,7 +2678,7 @@ namespace internal level.subdomain_ids.assign(size, 0); level.level_subdomain_ids.assign(size, 0); - level.refine_flags.assign(size, false); + level.refine_flags.assign(size, 0u); level.coarsen_flags.assign(size, false); level.parents.assign((size + 1) / 2, -1); @@ -16144,14 +16144,14 @@ Triangulation::prepare_coarsening_and_refinement() nb->face_flip(nb_indices.first), nb->face_rotation(nb_indices.first)); if ((nb_frc & RefinementCase::cut_x) && - !(refined_along_x || - to_be_refined_along_x)) + !((refined_along_x != 0u) || + (to_be_refined_along_x != 0u))) changed |= cell->flag_for_face_refinement( i, RefinementCase::cut_axis(0)); if ((nb_frc & RefinementCase::cut_y) && - !(refined_along_y || - to_be_refined_along_y)) + !((refined_along_y != 0u) || + (to_be_refined_along_y != 0u))) changed |= cell->flag_for_face_refinement( i, RefinementCase::cut_axis(1)); @@ -16335,7 +16335,7 @@ Triangulation::read_bool_vector(const unsigned int magic_number1, } for (unsigned int position = 0; position != N; ++position) - v[position] = (flags[position / 8] & (1 << (position % 8))); + v[position] = ((flags[position / 8] & (1 << (position % 8))) != 0); in >> magic_number; AssertThrow(magic_number == magic_number2, ExcGridReadError()); diff --git a/source/grid/tria_accessor.cc b/source/grid/tria_accessor.cc index 823105c8e9..0afb2f5882 100644 --- a/source/grid/tria_accessor.cc +++ b/source/grid/tria_accessor.cc @@ -72,7 +72,7 @@ namespace // which is 0 or 1 in an anisotropic case // (case_x, case_y, casex2y or casey2x) or // 0...3 in an isotropic case (case_xy) - return subface_no + first_child_has_children; + return subface_no + static_cast(first_child_has_children); } diff --git a/source/lac/dynamic_sparsity_pattern.cc b/source/lac/dynamic_sparsity_pattern.cc index 4a3a9e4202..d8112b99c5 100644 --- a/source/lac/dynamic_sparsity_pattern.cc +++ b/source/lac/dynamic_sparsity_pattern.cc @@ -662,7 +662,7 @@ DynamicSparsityPattern::column_index( Assert(rowset.size() == 0 || rowset.is_element(row), ExcInternalError()); const DynamicSparsityPattern::size_type local_row = - rowset.size() ? rowset.index_within_set(row) : row; + rowset.size() != 0u ? rowset.index_within_set(row) : row; // now we need to do a binary search. Note that col indices are assumed to // be sorted. diff --git a/source/lac/lapack_full_matrix.cc b/source/lac/lapack_full_matrix.cc index 19f2a6982e..dd37eebb13 100644 --- a/source/lac/lapack_full_matrix.cc +++ b/source/lac/lapack_full_matrix.cc @@ -2310,13 +2310,13 @@ LAPACKFullMatrix::print_formatted(std::ostream & out, if (scientific) { out.setf(std::ios::scientific, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 7; } else { out.setf(std::ios::fixed, std::ios::floatfield); - if (!width) + if (width == 0u) width = precision + 2; } diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 3bc1ecd538..58ea43f2ff 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -1055,7 +1055,7 @@ namespace SparsityTools const auto rlen = dsp.row_length(row); // skip empty lines - if (!rlen) + if (rlen == 0) continue; // save entries @@ -1137,7 +1137,7 @@ namespace SparsityTools BlockDynamicSparsityPattern::size_type rlen = dsp.row_length(row); // skip empty lines - if (!rlen) + if (rlen == 0) continue; // save entries @@ -1238,7 +1238,7 @@ namespace SparsityTools } // complete all sends, so that we can safely destroy the buffers. - if (requests.size()) + if (requests.size() > 0) { const int ierr = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE); diff --git a/source/lac/trilinos_precondition_ml.cc b/source/lac/trilinos_precondition_ml.cc index 9020a44208..3ffadb16af 100644 --- a/source/lac/trilinos_precondition_ml.cc +++ b/source/lac/trilinos_precondition_ml.cc @@ -169,7 +169,7 @@ namespace TrilinosWrappers TrilinosWrappers::global_index(domain_map, row) : row; distributed_constant_modes[d][row] = - constant_modes[d][mode_index]; + static_cast(constant_modes[d][mode_index]); } } (void)expected_mode_size; diff --git a/source/lac/trilinos_precondition_muelu.cc b/source/lac/trilinos_precondition_muelu.cc index b24f8a3959..eba0c5c82a 100644 --- a/source/lac/trilinos_precondition_muelu.cc +++ b/source/lac/trilinos_precondition_muelu.cc @@ -161,8 +161,8 @@ namespace TrilinosWrappers constant_modes_are_global ? TrilinosWrappers::global_index(domain_map, row) : row; - distributed_constant_modes[d][row] = - additional_data.constant_modes[d][global_row_id]; + distributed_constant_modes[d][row] = static_cast( + additional_data.constant_modes[d][global_row_id]); } parameter_list.set("null space: type", "pre-computed"); diff --git a/source/matrix_free/task_info.cc b/source/matrix_free/task_info.cc index bc0ccbc0a6..16e72164d1 100644 --- a/source/matrix_free/task_info.cc +++ b/source/matrix_free/task_info.cc @@ -807,7 +807,7 @@ namespace internal // power of two, which allows it to replace integer divisions by shifts unsigned int vectorization_length_bits = 0; unsigned int my_length = vectorization_length; - while (my_length >>= 1) + while ((my_length >>= 1) != 0u) ++vectorization_length_bits; const unsigned int n_lanes = 1 << vectorization_length_bits; @@ -852,9 +852,9 @@ namespace internal for (unsigned int j = n_categories - 1; j > 0; --j) { unsigned int lower_index = j - 1; - while (renumbering_category[j].size() % n_lanes) + while ((renumbering_category[j].size() % n_lanes) != 0u) { - while (renumbering_category[j].size() % n_lanes && + while (((renumbering_category[j].size() % n_lanes) != 0u) && !renumbering_category[lower_index].empty()) { renumbering_category[j].push_back( @@ -1044,7 +1044,7 @@ namespace internal cell_vectorization_categories[n_active_cells]); renumbering[cell] = cell; } - if (n_ghost_cells % n_lanes) + if ((n_ghost_cells % n_lanes) != 0u) incompletely_filled_vectorization.back() = n_ghost_cells % n_lanes; cell_partition_data.push_back(n_cell_batches + n_ghost_batches); partition_row_index.back() = cell_partition_data.size() - 1; diff --git a/source/numerics/data_out.cc b/source/numerics/data_out.cc index 43f4c3c3cf..a6cad27e8f 100644 --- a/source/numerics/data_out.cc +++ b/source/numerics/data_out.cc @@ -204,21 +204,21 @@ DataOut::build_one_patch( // we do not need to worry about getting any imaginary // components to the postprocessor, and we can safely // call the function that evaluates a scalar field - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) dataset->get_function_values( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, scratch_data.patch_values_scalar.solution_values); - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) dataset->get_function_gradients( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, scratch_data.patch_values_scalar.solution_gradients); - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) dataset->get_function_hessians( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: @@ -227,7 +227,7 @@ DataOut::build_one_patch( // Also fill some of the other fields postprocessors may // want to access. - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) scratch_data.patch_values_scalar.evaluation_points = this_fe_patch_values.get_quadrature_points(); @@ -260,21 +260,21 @@ DataOut::build_one_patch( { scratch_data.resize_system_vectors(n_components); - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) dataset->get_function_values( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, scratch_data.patch_values_system.solution_values); - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) dataset->get_function_gradients( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, scratch_data.patch_values_system.solution_gradients); - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) dataset->get_function_hessians( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: @@ -294,7 +294,7 @@ DataOut::build_one_patch( // First get the real component of the scalar solution // and copy the data into the // scratch_data.patch_values_system output fields - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) { dataset->get_function_values( this_fe_patch_values, @@ -320,7 +320,7 @@ DataOut::build_one_patch( } } - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) { dataset->get_function_gradients( this_fe_patch_values, @@ -346,7 +346,7 @@ DataOut::build_one_patch( } } - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) { dataset->get_function_hessians( this_fe_patch_values, @@ -377,7 +377,7 @@ DataOut::build_one_patch( // and copy the data into the // scratch_data.patch_values_system output fields // that follow the real one - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) { dataset->get_function_values( this_fe_patch_values, @@ -403,7 +403,7 @@ DataOut::build_one_patch( } } - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) { dataset->get_function_gradients( this_fe_patch_values, @@ -429,7 +429,7 @@ DataOut::build_one_patch( } } - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) { dataset->get_function_hessians( this_fe_patch_values, @@ -484,7 +484,7 @@ DataOut::build_one_patch( // values, then the real and imaginary parts of the // gradients, etc. This allows us to scope the // temporary objects better - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) { std::vector> tmp( scratch_data.patch_values_system.solution_values @@ -539,7 +539,7 @@ DataOut::build_one_patch( } // Now do the exact same thing for the gradients - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) { std::vector>> tmp( scratch_data.patch_values_system @@ -590,7 +590,7 @@ DataOut::build_one_patch( } // And finally the Hessians. Same scheme as above. - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) { std::vector>> tmp( scratch_data.patch_values_system @@ -643,7 +643,7 @@ DataOut::build_one_patch( } // Now set other fields we may need - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) scratch_data.patch_values_system.evaluation_points = this_fe_patch_values.get_quadrature_points(); diff --git a/source/numerics/data_out_faces.cc b/source/numerics/data_out_faces.cc index 7166cc8fca..d8c4777945 100644 --- a/source/numerics/data_out_faces.cc +++ b/source/numerics/data_out_faces.cc @@ -172,30 +172,30 @@ DataOutFaces::build_one_patch( { // at each point there is only one component of value, // gradient etc. - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) this->dof_data[dataset]->get_function_values( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_scalar.solution_values); - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) this->dof_data[dataset]->get_function_gradients( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_scalar.solution_gradients); - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) this->dof_data[dataset]->get_function_hessians( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_scalar.solution_hessians); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) data.patch_values_scalar.evaluation_points = this_fe_patch_values.get_quadrature_points(); - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) data.patch_values_scalar.normals = this_fe_patch_values.get_normal_vectors(); @@ -216,30 +216,30 @@ DataOutFaces::build_one_patch( // at each point there is a vector valued function and its // derivative... data.resize_system_vectors(n_components); - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) this->dof_data[dataset]->get_function_values( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_system.solution_values); - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) this->dof_data[dataset]->get_function_gradients( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_system.solution_gradients); - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) this->dof_data[dataset]->get_function_hessians( this_fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_system.solution_hessians); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) data.patch_values_system.evaluation_points = this_fe_patch_values.get_quadrature_points(); - if (update_flags & update_normal_vectors) + if ((update_flags & update_normal_vectors) != 0u) data.patch_values_system.normals = this_fe_patch_values.get_normal_vectors(); diff --git a/source/numerics/data_out_rotation.cc b/source/numerics/data_out_rotation.cc index 4b12a279ca..ef952619b8 100644 --- a/source/numerics/data_out_rotation.cc +++ b/source/numerics/data_out_rotation.cc @@ -220,26 +220,26 @@ DataOutRotation::build_one_patch( // at each point there is // only one component of // value, gradient etc. - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) this->dof_data[dataset]->get_function_values( fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_scalar.solution_values); - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) this->dof_data[dataset]->get_function_gradients( fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_scalar.solution_gradients); - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) this->dof_data[dataset]->get_function_hessians( fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_scalar.solution_hessians); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) data.patch_values_scalar.evaluation_points = fe_patch_values.get_quadrature_points(); @@ -261,26 +261,26 @@ DataOutRotation::build_one_patch( // at each point there is a vector valued function and // its derivative... - if (update_flags & update_values) + if ((update_flags & update_values) != 0u) this->dof_data[dataset]->get_function_values( fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_system.solution_values); - if (update_flags & update_gradients) + if ((update_flags & update_gradients) != 0u) this->dof_data[dataset]->get_function_gradients( fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_system.solution_gradients); - if (update_flags & update_hessians) + if ((update_flags & update_hessians) != 0u) this->dof_data[dataset]->get_function_hessians( fe_patch_values, internal::DataOutImplementation::ComponentExtractor:: real_part, data.patch_values_system.solution_hessians); - if (update_flags & update_quadrature_points) + if ((update_flags & update_quadrature_points) != 0u) data.patch_values_system.evaluation_points = fe_patch_values.get_quadrature_points(); diff --git a/source/numerics/solution_transfer.cc b/source/numerics/solution_transfer.cc index c42f99bf93..a7175306cf 100644 --- a/source/numerics/solution_transfer.cc +++ b/source/numerics/solution_transfer.cc @@ -500,7 +500,7 @@ SolutionTransfer::interpolate( *const valuesptr = pointerstruct->second.dof_values_ptr; // cell stayed as it was or was refined - if (indexptr) + if (indexptr != nullptr) { Assert(valuesptr == nullptr, ExcInternalError()); -- 2.39.5