-
Notifications
You must be signed in to change notification settings - Fork 192
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
Add Skew map #6446
base: develop
Are you sure you want to change the base?
Add Skew map #6446
Conversation
@nilsvu Pushed fixups and compressed the image some more. Wanted to keep it an svg so it rendered better online. |
gsl::at(source_coords, i) = gsl::at(source_coords_cvref, i); | ||
// Can't do math with the cvref typed data so we convert it to the result | ||
// type. If it's a DataVector then we use views. If it's doubles, just a copy | ||
const std::array<ResultT, 3> source_coords = [&source_coords_cvref]() { |
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.
Can you just do this:
const auto& x = dereference_wrapper(source_coords_cvref[0]);
const auto& y = dereference_wrapper(source_coords_cvref[1]);
const auto& z = dereference_wrapper(source_coords_cvref[2]);
Then you don't need any of these const-casts etc.
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.
Edit: I think in other maps we just do math with cref(DataVector)
and that seems to work, see Wedge.cpp. Haven't checked the details.
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.
No I want to do math with the entire std::array
, not the individual components. However, that math won't work between a std::array<DataVector>
and std::array<std::reference_wrapper<const DataVector>>
. That's why I const cast.
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.
ok const-casts are pretty dangerous so maybe sprinkle some dereferencing in StdArrayHelpers.hpp
instead?
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.
We use const_cast
in a lot of places for this exact purpose (to set data references). Quick VSCode/git search shows 136 occurrences in 64 files
skew_map.inverse(mapped_point, time, f_of_t_list); | ||
CHECK(inverse_point.has_value()); | ||
CHECK_ITERABLE_APPROX(inverse_point.value(), test_point); | ||
// Jacobian not defined at the center |
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.
do we not need it?
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.
Unclear. SpEC didn't handle this specially (and thus would get a division by zero error if the center was passed to the jacobian).
Proposed changes
Part of #4603.
Upgrade instructions
Code review checklist
make doc
to generate the documentation locally intoBUILD_DIR/docs/html
.Then open
index.html
.code review guide.
bugfix
ornew feature
if appropriate.Further comments