Skip to content

[Topology.Grid,Mapping.Linear] BarycentricMapperRegularGridTopology: grid resolution read once per loop - #6427

Merged
epernod merged 2 commits into
sofa-framework:masterfrom
fredroy:grid_data_access
Oct 29, 2026
Merged

epernod merged 2 commits into
sofa-framework:masterfrom
fredroy:grid_data_access

Conversation

@fredroy

@fredroy fredroy commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Create static functions in GridTopology and using them in BarycentricMapperRegularGridTopology to avoid calling d_n.getValue() a substantial number of times.

and adding a benchmark scene (focusing on the grid+mapping)

master: 10000 iterations done in 11.9005 s ( 840.298 FPS)
PR: 10000 iterations done in 5.6872 s ( 1758.33 FPS)

The gain scales with the number of points in the output state

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI labels Oct 21, 2026
…grid resolution read once per loop

GridTopology::getHexaCopy(i) read the Data d_n 9 times (once, then once per node through point()/getIndex), and
BarycentricMapperRegularGridTopology calls it for each mapped point in apply, applyJ, applyJT, getJ and draw
@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Oct 29, 2026
@epernod
epernod merged commit 105bf7e into sofa-framework:master Oct 29, 2026
17 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI pr: enhancement About a possible enhancement pr: status ready Approved a pull-request, ready to be squashed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants