-
Notifications
You must be signed in to change notification settings - Fork 343
[LinearSolver] Untangle linear solver and linear system #5648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
[ci-build][with-all-tests] |
|
[ci-depends-on] detected during build #2. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #3. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #4. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #5. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #6. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #7. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #8. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #9. To unlock the merge button, you must
|
| virtual void applyConstraintForce(const sofa::core::ConstraintParams* /*cparams*/,sofa::core::MultiVecDerivId /*dx*/, const linearalgebra::BaseVector* /*f*/) { | ||
| msg_error() << "applyConstraintForce has not been implemented."; | ||
| } | ||
| virtual void applyConstraintForce(const sofa::core::ConstraintParams* /*cparams*/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, not in the scope of this PR, but why do we need this ? Isn't addMinvJt enough ?
|
Ok so now the only purpose of a linear solver is to solve inverse linear problem given a LinearSystem that is responsible of defining the RHS and the LHS ? If the solver is a direct one, let's says a Cholesky solver, where is the decomposition supposed to be stored ? If the Solver is agnostic to the system, then it should not keep track of this decomposition no ? If in the future we would like to have many different LinearSystem using the same solver then they should somehow keep this info. Or maybe an intermediate map in the solver ? |
@bakpaul The linear solver is still bound to a single linear system through its Link. It think it still makes sense to have the decomposition in the solver because of that. The intention with this PR was only to remove the assembly part in the API of the solver. |
50aad79 to
5782255
Compare
|
[ci-depends-on] detected during build #10. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #11. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #12. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #13. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #14. To unlock the merge button, you must
|
|
[ci-build][with-all-tests] |
|
[ci-depends-on] detected during build #15. To unlock the merge button, you must
|
|
[ci-depends-on] detected during build #16. To unlock the merge button, you must
|
…logic and enhanced matrix handling
…trixSystem` for proper type resolution
c252e1a to
cd7c3d3
Compare
|
[ci-depends-on] detected during build #24. To unlock the merge button, you must
|
|
[ci-build][with-all-tests][force-full-build] |
|
[ci-depends-on] detected during build #25. To unlock the merge button, you must
|
|
[ci-build][with-all-tests][force-full-build] |
|
[ci-depends-on] detected during build #26. All dependencies are merged/closed. Congrats! 👍 |
In #2777, the matrix assembly was removed from the linear solver. Instead, the assembly is done in a dedicated component, a linear system. However, linear solvers still kept an API related to the matrix assembly. This PR removes this API for a clearer one, where both solvers and systems have their own responsibilities.
With this work, we will be able to assemble different systems while keeping the same linear solvers. For example, an augmented system containing also lagrangian constraints.
An interesting consequence is that a linear solver is now agnostic to the simulated physic: no mass factor, stiffness factor, damping factor. The assembly of the mass, damping and stiffness is now totally in the linear system. We can now imagine a linear system assembling different types of physics, while keeping the same linear solvers.
I took the opportunity to clean a few things in the preconditioners.
Additions:
authorizeAssemblyinBaseMatrixLinearSystem. This Data is hidden to the user. This Data exists to use the DDGNode system, in particular in the asynchronous solver.factorizationInvalidationis introduced inMatrixLinearSolver. This Data is linked to the DatamatrixChanged, also newly introduced, and serves as an observer for matrix changes. That way, the solver decompose the matrix only if a change in the matrix occurred.CompositeLinearSystemis now templated also onGraphScatteredMatrix.PreconditionedMatrixFreeSystemis a new component of the categories of the linear systems. It is intended to work withPCGLinearSolver. The specificity of this linear system is the link toward a the linear system of the preconditioner. It has a DataassemblingRate, allowing to assemble the matrix of the preconditioner only at a given rate. It is templated only onGraphScatteredMatrixsince it works only withPCGLinearSolver.Changes:
doubletoRealupdate_stepis removed inPCGLinearSolver. Since the solvers are no longer responsible to assemble the matrices, this Data is no longer used. Instead, the equivalent of this Data is now inPreconditionedMatrixFreeSystem.WarpPreconditioneris now transferred toRotationMatrixSystem. Similarly toPreconditionedMatrixFreeSystem, it has also a DataassemblingRate.RotationMatrixSystem. Before it was found implicitly with an index inWarpPreconditioner.To do:
MechanicalMultiVectorPeqBaseVectorVisitorinMatrixLinearSolver[ci-depends-on https://github.com/sofa-framework/SofaPython3/pull/528]
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