I manage to solve my problem by replacing 1 into 0 in the file
chrono_swig/interface/core/ChMatrix.i in line 127, 130, 139 and 145.
>From (*$self)(i, 1) to (*$self)(i, 0)
%extend chrono::ChVectorDynamic<double>{
public:
double __getitem__(int i) {
return (*$self)(i,0);
}
void __setitem__(int i, double v) {
(*$self)(i, 0) = v;
}
const int Size() {
const int r = $self->rows();
return r;
}
void GetVectorData(double* p, int len) {
for (int i = 0; i < len; i++){
p[i] = (double)(*$self)(i, 0);
}
}
void SetVect(int numel, double* q){
($self)->resize(numel);
for (int i = 0; i < numel; i++){
(*$self)(i, 0) = q[i];
}
}
};
Le vendredi 23 juin 2023 à 11:44:26 UTC+2, Nicolas CORTES a écrit :
> Hello,
> I am using ChElementBeamIGA and I wish to see the Knot sequence.
> I obtained a ChVectorDynamicD with the command :
> knots = element.GetKnotSquence()
> but I do not manage to print its content...
>
> I tried to get it with :
> - knots[0]
> - knots.GetVectData(0)
> - knots.GetVect()
>
> However, each of my tentatives sold with a core dumped. The exact error is
> :
>
> eigen-3.4.0/Eigen/src/Core/DenseCoeffsBase.h:367:
> Eigen::internal::traits<Derived>::Scalar &Eigen::DenseCoeffsBase<Derived,
> 1>::operator()(long, long) [with Derived = Eigen::Matrix<double, -1, 1, 0,
> -1, 1>]: Assertion `row >= 0 && row < rows() && col >= 0 && col < cols()'
> failed.
> Aborted (core dumped)
>
>
> Is this the correct way to access the content of a ChVectorDynamicD or is
> there an other way ?
>
> Thank you in advance for your help,
>
> Nicolas
>
>
--
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/c1b64a90-0d67-408d-94d0-5ca2538daae0n%40googlegroups.com.