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

Generalize identity determination in FE_SimplexP #14607

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

peterrum
Copy link
Member

@sebproell Maybe you could use this as starting point.

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.

Generally ok, but I have a couple of comments.

Comment on lines -764 to +775
// dofs are located along lines, so two dofs are identical if they are
// located at identical positions.
// Therefore, read the points in unit_support_points for the
// first coordinate direction. For FE_SimplexP, they are currently
// hard-coded and we iterate over points on the first line which begin
// after the 3 vertex points in the complete list of unit support points
std::vector<std::pair<unsigned int, unsigned int>> identities;

for (unsigned int i = 0; i < this->degree - 1; ++i)
for (unsigned int j = 0; j < fe_p_other->degree - 1; ++j)
if (std::fabs(this->unit_support_points[i + this->reference_cell()
.n_vertices()][0] -
fe_p_other->unit_support_points
[i + this->reference_cell().n_vertices()][0]) < 1e-14)
identities.emplace_back(i, j);
Copy link
Member

Choose a reason for hiding this comment

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

This looks reasonable, but I think that the comment actually was helpful in understanding the code. Why did you remove it?

Separately, do we fill face_unit_support_points for FE_SimplexP? If so, it might be easier to use because then the indexing becomes simpler.

Comment on lines +779 to +789
else if (const auto *fe_p_other =
dynamic_cast<const FE_PyramidP<dim, spacedim> *>(&fe_other))
{
std::vector<std::pair<unsigned int, unsigned int>> identities;

for (unsigned int i = 0; i < this->degree - 1; ++i)
for (unsigned int j = 0; j < fe_p_other->degree - 1; ++j)
if (std::fabs(this->unit_support_points[i + 3][0] -
fe_p_other->unit_support_points[i + 3][0]) < 1e-14)
if (std::fabs(this->unit_support_points[i + this->reference_cell()
.n_vertices()][0] -
fe_p_other->get_unit_support_points()
[i + this->reference_cell().n_vertices()][1]) < 1e-14)
Copy link
Member

Choose a reason for hiding this comment

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

This block could use a comment that says that if this function is called with both an FE_SimplexP and a FE_PyramidP, then we are clearly at a triangular face of the pyramid and can treat it the same way we did above for two FE_SimplexP meeting.

Comment on lines -778 to -786
else
{
// If nodes are not located in the same place, we have to
// interpolate. This is then not handled through the
// current function, but via interpolation matrices that
// result in constraints, rather than identities. Since
// that happens in a different function, there is nothing
// for us to do here.
}
Copy link
Member

Choose a reason for hiding this comment

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

I added this in #14444 because I was wondering how this is working if the if above is not satisfied. I think the comment is still relevant and if you don't mind too much, please leave it here and duplicate it in the FE_SimplexP case above.

Comment on lines +779 to +780
else if (const auto *fe_p_other =
dynamic_cast<const FE_PyramidP<dim, spacedim> *>(&fe_other))
Copy link
Member

Choose a reason for hiding this comment

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

I believe that you can avoid the code duplication in the same way as you did for the vertex case above: Just have a sequence of dynamic_cast<...> || dynamic_cast<...> questions in the if, and then access the information via fe_other rather than via fe_p_other. I believe that nothing you do in the if block actually requires access to information of the derived object.

@tamiko tamiko marked this pull request as draft July 4, 2023 18:10
@tamiko tamiko changed the title [WIP] Generalize identity determination in FE_SimplexP Generalize identity determination in FE_SimplexP Jul 4, 2023
@bangerth
Copy link
Member

@peterrum If you address the comments, I will gladly look at it again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants