hi Alberto,
the problem is that chrono::fea::ChElasticityCosseratAdvancedGenericFPM::ChElasticityCosseratAdvancedGenericFPM( ... ) requires a ChMatrixNM, that is a fixed size 6x6 matrix built on stack, but most likely you are passing ChMatrixDynamicD , that is a dynamically-sized matrix on the heap. Even if this is a 6x6 matrix too, both are not interchangeable. At the moment there is no way to generate a ChMatrixNM< double,6,6 > in Python because Python does not support templating, sorry.
Alessandro
--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/61be7629-c3cc-4bff-a2e0-595e67cff81cn%40googlegroups.com.
Alessandro, you may want to look into changing the signature of ChElasticityCosseratAdvancedGenericFPM to take a ChMatrixRef. I implemented ChMatrixRef precisely so that one can write non-template functions that can accept either a ChMatrixDynamic or a ChMatrixNM. I used this approach in other parts of Chrono (and there are others that I need to change along these lines to make them available to PyChrono).
--Radu
From: projec...@googlegroups.com <projec...@googlegroups.com>
On Behalf Of Alberto Fernández
Sent: Thursday, April 13, 2023 10:08 AM
To: ProjectChrono <projec...@googlegroups.com>
Subject: Re: [chrono] pychrono error creating ChElasticityCosseratAdvancedGenericFPM
Thanks for the answer Alessandro.
I'm in fact using ChMatrixDynamicD. I tried first with ChMatrixNMD since the reference documentation shows:
"""
chrono.ChVectorD # as ChVector<double> in c++
chrono.ChQuaternionD # as ChQuaternion<double> in c++
chrono.ChMatrix33D # as ChMatrix33<double> in c++
chrono.ChMatrixNMD # as ChMatrixNM<double> in c++
chrono.ChMatrixDynamicD # as ChMatrixDynamic<double> in c++
chrono.ChMatrixD # as ChMatrix<double> in c++
chrono.ChFrameD # as ChFrame<double> in c++
chrono.ChFrameMovingD # as ChFrameMoving<double> in c++
chrono.ChCoordsysD # as ChCoordsys<double> in c++
"""
However, it looks like it was not implemented. Then I saw in the changelog that `ChMatrixNM`, `ChMatrixDynamic`, `ChVectorDynamic` are aliases to Eigen type. Without going deeper I gave it a try just in case. I think I understand why it does not work now. Thanks
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/f009b623-4be0-4231-9c0e-f6b7bc6ee32en%40googlegroups.com.