-
Notifications
You must be signed in to change notification settings - Fork 708
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
Fix do_reinit of FEPointEvaluation for empty unit_points #15176
Merged
bangerth
merged 1 commit into
dealii:master
from
bergbauer:fix_empty_quadrature_fe_point
May 4, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1495,8 +1495,18 @@ FEPointEvaluation<n_components, dim, spacedim, Number>::do_reinit() | |
current_face_number); | ||
|
||
const_cast<unsigned int &>(n_q_points) = | ||
n_q_points_scalar / n_lanes_user_interface + | ||
(n_q_points_scalar % n_lanes_user_interface > 0 ? 1 : 0); | ||
(n_q_points_scalar + n_lanes_user_interface - 1) / n_lanes_user_interface; | ||
|
||
if (update_flags & update_values) | ||
values.resize(n_q_points, numbers::signaling_nan<value_type>()); | ||
if (update_flags & update_gradients) | ||
gradients.resize(n_q_points, numbers::signaling_nan<gradient_type>()); | ||
|
||
if (n_q_points == 0) | ||
{ | ||
is_reinitialized = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The early return looks not correct. All the pointers should be set nullptr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, they should be set |
||
return; | ||
} | ||
|
||
// set unit point pointer | ||
const unsigned int unit_point_offset = | ||
|
@@ -1521,11 +1531,6 @@ FEPointEvaluation<n_components, dim, spacedim, Number>::do_reinit() | |
if (update_flags_mapping & UpdateFlags::update_JxW_values) | ||
JxW_ptr = mapping_info->get_JxW(data_offset); | ||
|
||
if (update_flags & update_values) | ||
values.resize(n_q_points, numbers::signaling_nan<value_type>()); | ||
if (update_flags & update_gradients) | ||
gradients.resize(n_q_points, numbers::signaling_nan<gradient_type>()); | ||
|
||
if (fast_path && !polynomials_are_hat_functions) | ||
{ | ||
const std::size_t n_batches = | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resize()
and notassign
is wanted? It feels odd that only the new entries are set to nan.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If at all possible, I would avoid using
assign
at least in release mode, because these operations are not for free. When resizing, we have no other choice, but for the remaining entries we should not.