← Back to team overview

yade-dev team mailing list archive

Vector6r &c

 

Hi Jan,

we had some comflict with Vector6{r,i} and I made some modifications
that I would like to clarify here.

1. You derived Vector6r from Eigen::Matrix<6,1,Real>. That makes it
possible to add new methods, but it has adverse consequences. For
instance, all operators (such as addition of 2 Vector6r) will resolve to
the operation on Eigen::Matrix<6,1,Real> (which is the parent class of
Vector6r, not the same one), and will return Eigen::Matrix<6,1,Real> as
well. That is quite counter-intuitive (compile errors etc) and also will
break if that class is passed from c++ to python (there will be no
conversion).

Unfortunately (?), you cannot enrich interface of an already existing
class in c++ (with an "exception" of defining operators outside of the
class, which is transparent), so the only resort is to define external
functions. 

For the tensor/vector conversions, I called them voigt_toSymmTensor and
tensor_toVoigt.

The maxabs method can be replaced by a.cwise().abs.maxCoeff() in eigen,
so I changed that in the code everywhere.

You must have had conflicts when updating your code; conflicts signify
that someone else modified the same part of the code meanwhile, do not
just overwrite the other person's changes (mine, in this case) without
some prior communication!

2. Regarding Peri3dController::{xx,yy,zz,yz,xz,xy} -- by coincidence, I
needed similar thing in LawTeser (path, rotPath). The solution I went
for (and I think it better, perhaps) is to have a separate vector<Real>
(in my case, it was vector<int>, since I give step numbers) for time
coordinate of path points and then either one vector<Vector6r> for
describing all stress/strain components, or two vector<Vector3r>, for
normal and shear components separately. I think it is then easier to
read python code, since you don't have to connect points accross paths,
but have all the values at one place.

That is just a humble suggestion, though.

3. Another suggestion is that you have a look at
pkg/common/LinearInterpolate.hpp which defines a template for
interpolating piecewise-linear functions; see how it is used in
Interpolating*Engine's or in LawTester. That way you might get rid of
the hairy code after line 300.

4. Another detail is that instead of .operator()(op2i) you can write
just (op2i), and instead of paths[pi]->operator[](op1i), you can also
write (*paths[pi])[op1i].

5. I uploaded the current documentation and I think you are sure to
become the winner of the hypothetical competition for best
documentation :-)
https://www.yade-dem.org/sphinx/yade.wrapper.html#yade.wrapper.Peri3dController
.

Cheers, Vaclav