Skip to content

Solver.poisson support pre-integrated vfuncs#115

Merged
m-reuter merged 3 commits intoDeep-MI:mainfrom
magnesium2400:integrate
Apr 15, 2026
Merged

Solver.poisson support pre-integrated vfuncs#115
m-reuter merged 3 commits intoDeep-MI:mainfrom
magnesium2400:integrate

Conversation

@magnesium2400
Copy link
Copy Markdown
Contributor

  • Solver.poisson always multiplies the input vfunc h by self.mass to generate an integrated map
  • This creates difficulties when solving for different maps, where some are integrated, and some are not: a new Solver object has to be created and its mass set to the identity
  • It is easier to create a flag where the user can specify if the map is already integrated or not. This is what I have done here.
  • This also simplifies the code in diffgeo.compute_geodesic_f etc.
  • The default behaviour is preserved
  • The figures in Test_TriaMesh_Geodesics.ipynb still look good when vf = fem.poisson(Bi * divx) is replaced by vf = fem.poisson(divx, integrate=False)

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 50.01%. Comparing base (dcacc4a) to head (6002763).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
lapy/diffgeo.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #115      +/-   ##
==========================================
- Coverage   50.04%   50.01%   -0.04%     
==========================================
  Files          15       15              
  Lines        3153     3151       -2     
  Branches      414      415       +1     
==========================================
- Hits         1578     1576       -2     
  Misses       1426     1426              
  Partials      149      149              
Flag Coverage Δ
unittests 50.01% <88.88%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an option to Solver.poisson to skip mass-matrix integration when the RHS is already pre-integrated, and updates differential-geometry helpers to use that option instead of mutating Solver.mass.

Changes:

  • Add integrate: bool = True to Solver.poisson to optionally bypass B*h integration.
  • Update diffgeo.compute_geodesic_f, tria_compute_geodesic_f, and tria_compute_rotated_f to call poisson(..., integrate=False) instead of replacing fem.mass with the identity.
  • Document the new flag in the poisson docstring.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
lapy/solver.py Introduces integrate flag and conditional mass-matrix application when building the RHS.
lapy/diffgeo.py Switches geodesic/rotated-function routines to use integrate=False rather than altering solver state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lapy/solver.py Outdated
Comment thread lapy/solver.py
Comment thread lapy/diffgeo.py Outdated
Comment thread lapy/diffgeo.py Outdated
Comment thread lapy/diffgeo.py Outdated
@m-reuter
Copy link
Copy Markdown
Member

Hi @magnesium2400 thanks for this PR. I like to integrate it, but first the comments above need to be resolved. Fixing the doc-string to numpy format should also fix the doc build CI error.

@magnesium2400
Copy link
Copy Markdown
Contributor Author

ok thanks @m-reuter , i will only have time in a few weeks but will do it then. and sorry, I couldnt find the tests anywhere (I could only see the notebooks) -- where/how should i write the tests (can I use pytest)? cheers.

@m-reuter
Copy link
Copy Markdown
Member

Hi, tests are under lapy/utils/tests ( we will move them at some point into the project root, but currently you can add things there, if you find a similar tests already, if not, don't worry too much about the test). The other comments are more important.

@magnesium2400
Copy link
Copy Markdown
Contributor Author

thanks @m-reuter , i think i did all the changes that were brought up earlier. they were just small changes to the comments/docstrings. I added a simple test.

Comment thread lapy/utils/tests/test_solver.py Outdated
@m-reuter m-reuter merged commit eb6edfc into Deep-MI:main Apr 15, 2026
29 checks passed
@m-reuter
Copy link
Copy Markdown
Member

Thanks for your contribution!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants