sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
934 stars 312 forks source link

[LinearAlgebra] CompressedRowSparseMatrixConstraint: make consistent the serialization/deserialization process #5087

Open fredroy opened 3 weeks ago

fredroy commented 3 weeks ago

For now, the serialization of a CSR cannot be used a deserialization as the format are different. In a nutshell, it is not possible to do:

    std::ostringstream oss;
    oss << outMatrix;

    CSR inMatrix;
    std::istringstream iss(oss.str());
    iss >> inMatrix;

So this PR tries to fix it by changing the output format of the serialization. + more concise (faster to serialize, less space) - much less human-readable

Other/complimentary solutions: - adding a nice printing (same as the deserialization now) - dont change the serialization but the deserialization

EDIT:

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

fredroy commented 3 weeks ago

[ci-build][with-all-tests]