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

Add Skew map #6446

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Add Skew map #6446

wants to merge 4 commits into from

Conversation

knelli2
Copy link
Contributor

@knelli2 knelli2 commented Jan 22, 2025

Proposed changes

Part of #4603.

image

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

@knelli2 knelli2 added this to the BBH larger q & higher spins milestone Jan 22, 2025
@knelli2 knelli2 mentioned this pull request Jan 22, 2025
3 tasks
src/Domain/CoordinateMaps/TimeDependent/Skew.hpp Outdated Show resolved Hide resolved
src/Domain/CoordinateMaps/TimeDependent/Skew.hpp Outdated Show resolved Hide resolved
src/Domain/CoordinateMaps/TimeDependent/Skew.hpp Outdated Show resolved Hide resolved
src/Domain/CoordinateMaps/TimeDependent/Skew.cpp Outdated Show resolved Hide resolved
src/Domain/CoordinateMaps/TimeDependent/Skew.cpp Outdated Show resolved Hide resolved
src/Domain/CoordinateMaps/TimeDependent/Skew.cpp Outdated Show resolved Hide resolved
src/Domain/CoordinateMaps/TimeDependent/Skew.cpp Outdated Show resolved Hide resolved
@knelli2
Copy link
Contributor Author

knelli2 commented Jan 23, 2025

@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]() {
Copy link
Member

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.

Copy link
Member

@nilsvu nilsvu Jan 23, 2025

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.

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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).

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.

2 participants