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
Improve assert message for non-matching reference cell types #16020
Improve assert message for non-matching reference cell types #16020
Conversation
98cbe90
to
6145b8d
Compare
6145b8d
to
48b47c7
Compare
/rebuild |
internal::ExcNonMatchingReferenceCellTypes(this->reference_cell(), | ||
fe.reference_cell())); |
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.
Let's not invent a whole new exception class for just one place. This is more easily done in the following way:
internal::ExcNonMatchingReferenceCellTypes(this->reference_cell(), | |
fe.reference_cell())); | |
ExcMessage ("The reference-cell type used on this cell (" + this->reference_cell().to_string() + | |
") does not match the reference-cell type of the finite element associated with this cell (" + | |
fe.reference_cell.to_string() | |
+ "). Did you accidentally use simplex elements on hypercube meshes (or the other way around), or " | |
"are you using a mixed mesh and assigned a simplex element to a hypercube cell " | |
"(or the other way around) via the " | |
"active_fe_index?")); |
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 would suggest to keep the class, since, if I remember correctly, there are other places, where it could be used.
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.
By performing a quick search I could at least replace one additional assert message. I'll have a deeper look if there are more relevant places. Then we can decide.
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 you need a new class, use DeclExceptionMessage
instead of doing it by hand, though.
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.
Done!
dcdc123
to
c1e3ede
Compare
<< "The reference-cell type of " << arg1.to_string() | ||
<< " does not match with " << arg2.to_string() << ". " | ||
<< "This could happen if one object (e.g. Triangulation) holds " | ||
<< "reference cells from a hexahedral mesh and the other one " | ||
<< "(e.g. FiniteElement) from a simplex mesh."); |
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 still think that this message is too specific. What do you think of the text I had in the other comment?
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.
Excellent, thanks, I like it and adopted it. I got so caught up in the other part that I didn't notice the changes in the text initially :-).
c1e3ede
to
98f8db1
Compare
Excellent, thank you! |
This PR suggest to improve the assert message if two reference cell types don't match, from
to
This can happen if one attaches a simplex triangulation to the
DoFHandler
and subsequently callsDoFHandler::distribute_dofs(fe)
with a FE type for hexahedral elements, e.g.FE_Q<dim>
.@tinhvo-TUM @peterrum FYI