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: [email protected] <[email protected]> On Behalf 
Of Alberto Fernández
Sent: Thursday, April 13, 2023 10:08 AM
To: ProjectChrono <[email protected]>
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
El jueves, 13 de abril de 2023 a las 9:40:30 UTC+2, Alessandro Tasora 
([email protected]<mailto:[email protected]>) escribió:

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
On 12/04/2023 12:24, Alberto Fernández wrote:
I'm trying to create a Cosserat beam in python using the full matrix with 
coupling terms. I think the call to the constructor is correct, but I get a 
type error

Call (Klaw is a  pychrono.ChMatrixDynamicD 6x6):
melasticity = fea.ChElasticityCosseratAdvancedGenericFPM(Klaw, 0.0, 0.0, 0.0, 
0.0, 0.0, 0.0)

Error:

TypeError: Wrong number or type of arguments for overloaded function 
'new_ChElasticityCosseratAdvancedGenericFPM'.
  Possible C/C++ prototypes are:
    
chrono::fea::ChElasticityCosseratAdvancedGenericFPM::ChElasticityCosseratAdvancedGenericFPM()
    
chrono::fea::ChElasticityCosseratAdvancedGenericFPM::ChElasticityCosseratAdvancedGenericFPM(chrono::ChMatrixNM<
 double,6,6 > const,double const,double const,double const,double const,double 
const,double const)

I assume this is a problem with the call not being correctly defined in the 
python wrapper, but I don't know how to fix it. Is there other route that may 
work?
I also tried instantiating  ChElasticityCosseratAdvancedGenericFPMand then 
using SetEMatrix but no luck that way either.
Thank you for your time
--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/61be7629-c3cc-4bff-a2e0-595e67cff81cn%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/61be7629-c3cc-4bff-a2e0-595e67cff81cn%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/f009b623-4be0-4231-9c0e-f6b7bc6ee32en%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/f009b623-4be0-4231-9c0e-f6b7bc6ee32en%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/PH0PR06MB82371534592B1CDA36F20A2CA7999%40PH0PR06MB8237.namprd06.prod.outlook.com.

Reply via email to