In an internal function called from a virtual function, do not call virtual functions. #16741
+4
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Finding this bug took probably on the order of half a week of actual work, for the addition of 34 characters. My many failed attempts at figuring out what is going on are chronicled in geodynamics/aspect#5421 and geodynamics/aspect#5577 .
The root cause here is that in ASPECT, we derive a class from
SphericalManifold
in which we create a sphere with topography (the Earth) by stacking operations in the same way as we often do with manifolds: You just concatenate operations to form the pull back and push forward operations. As a consequence, the overriding functions then call back into the functions in the base class. Then, our implementation of functions inSphericalManifold
calls internal functions that do certain things and, in at least one case, further delegate to yet another function -- which isvirtual
! So we end back up in user space, apply our own secondary transformation one more time, and then call back into theSphericalManifold
class. This is not desirable. The internal function only calls the other function for convenience, and so it needs to call the one inSphericalManifold
, not the one in user space.This patch fixes this. I cannot express how relieved I am to have fixed this.
(For the purposes of cross linking: We have had trouble with this class before. See #16242 and what is linked from there.)