Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use numbers::is_finite whenever we compare with infinity. #15314

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/deal.II/lac/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ namespace Utilities
const double b = unwanted_spectrum.second;
Assert(degree > 0, ExcMessage("Only positive degrees make sense."));

const bool scale = (a_L < std::numeric_limits<double>::infinity());
const bool scale = numbers::is_finite(a_L);
Assert(
a < b,
ExcMessage(
Expand Down
13 changes: 6 additions & 7 deletions source/fe/mapping_q.cc
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,8 @@ MappingQ<dim, spacedim>::transform_real_to_unit_cell(
// statement may throw an exception, which we simply pass up to the caller
const Point<dim> p_unit =
this->transform_real_to_unit_cell_internal(cell, p, initial_p_unit);
if (p_unit[0] == std::numeric_limits<double>::infinity())
AssertThrow(false,
(typename Mapping<dim, spacedim>::ExcTransformationFailed()));
AssertThrow(numbers::is_finite(p_unit[0]),
(typename Mapping<dim, spacedim>::ExcTransformationFailed()));
return p_unit;
}

Expand Down Expand Up @@ -646,17 +645,17 @@ MappingQ<dim, spacedim>::transform_points_real_to_unit_cell(
// determinants) from other SIMD lanes. Repeat the computation in this
// unlikely case with scalar arguments.
for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j)
if (unit_point[0][j] == std::numeric_limits<double>::infinity())
if (numbers::is_finite(unit_point[0][j]))
for (unsigned int d = 0; d < dim; ++d)
unit_points[i + j][d] = unit_point[d][j];
else
unit_points[i + j] = internal::MappingQImplementation::
do_transform_real_to_unit_cell_internal<dim, spacedim>(
real_points[i + j],
inverse_approximation.compute(real_points[i + j]),
support_points,
polynomials_1d,
renumber_lexicographic_to_hierarchic);
else
for (unsigned int d = 0; d < dim; ++d)
unit_points[i + j][d] = unit_point[d][j];
}
else
unit_points[i] = internal::MappingQImplementation::
Expand Down
8 changes: 4 additions & 4 deletions source/particles/particle_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1261,11 +1261,11 @@ namespace Particles
auto particle = pic.begin();
for (const auto &p_unit : reference_locations)
{
if (p_unit[0] == std::numeric_limits<double>::infinity() ||
!GeometryInfo<dim>::is_inside_unit_cell(p_unit))
particles_out_of_cell.push_back(particle);
else
if (numbers::is_finite(p_unit[0]) &&
GeometryInfo<dim>::is_inside_unit_cell(p_unit))
particle->set_reference_location(p_unit);
else
particles_out_of_cell.push_back(particle);

++particle;
}
Expand Down