-
Notifications
You must be signed in to change notification settings - Fork 213
Add equatorial compression option for spherical torus map #6263
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
Conversation
| const auto theta = | ||
| M_PI_2 - (pi_over_2_minus_theta_min_ * get<1>(source_coords)); | ||
| // intermediate variable for equatorial compression | ||
| const auto intermediate_val = cubic_compression(get<1>(source_coords)); |
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.
Having a variable called intermediate_val that's only used once isn't adding clarity. Just call the function in the expression on the next line.
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.
okay.
| auto& sin_theta = get<2, 1>(jacobian); | ||
| auto& cos_theta = get<2, 0>(jacobian); | ||
| // intermediate variable for equatorial compression | ||
| get<2, 2>(jacobian) = cubic_compression(get<1>(source_coords)); |
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.
Again, just call this inline.
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.
done.
| auto& sin_theta = get<1, 2>(inv_jacobian); | ||
| auto& cos_theta = get<0, 2>(inv_jacobian); | ||
| // intermediate variable for equatorial compression | ||
| get<2, 2>(inv_jacobian) = cubic_compression(get<1>(source_coords)); |
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.
Again. Go through and find all cases of this.
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.
done.
| // using p.228 of Numerical Recipe (cubic equation) | ||
| const double Q = (compression_level_ - 1.0) / (3.0 * compression_level_); | ||
| const double R = -0.5 * x / (compression_level_); | ||
| const double A = |
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.
Lowercase variable names.
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.
done.
| return compression_level_ * pow<3>(x) + (1.0 - compression_level_) * x; | ||
| } | ||
|
|
||
| double SphericalTorus::cubic_inversion(const double& x) const { |
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.
Take double by value, not reference.
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.
done.
| const auto numerical_hessian = numerical_derivative( | ||
| [&i, &j, &partial_torus](const std::array<double, 3>& y) { | ||
| const auto y_tnsr = a2t(y); | ||
| CAPTURE(y); |
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.
This doesn't do anything. There are no checks before it goes out of scope.
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.
done.
| cubic_compression(get<1>(source_coords))); | ||
| const T compressed_coord = cubic_compression(get<1>(source_coords)); | ||
| const auto theta = M_PI_2 - (pi_over_2_minus_theta_min_ * compressed_coord); | ||
| const auto phi = M_PI * fraction_of_torus_ * get<2>(source_coords); |
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.
Change these autos to Ts, and then it should work.
|
You have a syntax error typo, but otherwise looks good. You can squash when you fix it. |
e629b65 to
50a69f6
Compare
Proposed changes
Add an equatorial compression option for the spherical torus map using a simple cubic function. This is for PolarMagFmDisk runs which use spherical torus.
Upgrade instructions
Code review checklist
make docto generate the documentation locally intoBUILD_DIR/docs/html.Then open
index.html.code review guide.
bugfixornew featureif appropriate.Further comments