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 two small things in FiniteElement. #14692

Closed
wants to merge 1 commit into from

Conversation

drwells
Copy link
Member

@drwells drwells commented Jan 17, 2023

Taken from #14583.

  1. Avoid hard-coding in the number of permutations
  2. Correctly calculate the combined/raw orientation

Here and elsewhere, we store the orientation information in a single unsigned char which we unpack to call this function and then pack again to access the array. Is there any reason to not just pass the combined orientation as an argument? I'd like to deprecate this function and eliminate that middle step to avoid packing/unpacking bugs like this one.

1. Avoid hard-coding in the number of permutations
2. Correctly calculated the combined/raw orientation
@drwells
Copy link
Member Author

drwells commented Jan 17, 2023

This fix might not be right. Pre-simplices we had

  return index+adjust_quad_dof_index_for_face_orientation_table(index,4*face_orientation+2*face_flip+face_rotation);

which is not the right packing (and won't work for simplices since those orientations go 0-5, so these weights on orientation + flip are out of bounds) but is perhaps consistent with other parts of the library. Lets see what the CI does.

(face_orientation ? 4 : 0) +
(face_flip ? 2 : 0) +
(face_rotation ? 1 : 0));
(face_orientation ? 1 : 0) +
(face_rotation ? 2 : 0) +
(face_flip ? 4 : 0));
Copy link
Member

Choose a reason for hiding this comment

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

This is apparently not the same encoding used in other places in this class -- judging by the fact that a number of tests fail. You're completely correct that we ought to not do the en/decoding of these flags by hand, but using the corresponding functions in ReferenceCell. Maybe the right step would be to just search through the entire file for face_flip or some such, and replace all of these hand encodings by what ReferenceCell offers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Definitely - this would be a good time to simultaneously make our encodings uniform and do the follow-ups listed in #12878. We have at least three different orientation conventions in the library and I would much rather have one.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, three is too many when there are really only 6 possible (reasonable) encodings of three bits of information...

@drwells
Copy link
Member Author

drwells commented Jan 18, 2023

These orientation fixes are going to be quite large - I'll handle them in separate future PRs.

@drwells drwells closed this Jan 18, 2023
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

2 participants