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
Conversation
return this->face_orientation(face) + 4 * this->face_flip(face) + | ||
2 * this->face_rotation(face); |
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.
I am thinking about the following two points:
- Maybe we should change the type from
unsigned char
to a struct/class built aroundunsigned 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
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.
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.
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.
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
.
include/deal.II/grid/tria_accessor.h
Outdated
@@ -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. |
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.
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; |
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.
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.
08062ed
to
14975f5
Compare
@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. |
Sounds good to me. /rebuild |
As noted in https://github.com/dealii/dealii/pull/12859/files#r735246075.
Depends on #12859.