Skip to content

Commit

Permalink
Fix the rest
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed May 21, 2021
1 parent a6c258e commit 3366245
Show file tree
Hide file tree
Showing 23 changed files with 185 additions and 178 deletions.
9 changes: 5 additions & 4 deletions include/deal.II/base/geometry_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -3826,7 +3826,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);
}
Expand Down Expand Up @@ -3878,8 +3878,8 @@ GeometryInfo<2>::min_cell_refinement_case_for_face_refinement(
AssertIndexRange(face_no, GeometryInfo<dim>::faces_per_cell);

if (face_refinement_case == RefinementCase<dim>::cut_x)
return (face_no / 2) ? RefinementCase<dim>::cut_x :
RefinementCase<dim>::cut_y;
return (face_no / 2) != 0u ? RefinementCase<dim>::cut_x :
RefinementCase<dim>::cut_y;
else
return RefinementCase<dim>::no_refinement;
}
Expand Down Expand Up @@ -3974,7 +3974,8 @@ GeometryInfo<2>::min_cell_refinement_case_for_line_refinement(
(void)dim;
AssertIndexRange(line_no, GeometryInfo<dim>::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;
}


Expand Down
6 changes: 3 additions & 3 deletions include/deal.II/base/mpi_consensus_algorithms.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,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
Expand Down Expand Up @@ -181,7 +181,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
Expand Down Expand Up @@ -210,7 +210,7 @@ namespace Utilities
&status);
AssertThrowMPI(ierr);

if (request_is_pending) // request is pending
if (request_is_pending != 0) // request is pending
{
// get rank of requesting process
const auto other_rank = status.MPI_SOURCE;
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/base/numbers.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ namespace numbers
inline bool
is_nan(const double x)
{
return std::isnan(x);
return std::isnan(x) != 0;
}


Expand Down
3 changes: 2 additions & 1 deletion include/deal.II/base/patterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,8 @@ namespace Patterns
const auto string_array = Convert<T>::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;
}
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/base/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,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;
}


Expand Down
27 changes: 14 additions & 13 deletions include/deal.II/fe/fe_poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,14 @@ class FE_Poly : public FiniteElement<dim, spacedim>
// polynomial to put the values and derivatives of shape functions
// to put there, depending on what the user requested
std::vector<double> values(
update_flags & update_values ? this->n_dofs_per_cell() : 0);
(update_flags & update_values) != 0u ? this->n_dofs_per_cell() : 0);
std::vector<Tensor<1, dim>> grads(
update_flags & update_gradients ? this->n_dofs_per_cell() : 0);
(update_flags & update_gradients) != 0u ? this->n_dofs_per_cell() : 0);
std::vector<Tensor<2, dim>> 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<Tensor<3, dim>> 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<Tensor<4, dim>>
fourth_derivatives; // won't be needed, so leave empty

Expand All @@ -312,20 +313,20 @@ class FE_Poly : public FiniteElement<dim, spacedim>
(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),
Expand All @@ -342,7 +343,7 @@ class FE_Poly : public FiniteElement<dim, spacedim>
// 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)
Expand All @@ -356,15 +357,15 @@ class FE_Poly : public FiniteElement<dim, spacedim>
// 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];
}
Expand Down
32 changes: 16 additions & 16 deletions include/deal.II/fe/fe_poly.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,19 @@ FE_Poly<dim, spacedim>::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;
Expand Down Expand Up @@ -293,15 +293,15 @@ FE_Poly<dim, spacedim>::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),
mapping_covariant,
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)
Expand All @@ -314,7 +314,7 @@ FE_Poly<dim, spacedim>::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)
Expand Down Expand Up @@ -381,20 +381,20 @@ FE_Poly<dim, spacedim>::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),
mapping_covariant,
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(
Expand All @@ -407,7 +407,7 @@ FE_Poly<dim, spacedim>::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(
Expand Down Expand Up @@ -473,20 +473,20 @@ FE_Poly<dim, spacedim>::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()),
mapping_covariant,
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(
Expand All @@ -499,7 +499,7 @@ FE_Poly<dim, spacedim>::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,
Expand Down
6 changes: 3 additions & 3 deletions include/deal.II/fe/fe_poly_face.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ FE_PolyFace<PolynomialType, dim, 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;
Expand Down
17 changes: 9 additions & 8 deletions include/deal.II/fe/fe_poly_tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ class FE_PolyTensor : public FiniteElement<dim, spacedim>
std::vector<Tensor<4, dim>> third_derivatives(0);
std::vector<Tensor<5, dim>> 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
Expand All @@ -324,15 +325,15 @@ class FE_PolyTensor : public FiniteElement<dim, spacedim>
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);
if (update_transformed_shape_values)
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);
Expand All @@ -342,7 +343,7 @@ class FE_PolyTensor : public FiniteElement<dim, spacedim>
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);
Expand All @@ -358,7 +359,7 @@ class FE_PolyTensor : public FiniteElement<dim, spacedim>
// 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),
Expand All @@ -368,7 +369,7 @@ class FE_PolyTensor : public FiniteElement<dim, spacedim>
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)
Expand All @@ -383,7 +384,7 @@ class FE_PolyTensor : public FiniteElement<dim, spacedim>
}
}

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)
Expand All @@ -398,7 +399,7 @@ class FE_PolyTensor : public FiniteElement<dim, spacedim>
}
}

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)
Expand Down
5 changes: 3 additions & 2 deletions include/deal.II/grid/reference_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ ReferenceCell::face_to_cell_vertices(const unsigned int face,
static const ndarray<unsigned int, 3, 2> 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)
{
Expand Down Expand Up @@ -1309,7 +1309,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)
{
Expand Down
4 changes: 3 additions & 1 deletion include/deal.II/grid/tria_accessor.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned char>(
accessor.quad(quad_index)
->line_orientation(line_within_face_index)));
}


Expand Down

0 comments on commit 3366245

Please sign in to comment.