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

Fix do_reinit of FEPointEvaluation for empty unit_points #15176

Merged
merged 1 commit into from May 4, 2023

Conversation

@bangerth
Copy link
Member

bangerth commented May 4, 2023

I don't know the code in question, but would appreciate quick resolution -- master is currently broken without this patch.

@bergbauer bergbauer force-pushed the fix_empty_quadrature_fe_point branch from 702793e to e9feb6a Compare May 4, 2023 15:27

if (n_q_points == 0)
{
is_reinitialized = true;
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, they should be set nullptr and then we return early.

@bergbauer bergbauer force-pushed the fix_empty_quadrature_fe_point branch from e9feb6a to 3a62eb3 Compare May 4, 2023 15:51
Comment on lines 1507 to 1512
unit_point_ptr = nullptr;
real_point_ptr = nullptr;
jacobian_ptr = nullptr;
inverse_jacobian_ptr = nullptr;
normal_ptr = nullptr;
JxW_ptr = nullptr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not wrong, but I don't understand why these are needed from a correctness point of view. As far as I can see, all uses of these variables in the context of nullptr in this class can they are all after an AssertIndexRange(point_index, n_q_points); - in other words, while the pointers might not point to the right place, it won't hurt too much, and in fact I would think we then need to set them to nullptr also in the respective constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right the assert should catch all cases. Should we remove setting nullptr again? We should keep the resizing of values and gradient field or we also add the assert AssertIndexRange(point_index, n_q_points); there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to leave at 7 pm today so we should converge to a final solution. @peterrum @kronbichler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed setting nullptr and kept the resizing. ready from my side. We can discuss the optimal solution in a follow-up, this is should be sufficient to fix master.

@bergbauer bergbauer force-pushed the fix_empty_quadrature_fe_point branch from 3a62eb3 to 93d2903 Compare May 4, 2023 16:54
@kronbichler
Copy link
Member

OK from my side.

(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>());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resize() and not assign is wanted? It feels odd that only the new entries are set to nan.

Copy link
Member

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.

@peterrum
Copy link
Member

peterrum commented May 4, 2023

/rebuild

@bangerth bangerth merged commit d62c94c into dealii:master May 4, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants