Skip to content

Refactoring of DiscreteGridField and add ScalarFieldMapping - #3

Open
damienmarchal wants to merge 6 commits into
sofa-framework:masterfrom
CRIStAL-PADR:xp-discretegridfield-and-mapping
Open

damienmarchal wants to merge 6 commits into
sofa-framework:masterfrom
CRIStAL-PADR:xp-discretegridfield-and-mapping

Conversation

@damienmarchal

Copy link
Copy Markdown
Contributor

DiscreteGridField is a component made a long time ago to cut dependencies between SofaImplicitField & SofaDistanceGrid.

The current implementation has defects, one of them is that the component can only load the grid content from a MHD file. So i refactor it to become a component with the sole purpose of storing a grid and doing field/grad/hessian evaluation and delegating to other component the content generation (from a file, from a field: see example-grid-generation-from-field.py). I also added experiment on using the grid that results in a mapping (see example scalar-field-mapping.py)

The PR:

  • add const qualifier on the position parameter for every getValue/getGradient/getHessian
  • move the MHD loader from the DiscreteGridField in a dedicated component
  • add a GridSampler that can initialize the content of the DiscreteGridField from and ScalarField.
  • add a ScalarFieldMapping the map from a positional 3D mstate to a 1D mstate (to be used in constraints)

@damienmarchal damienmarchal added pr: breaking Change possibly inducing a compilation error pr: enhancement About a possible enhancement pr: refactoring Refactor code pr: status wip Development in the pull-request is still in progress labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: breaking Change possibly inducing a compilation error pr: enhancement About a possible enhancement pr: refactoring Refactor code pr: status wip Development in the pull-request is still in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant