Add ZernikeB1 interpolation matrix#7232
Conversation
45830a1 to
9409096
Compare
| const DataVector collocation_pts = | ||
| Zernike<Dim>::compute_collocation_points_and_weights(num_points).first + | ||
| 1.0; | ||
| // Build shifted target points in the same [0,2] coordinate system | ||
| const T shifted_target = target_points + 1.0; | ||
| DataVector extended_collocation_pts(2 * num_points, 0.0); |
There was a problem hiding this comment.
Is it possible to combine the 3 DataVector-ish things into 1 allocation? The matrix here is also temp/internal, but I don't know if we can do non-owning Matrix.
9409096 to
dafeaac
Compare
| sign * extended_diff_matrix(i, j + num_points); | ||
| } | ||
| } | ||
| extended_diff_matrix.resize(num_points, num_points, true); |
There was a problem hiding this comment.
This does another allocation and copy. Can you restructure the loop on line 213 to do the "evaluate and fold" all at once?
There was a problem hiding this comment.
Why not just make the matrix num_points X num_points to start now?
dafeaac to
8fec12e
Compare
| sign * extended_diff_matrix(i, j + num_points); | ||
| } | ||
| } | ||
| extended_diff_matrix.resize(num_points, num_points, true); |
There was a problem hiding this comment.
Why not just make the matrix num_points X num_points to start now?
| // Mirror xi around the symmetry point xi=-1 (r=0): xi' = -xi - 2. | ||
| DataVector extended_collocation_pts(2 * num_points); | ||
| { | ||
| const DataVector pts = |
| Matrix result = | ||
| fornberg_interpolation_matrix(target_points, extended_collocation_pts); | ||
| const size_t num_target = result.rows(); | ||
| for (size_t i = 0; i < num_points; ++i) { | ||
| for (size_t k = 0; k < num_target; ++k) { | ||
| result(k, i) += sign * result(k, i + num_points); | ||
| } | ||
| } | ||
| result.resize(num_target, num_points, true); |
There was a problem hiding this comment.
Same fold question as for the diff matrix. Can this also elide the resize?
There was a problem hiding this comment.
I don't think I can avoid the extra allocation...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
8fec12e to
46bfba7
Compare
Proposed changes
To go between DG and Subcell grids, we need to project which requires an interpolation matrix for ZernikeB1.
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."Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com",
"Co-Authored-by: Codex noreply@openai.com", or
"Co-Authored-By: GitHub Copilot CLI noreply@microsoft.com"
as the last line of the commit, depending on the agent.
Further comments