-
Notifications
You must be signed in to change notification settings - Fork 90
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
Support multiple parallel slices in ShiftedMetricInterp #2049
Conversation
Should allow interpolation loop to vectorize better.
I guess the This worries me a little bit, because storing it as One would be to take Another way would be to take it to just take it by value instead. Then there are two ways to do this, the first is to use the default argument as Storing an empty A better option might be |
Thanks @ZedThree, I like the idea of just having a |
Don't need unique_ptrs for 'region' because it's possible to have an 'empty' Region already. Replaces not-ideal use of raw pointer Region* constructor arguments.
|
||
/// ZInterpolation objects for shifting to and from field-aligned coordinates | ||
std::unique_ptr<ZInterpolation> interp_to_aligned, interp_from_aligned; | ||
|
||
Mesh& mesh; |
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.
Could store const std::size_t ydown_index = mesh.ystart
instead of Mesh&
to index parallel_slice_interpolators
above? This removes the need to include the mesh header here, although we'd still need in it the .cxx file.
For consistency, might then be nice to have constexpr std::size_t yup_index = 0;
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.
The ParallelTransform
base class already has a Mesh& mesh
member, so I didn't need to add it to ShiftedMetricInterp
at all... I think it's still nicer to add yup_index
and ydown_index
members as you suggested, it's probably nicer to have a const size_t
than a Mesh
member variable in the hopefully-inlined getWeightsFor*
methods.
Removes need for including mesh.hxx in shiftedmetric.hxx, and simplifies the variables going into the getWeightsForY*Approximation methods, which we want to be inlined and optimized as they are called within tight loops.
ShiftedMetric
has supportedMYG
parallel slices instead of just one yup and one ydown slice, this PR adds similar support toShiftedMetricInterp
BoutMask skip_mask
with support forRegion
s. This is an optimization - I tried one simulation which ran ~10% faster (for the full simulation, I haven't done detailed timing on thetoFieldAligned
/fromFieldAligned
parts)ZInterpolation
to use for interpolation with a non-zeroy_offset
which replaces the previous creation ofskip_mask
inShiftedMetricInterp
ZInterpolation
constructor.ZHermiteSpline
is not totally optimal if passing a custom region, because the calculation of a z-derivative also requires a region, and at the momentRGN_ALL
is used for the z-derivative if a custom region was passed.