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

Introduce TriaAccessor::combined_face_orientation() #12878

Merged
merged 1 commit into from Oct 28, 2021

Conversation

peterrum
Copy link
Member

Comment on lines +1196 to +1197
return this->face_orientation(face) + 4 * this->face_flip(face) +
2 * this->face_rotation(face);
Copy link
Member Author

Choose a reason for hiding this comment

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

I am thinking about the following two points:

  • Maybe we should change the type from unsigned char to a struct/class built around unsigned char. This data structure would be the only place dealing with the shifts and would provide appropriate functions to get the right bits.
  • In MatrixFree, face_orientation is flipped, isn't it? Maybe should we should do this as well here? @kronbichler

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, in MatrixFree the choice is such that the default case without any re-orientation or rotation is a plain 0, which simplifies life for the compiler to generate as good assembly code as possible for the most common case.

@peterrum peterrum changed the title Combined face orientation Introduce TriaAccessor::combined_face_orientation() Oct 25, 2021
Copy link
Member

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

Having a struct would also make sense. It could be a bitfield.

Alternatively, just introduce a new typedef in namespace types that gives the underlying type a name that describes what it does. Instead of unsigned char, we might want to use uint8_t.

@@ -899,6 +899,13 @@ class TriaAccessor : public TriaAccessorBase<structdim, dim, spacedim>
* @{
*/

/**
* Return a combination of face_orientation(), face_flip(), and
* face_rotation() for the given @p face.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe say "Return an integer representation that uniquely encodes the orientation, flip, and rotation of a face."

* face_rotation() for the given @p face.
*/
unsigned char
combined_face_orientation(const unsigned int face) const;
Copy link
Member

Choose a reason for hiding this comment

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

Yes, this is useful. I would actually prefer if that function simply forwarded to a member of ReferenceCell that then does the combining of the three flags. I think of the latter operation as a geometric primitive.

@peterrum
Copy link
Member Author

@bangerth @kronbichler I would suggest to merge as it is now and we make the potential changes (char to struct, flip the orientation bit) in follow-up PRs.

@bangerth
Copy link
Member

Sounds good to me.

/rebuild

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

3 participants