← Back to team overview

yade-dev team mailing list archive

Re: WM3 -> Eigen migration

 

> I have just committed first Eigen strings.
> Could you not check it?
> 
> There are some syntax differences. For instance, vector3r.Zero() in
> Eigen and vector3r.ZERO() in Wm3, UNIT_X in Wm3 and UnitX in Eigen.
Those are static objects in wm3 (Vector3r::ZERO) and are initialized in
a cpp file, whereas in eigen, they are methods, keep that in mind.
> How is it better to handle it? Deriving class or some better
> solution? 
Yes, you need to derive class (not just typedef as you do now), so that
the interface is the same (don't use virtual methods, we need just plain
derived class); the derived class will just define thin wrapper
functions, like Real Length(){ return norm(); }.

This will be all in a .hpp file, probably, with the exception of static
initializers which haveto be in the .cpp file. (don't include
yadeMath.cpp, include yadeMath.hpp)

Derived class will have the advantage that you will be able to use both
syntaxes for the derived class (i.e. both Length and norm), when we make
the switch progressively later (it can be automatized for some part).

(BTW. Normalize() returns length in wm3, but is void in eigen. You have
to emulate that.)

Cheers, Vaclav





Follow ups

References