Using AxisAlignedCubeGeometry with dim != coorddim and the constructor taking only two arguments leads
to potentially wrong results.
The constructor's comment actually hints to this issue:
/** \brief Constructor from a lower left and an upper right corner \note Only for dim==coorddim */AxisAlignedCubeGeometry(constDune::FieldVector<ctype,coorddim>lower,constDune::FieldVector<ctype,coorddim>upper)
Since both dim and coorddim are known at compile time, a static_assert could prevent wrong usage.
Alternatively, this constructor could be disabled by SFINAE.
Is there any reason why this is not done yet?
Edited
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
Back in medieval times YaspGrid actually supported the dim<dimworld case, and it may have been for that. Somehow. Apologies for not remembering any more details.
I read the code again and it makes more sense to me now. You do need these constructors, and they are not the relic of old YaspGrid features. But the code was written before static_assert was available, and I didn't know about SFINAE back then.
The snipped above would work in principle, however, YaspGrid actually does use this constructor for the intersections with dim != coorddim in dune-grid/dune/grid/yaspgrid/yaspgridgeometry.hh
@oliver.sander Thanks for having a look. Sure, I can do that. Should the default constructor do anything, i.e., assign any values for lower_, upper_ or axes_?
After even more thought here is yet another attempt: dune-grid!446 (merged) makes YaspGrid not require default construction anymore. The patch has further benefits, and as it does not require interface changes it is my current favourite.
Great, thanks! I think this issue and the related MR is still relevant. I (mis-)used AxisAlignedCubeGeometry and it took my quite some time to figure out the error. So I thin the static_assert would be useful.
The question is if we still need the default ctor now. If not, I can remove it again.