Open BrendanKKrueger opened 1 month ago
@Yurlungur, I give about a 50% chance that this solution is controversial. But it's a way to clean up all the nasty equations that span 30ish lines. It also extends the ability to use an index in place of a coordinate so that it can be applied to any dimension instead of only the hard-coded ones (assuming one uses the new interface rather than the existing interface that I left in place so that we discuss all the details that go into this change).
It also extends the ability to use an index in place of a coordinate so that it can be applied to any dimension instead of only the hard-coded ones
It may be that this fulfills your desire for DataBox
to be used as a data array in addition to being used as an interpolator. I realize I'm proposing more sweeping changes, but this is just thinking about possible future evolution. If we rename interpToReal
to operator()
then the user can do something like
auto value = db(1,7,3);
and that becomes simply looking up the value with those indices. If the user instead does
auto value = db(1.0, 7.0, 3.0);
then that's an interpolation. And they can mix and match as well, such as
auto value = db(1.0, 7, 3.0);
Of course, one could argue that this becomes unclear and hard to understand the difference between interpolating and indexing, but maybe not.
PR Summary
Recursive implementation of
interpToReal
to avoid the big, nasty formulas.PR Checklist