Skip to content

Add vectorized version of the getValue function in ScalarField. - #2

Merged
hugtalbot merged 1 commit into
sofa-framework:masterfrom
CRIStAL-PADR:pr-vectorize-getvalue
Sep 10, 2026
Merged

hugtalbot merged 1 commit into
sofa-framework:masterfrom
CRIStAL-PADR:pr-vectorize-getvalue

Conversation

@damienmarchal

Copy link
Copy Markdown
Contributor

Currently the scalar field can be evaluated only one by one. This is very time consuming and not CUDA friendly. So I add a new method getValues to get a bunch of values in a single call.

Using the vector version accelerates a lot the the evaluation of fields especially when defined in python because the traversal from c++ to python has to be done one time.

A simple benchmark made on the file example-mesh-extraction-from-implicit.py.
It takes 26 seconds on my machine with the getValue API and only 4 seconds with the vector version.

This allows to accelerates a lot the evaluation of field defined in python as the conversion
has to be done a limited amount of time.

On The example-mesh-extraction-from-implicit.py exemple the computation time goes from 26 seconds with the current implementation using getValue down to 4 seconds with the getValues.
@hugtalbot

Copy link
Copy Markdown
Contributor

@damienmarchal thanks for the PR, just a notice that several comments are written in French

@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 Sep 10, 2026
@hugtalbot
hugtalbot merged commit 1ccc0c5 into sofa-framework:master Sep 10, 2026
4 checks passed
@damienmarchal

Copy link
Copy Markdown
Contributor Author

Thanks for pointing this, I will fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: status ready Approved a pull-request, ready to be squashed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants