[MBDyn-users] A plug in module for calling GNU-octave functions and classes from MBDyn

masarati at aero.polimi.it masarati at aero.polimi.it
Wed Apr 25 11:22:08 CEST 2012

> Dear all,
> In the attached file you can find an enhanced version of the octave
> module.
> New features are:
> - A direct interface to selected MBDyn objects (DataManager, StructNode)
> callable from octave.
>   The same object oriented syntax like in C++ is used in octave. Other
> MBDyn objects could be added easily. This interface should work on
> Microsoft Windows too.
> - Automatic forward differentiation of octave functions with respect to
> time or with respect to dVar. In order to enable this feature the
> octave-ad package and a special .m file are required.
> - Differentiable template drive callers of any dimension (doublereal,
> Vec3, Vec6, Mat3x3, Mat6x6).
> - User defined elements written entirely in octave. For this purpose it is
> necessary to define a octave class with member functions like
> WorkSpaceDim, AssRes, AssJac. An arbitrary number of user defined
> arguments can be passed to the constructor of the octave class within the
> MBDyn input file.
> - A differentiable octave scalar function
> - Optional updating of all global variables before each call of a octave
> function.
> - A derivative drive caller that returns the derivative of the input drive
> caller.
> Two examples are provided in the .tar archive:
> One example for drive callers, scalar functions and automatic
> differentiation, and on example for user defined elements.
> I have provided three patches for MBDyn in the .tar archive which are
> needed to compile and run the examples.
> The module has been tested with MBDyn version 1.4.3 and GNU-octave version
> 3.2.3 with static linking.
> For static linking the flag --with-static-modules must be enabled when
> running configure. Also two additional patches are required for static
> linking (mbdyn/base/userelem.cc, mbdyn/struct/Makefile.am).
> The following linker flags are required for compilation:
> -L/usr/lib/octave-3.2.3 -loctinterp -loctave -lcruft
> Also the LD_LIBRARY_PATH environment variable has to be defined at run
> time.
> export LD_LIBRARY_PATH=/usr/lib/octave-3.2.3:${LD_LIBRARY_PATH}

Dear Reinhard,

this contribution looks quite interesting.  I was able to have the
previous one working.  I applied minimal modifications, which are now in a
snapshot.  I'll immediately incorporate the first three patches, which can
be of general use.

I'd like to split the last two in separate functions for drive, scalar
function and element initialization, because they logically belong to
different places, but this is a minimal and trivial change.  Also, as you
can see, I changed octave_set() into mbdyn_octave_set(), to avoid clashing
with octave_* namespace.

In any case, the module works correctly also when run-time loaded, so
there is no hurry about that.

Sincerely, p.

More information about the MBDyn-users mailing list